From da3ad3347ddaf5d2e9bd6e3f9dad9a9dcdb90f8b Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 30 Jan 2024 23:11:00 +0100 Subject: [PATCH] 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 --- testhelper/helper.h | 1 + tray/gui/devbuttonsitemdelegate.cpp | 7 ++----- tray/gui/dirbuttonsitemdelegate.cpp | 7 ++----- tray/gui/downloaditemdelegate.cpp | 7 ++----- tray/gui/helper.h | 5 +++++ 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/testhelper/helper.h b/testhelper/helper.h index c81482f..2b604de 100644 --- a/testhelper/helper.h +++ b/testhelper/helper.h @@ -4,6 +4,7 @@ #include "./global.h" #include +#include #ifndef SYNCTHINGTESTHELPER_FOR_CLI #include diff --git a/tray/gui/devbuttonsitemdelegate.cpp b/tray/gui/devbuttonsitemdelegate.cpp index a86087e..f1c0bc3 100644 --- a/tray/gui/devbuttonsitemdelegate.cpp +++ b/tray/gui/devbuttonsitemdelegate.cpp @@ -1,5 +1,7 @@ #include "./devbuttonsitemdelegate.h" +#include "./helper.h" + #include #include #include @@ -20,11 +22,6 @@ using namespace Data; namespace QtGui { -inline int centerObj(int avail, int size) -{ - return (avail - size) / 2; -} - DevButtonsItemDelegate::DevButtonsItemDelegate(QObject *parent) : QStyledItemDelegate(parent) { diff --git a/tray/gui/dirbuttonsitemdelegate.cpp b/tray/gui/dirbuttonsitemdelegate.cpp index 14478c2..03abd4c 100644 --- a/tray/gui/dirbuttonsitemdelegate.cpp +++ b/tray/gui/dirbuttonsitemdelegate.cpp @@ -1,5 +1,7 @@ #include "./dirbuttonsitemdelegate.h" +#include "./helper.h" + #include #include @@ -19,11 +21,6 @@ using namespace Data; namespace QtGui { -inline int centerObj(int avail, int size) -{ - return (avail - size) / 2; -} - DirButtonsItemDelegate::DirButtonsItemDelegate(QObject *parent) : QStyledItemDelegate(parent) { diff --git a/tray/gui/downloaditemdelegate.cpp b/tray/gui/downloaditemdelegate.cpp index a4c5bb0..4927733 100644 --- a/tray/gui/downloaditemdelegate.cpp +++ b/tray/gui/downloaditemdelegate.cpp @@ -1,5 +1,7 @@ #include "./downloaditemdelegate.h" +#include "./helper.h" + #include #include @@ -23,11 +25,6 @@ using namespace Data; namespace QtGui { -inline int centerObj(int avail, int size) -{ - return (avail - size) / 2; -} - DownloadItemDelegate::DownloadItemDelegate(QObject *parent) : QStyledItemDelegate(parent) { diff --git a/tray/gui/helper.h b/tray/gui/helper.h index 8c620cd..5cb7fd4 100644 --- a/tray/gui/helper.h +++ b/tray/gui/helper.h @@ -103,6 +103,11 @@ template inline auto triggerActionForSe }; } +inline int centerObj(int avail, int size) +{ + return (avail - size) / 2; +} + } // namespace QtGui #endif // TRAY_GUI_HELPER_H