From 18cb4bd6e52441f20acd452c7f8a3ea79e5e1b45 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 8 Jan 2023 13:07:06 +0100 Subject: [PATCH] Massage includes some more (#4294) * Add `` include to QStringHash.hpp This ensures the base `std::hash` template is declared before this specialization * Add missing includes to `src/providers/twitch/TwitchAccountManager.hpp` * Move explicit HelixChatters constructor to the source file * Remove unused includes & add used includes to NicknamesModel.hpp * NicknamesModel.hpp: Remove `virtual` when `override` is used * Add missing QStringHash include to TwitchEmotes.cpp * Add missing includes to various files * Print Qt version in cmake step Technically unrelated, but I'm sneaking it in * Add changelog entry --- CHANGELOG.md | 2 +- CMakeLists.txt | 2 ++ src/controllers/nicknames/NicknamesModel.cpp | 3 --- src/controllers/nicknames/NicknamesModel.hpp | 10 ++++++---- src/providers/colors/ColorProvider.hpp | 1 + src/providers/emoji/Emojis.hpp | 1 + .../eventapi/SeventvEventAPISubscription.cpp | 3 +++ src/providers/twitch/TwitchAccountManager.hpp | 3 +++ src/providers/twitch/TwitchCommon.hpp | 2 ++ src/providers/twitch/TwitchEmotes.cpp | 2 ++ src/providers/twitch/api/Helix.cpp | 13 +++++++++++++ src/providers/twitch/api/Helix.hpp | 15 +-------------- src/util/Helpers.hpp | 1 + src/util/QStringHash.hpp | 2 ++ src/util/RatelimitBucket.hpp | 2 ++ src/widgets/splits/ClosedSplits.hpp | 1 + src/widgets/splits/InputCompletionItem.hpp | 1 + src/widgets/splits/InputCompletionPopup.hpp | 1 + 18 files changed, 43 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34e768589..c2335549f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ - Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198) - Dev: Migrated to C++ 20 (#4252, #4257) - Dev: Enable LTO for main branch builds. (#4258, #4260) -- Dev: Removed unused include directives. (#4266, #4275) +- Dev: Removed unused include directives. (#4266, #4275, #4294) - Dev: Removed TooltipPreviewImage. (#4268) - Dev: Removed unused operators in `Image` (#4267) - Dev: Removed usage of deprecated `QDesktopWidget` (#4287) diff --git a/CMakeLists.txt b/CMakeLists.txt index 077b0c2e1..9409c2cec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,8 @@ find_package(Qt${MAJOR_QT_VERSION} REQUIRED Concurrent ) +message(STATUS "Qt version: ${Qt${MAJOR_QT_VERSION}_VERSION}") + if (WIN32) find_package(WinToast REQUIRED) endif () diff --git a/src/controllers/nicknames/NicknamesModel.cpp b/src/controllers/nicknames/NicknamesModel.cpp index 4277b128f..f3ab42af2 100644 --- a/src/controllers/nicknames/NicknamesModel.cpp +++ b/src/controllers/nicknames/NicknamesModel.cpp @@ -1,9 +1,6 @@ #include "controllers/nicknames/NicknamesModel.hpp" -#include "Application.hpp" #include "controllers/nicknames/Nickname.hpp" -#include "providers/twitch/api/Helix.hpp" -#include "singletons/Settings.hpp" #include "util/StandardItemHelper.hpp" namespace chatterino { diff --git a/src/controllers/nicknames/NicknamesModel.hpp b/src/controllers/nicknames/NicknamesModel.hpp index aab622203..2e3f32341 100644 --- a/src/controllers/nicknames/NicknamesModel.hpp +++ b/src/controllers/nicknames/NicknamesModel.hpp @@ -4,6 +4,8 @@ #include +#include + namespace chatterino { class Nickname; @@ -15,12 +17,12 @@ public: protected: // turn a vector item into a model row - virtual Nickname getItemFromRow(std::vector &row, - const Nickname &original) override; + Nickname getItemFromRow(std::vector &row, + const Nickname &original) override; // turns a row in the model into a vector item - virtual void getRowFromItem(const Nickname &item, - std::vector &row) override; + void getRowFromItem(const Nickname &item, + std::vector &row) override; }; } // namespace chatterino diff --git a/src/providers/colors/ColorProvider.hpp b/src/providers/colors/ColorProvider.hpp index efb2e6fff..f6fdcde50 100644 --- a/src/providers/colors/ColorProvider.hpp +++ b/src/providers/colors/ColorProvider.hpp @@ -4,6 +4,7 @@ #include #include +#include namespace chatterino { diff --git a/src/providers/emoji/Emojis.hpp b/src/providers/emoji/Emojis.hpp index 323c53d9a..2f1679b6e 100644 --- a/src/providers/emoji/Emojis.hpp +++ b/src/providers/emoji/Emojis.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/src/providers/seventv/eventapi/SeventvEventAPISubscription.cpp b/src/providers/seventv/eventapi/SeventvEventAPISubscription.cpp index a25e24f55..6ae3b9363 100644 --- a/src/providers/seventv/eventapi/SeventvEventAPISubscription.cpp +++ b/src/providers/seventv/eventapi/SeventvEventAPISubscription.cpp @@ -1,8 +1,11 @@ #include "providers/seventv/eventapi/SeventvEventAPISubscription.hpp" +#include #include #include +#include + namespace { using namespace chatterino; diff --git a/src/providers/twitch/TwitchAccountManager.hpp b/src/providers/twitch/TwitchAccountManager.hpp index 4eb90f95a..d3bec563b 100644 --- a/src/providers/twitch/TwitchAccountManager.hpp +++ b/src/providers/twitch/TwitchAccountManager.hpp @@ -2,10 +2,13 @@ #include "common/ChatterinoSetting.hpp" #include "common/SignalVector.hpp" +#include "util/QStringHash.hpp" #include "util/RapidJsonSerializeQString.hpp" #include +#include +#include #include #include diff --git a/src/providers/twitch/TwitchCommon.hpp b/src/providers/twitch/TwitchCommon.hpp index b80e12a03..19f538c2a 100644 --- a/src/providers/twitch/TwitchCommon.hpp +++ b/src/providers/twitch/TwitchCommon.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace chatterino { #ifndef ATTR_UNUSED diff --git a/src/providers/twitch/TwitchEmotes.cpp b/src/providers/twitch/TwitchEmotes.cpp index 890b19686..8c2efa0e2 100644 --- a/src/providers/twitch/TwitchEmotes.cpp +++ b/src/providers/twitch/TwitchEmotes.cpp @@ -1,7 +1,9 @@ #include "providers/twitch/TwitchEmotes.hpp" +#include "common/QLogging.hpp" #include "messages/Emote.hpp" #include "messages/Image.hpp" +#include "util/QStringHash.hpp" namespace chatterino { diff --git a/src/providers/twitch/api/Helix.cpp b/src/providers/twitch/api/Helix.cpp index 76942e8f2..5df03372e 100644 --- a/src/providers/twitch/api/Helix.cpp +++ b/src/providers/twitch/api/Helix.cpp @@ -22,6 +22,19 @@ namespace chatterino { static IHelix *instance = nullptr; +HelixChatters::HelixChatters(const QJsonObject &jsonObject) + : total(jsonObject.value("total").toInt()) + , cursor( + jsonObject.value("pagination").toObject().value("cursor").toString()) +{ + const auto &data = jsonObject.value("data").toArray(); + for (const auto &chatter : data) + { + auto userLogin = chatter.toObject().value("user_login").toString(); + this->chatters.insert(userLogin); + } +} + void Helix::fetchUsers(QStringList userIds, QStringList userLogins, ResultCallback> successCallback, HelixFailureCallback failureCallback) diff --git a/src/providers/twitch/api/Helix.hpp b/src/providers/twitch/api/Helix.hpp index a91f67f40..42242fc8e 100644 --- a/src/providers/twitch/api/Helix.hpp +++ b/src/providers/twitch/api/Helix.hpp @@ -357,20 +357,7 @@ struct HelixChatters { HelixChatters() = default; - explicit HelixChatters(const QJsonObject &jsonObject) - : total(jsonObject.value("total").toInt()) - , cursor(jsonObject.value("pagination") - .toObject() - .value("cursor") - .toString()) - { - const auto &data = jsonObject.value("data").toArray(); - for (const auto &chatter : data) - { - auto userLogin = chatter.toObject().value("user_login").toString(); - this->chatters.insert(userLogin); - } - } + explicit HelixChatters(const QJsonObject &jsonObject); }; using HelixModerator = HelixVip; diff --git a/src/util/Helpers.hpp b/src/util/Helpers.hpp index df2dd4d92..f16590282 100644 --- a/src/util/Helpers.hpp +++ b/src/util/Helpers.hpp @@ -5,6 +5,7 @@ #include #include +#include namespace chatterino { diff --git a/src/util/QStringHash.hpp b/src/util/QStringHash.hpp index 1152e76e2..73148b814 100644 --- a/src/util/QStringHash.hpp +++ b/src/util/QStringHash.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace std { #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) diff --git a/src/util/RatelimitBucket.hpp b/src/util/RatelimitBucket.hpp index 89ecdc570..650eb9640 100644 --- a/src/util/RatelimitBucket.hpp +++ b/src/util/RatelimitBucket.hpp @@ -4,6 +4,8 @@ #include #include +#include + namespace chatterino { class RatelimitBucket : public QObject diff --git a/src/widgets/splits/ClosedSplits.hpp b/src/widgets/splits/ClosedSplits.hpp index d93d4f7b1..5f90a1493 100644 --- a/src/widgets/splits/ClosedSplits.hpp +++ b/src/widgets/splits/ClosedSplits.hpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace chatterino { diff --git a/src/widgets/splits/InputCompletionItem.hpp b/src/widgets/splits/InputCompletionItem.hpp index 19af41316..51498123e 100644 --- a/src/widgets/splits/InputCompletionItem.hpp +++ b/src/widgets/splits/InputCompletionItem.hpp @@ -3,6 +3,7 @@ #include "widgets/listview/GenericListItem.hpp" #include +#include namespace chatterino { diff --git a/src/widgets/splits/InputCompletionPopup.hpp b/src/widgets/splits/InputCompletionPopup.hpp index a26733693..a75b64563 100644 --- a/src/widgets/splits/InputCompletionPopup.hpp +++ b/src/widgets/splits/InputCompletionPopup.hpp @@ -4,6 +4,7 @@ #include "widgets/listview/GenericListModel.hpp" #include +#include namespace chatterino {