refactor: Remove most raw accesses into Application (#5104)

This commit is contained in:
pajlada
2024-01-19 17:59:55 +01:00
committed by GitHub
parent 326a402710
commit 4380ef8c5f
82 changed files with 552 additions and 452 deletions
+30 -89
View File
@@ -85,6 +85,9 @@ public:
virtual TwitchBadges *getTwitchBadges() = 0;
virtual ImageUploader *getImageUploader() = 0;
virtual SeventvAPI *getSeventvAPI() = 0;
#ifdef CHATTERINO_HAVE_PLUGINS
virtual PluginController *getPlugins() = 0;
#endif
virtual Updates &getUpdates() = 0;
};
@@ -122,9 +125,14 @@ public:
friend void test();
private:
Theme *const themes{};
Fonts *const fonts{};
public:
Emotes *const emotes{};
private:
AccountController *const accounts{};
HotkeyController *const hotkeys{};
WindowManager *const windows{};
@@ -132,28 +140,28 @@ public:
ImageUploader *const imageUploader{};
SeventvAPI *const seventvAPI{};
CrashHandler *const crashHandler{};
CommandController *const commands{};
NotificationController *const notifications{};
HighlightController *const highlights{};
public:
TwitchIrcServer *const twitch{};
private:
FfzBadges *const ffzBadges{};
SeventvBadges *const seventvBadges{};
UserDataController *const userData{};
ISoundController *const sound{};
private:
TwitchLiveController *const twitchLiveController{};
std::unique_ptr<PubSub> twitchPubSub;
std::unique_ptr<TwitchBadges> twitchBadges;
std::unique_ptr<ChatterinoBadges> chatterinoBadges;
const std::unique_ptr<Logging> logging;
public:
#ifdef CHATTERINO_HAVE_PLUGINS
PluginController *const plugins{};
#endif
public:
const Paths &getPaths() override
{
return this->paths_;
@@ -162,99 +170,32 @@ public:
{
return this->args_;
}
Theme *getThemes() override
{
assertInGuiThread();
return this->themes;
}
Fonts *getFonts() override
{
assertInGuiThread();
return this->fonts;
}
Theme *getThemes() override;
Fonts *getFonts() override;
IEmotes *getEmotes() override;
AccountController *getAccounts() override
{
assertInGuiThread();
return this->accounts;
}
HotkeyController *getHotkeys() override
{
assertInGuiThread();
return this->hotkeys;
}
WindowManager *getWindows() override
{
assertInGuiThread();
return this->windows;
}
Toasts *getToasts() override
{
assertInGuiThread();
return this->toasts;
}
CrashHandler *getCrashHandler() override
{
assertInGuiThread();
return this->crashHandler;
}
CommandController *getCommands() override
{
assertInGuiThread();
return this->commands;
}
NotificationController *getNotifications() override
{
assertInGuiThread();
return this->notifications;
}
HighlightController *getHighlights() override
{
assertInGuiThread();
return this->highlights;
}
AccountController *getAccounts() override;
HotkeyController *getHotkeys() override;
WindowManager *getWindows() override;
Toasts *getToasts() override;
CrashHandler *getCrashHandler() override;
CommandController *getCommands() override;
NotificationController *getNotifications() override;
HighlightController *getHighlights() override;
ITwitchIrcServer *getTwitch() override;
PubSub *getTwitchPubSub() override;
Logging *getChatLogger() override;
FfzBadges *getFfzBadges() override
{
assertInGuiThread();
return this->ffzBadges;
}
SeventvBadges *getSeventvBadges() override
{
assertInGuiThread();
return this->seventvBadges;
}
FfzBadges *getFfzBadges() override;
SeventvBadges *getSeventvBadges() override;
IUserDataController *getUserData() override;
ISoundController *getSound() override;
ITwitchLiveController *getTwitchLiveController() override;
TwitchBadges *getTwitchBadges() override;
IChatterinoBadges *getChatterinoBadges() override;
ImageUploader *getImageUploader() override
{
assertInGuiThread();
return this->imageUploader;
}
SeventvAPI *getSeventvAPI() override
{
assertInGuiThread();
return this->seventvAPI;
}
ImageUploader *getImageUploader() override;
SeventvAPI *getSeventvAPI() override;
#ifdef CHATTERINO_HAVE_PLUGINS
PluginController *getPlugins() override;
#endif
Updates &getUpdates() override
{
assertInGuiThread();