renamed Themes to Theme

This commit is contained in:
fourtf 2018-06-28 20:03:04 +02:00
parent c01d1ed732
commit 86347dc63e
29 changed files with 45 additions and 45 deletions

View file

@ -222,8 +222,8 @@ SOURCES += \
src/singletons/Paths.cpp \ src/singletons/Paths.cpp \
src/singletons/Resources.cpp \ src/singletons/Resources.cpp \
src/singletons/Settings.cpp \ src/singletons/Settings.cpp \
src/singletons/Themes.cpp \ src/singletons/Updates.cpp \
src/singletons/Updates.cpp src/singletons/Theme.cpp
HEADERS += \ HEADERS += \
src/Application.hpp \ src/Application.hpp \
@ -390,9 +390,9 @@ HEADERS += \
src/singletons/Paths.hpp \ src/singletons/Paths.hpp \
src/singletons/Resources.hpp \ src/singletons/Resources.hpp \
src/singletons/Settings.hpp \ src/singletons/Settings.hpp \
src/singletons/Themes.hpp \
src/singletons/Updates.hpp \ src/singletons/Updates.hpp \
src/singletons/NativeMessaging.hpp src/singletons/NativeMessaging.hpp \
src/singletons/Theme.hpp
RESOURCES += \ RESOURCES += \
resources/resources.qrc \ resources/resources.qrc \

View file

@ -15,7 +15,7 @@
#include "singletons/Paths.hpp" #include "singletons/Paths.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/IsBigEndian.hpp" #include "util/IsBigEndian.hpp"
#include "util/PostToThread.hpp" #include "util/PostToThread.hpp"
@ -47,7 +47,7 @@ void Application::construct()
this->settings = getSettings(); this->settings = getSettings();
this->paths = Paths::getInstance(); this->paths = Paths::getInstance();
this->themes = new Themes; this->themes = new Theme;
this->windows = new WindowManager; this->windows = new WindowManager;
this->logging = new Logging; this->logging = new Logging;
this->commands = new CommandController; this->commands = new CommandController;

View file

@ -16,7 +16,7 @@ class TaggedUsersController;
class AccountController; class AccountController;
class ModerationActions; class ModerationActions;
class Themes; class Theme;
class WindowManager; class WindowManager;
class Logging; class Logging;
class Paths; class Paths;
@ -45,7 +45,7 @@ public:
friend void test(); friend void test();
Paths *paths = nullptr; Paths *paths = nullptr;
Themes *themes = nullptr; Theme *themes = nullptr;
WindowManager *windows = nullptr; WindowManager *windows = nullptr;
Logging *logging = nullptr; Logging *logging = nullptr;
CommandController *commands = nullptr; CommandController *commands = nullptr;

View file

@ -3,7 +3,7 @@
#include "common/LinkParser.hpp" #include "common/LinkParser.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include <QDateTime> #include <QDateTime>

View file

