Fix remaining problems preventing unity builds to work

* Avoid multiple definitions of `centerObj()`; this was very bad anyway
* Include `c++utilities/tests/testutils.h` upfront so the formatting
  operators are included before CppUnit
This commit is contained in:
Martchus 2024-01-30 23:11:00 +01:00
parent 57e3ad67ea
commit da3ad3347d
5 changed files with 12 additions and 15 deletions

View File

@ -4,6 +4,7 @@
#include "./global.h" #include "./global.h"
#include <c++utilities/conversion/stringbuilder.h> #include <c++utilities/conversion/stringbuilder.h>
#include <c++utilities/tests/testutils.h>
#ifndef SYNCTHINGTESTHELPER_FOR_CLI #ifndef SYNCTHINGTESTHELPER_FOR_CLI
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>

View File

@ -1,5 +1,7 @@
#include "./devbuttonsitemdelegate.h" #include "./devbuttonsitemdelegate.h"
#include "./helper.h"
#include <syncthingconnector/syncthingconnection.h> #include <syncthingconnector/syncthingconnection.h>
#include <syncthingmodel/syncthingdevicemodel.h> #include <syncthingmodel/syncthingdevicemodel.h>
#include <syncthingmodel/syncthingicons.h> #include <syncthingmodel/syncthingicons.h>
@ -20,11 +22,6 @@ using namespace Data;
namespace QtGui { namespace QtGui {
inline int centerObj(int avail, int size)
{
return (avail - size) / 2;
}
DevButtonsItemDelegate::DevButtonsItemDelegate(QObject *parent) DevButtonsItemDelegate::DevButtonsItemDelegate(QObject *parent)
: QStyledItemDelegate(parent) : QStyledItemDelegate(parent)
{ {

View File

@ -1,5 +1,7 @@
#include "./dirbuttonsitemdelegate.h" #include "./dirbuttonsitemdelegate.h"
#include "./helper.h"
#include <syncthingmodel/syncthingdirectorymodel.h> #include <syncthingmodel/syncthingdirectorymodel.h>
#include <syncthingmodel/syncthingicons.h> #include <syncthingmodel/syncthingicons.h>
@ -19,11 +21,6 @@ using namespace Data;
namespace QtGui { namespace QtGui {
inline int centerObj(int avail, int size)
{
return (avail - size) / 2;
}
DirButtonsItemDelegate::DirButtonsItemDelegate(QObject *parent) DirButtonsItemDelegate::DirButtonsItemDelegate(QObject *parent)
: QStyledItemDelegate(parent) : QStyledItemDelegate(parent)
{ {

View File

@ -1,5 +1,7 @@
#include "./downloaditemdelegate.h" #include "./downloaditemdelegate.h"
#include "./helper.h"
#include <syncthingmodel/syncthingdownloadmodel.h> #include <syncthingmodel/syncthingdownloadmodel.h>
#include <syncthingmodel/syncthingicons.h> #include <syncthingmodel/syncthingicons.h>
@ -23,11 +25,6 @@ using namespace Data;
namespace QtGui { namespace QtGui {
inline int centerObj(int avail, int size)
{
return (avail - size) / 2;
}
DownloadItemDelegate::DownloadItemDelegate(QObject *parent) DownloadItemDelegate::DownloadItemDelegate(QObject *parent)
: QStyledItemDelegate(parent) : QStyledItemDelegate(parent)
{ {

View File

@ -103,6 +103,11 @@ template <typename ViewType, typename ActionType> inline auto triggerActionForSe
}; };
} }
inline int centerObj(int avail, int size)
{
return (avail - size) / 2;
}
} // namespace QtGui } // namespace QtGui
#endif // TRAY_GUI_HELPER_H #endif // TRAY_GUI_HELPER_H