From 86347dc63e90683914a99cd947b48a4a360d2f23 Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 28 Jun 2018 20:03:04 +0200 Subject: [PATCH] renamed Themes to Theme --- chatterino.pro | 8 ++++---- src/Application.cpp | 4 ++-- src/Application.hpp | 4 ++-- src/messages/MessageBuilder.cpp | 2 +- src/messages/MessageColor.cpp | 2 +- src/messages/MessageColor.hpp | 4 ++-- src/providers/twitch/TwitchMessageBuilder.cpp | 2 +- src/singletons/{Themes.cpp => Theme.cpp} | 12 ++++++------ src/singletons/{Themes.hpp => Theme.hpp} | 6 +++--- src/singletons/WindowManager.cpp | 2 +- src/widgets/BaseWidget.cpp | 2 +- src/widgets/BaseWidget.hpp | 4 ++-- src/widgets/Notebook.cpp | 2 +- src/widgets/Scrollbar.cpp | 2 +- src/widgets/TooltipWidget.cpp | 2 +- src/widgets/Window.cpp | 2 +- src/widgets/Window.hpp | 2 +- src/widgets/helper/ChannelView.cpp | 2 +- src/widgets/helper/DropPreview.cpp | 2 +- src/widgets/helper/NotebookButton.cpp | 2 +- src/widgets/helper/NotebookTab.cpp | 6 +++--- src/widgets/helper/RippleEffectButton.cpp | 2 +- src/widgets/helper/RippleEffectLabel.cpp | 2 +- src/widgets/helper/ScrollbarHighlight.cpp | 2 +- src/widgets/helper/TitlebarButton.cpp | 2 +- src/widgets/splits/Split.cpp | 2 +- src/widgets/splits/SplitContainer.cpp | 2 +- src/widgets/splits/SplitHeader.cpp | 2 +- src/widgets/splits/SplitInput.cpp | 2 +- 29 files changed, 45 insertions(+), 45 deletions(-) rename src/singletons/{Themes.cpp => Theme.cpp} (97%) rename src/singletons/{Themes.hpp => Theme.hpp} (98%) diff --git a/chatterino.pro b/chatterino.pro index 4c101e78e..924c4b6b6 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -222,8 +222,8 @@ SOURCES += \ src/singletons/Paths.cpp \ src/singletons/Resources.cpp \ src/singletons/Settings.cpp \ - src/singletons/Themes.cpp \ - src/singletons/Updates.cpp + src/singletons/Updates.cpp \ + src/singletons/Theme.cpp HEADERS += \ src/Application.hpp \ @@ -390,9 +390,9 @@ HEADERS += \ src/singletons/Paths.hpp \ src/singletons/Resources.hpp \ src/singletons/Settings.hpp \ - src/singletons/Themes.hpp \ src/singletons/Updates.hpp \ - src/singletons/NativeMessaging.hpp + src/singletons/NativeMessaging.hpp \ + src/singletons/Theme.hpp RESOURCES += \ resources/resources.qrc \ diff --git a/src/Application.cpp b/src/Application.cpp index c148fb7a8..7b01174dc 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -15,7 +15,7 @@ #include "singletons/Paths.hpp" #include "singletons/Resources.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "util/IsBigEndian.hpp" #include "util/PostToThread.hpp" @@ -47,7 +47,7 @@ void Application::construct() this->settings = getSettings(); this->paths = Paths::getInstance(); - this->themes = new Themes; + this->themes = new Theme; this->windows = new WindowManager; this->logging = new Logging; this->commands = new CommandController; diff --git a/src/Application.hpp b/src/Application.hpp index 3d9328a8c..582f2d06a 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -16,7 +16,7 @@ class TaggedUsersController; class AccountController; class ModerationActions; -class Themes; +class Theme; class WindowManager; class Logging; class Paths; @@ -45,7 +45,7 @@ public: friend void test(); Paths *paths = nullptr; - Themes *themes = nullptr; + Theme *themes = nullptr; WindowManager *windows = nullptr; Logging *logging = nullptr; CommandController *commands = nullptr; diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index 73a6b23c0..9d19dbdd9 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -3,7 +3,7 @@ #include "common/LinkParser.hpp" #include "singletons/Emotes.hpp" #include "singletons/Resources.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include diff --git a/src/messages/MessageColor.cpp b/src/messages/MessageColor.cpp index 760608f58..fd3b248b5 100644 --- a/src/messages/MessageColor.cpp +++ b/src/messages/MessageColor.cpp @@ -13,7 +13,7 @@ MessageColor::MessageColor(Type _type) { } -const QColor &MessageColor::getColor(Themes &themeManager) const +const QColor &MessageColor::getColor(Theme &themeManager) const { switch (this->type) { case Type::Custom: diff --git a/src/messages/MessageColor.hpp b/src/messages/MessageColor.hpp index 54c483cbe..f6ce3b68f 100644 --- a/src/messages/MessageColor.hpp +++ b/src/messages/MessageColor.hpp @@ -1,6 +1,6 @@ #pragma once -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include @@ -12,7 +12,7 @@ struct MessageColor { MessageColor(const QColor &color); MessageColor(Type type = Text); - const QColor &getColor(Themes &themeManager) const; + const QColor &getColor(Theme &themeManager) const; private: Type type; diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 2ece87e1f..03be79160 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -9,7 +9,7 @@ #include "singletons/Emotes.hpp" #include "singletons/Resources.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "util/IrcHelpers.hpp" diff --git a/src/singletons/Themes.cpp b/src/singletons/Theme.cpp similarity index 97% rename from src/singletons/Themes.cpp rename to src/singletons/Theme.cpp index 4165766f5..d38fc4d00 100644 --- a/src/singletons/Themes.cpp +++ b/src/singletons/Theme.cpp @@ -1,6 +1,6 @@ #define LOOKUP_COLOR_COUNT 360 -#include "Themes.hpp" +#include "Theme.hpp" #include @@ -27,7 +27,7 @@ double getMultiplierByTheme(const QString &themeName) } // namespace detail -Themes::Themes() +Theme::Theme() : themeName("/appearance/theme/name", "Dark") , themeHue("/appearance/theme/hue", 0.0) { @@ -37,14 +37,14 @@ Themes::Themes() this->themeHue.connectSimple([this](auto) { this->update(); }, false); } -void Themes::update() +void Theme::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 Themes::actuallyUpdate(double hue, double multiplier) +void Theme::actuallyUpdate(double hue, double multiplier) { isLight = multiplier > 0; bool lightWin = isLight; @@ -217,7 +217,7 @@ void Themes::actuallyUpdate(double hue, double multiplier) this->updated.invoke(); } -QColor Themes::blendColors(const QColor &color1, const QColor &color2, qreal ratio) +QColor Theme::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 Themes::blendColors(const QColor &color1, const QColor &color2, qreal rat return QColor(r, g, b, 255); } -void Themes::normalizeColor(QColor &color) +void Theme::normalizeColor(QColor &color) { if (this->isLight) { if (color.lightnessF() > 0.5) { diff --git a/src/singletons/Themes.hpp b/src/singletons/Theme.hpp similarity index 98% rename from src/singletons/Themes.hpp rename to src/singletons/Theme.hpp index 7479172d5..048af2c2f 100644 --- a/src/singletons/Themes.hpp +++ b/src/singletons/Theme.hpp @@ -10,12 +10,12 @@ namespace chatterino { class WindowManager; -class Themes +class Theme { public: - Themes(); + Theme(); - ~Themes() = delete; + ~Theme() = delete; inline bool isLightTheme() const { diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index a09874134..fee85989a 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -6,7 +6,7 @@ #include "providers/twitch/TwitchServer.hpp" #include "singletons/Fonts.hpp" #include "singletons/Paths.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "util/Clamp.hpp" #include "widgets/AccountSwitchPopupWidget.hpp" #include "widgets/dialogs/SettingsDialog.hpp" diff --git a/src/widgets/BaseWidget.cpp b/src/widgets/BaseWidget.cpp index e06cb633e..1b21e3e46 100644 --- a/src/widgets/BaseWidget.cpp +++ b/src/widgets/BaseWidget.cpp @@ -3,7 +3,7 @@ #include "Application.hpp" #include "debug/Log.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "widgets/BaseWindow.hpp" #include diff --git a/src/widgets/BaseWidget.hpp b/src/widgets/BaseWidget.hpp index edcc76098..0e00f5e55 100644 --- a/src/widgets/BaseWidget.hpp +++ b/src/widgets/BaseWidget.hpp @@ -6,7 +6,7 @@ namespace chatterino { -class Themes; +class Theme; class BaseWindow; class BaseWidget : public QWidget @@ -41,7 +41,7 @@ protected: void setScale(float value); - Themes *themeManager; + Theme *themeManager; private: void init(); diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 7ccc36845..4fbacc12c 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -2,7 +2,7 @@ #include "Application.hpp" #include "debug/Log.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "widgets/Window.hpp" #include "widgets/dialogs/SettingsDialog.hpp" diff --git a/src/widgets/Scrollbar.cpp b/src/widgets/Scrollbar.cpp index 16aa7218c..0e656ad58 100644 --- a/src/widgets/Scrollbar.cpp +++ b/src/widgets/Scrollbar.cpp @@ -1,7 +1,7 @@ #include "widgets/Scrollbar.hpp" #include "Application.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "widgets/helper/ChannelView.hpp" #include diff --git a/src/widgets/TooltipWidget.cpp b/src/widgets/TooltipWidget.cpp index b7be639ea..a371f25bd 100644 --- a/src/widgets/TooltipWidget.cpp +++ b/src/widgets/TooltipWidget.cpp @@ -2,7 +2,7 @@ #include "Application.hpp" #include "singletons/Fonts.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include #include diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index 030447cec..99bc9ce60 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -5,7 +5,7 @@ #include "controllers/accounts/AccountController.hpp" #include "providers/twitch/TwitchServer.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "widgets/AccountSwitchPopupWidget.hpp" #include "widgets/Notebook.hpp" diff --git a/src/widgets/Window.hpp b/src/widgets/Window.hpp index a4ef1d503..60bf8be8d 100644 --- a/src/widgets/Window.hpp +++ b/src/widgets/Window.hpp @@ -13,7 +13,7 @@ namespace chatterino { -class Themes; +class Theme; class Window : public BaseWindow { diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index ecc7d29e0..331b324d2 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -8,7 +8,7 @@ #include "messages/layouts/MessageLayout.hpp" #include "providers/twitch/TwitchServer.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "util/DistanceBetweenPoints.hpp" #include "widgets/TooltipWidget.hpp" diff --git a/src/widgets/helper/DropPreview.cpp b/src/widgets/helper/DropPreview.cpp index fa93085ec..3ec383894 100644 --- a/src/widgets/helper/DropPreview.cpp +++ b/src/widgets/helper/DropPreview.cpp @@ -1,6 +1,6 @@ #include "widgets/helper/DropPreview.hpp" #include "Application.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include #include diff --git a/src/widgets/helper/NotebookButton.cpp b/src/widgets/helper/NotebookButton.cpp index 8d4f926ec..6bfdb5ff1 100644 --- a/src/widgets/helper/NotebookButton.cpp +++ b/src/widgets/helper/NotebookButton.cpp @@ -1,5 +1,5 @@ #include "widgets/helper/NotebookButton.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "widgets/Notebook.hpp" #include "widgets/helper/RippleEffectButton.hpp" #include "widgets/splits/SplitContainer.hpp" diff --git a/src/widgets/helper/NotebookTab.cpp b/src/widgets/helper/NotebookTab.cpp index 926f54cfe..d14da7ae4 100644 --- a/src/widgets/helper/NotebookTab.cpp +++ b/src/widgets/helper/NotebookTab.cpp @@ -4,7 +4,7 @@ #include "common/Common.hpp" #include "debug/Log.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "util/Clamp.hpp" #include "util/Helpers.hpp" #include "widgets/Notebook.hpp" @@ -221,8 +221,8 @@ void NotebookTab::paintEvent(QPaintEvent *) // int fullHeight = (int)(scale * 48); // select the right tab colors - Themes::TabColors colors; - Themes::TabColors regular = this->themeManager->tabs.regular; + Theme::TabColors colors; + Theme::TabColors regular = this->themeManager->tabs.regular; if (this->selected_) { colors = this->themeManager->tabs.selected; diff --git a/src/widgets/helper/RippleEffectButton.cpp b/src/widgets/helper/RippleEffectButton.cpp index d5893bc2e..0bf6f50fd 100644 --- a/src/widgets/helper/RippleEffectButton.cpp +++ b/src/widgets/helper/RippleEffectButton.cpp @@ -3,7 +3,7 @@ #include #include -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" namespace chatterino { diff --git a/src/widgets/helper/RippleEffectLabel.cpp b/src/widgets/helper/RippleEffectLabel.cpp index 78aa3321c..40c9c876a 100644 --- a/src/widgets/helper/RippleEffectLabel.cpp +++ b/src/widgets/helper/RippleEffectLabel.cpp @@ -1,5 +1,5 @@ #include "widgets/helper/RippleEffectLabel.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "widgets/splits/SplitHeader.hpp" #include diff --git a/src/widgets/helper/ScrollbarHighlight.cpp b/src/widgets/helper/ScrollbarHighlight.cpp index 8e200dd2f..a9892d067 100644 --- a/src/widgets/helper/ScrollbarHighlight.cpp +++ b/src/widgets/helper/ScrollbarHighlight.cpp @@ -1,5 +1,5 @@ #include "widgets/helper/ScrollbarHighlight.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "widgets/Scrollbar.hpp" namespace chatterino { diff --git a/src/widgets/helper/TitlebarButton.cpp b/src/widgets/helper/TitlebarButton.cpp index 53fba0656..adb451736 100644 --- a/src/widgets/helper/TitlebarButton.cpp +++ b/src/widgets/helper/TitlebarButton.cpp @@ -1,6 +1,6 @@ #include "TitlebarButton.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" namespace chatterino { diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index f96ccc765..873383cd8 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -8,7 +8,7 @@ #include "providers/twitch/TwitchMessageBuilder.hpp" #include "providers/twitch/TwitchServer.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "util/StreamLink.hpp" #include "widgets/Window.hpp" diff --git a/src/widgets/splits/SplitContainer.cpp b/src/widgets/splits/SplitContainer.cpp index 08ce8d9b4..ceef09ee0 100644 --- a/src/widgets/splits/SplitContainer.cpp +++ b/src/widgets/splits/SplitContainer.cpp @@ -2,7 +2,7 @@ #include "Application.hpp" #include "common/Common.hpp" #include "debug/AssertInGuiThread.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "singletons/WindowManager.hpp" #include "util/Helpers.hpp" #include "util/LayoutCreator.hpp" diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index d44b57e8d..9d138b210 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -5,7 +5,7 @@ #include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchServer.hpp" #include "singletons/Resources.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "util/LayoutCreator.hpp" #include "widgets/Label.hpp" #include "widgets/TooltipWidget.hpp" diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index f78a0cb7b..f9743ed51 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -6,7 +6,7 @@ #include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchServer.hpp" #include "singletons/Settings.hpp" -#include "singletons/Themes.hpp" +#include "singletons/Theme.hpp" #include "util/LayoutCreator.hpp" #include "widgets/Notebook.hpp" #include "widgets/splits/Split.hpp"