diff --git a/src/Application.cpp b/src/Application.cpp index afc9b0ad1..c148fb7a8 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -45,19 +45,19 @@ void Application::construct() // 1. Instantiate all classes this->settings = getSettings(); - this->paths = PathManager::getInstance(); + this->paths = Paths::getInstance(); - this->themes = new ThemeManager; + this->themes = new Themes; this->windows = new WindowManager; - this->logging = new LoggingManager; + this->logging = new Logging; this->commands = new CommandController; this->highlights = new HighlightController; this->ignores = new IgnoreController; this->taggedUsers = new TaggedUsersController; this->accounts = new AccountController; - this->emotes = new EmoteManager; - this->fonts = new FontManager; - this->resources = new ResourceManager; + this->emotes = new Emotes; + this->fonts = new Fonts; + this->resources = new Resources; this->moderationActions = new ModerationActions; this->twitch.server = new TwitchServer; diff --git a/src/Application.hpp b/src/Application.hpp index d85687cc0..e3eaa2fd6 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -17,16 +17,16 @@ class TaggedUsersController; class AccountController; class ModerationActions; -class ThemeManager; +class Themes; class WindowManager; -class LoggingManager; -class PathManager; +class Logging; +class Paths; class AccountManager; -class EmoteManager; -class NativeMessagingManager; -class SettingManager; -class FontManager; -class ResourceManager; +class Emotes; +class NativeMessaging; +class Settings; +class Fonts; +class Resources; class Application { @@ -45,20 +45,20 @@ public: friend void test(); - PathManager *paths = nullptr; - ThemeManager *themes = nullptr; + Paths *paths = nullptr; + Themes *themes = nullptr; WindowManager *windows = nullptr; - LoggingManager *logging = nullptr; + Logging *logging = nullptr; CommandController *commands = nullptr; HighlightController *highlights = nullptr; IgnoreController *ignores = nullptr; TaggedUsersController *taggedUsers = nullptr; AccountController *accounts = nullptr; - EmoteManager *emotes = nullptr; - NativeMessagingManager *nativeMessaging = nullptr; - SettingManager *settings = nullptr; - FontManager *fonts = nullptr; - ResourceManager *resources = nullptr; + Emotes *emotes = nullptr; + NativeMessaging *nativeMessaging = nullptr; + Settings *settings = nullptr; + Fonts *fonts = nullptr; + Resources *resources = nullptr; ModerationActions *moderationActions = nullptr; /// Provider-specific diff --git a/src/main.cpp b/src/main.cpp index 498a9d0cc..aa7e53aca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); // FOURTF: might get arguments from the commandline passed in the future - chatterino::PathManager::initInstance(); + chatterino::Paths::initInstance(); // read args QStringList args; @@ -79,7 +79,7 @@ int runGui(QApplication &a, int argc, char *argv[]) chatterino::NetworkManager::init(); // Check for upates - chatterino::UpdateManager::getInstance().checkForUpdates(); + chatterino::Updates::getInstance().checkForUpdates(); // Initialize application chatterino::Application::instantiate(argc, argv); @@ -139,7 +139,7 @@ int runGui(QApplication &a, int argc, char *argv[]) void runNativeMessagingHost() { - auto *nm = new chatterino::NativeMessagingManager; + auto *nm = new chatterino::NativeMessaging; #ifdef Q_OS_WIN _setmode(_fileno(stdin), _O_BINARY); diff --git a/src/messages/MessageColor.cpp b/src/messages/MessageColor.cpp index b6700a9ad..760608f58 100644 --- a/src/messages/MessageColor.cpp +++ b/src/messages/MessageColor.cpp @@ -13,7 +13,7 @@ MessageColor::MessageColor(Type _type) { } -const QColor &MessageColor::getColor(ThemeManager &themeManager) const +const QColor &MessageColor::getColor(Themes &themeManager) const { switch (this->type) { case Type::Custom: diff --git a/src/messages/MessageColor.hpp b/src/messages/MessageColor.hpp index 61d13fdb8..54c483cbe 100644 --- a/src/messages/MessageColor.hpp +++ b/src/messages/MessageColor.hpp @@ -12,7 +12,7 @@ struct MessageColor { MessageColor(const QColor &color); MessageColor(Type type = Text); - const QColor &getColor(ThemeManager &themeManager) const; + const QColor &getColor(Themes &themeManager) const; private: Type type; diff --git a/src/singletons/Emotes.cpp b/src/singletons/Emotes.cpp index 485fa6e76..f8f68348a 100644 --- a/src/singletons/Emotes.cpp +++ b/src/singletons/Emotes.cpp @@ -5,7 +5,7 @@ namespace chatterino { -void EmoteManager::initialize() +void Emotes::initialize() { getApp()->accounts->twitch.currentUserChanged.connect([this] { auto currentUser = getApp()->accounts->twitch.getCurrent(); @@ -20,7 +20,7 @@ void EmoteManager::initialize() this->gifTimer.initialize(); } -bool EmoteManager::isIgnoredEmote(const QString &) +bool Emotes::isIgnoredEmote(const QString &) { return false; } diff --git a/src/singletons/Emotes.hpp b/src/singletons/Emotes.hpp index 0315259cd..7500dba9f 100644 --- a/src/singletons/Emotes.hpp +++ b/src/singletons/Emotes.hpp @@ -10,10 +10,10 @@ namespace chatterino { -class EmoteManager +class Emotes { public: - ~EmoteManager() = delete; + ~Emotes() = delete; void initialize(); diff --git a/src/singletons/Fonts.cpp b/src/singletons/Fonts.cpp index fdd9f4a3e..0e5f86fce 100644 --- a/src/singletons/Fonts.cpp +++ b/src/singletons/Fonts.cpp @@ -22,7 +22,7 @@ namespace chatterino { -FontManager::FontManager() +Fonts::Fonts() : chatFontFamily("/appearance/currentFontFamily", DEFAULT_FONT_FAMILY) , chatFontSize("/appearance/currentFontSize", DEFAULT_FONT_SIZE) { @@ -57,17 +57,17 @@ FontManager::FontManager() this->fontsByType.resize(size_t(EndType)); } -QFont FontManager::getFont(FontManager::Type type, float scale) +QFont Fonts::getFont(Fonts::Type type, float scale) { return this->getOrCreateFontData(type, scale).font; } -QFontMetrics FontManager::getFontMetrics(FontManager::Type type, float scale) +QFontMetrics Fonts::getFontMetrics(Fonts::Type type, float scale) { return this->getOrCreateFontData(type, scale).metrics; } -FontManager::FontData &FontManager::getOrCreateFontData(Type type, float scale) +Fonts::FontData &Fonts::getOrCreateFontData(Type type, float scale) { assertInGuiThread(); @@ -90,7 +90,7 @@ FontManager::FontData &FontManager::getOrCreateFontData(Type type, float scale) return result.first->second; } -FontManager::FontData FontManager::createFontData(Type type, float scale) +Fonts::FontData Fonts::createFontData(Type type, float scale) { // check if it's a chat (scale the setting) if (type >= ChatStart && type <= ChatEnd) { diff --git a/src/singletons/Fonts.hpp b/src/singletons/Fonts.hpp index cd5ebc03d..193640a5e 100644 --- a/src/singletons/Fonts.hpp +++ b/src/singletons/Fonts.hpp @@ -11,10 +11,10 @@ namespace chatterino { -class FontManager : boost::noncopyable +class Fonts : boost::noncopyable { public: - FontManager(); + Fonts(); // font data gets set in createFontData(...) enum Type : uint8_t { @@ -77,6 +77,6 @@ private: std::vector> fontsByType; }; -using FontStyle = FontManager::Type; +using FontStyle = Fonts::Type; } // namespace chatterino diff --git a/src/singletons/Logging.cpp b/src/singletons/Logging.cpp index e59ff06d5..e4fbec982 100644 --- a/src/singletons/Logging.cpp +++ b/src/singletons/Logging.cpp @@ -12,12 +12,12 @@ namespace chatterino { -void LoggingManager::initialize() +void Logging::initialize() { this->pathManager = getApp()->paths; } -void LoggingManager::addMessage(const QString &channelName, MessagePtr message) +void Logging::addMessage(const QString &channelName, MessagePtr message) { auto app = getApp(); diff --git a/src/singletons/Logging.hpp b/src/singletons/Logging.hpp index 5ba9ea5a4..41286f130 100644 --- a/src/singletons/Logging.hpp +++ b/src/singletons/Logging.hpp @@ -7,16 +7,16 @@ namespace chatterino { -class PathManager; +class Paths; -class LoggingManager +class Logging { - PathManager *pathManager = nullptr; + Paths *pathManager = nullptr; public: - LoggingManager() = default; + Logging() = default; - ~LoggingManager() = delete; + ~Logging() = delete; void initialize(); diff --git a/src/singletons/NativeMessaging.cpp b/src/singletons/NativeMessaging.cpp index bb4b93814..60226433b 100644 --- a/src/singletons/NativeMessaging.cpp +++ b/src/singletons/NativeMessaging.cpp @@ -32,12 +32,12 @@ namespace ipc = boost::interprocess; namespace chatterino { // fourtf: don't add this class to the application class -NativeMessagingManager::NativeMessagingManager() +NativeMessaging::NativeMessaging() { qDebug() << "init NativeMessagingManager"; } -void NativeMessagingManager::writeByteArray(QByteArray a) +void NativeMessaging::writeByteArray(QByteArray a) { char *data = a.data(); uint32_t size; @@ -47,7 +47,7 @@ void NativeMessagingManager::writeByteArray(QByteArray a) std::cout.flush(); } -void NativeMessagingManager::registerHost() +void NativeMessaging::registerHost() { auto app = getApp(); @@ -111,7 +111,7 @@ void NativeMessagingManager::registerHost() } } -void NativeMessagingManager::openGuiMessageQueue() +void NativeMessaging::openGuiMessageQueue() { static ReceiverThread thread; @@ -122,7 +122,7 @@ void NativeMessagingManager::openGuiMessageQueue() thread.start(); } -void NativeMessagingManager::sendToGuiProcess(const QByteArray &array) +void NativeMessaging::sendToGuiProcess(const QByteArray &array) { try { ipc::message_queue messageQueue(ipc::open_only, "chatterino_gui"); @@ -133,7 +133,7 @@ void NativeMessagingManager::sendToGuiProcess(const QByteArray &array) } } -void NativeMessagingManager::ReceiverThread::run() +void NativeMessaging::ReceiverThread::run() { ipc::message_queue::remove("chatterino_gui"); @@ -157,7 +157,7 @@ void NativeMessagingManager::ReceiverThread::run() } } -void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &root) +void NativeMessaging::ReceiverThread::handleMessage(const QJsonObject &root) { auto app = getApp(); @@ -231,10 +231,10 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro } } -std::string &NativeMessagingManager::getGuiMessageQueueName() +std::string &NativeMessaging::getGuiMessageQueueName() { static std::string name = - "chatterino_gui" + PathManager::getInstance()->applicationFilePathHash.toStdString(); + "chatterino_gui" + Paths::getInstance()->applicationFilePathHash.toStdString(); return name; } diff --git a/src/singletons/NativeMessaging.hpp b/src/singletons/NativeMessaging.hpp index d71f89871..9906f833b 100644 --- a/src/singletons/NativeMessaging.hpp +++ b/src/singletons/NativeMessaging.hpp @@ -4,13 +4,13 @@ namespace chatterino { -class NativeMessagingManager +class NativeMessaging { public: // fourtf: don't add this class to the application class - NativeMessagingManager(); + NativeMessaging(); - ~NativeMessagingManager() = delete; + ~NativeMessaging() = delete; class ReceiverThread : public QThread { diff --git a/src/singletons/Paths.cpp b/src/singletons/Paths.cpp index 836b01045..8df1bd4f6 100644 --- a/src/singletons/Paths.cpp +++ b/src/singletons/Paths.cpp @@ -10,9 +10,9 @@ namespace chatterino { -PathManager *PathManager::instance = nullptr; +Paths *Paths::instance = nullptr; -PathManager::PathManager() +Paths::Paths() { this->initAppFilePathHash(); @@ -21,31 +21,31 @@ PathManager::PathManager() this->initSubDirectories(); } -void PathManager::initInstance() +void Paths::initInstance() { assert(!instance); - instance = new PathManager(); + instance = new Paths(); } -PathManager *PathManager::getInstance() +Paths *Paths::getInstance() { assert(instance); return instance; } -bool PathManager::createFolder(const QString &folderPath) +bool Paths::createFolder(const QString &folderPath) { return QDir().mkpath(folderPath); } -bool PathManager::isPortable() +bool Paths::isPortable() { return this->portable.get(); } -void PathManager::initAppFilePathHash() +void Paths::initAppFilePathHash() { this->applicationFilePathHash = QCryptographicHash::hash(QCoreApplication::applicationFilePath().toUtf8(), @@ -56,13 +56,13 @@ void PathManager::initAppFilePathHash() .replace("/", "x"); } -void PathManager::initCheckPortable() +void Paths::initCheckPortable() { this->portable = QFileInfo::exists(combinePath(QCoreApplication::applicationDirPath(), "portable")); } -void PathManager::initAppDataDirectory() +void Paths::initAppDataDirectory() { assert(this->portable.is_initialized()); @@ -91,7 +91,7 @@ void PathManager::initAppDataDirectory() }(); } -void PathManager::initSubDirectories() +void Paths::initSubDirectories() { // required the app data directory to be set first assert(!this->rootAppDataDirectory.isEmpty()); diff --git a/src/singletons/Paths.hpp b/src/singletons/Paths.hpp index a189f9639..69d30c5ab 100644 --- a/src/singletons/Paths.hpp +++ b/src/singletons/Paths.hpp @@ -5,13 +5,13 @@ namespace chatterino { -class PathManager +class Paths { - PathManager(); + Paths(); public: static void initInstance(); - static PathManager *getInstance(); + static Paths *getInstance(); // Root directory for the configuration files. %APPDATA%/chatterino or ExecutablePath for // portable mode @@ -36,7 +36,7 @@ public: bool isPortable(); private: - static PathManager *instance; + static Paths *instance; boost::optional portable; void initAppFilePathHash(); diff --git a/src/singletons/Resources.cpp b/src/singletons/Resources.cpp index 3b0d4a605..730985f0f 100644 --- a/src/singletons/Resources.cpp +++ b/src/singletons/Resources.cpp @@ -75,7 +75,7 @@ inline bool ReadValue>(const rapidjson::Value &object, cons } // Parse a single cheermote set (or "action") from the twitch api -inline bool ParseSingleCheermoteSet(ResourceManager::JSONCheermoteSet &set, +inline bool ParseSingleCheermoteSet(Resources::JSONCheermoteSet &set, const rapidjson::Value &action) { if (!action.IsObject()) { @@ -122,7 +122,7 @@ inline bool ParseSingleCheermoteSet(ResourceManager::JSONCheermoteSet &set, } for (const rapidjson::Value &tierValue : tiersValue.GetArray()) { - ResourceManager::JSONCheermoteSet::CheermoteTier tier; + Resources::JSONCheermoteSet::CheermoteTier tier; if (!tierValue.IsObject()) { return false; @@ -237,7 +237,7 @@ inline bool ParseSingleCheermoteSet(ResourceManager::JSONCheermoteSet &set, // Look through the results of https://api.twitch.tv/kraken/bits/actions?channel_id=11148817 for // cheermote sets or "Actions" as they are called in the API -inline void ParseCheermoteSets(std::vector &sets, +inline void ParseCheermoteSets(std::vector &sets, const rapidjson::Document &d) { if (!d.IsObject()) { @@ -255,7 +255,7 @@ inline void ParseCheermoteSets(std::vector &s } for (const auto &action : actionsValue.GetArray()) { - ResourceManager::JSONCheermoteSet set; + Resources::JSONCheermoteSet set; bool res = ParseSingleCheermoteSet(set, action); if (res) { @@ -265,7 +265,7 @@ inline void ParseCheermoteSets(std::vector &s } } // namespace -ResourceManager::ResourceManager() +Resources::Resources() : badgeStaff(lli(":/images/staff_bg.png")) , badgeAdmin(lli(":/images/admin_bg.png")) , badgeGlobalModerator(lli(":/images/globalmod_bg.png")) @@ -302,14 +302,14 @@ ResourceManager::ResourceManager() qDebug() << "init ResourceManager"; } -void ResourceManager::initialize() +void Resources::initialize() { this->loadDynamicTwitchBadges(); this->loadChatterinoBadges(); } -ResourceManager::BadgeVersion::BadgeVersion(QJsonObject &&root) +Resources::BadgeVersion::BadgeVersion(QJsonObject &&root) : badgeImage1x(new Image(root.value("image_url_1x").toString())) , badgeImage2x(new Image(root.value("image_url_2x").toString())) , badgeImage4x(new Image(root.value("image_url_4x").toString())) @@ -320,7 +320,7 @@ ResourceManager::BadgeVersion::BadgeVersion(QJsonObject &&root) { } -void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache) +void Resources::loadChannelData(const QString &roomID, bool bypassCache) { QString url = "https://badges.twitch.tv/v1/badges/channels/" + roomID + "/display?language=en"; @@ -330,7 +330,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache) req.getJSON([this, roomID](QJsonObject &root) { QJsonObject sets = root.value("badge_sets").toObject(); - ResourceManager::Channel &ch = this->channels[roomID]; + Resources::Channel &ch = this->channels[roomID]; for (QJsonObject::iterator it = sets.begin(); it != sets.end(); ++it) { QJsonObject versions = it.value().toObject().value("versions").toObject(); @@ -354,7 +354,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache) twitchApiGet2( cheermoteURL, QThread::currentThread(), true, [this, roomID](const rapidjson::Document &d) { - ResourceManager::Channel &ch = this->channels[roomID]; + Resources::Channel &ch = this->channels[roomID]; ParseCheermoteSets(ch.jsonCheermoteSets, d); @@ -393,7 +393,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache) }); } -void ResourceManager::loadDynamicTwitchBadges() +void Resources::loadDynamicTwitchBadges() { static QString url("https://badges.twitch.tv/v1/badges/global/display?language=en"); @@ -420,7 +420,7 @@ void ResourceManager::loadDynamicTwitchBadges() }); } -void ResourceManager::loadChatterinoBadges() +void Resources::loadChatterinoBadges() { this->chatterinoBadges.clear(); diff --git a/src/singletons/Resources.hpp b/src/singletons/Resources.hpp index 689db1630..0a521267d 100644 --- a/src/singletons/Resources.hpp +++ b/src/singletons/Resources.hpp @@ -11,12 +11,12 @@ namespace chatterino { -class ResourceManager +class Resources { public: - ResourceManager(); + Resources(); - ~ResourceManager() = delete; + ~Resources() = delete; void initialize(); diff --git a/src/singletons/Settings.cpp b/src/singletons/Settings.cpp index 24963d5b4..0ade53a49 100644 --- a/src/singletons/Settings.cpp +++ b/src/singletons/Settings.cpp @@ -15,19 +15,19 @@ void _actuallyRegisterSetting(std::weak_ptr set _settings.push_back(setting); } -SettingManager::SettingManager() +Settings::Settings() { qDebug() << "init SettingManager"; } -SettingManager &SettingManager::getInstance() +Settings &Settings::getInstance() { - static SettingManager instance; + static Settings instance; return instance; } -void SettingManager::initialize() +void Settings::initialize() { this->timestampFormat.connect([](auto, auto) { auto app = getApp(); @@ -45,7 +45,7 @@ void SettingManager::initialize() [](auto, auto) { getApp()->windows->forceLayoutChannelViews(); }); } -void SettingManager::load() +void Settings::load() { auto app = getApp(); QString settingsPath = app->paths->settingsDirectory + "/settings.json"; @@ -53,7 +53,7 @@ void SettingManager::load() pajlada::Settings::SettingManager::load(qPrintable(settingsPath)); } -void SettingManager::saveSnapshot() +void Settings::saveSnapshot() { rapidjson::Document *d = new rapidjson::Document(rapidjson::kObjectType); rapidjson::Document::AllocatorType &a = d->GetAllocator(); @@ -74,7 +74,7 @@ void SettingManager::saveSnapshot() Log("hehe: {}", pajlada::Settings::SettingManager::stringify(*d)); } -void SettingManager::restoreSnapshot() +void Settings::restoreSnapshot() { if (!this->snapshot) { return; @@ -100,9 +100,9 @@ void SettingManager::restoreSnapshot() } } -SettingManager *getSettings() +Settings *getSettings() { - return &SettingManager::getInstance(); + return &Settings::getInstance(); } } // namespace chatterino diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 31b2caec4..03a0ec146 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -12,12 +12,12 @@ namespace chatterino { void _actuallyRegisterSetting(std::weak_ptr setting); -class SettingManager +class Settings { - SettingManager(); + Settings(); public: - static SettingManager &getInstance(); + static Settings &getInstance(); void initialize(); void load(); @@ -127,6 +127,6 @@ private: void updateModerationActions(); }; -SettingManager *getSettings(); +Settings *getSettings(); } // namespace chatterino diff --git a/src/singletons/Themes.cpp b/src/singletons/Themes.cpp index 49f427531..4165766f5 100644 --- a/src/singletons/Themes.cpp +++ b/src/singletons/Themes.cpp @@ -27,7 +27,7 @@ double getMultiplierByTheme(const QString &themeName) } // namespace detail -ThemeManager::ThemeManager() +Themes::Themes() : themeName("/appearance/theme/name", "Dark") , themeHue("/appearance/theme/hue", 0.0) { @@ -37,14 +37,14 @@ ThemeManager::ThemeManager() this->themeHue.connectSimple([this](auto) { this->update(); }, false); } -void ThemeManager::update() +void Themes::update() { this->actuallyUpdate(this->themeHue, detail::getMultiplierByTheme(this->themeName.getValue())); } // hue: theme color (0 - 1) // multiplier: 1 = white, 0.8 = light, -0.8 dark, -1 black -void ThemeManager::actuallyUpdate(double hue, double multiplier) +void Themes::actuallyUpdate(double hue, double multiplier) { isLight = multiplier > 0; bool lightWin = isLight; @@ -217,7 +217,7 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier) this->updated.invoke(); } -QColor ThemeManager::blendColors(const QColor &color1, const QColor &color2, qreal ratio) +QColor Themes::blendColors(const QColor &color1, const QColor &color2, qreal ratio) { int r = int(color1.red() * (1 - ratio) + color2.red() * ratio); int g = int(color1.green() * (1 - ratio) + color2.green() * ratio); @@ -226,7 +226,7 @@ QColor ThemeManager::blendColors(const QColor &color1, const QColor &color2, qre return QColor(r, g, b, 255); } -void ThemeManager::normalizeColor(QColor &color) +void Themes::normalizeColor(QColor &color) { if (this->isLight) { if (color.lightnessF() > 0.5) { diff --git a/src/singletons/Themes.hpp b/src/singletons/Themes.hpp index d0157f183..7479172d5 100644 --- a/src/singletons/Themes.hpp +++ b/src/singletons/Themes.hpp @@ -10,12 +10,12 @@ namespace chatterino { class WindowManager; -class ThemeManager +class Themes { public: - ThemeManager(); + Themes(); - ~ThemeManager() = delete; + ~Themes() = delete; inline bool isLightTheme() const { diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index 99240b091..4cadf2b1a 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -10,31 +10,31 @@ namespace chatterino { -UpdateManager::UpdateManager() +Updates::Updates() : currentVersion_(CHATTERINO_VERSION) { qDebug() << "init UpdateManager"; } -UpdateManager &UpdateManager::getInstance() +Updates &Updates::getInstance() { // fourtf: don't add this class to the application class - static UpdateManager instance; + static Updates instance; return instance; } -const QString &UpdateManager::getCurrentVersion() const +const QString &Updates::getCurrentVersion() const { return currentVersion_; } -const QString &UpdateManager::getOnlineVersion() const +const QString &Updates::getOnlineVersion() const { return onlineVersion_; } -void UpdateManager::installUpdates() +void Updates::installUpdates() { if (this->status_ != UpdateAvailable) { assert(false); @@ -87,7 +87,7 @@ void UpdateManager::installUpdates() #endif } -void UpdateManager::checkForUpdates() +void Updates::checkForUpdates() { #ifdef Q_OS_WIN QString url = "https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/stable"; @@ -141,12 +141,12 @@ void UpdateManager::checkForUpdates() #endif } -UpdateManager::UpdateStatus UpdateManager::getStatus() const +Updates::UpdateStatus Updates::getStatus() const { return this->status_; } -void UpdateManager::setStatus_(UpdateStatus status) +void Updates::setStatus_(UpdateStatus status) { if (this->status_ != status) { this->status_ = status; diff --git a/src/singletons/Updates.hpp b/src/singletons/Updates.hpp index e2f7a7b17..f760631a9 100644 --- a/src/singletons/Updates.hpp +++ b/src/singletons/Updates.hpp @@ -5,9 +5,9 @@ namespace chatterino { -class UpdateManager +class Updates { - UpdateManager(); + Updates(); public: enum UpdateStatus { @@ -22,7 +22,7 @@ public: }; // fourtf: don't add this class to the application class - static UpdateManager &getInstance(); + static Updates &getInstance(); void checkForUpdates(); const QString &getCurrentVersion() const; diff --git a/src/widgets/BaseWidget.hpp b/src/widgets/BaseWidget.hpp index bc1faa5ac..edcc76098 100644 --- a/src/widgets/BaseWidget.hpp +++ b/src/widgets/BaseWidget.hpp @@ -6,7 +6,7 @@ namespace chatterino { -class ThemeManager; +class Themes; class BaseWindow; class BaseWidget : public QWidget @@ -41,7 +41,7 @@ protected: void setScale(float value); - ThemeManager *themeManager; + Themes *themeManager; private: void init(); diff --git a/src/widgets/TooltipWidget.cpp b/src/widgets/TooltipWidget.cpp index d80dc89cd..b7be639ea 100644 --- a/src/widgets/TooltipWidget.cpp +++ b/src/widgets/TooltipWidget.cpp @@ -77,7 +77,7 @@ void TooltipWidget::updateFont() auto app = getApp(); this->setFont( - app->fonts->getFont(FontManager::Type::ChatMediumSmall, this->getScale())); + app->fonts->getFont(Fonts::Type::ChatMediumSmall, this->getScale())); } void TooltipWidget::setText(QString text) diff --git a/src/widgets/Window.hpp b/src/widgets/Window.hpp index 1d0784e92..a4ef1d503 100644 --- a/src/widgets/Window.hpp +++ b/src/widgets/Window.hpp @@ -13,7 +13,7 @@ namespace chatterino { -class ThemeManager; +class Themes; class Window : public BaseWindow { diff --git a/src/widgets/dialogs/LastRunCrashDialog.cpp b/src/widgets/dialogs/LastRunCrashDialog.cpp index 349060fce..b2d66e15d 100644 --- a/src/widgets/dialogs/LastRunCrashDialog.cpp +++ b/src/widgets/dialogs/LastRunCrashDialog.cpp @@ -16,7 +16,7 @@ LastRunCrashDialog::LastRunCrashDialog() this->setWindowFlag(Qt::WindowContextHelpButtonHint, false); this->setWindowTitle("Chatterino"); - auto &updateManager = UpdateManager::getInstance(); + auto &updateManager = Updates::getInstance(); auto layout = LayoutCreator(this).setLayoutType(); diff --git a/src/widgets/helper/NotebookTab.cpp b/src/widgets/helper/NotebookTab.cpp index 6244bfc68..926f54cfe 100644 --- a/src/widgets/helper/NotebookTab.cpp +++ b/src/widgets/helper/NotebookTab.cpp @@ -221,8 +221,8 @@ void NotebookTab::paintEvent(QPaintEvent *) // int fullHeight = (int)(scale * 48); // select the right tab colors - ThemeManager::TabColors colors; - ThemeManager::TabColors regular = this->themeManager->tabs.regular; + Themes::TabColors colors; + Themes::TabColors regular = this->themeManager->tabs.regular; if (this->selected_) { colors = this->themeManager->tabs.selected; diff --git a/src/widgets/settingspages/AppearancePage.cpp b/src/widgets/settingspages/AppearancePage.cpp index a434b52a1..e31401d05 100644 --- a/src/widgets/settingspages/AppearancePage.cpp +++ b/src/widgets/settingspages/AppearancePage.cpp @@ -226,7 +226,7 @@ QLayout *AppearancePage::createFontChanger() button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed); QObject::connect(button, &QPushButton::clicked, [=]() { - QFontDialog dialog(app->fonts->getFont(FontManager::ChatMedium, 1.)); + QFontDialog dialog(app->fonts->getFont(Fonts::ChatMedium, 1.)); dialog.setWindowFlag(Qt::WindowStaysOnTopHint); diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 051e4328e..29e909cd2 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -67,11 +67,11 @@ void SplitInput::initLayout() // set edit font this->ui_.textEdit->setFont( - app->fonts->getFont(FontManager::Type::ChatMedium, this->getScale())); + app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale())); this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() { this->ui_.textEdit->setFont( - app->fonts->getFont(FontManager::Type::ChatMedium, this->getScale())); + app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale())); })); // open emote popup