@ -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) { switch (this->type) {
case Type::Custom: case Type::Custom:

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include <QColor> #include <QColor>
@ -12,7 +12,7 @@ struct MessageColor {
MessageColor(const QColor &color); MessageColor(const QColor &color);
MessageColor(Type type = Text); MessageColor(Type type = Text);
const QColor &getColor(Themes &themeManager) const; const QColor &getColor(Theme &themeManager) const;
private: private:
Type type; Type type;

View file

@ -9,7 +9,7 @@
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/IrcHelpers.hpp" #include "util/IrcHelpers.hpp"

View file

@ -1,6 +1,6 @@
#define LOOKUP_COLOR_COUNT 360 #define LOOKUP_COLOR_COUNT 360
#include "Themes.hpp" #include "Theme.hpp"
#include <QColor> #include <QColor>
@ -27,7 +27,7 @@ double getMultiplierByTheme(const QString &themeName)
} // namespace detail } // namespace detail
Themes::Themes() Theme::Theme()
: themeName("/appearance/theme/name", "Dark") : themeName("/appearance/theme/name", "Dark")
, themeHue("/appearance/theme/hue", 0.0) , themeHue("/appearance/theme/hue", 0.0)
{ {
@ -37,14 +37,14 @@ Themes::Themes()
this->themeHue.connectSimple([this](auto) { this->update(); }, false); this->themeHue.connectSimple([this](auto) { this->update(); }, false);
} }
void Themes::update() void Theme::update()
{ {
this->actuallyUpdate(this->themeHue, detail::getMultiplierByTheme(this->themeName.getValue())); this->actuallyUpdate(this->themeHue, detail::getMultiplierByTheme(this->themeName.getValue()));
} }
// hue: theme color (0 - 1) // hue: theme color (0 - 1)
// multiplier: 1 = white, 0.8 = light, -0.8 dark, -1 black // 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; isLight = multiplier > 0;
bool lightWin = isLight; bool lightWin = isLight;
@ -217,7 +217,7 @@ void Themes::actuallyUpdate(double hue, double multiplier)
this->updated.invoke(); 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 r = int(color1.red() * (1 - ratio) + color2.red() * ratio);
int g = int(color1.green() * (1 - ratio) + color2.green() * 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); return QColor(r, g, b, 255);
} }
void Themes::normalizeColor(QColor &color) void Theme::normalizeColor(QColor &color)
{ {
if (this->isLight) { if (this->isLight) {
if (color.lightnessF() > 0.5) { if (color.lightnessF() > 0.5) {

View file

@ -10,12 +10,12 @@ namespace chatterino {
class WindowManager; class WindowManager;
class Themes class Theme
{ {
public: public:
Themes(); Theme();
~Themes() = delete; ~Theme() = delete;
inline bool isLightTheme() const inline bool isLightTheme() const
{ {

View file

@ -6,7 +6,7 @@
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/Fonts.hpp" #include "singletons/Fonts.hpp"
#include "singletons/Paths.hpp" #include "singletons/Paths.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "util/Clamp.hpp" #include "util/Clamp.hpp"
#include "widgets/AccountSwitchPopupWidget.hpp" #include "widgets/AccountSwitchPopupWidget.hpp"
#include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/dialogs/SettingsDialog.hpp"

View file

@ -3,7 +3,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "widgets/BaseWindow.hpp" #include "widgets/BaseWindow.hpp"
#include <QChildEvent> #include <QChildEvent>

View file

@ -6,7 +6,7 @@
namespace chatterino { namespace chatterino {
class Themes; class Theme;
class BaseWindow; class BaseWindow;
class BaseWidget : public QWidget class BaseWidget : public QWidget
@ -41,7 +41,7 @@ protected:
void setScale(float value); void setScale(float value);
Themes *themeManager; Theme *themeManager;
private: private:
void init(); void init();

View file

@ -2,7 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "widgets/Window.hpp" #include "widgets/Window.hpp"
#include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/dialogs/SettingsDialog.hpp"

View file

@ -1,7 +1,7 @@
#include "widgets/Scrollbar.hpp" #include "widgets/Scrollbar.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "widgets/helper/ChannelView.hpp" #include "widgets/helper/ChannelView.hpp"
#include <QDebug> #include <QDebug>

View file

@ -2,7 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "singletons/Fonts.hpp" #include "singletons/Fonts.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include <QDebug> #include <QDebug>
#include <QDesktopWidget> #include <QDesktopWidget>

View file

@ -5,7 +5,7 @@
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "widgets/AccountSwitchPopupWidget.hpp" #include "widgets/AccountSwitchPopupWidget.hpp"
#include "widgets/Notebook.hpp" #include "widgets/Notebook.hpp"

View file

@ -13,7 +13,7 @@
namespace chatterino { namespace chatterino {
class Themes; class Theme;
class Window : public BaseWindow class Window : public BaseWindow
{ {

View file

@ -8,7 +8,7 @@
#include "messages/layouts/MessageLayout.hpp" #include "messages/layouts/MessageLayout.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/DistanceBetweenPoints.hpp" #include "util/DistanceBetweenPoints.hpp"
#include "widgets/TooltipWidget.hpp" #include "widgets/TooltipWidget.hpp"

View file

@ -1,6 +1,6 @@
#include "widgets/helper/DropPreview.hpp" #include "widgets/helper/DropPreview.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include <QDebug> #include <QDebug>
#include <QPainter> #include <QPainter>

View file

@ -1,5 +1,5 @@
#include "widgets/helper/NotebookButton.hpp" #include "widgets/helper/NotebookButton.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "widgets/Notebook.hpp" #include "widgets/Notebook.hpp"
#include "widgets/helper/RippleEffectButton.hpp" #include "widgets/helper/RippleEffectButton.hpp"
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"

View file

@ -4,7 +4,7 @@
#include "common/Common.hpp" #include "common/Common.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "util/Clamp.hpp" #include "util/Clamp.hpp"
#include "util/Helpers.hpp" #include "util/Helpers.hpp"
#include "widgets/Notebook.hpp" #include "widgets/Notebook.hpp"
@ -221,8 +221,8 @@ void NotebookTab::paintEvent(QPaintEvent *)
// int fullHeight = (int)(scale * 48); // int fullHeight = (int)(scale * 48);
// select the right tab colors // select the right tab colors
Themes::TabColors colors; Theme::TabColors colors;
Themes::TabColors regular = this->themeManager->tabs.regular; Theme::TabColors regular = this->themeManager->tabs.regular;
if (this->selected_) { if (this->selected_) {
colors = this->themeManager->tabs.selected; colors = this->themeManager->tabs.selected;

View file

@ -3,7 +3,7 @@
#include <QDebug> #include <QDebug>
#include <QPainter> #include <QPainter>
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,5 +1,5 @@
#include "widgets/helper/RippleEffectLabel.hpp" #include "widgets/helper/RippleEffectLabel.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "widgets/splits/SplitHeader.hpp" #include "widgets/splits/SplitHeader.hpp"
#include <QBrush> #include <QBrush>

View file

@ -1,5 +1,5 @@
#include "widgets/helper/ScrollbarHighlight.hpp" #include "widgets/helper/ScrollbarHighlight.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "widgets/Scrollbar.hpp" #include "widgets/Scrollbar.hpp"
namespace chatterino { namespace chatterino {

View file

@ -1,6 +1,6 @@
#include "TitlebarButton.hpp" #include "TitlebarButton.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
namespace chatterino { namespace chatterino {

View file

@ -8,7 +8,7 @@
#include "providers/twitch/TwitchMessageBuilder.hpp" #include "providers/twitch/TwitchMessageBuilder.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/StreamLink.hpp" #include "util/StreamLink.hpp"
#include "widgets/Window.hpp" #include "widgets/Window.hpp"

View file

@ -2,7 +2,7 @@
#include "Application.hpp" #include "Application.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "debug/AssertInGuiThread.hpp" #include "debug/AssertInGuiThread.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/Helpers.hpp" #include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"

View file

@ -5,7 +5,7 @@
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "widgets/Label.hpp" #include "widgets/Label.hpp"
#include "widgets/TooltipWidget.hpp" #include "widgets/TooltipWidget.hpp"

View file

@ -6,7 +6,7 @@
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Theme.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "widgets/Notebook.hpp" #include "widgets/Notebook.hpp"
#include "widgets/splits/Split.hpp" #include "widgets/splits/Split.hpp"