Forward declare some things to speed up compile (#6162)

* Forward declare NativeMessagingServer and use a unique_ptr

* Forward declare GenericListModel to save on unneeded includes of its
header
This commit is contained in:
Mm2PL
2025-05-18 17:30:02 +02:00
committed by GitHub
parent 20e306760c
commit 33a5419350
7 changed files with 13 additions and 10 deletions
+3 -1
View File
@@ -20,6 +20,7 @@
#include "providers/twitch/eventsub/Controller.hpp" #include "providers/twitch/eventsub/Controller.hpp"
#include "providers/twitch/TwitchBadges.hpp" #include "providers/twitch/TwitchBadges.hpp"
#include "singletons/ImageUploader.hpp" #include "singletons/ImageUploader.hpp"
#include "singletons/NativeMessaging.hpp"
#ifdef CHATTERINO_HAVE_PLUGINS #ifdef CHATTERINO_HAVE_PLUGINS
# include "controllers/plugins/PluginController.hpp" # include "controllers/plugins/PluginController.hpp"
#endif #endif
@@ -197,6 +198,7 @@ Application::Application(Settings &_settings, const Paths &paths,
#ifdef CHATTERINO_HAVE_PLUGINS #ifdef CHATTERINO_HAVE_PLUGINS
, plugins(new PluginController(paths)) , plugins(new PluginController(paths))
#endif #endif
, nmServer(new NativeMessagingServer())
, updates(_updates) , updates(_updates)
{ {
} }
@@ -655,7 +657,7 @@ void Application::initNm(const Paths &paths)
#if defined QT_NO_DEBUG || defined CHATTERINO_DEBUG_NM #if defined QT_NO_DEBUG || defined CHATTERINO_DEBUG_NM
registerNmHost(paths); registerNmHost(paths);
this->nmServer.start(); this->nmServer->start();
#endif #endif
} }
+2 -3
View File
@@ -1,7 +1,5 @@
#pragma once #pragma once
#include "singletons/NativeMessaging.hpp"
#include <cassert> #include <cassert>
#include <memory> #include <memory>
@@ -54,6 +52,7 @@ class SeventvEventAPI;
class ILinkResolver; class ILinkResolver;
class IStreamerMode; class IStreamerMode;
class ITwitchUsers; class ITwitchUsers;
class NativeMessagingServer;
namespace pronouns { namespace pronouns {
class Pronouns; class Pronouns;
} // namespace pronouns } // namespace pronouns
@@ -236,7 +235,7 @@ public:
private: private:
void initNm(const Paths &paths); void initNm(const Paths &paths);
NativeMessagingServer nmServer; std::unique_ptr<NativeMessagingServer> nmServer;
Updates &updates; Updates &updates;
bool initialized{false}; bool initialized{false};
@@ -5,6 +5,7 @@
#include "controllers/commands/CommandController.hpp" #include "controllers/commands/CommandController.hpp"
#include "controllers/completion/sources/Helpers.hpp" #include "controllers/completion/sources/Helpers.hpp"
#include "providers/twitch/TwitchCommon.hpp" #include "providers/twitch/TwitchCommon.hpp"
#include "widgets/splits/InputCompletionItem.hpp"
namespace chatterino::completion { namespace chatterino::completion {
@@ -11,6 +11,7 @@
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp" #include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "widgets/splits/InputCompletionItem.hpp"
namespace chatterino::completion { namespace chatterino::completion {
@@ -1,13 +1,10 @@
#pragma once #pragma once
#include "widgets/listview/GenericListModel.hpp"
#include "widgets/splits/InputCompletionItem.hpp"
#include <QStringList> #include <QStringList>
#include <memory> namespace chatterino {
#include <utility> class GenericListModel;
#include <vector> } // namespace chatterino
namespace chatterino::completion { namespace chatterino::completion {
@@ -1,5 +1,7 @@
#include "controllers/completion/sources/UnifiedSource.hpp" #include "controllers/completion/sources/UnifiedSource.hpp"
#include "widgets/listview/GenericListModel.hpp"
namespace chatterino::completion { namespace chatterino::completion {
UnifiedSource::UnifiedSource(std::vector<std::unique_ptr<Source>> sources) UnifiedSource::UnifiedSource(std::vector<std::unique_ptr<Source>> sources)
@@ -4,6 +4,7 @@
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "util/Helpers.hpp" #include "util/Helpers.hpp"
#include "widgets/splits/InputCompletionItem.hpp"
namespace chatterino::completion { namespace chatterino::completion {