#pragma once #include "common/Singleton.hpp" #include "singletons/Resources.hpp" #include #include namespace chatterino { class TwitchServer; class PubSub; class CommandController; class HighlightController; class IgnoreController; class TaggedUsersController; class AccountController; class ModerationActions; class Theme; class WindowManager; class Logging; class Paths; class AccountManager; class Emotes; class Settings; class Fonts; class Resources; class Application { std::vector> singletons_; int argc_; char **argv_; public: static Application *instance; Application(Settings &settings, Paths &paths); void initialize(Settings &settings, Paths &paths); void load(); void save(); int run(QApplication &qtApp); friend void test(); Settings *const settings = nullptr; Paths *const paths = nullptr; Resources2 *const resources; Theme *const themes = nullptr; Fonts *const fonts = nullptr; Emotes *const emotes = nullptr; WindowManager *const windows = nullptr; AccountController *const accounts = nullptr; CommandController *const commands = nullptr; HighlightController *const highlights = nullptr; IgnoreController *const ignores = nullptr; TaggedUsersController *const taggedUsers = nullptr; ModerationActions *const moderationActions = nullptr; TwitchServer *const twitch2 = nullptr; [[deprecated]] Logging *const logging = nullptr; /// Provider-specific struct { [[deprecated("use twitch2 instead")]] TwitchServer *server = nullptr; [[deprecated("use twitch2->pubsub instead")]] PubSub *pubsub = nullptr; } twitch; private: void addSingleton(Singleton *singleton); void initPubsub(); void initNm(); template ::value>> T &emplace() { auto t = new T; this->singletons_.push_back(std::unique_ptr(t)); return *t; } }; Application *getApp(); } // namespace chatterino