diff --git a/src/messages/messagecolor.cpp b/src/messages/messagecolor.cpp
index b3889c95b..20fb96fd8 100644
--- a/src/messages/messagecolor.cpp
+++ b/src/messages/messagecolor.cpp
@@ -25,11 +25,11 @@ const QColor &MessageColor::getColor(singletons::ThemeManager &themeManager) con
case Type::Custom:
return this->color;
case Type::Text:
- return themeManager.Text;
+ return themeManager.messages.textColors.regular;
case Type::System:
- return themeManager.SystemMessageColor;
+ return themeManager.messages.textColors.system;
case Type::Link:
- return themeManager.TextLink;
+ return themeManager.messages.textColors.link;
}
static QColor _default;
diff --git a/src/singletons/ircmanager.cpp b/src/singletons/ircmanager.cpp
index db09e55ae..e25cb3c76 100644
--- a/src/singletons/ircmanager.cpp
+++ b/src/singletons/ircmanager.cpp
@@ -291,7 +291,7 @@ void IrcManager::writeConnectionMessageReceived(Communi::IrcMessage *message)
}
// XXX: This does not fit in IrcManager
-bool IrcManager::isTwitchBlockedUser(QString const &username)
+bool IrcManager::isTwitchUserBlocked(QString const &username)
{
QMutexLocker locker(&this->twitchBlockedUsersMutex);
diff --git a/src/singletons/thememanager.cpp b/src/singletons/thememanager.cpp
index 3919014aa..f11c56792 100644
--- a/src/singletons/thememanager.cpp
+++ b/src/singletons/thememanager.cpp
@@ -57,70 +57,85 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier)
qreal sat = 0.05;
- SystemMessageColor = QColor(140, 127, 127);
-
auto getColor = [multiplier](double h, double s, double l, double a = 1.0) {
return QColor::fromHslF(h, s, ((l - 0.5) * multiplier) + 0.5, a);
};
- DropPreviewBackground = getColor(hue, 0.5, 0.5, 0.6);
+ // Ubuntu style
+ // TODO: add setting for this
+ // TabText = QColor(210, 210, 210);
+ // TabBackground = QColor(61, 60, 56);
+ // TabHoverText = QColor(210, 210, 210);
+ // TabHoverBackground = QColor(73, 72, 68);
- Text = TextCaret = lightTheme ? QColor(0, 0, 0) : QColor(255, 255, 255);
- TextLink = lightTheme ? QColor(66, 134, 244) : QColor(66, 134, 244);
+ // message (referenced later)
+ this->messages.textColors.caret = //
+ this->messages.textColors.regular = lightTheme ? QColor(0, 0, 0) : QColor(255, 255, 255);
- // tab
- if (true) {
- TabText = QColor(0, 0, 0);
- TabBackground = QColor(255, 255, 255);
+ // tabs
+ // text, {regular, hover, unfocused}
+ this->tabs.regular = {QColor(0, 0, 0),
+ {QColor(255, 255, 255), QColor(200, 200, 200), QColor(255, 255, 255)}};
- TabHoverText = QColor(0, 0, 0);
- TabHoverBackground = QColor::fromHslF(hue, 0, 0.95);
- } else {
- // Ubuntu style
- // TODO: add setting for this
- TabText = QColor(210, 210, 210);
- TabBackground = QColor(61, 60, 56);
+ this->tabs.selected = {QColor(255, 255, 255),
+ {QColor::fromHslF(hue, 0.5, 0.5), QColor::fromHslF(hue, 0.5, 0.5),
+ QColor::fromHslF(hue, 0, 0.5)}};
- TabHoverText = QColor(210, 210, 210);
- TabHoverBackground = QColor(73, 72, 68);
- }
+ this->tabs.newMessage = {QColor(0, 0, 0),
+ {QBrush(QColor::fromHslF(hue, 0.5, 0.8), Qt::DiagCrossPattern),
+ QBrush(QColor::fromHslF(hue, 0.5, 0.7), Qt::DiagCrossPattern),
+ QBrush(QColor::fromHslF(hue, 0, 0.8), Qt::DiagCrossPattern)}};
- TabSelectedText = QColor(255, 255, 255);
- TabSelectedBackground = QColor::fromHslF(hue, 0.5, 0.5);
+ this->tabs.highlighted = {QColor(0, 0, 0),
+ {QColor::fromHslF(hue, 0.5, 0.8), QColor::fromHslF(hue, 0.5, 0.7),
+ QColor::fromHslF(hue, 0, 0.8)}};
- TabSelectedUnfocusedText = QColor(255, 255, 255);
- TabSelectedUnfocusedBackground = QColor::fromHslF(hue, 0, 0.5);
-
- TabHighlightedText = QColor(0, 0, 0);
- TabHighlightedBackground = QColor::fromHslF(hue, 0.5, 0.8);
-
- TabNewMessageBackground = QBrush(QColor::fromHslF(hue, 0.5, 0.8), Qt::DiagCrossPattern);
-
- // Chat
+ // Split
bool flat = lightTheme;
- ChatBackground = getColor(0, sat, 1);
- DisabledMessageOverlay = getColor(0, sat, 1, 0.6);
- ChatBackgroundHighlighted = blendColors(TabSelectedBackground, ChatBackground, 0.8);
- ChatHeaderBackground = getColor(0, sat, flat ? 1 : 0.9);
- ChatHeaderBorder = getColor(0, sat, flat ? 1 : 0.85);
- ChatInputBackground = getColor(0, sat, flat ? 0.95 : 0.95);
- ChatInputBorder = getColor(0, sat, flat ? 1 : 1);
- ChatSeperator = lightTheme ? QColor(127, 127, 127) : QColor(80, 80, 80);
+ this->splits.messageSeperator = lightTheme ? QColor(127, 127, 127) : QColor(80, 80, 80);
+ this->splits.background = getColor(0, sat, 1);
+ this->splits.dropPreview = getColor(hue, 0.5, 0.5, 0.6);
+ // this->splits.border
+ // this->splits.borderFocused
+
+ this->splits.header.background = getColor(0, sat, flat ? 1 : 0.9);
+ this->splits.header.border = getColor(0, sat, flat ? 1 : 0.85);
+ this->splits.header.text = this->messages.textColors.regular;
+
+ this->splits.input.background = getColor(0, sat, flat ? 0.95 : 0.95);
+ this->splits.input.border = getColor(0, sat, flat ? 1 : 1);
+ this->splits.input.text = this->messages.textColors.regular;
+ this->splits.input.styleSheet =
+ "background:" + this->splits.input.background.name() + ";" +
+ "border:" + this->tabs.selected.backgrounds.regular.color().name() + ";" +
+ "color:" + this->messages.textColors.regular.name() + ";" +
+ "selection-background-color:" + this->tabs.selected.backgrounds.regular.color().name();
+
+ // Message
+ this->messages.textColors.link = lightTheme ? QColor(66, 134, 244) : QColor(66, 134, 244);
+ this->messages.textColors.system = QColor(140, 127, 127);
+
+ this->messages.backgrounds.regular = splits.background;
+ this->messages.backgrounds.highlighted = blendColors(
+ this->tabs.selected.backgrounds.regular.color(), this->messages.backgrounds.regular, 0.8);
+ // this->messages.backgrounds.resub
+ // this->messages.backgrounds.whisper
+ this->messages.disabled = getColor(0, sat, 1, 0.6);
+ // this->messages.seperator =
+ // this->messages.seperatorInner =
// Scrollbar
- ScrollbarBG = getColor(0, sat, 0.94);
- ScrollbarThumb = getColor(0, sat, 0.80);
- ScrollbarThumbSelected = getColor(0, sat, 0.7);
- ScrollbarArrow = getColor(0, sat, 0.9);
+ this->scrollbars.background = getColor(0, sat, 0.94);
+ this->scrollbars.thumb = getColor(0, sat, 0.80);
+ this->scrollbars.thumbSelected = getColor(0, sat, 0.7);
- // stylesheet
- InputStyleSheet = "background:" + ChatInputBackground.name() + ";" +
- "border:" + TabSelectedBackground.name() + ";" + "color:" + Text.name() +
- ";" + "selection-background-color:" + TabSelectedBackground.name();
+ // tooltip
+ this->tooltip.background = QColor(0, 0, 0);
+ this->tooltip.text = QColor(255, 255, 255);
// Selection
- Selection = isLightTheme() ? QColor(0, 0, 0, 64) : QColor(255, 255, 255, 64);
+ this->messages.selection = isLightTheme() ? QColor(0, 0, 0, 64) : QColor(255, 255, 255, 64);
this->updated();
}
diff --git a/src/singletons/thememanager.hpp b/src/singletons/thememanager.hpp
index fa57e84be..12da082af 100644
--- a/src/singletons/thememanager.hpp
+++ b/src/singletons/thememanager.hpp
@@ -22,65 +22,79 @@ public:
return this->lightTheme;
}
- QString InputStyleSheet;
+ struct TabColors {
+ QColor text;
+ struct Backgrounds {
+ QBrush regular;
+ QBrush hover;
+ QBrush unfocused;
+ } backgrounds;
+ };
- QColor SystemMessageColor;
+ struct Tabs {
+ TabColors regular;
+ TabColors selected;
+ TabColors highlighted;
+ TabColors newMessage;
+ } tabs;
- QColor DropPreviewBackground;
+ struct Splits {
+ QColor messageSeperator;
+ QColor background;
+ QColor border;
+ QColor borderFocused;
+ QColor dropPreview;
- QColor TooltipBackground;
- QColor TooltipText;
+ struct Header {
+ QColor border;
+ QColor background;
+ QColor text;
+ // int margin;
+ } header;
- QColor ChatSeperator;
- QColor ChatBackground;
- QColor ChatBackgroundHighlighted;
- QColor ChatBackgroundResub;
- QColor ChatBackgroundWhisper;
- QColor DisabledMessageOverlay;
+ struct Input {
+ QColor border;
+ QColor background;
+ QColor selection;
+ QColor text;
+ QString styleSheet;
+ // int margin;
+ } input;
+ } splits;
- QColor ChatHeaderBorder;
- QColor ChatHeaderBackground;
+ struct Messages {
+ struct TextColors {
+ QColor regular;
+ QColor caret;
+ QColor link;
+ QColor system;
+ } textColors;
- QColor ChatInputBackground;
- QColor ChatInputBorder;
+ struct Backgrounds {
+ QColor regular;
+ QColor highlighted;
+ // QColor resub;
+ // QColor whisper;
+ } backgrounds;
- QColor ChatMessageSeperatorBorder;
- QColor ChatMessageSeperatorBorderInner;
- QColor ChatBorder;
- QColor ChatBorderFocused;
- QColor Text;
- QColor TextCaret;
- QColor TextLink;
- QColor TextFocused;
- QColor Menu;
- QColor MenuBorder;
+ QColor disabled;
+ // QColor seperator;
+ // QColor seperatorInner;
+ QColor selection;
+ } messages;
- QColor ScrollbarBG;
- QColor ScrollbarThumb;
- QColor ScrollbarThumbSelected;
- QColor ScrollbarArrow;
+ struct Scrollbars {
+ QColor background;
+ QColor thumb;
+ QColor thumbSelected;
+ // const int highlightsCount = 3;
+ // QColor highlights[3];
+ } scrollbars;
- QColor TabText;
- QColor TabBackground;
-
- QColor TabHoverText;
- QColor TabHoverBackground;
-
- QColor TabSelectedText;
- QColor TabSelectedBackground;
-
- QColor TabHighlightedText;
- QColor TabHighlightedBackground;
-
- QColor TabSelectedUnfocusedText;
- QColor TabSelectedUnfocusedBackground;
-
- QBrush TabNewMessageBackground;
-
- QColor Selection;
-
- const int HighlightColorCount = 3;
- QColor HighlightColors[3];
+ struct Tooltip {
+ QColor text;
+ QColor background;
+ } tooltip;
void normalizeColor(QColor &color);
diff --git a/src/twitch/twitchmessagebuilder.cpp b/src/twitch/twitchmessagebuilder.cpp
index d90542845..21da5a8f5 100644
--- a/src/twitch/twitchmessagebuilder.cpp
+++ b/src/twitch/twitchmessagebuilder.cpp
@@ -25,7 +25,7 @@ TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel,
, ircMessage(_ircMessage)
, args(_args)
, tags(this->ircMessage->tags())
- , usernameColor(singletons::ThemeManager::getInstance().SystemMessageColor)
+ , usernameColor(singletons::ThemeManager::getInstance().messages.textColors.system)
{
}
diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp
index 29755d35c..db68a19cc 100644
--- a/src/widgets/helper/channelview.cpp
+++ b/src/widgets/helper/channelview.cpp
@@ -483,7 +483,7 @@ void ChannelView::paintEvent(QPaintEvent * /*event*/)
// update all messages
this->gifEmotes.clear();
- painter.fillRect(rect(), this->themeManager.ChatBackground);
+ painter.fillRect(rect(), this->themeManager.splits.background);
// draw messages
this->drawMessages(painter, false);
@@ -524,7 +524,7 @@ void ChannelView::drawMessages(QPainter &painter, bool overlays)
if (overlays) {
if (messageRef->isDisabled()) {
painter.fillRect(0, y, this->width(), messageRef->getHeight(),
- this->themeManager.DisabledMessageOverlay);
+ this->themeManager.messages.disabled);
}
} else {
std::shared_ptr buffer = messageRef->buffer;
@@ -624,8 +624,8 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
//} else {
painter.fillRect(buffer->rect(),
(messageRef->getMessage()->containsHighlightedPhrase())
- ? this->themeManager.ChatBackgroundHighlighted
- : this->themeManager.ChatBackground);
+ ? this->themeManager.messages.backgrounds.highlighted
+ : this->themeManager.messages.backgrounds.regular);
//}
// draw selection
@@ -672,7 +672,7 @@ void ChannelView::drawMessageSelection(QPainter &painter, messages::MessageRef *
return;
}
- QColor selectionColor = this->themeManager.Selection;
+ QColor selectionColor = this->themeManager.messages.selection;
int charIndex = 0;
size_t i = 0;
diff --git a/src/widgets/helper/droppreview.cpp b/src/widgets/helper/droppreview.cpp
index cc38de915..43e1d3ade 100644
--- a/src/widgets/helper/droppreview.cpp
+++ b/src/widgets/helper/droppreview.cpp
@@ -20,7 +20,7 @@ void NotebookPageDropPreview::paintEvent(QPaintEvent *)
QPainter painter(this);
painter.fillRect(8, 8, this->width() - 17, this->height() - 17,
- this->themeManager.DropPreviewBackground);
+ this->themeManager.splits.dropPreview);
}
void NotebookPageDropPreview::hideEvent(QHideEvent *)
diff --git a/src/widgets/helper/notebookbutton.cpp b/src/widgets/helper/notebookbutton.cpp
index 1f6de41ad..3f567f3ff 100644
--- a/src/widgets/helper/notebookbutton.cpp
+++ b/src/widgets/helper/notebookbutton.cpp
@@ -23,16 +23,11 @@ void NotebookButton::paintEvent(QPaintEvent *)
QColor background;
QColor foreground;
- background = this->themeManager.TabBackground;
-
- if (mouseDown) {
- // background = this->themeManager.TabSelectedBackground;
- foreground = this->themeManager.TabHoverText;
- } else if (mouseOver) {
- // background = this->themeManager.TabHoverText;
- foreground = this->themeManager.TabHoverText;
+ if (mouseDown || mouseOver) {
+ background = this->themeManager.tabs.regular.backgrounds.regular.color();
+ foreground = this->themeManager.tabs.regular.text;
} else {
- // background = this->themeManager.TabPanelBackground;
+ background = this->themeManager.tabs.regular.backgrounds.regular.color();
foreground = QColor(70, 80, 80);
}
diff --git a/src/widgets/helper/notebooktab.cpp b/src/widgets/helper/notebooktab.cpp
index f3bd631ab..213faa46a 100644
--- a/src/widgets/helper/notebooktab.cpp
+++ b/src/widgets/helper/notebooktab.cpp
@@ -1,10 +1,11 @@
#include "widgets/helper/notebooktab.hpp"
-#include "singletons/thememanager.hpp"
#include "common.hpp"
#include "debug/log.hpp"
#include "singletons/settingsmanager.hpp"
+#include "singletons/thememanager.hpp"
#include "util/helpers.hpp"
#include "widgets/notebook.hpp"
+#include "widgets/settingsdialog.hpp"
#include "widgets/textinputdialog.hpp"
#include
@@ -161,41 +162,44 @@ void NotebookTab::moveAnimated(QPoint pos, bool animated)
void NotebookTab::paintEvent(QPaintEvent *)
{
+ singletons::SettingManager &settingManager = singletons::SettingManager::getInstance();
QPainter painter(this);
- QColor fg = QColor(0, 0, 0);
+ // select the right tab colors
+ singletons::ThemeManager::TabColors colors;
if (this->selected) {
- if (this->window() == QApplication::activeWindow()) {
- painter.fillRect(rect(), this->themeManager.TabSelectedBackground);
- fg = this->themeManager.TabSelectedText;
- } else {
- painter.fillRect(rect(), this->themeManager.TabSelectedUnfocusedBackground);
- fg = this->themeManager.TabSelectedUnfocusedText;
- }
- } else if (this->mouseOver) {
- painter.fillRect(rect(), this->themeManager.TabHoverBackground);
- fg = this->themeManager.TabHoverText;
+ colors = this->themeManager.tabs.selected;
} else if (this->highlightState == HighlightState::Highlighted) {
- painter.fillRect(rect(), this->themeManager.TabHighlightedBackground);
- fg = this->themeManager.TabHighlightedText;
+ colors = this->themeManager.tabs.highlighted;
} else if (this->highlightState == HighlightState::NewMessage) {
- painter.fillRect(rect(), this->themeManager.TabNewMessageBackground);
- fg = this->themeManager.TabHighlightedText;
+ colors = this->themeManager.tabs.newMessage;
} else {
- painter.fillRect(rect(), this->themeManager.TabBackground);
- fg = this->themeManager.TabText;
+ colors = this->themeManager.tabs.regular;
}
- painter.setPen(fg);
+ bool windowFocused = this->window() == QApplication::activeWindow();
+ // || SettingsDialog::getHandle() == QApplication::activeWindow();
+ // fill the tab background
+ painter.fillRect(rect(),
+ windowFocused
+ ? (this->mouseOver ? colors.backgrounds.hover : colors.backgrounds.regular)
+ : colors.backgrounds.unfocused);
+
+ // set the pen color
+ painter.setPen(colors.text);
+
+ // set area for text
float scale = this->getDpiMultiplier();
- int rectW = (singletons::SettingManager::getInstance().hideTabX ? 0 : static_cast(16) * scale);
+ int rectW = (settingManager.hideTabX ? 0 : static_cast(16) * scale);
QRect rect(0, 0, this->width() - rectW, this->height());
+ // draw text
painter.drawText(rect, this->getTitle(), QTextOption(Qt::AlignCenter));
- if (!singletons::SettingManager::getInstance().hideTabX && (mouseOver || selected)) {
+ // draw close x
+ if (!settingManager.hideTabX && (mouseOver || selected)) {
QRect xRect = this->getXRect();
if (mouseOverX) {
painter.fillRect(xRect, QColor(0, 0, 0, 64));
diff --git a/src/widgets/helper/scrollbarhighlight.cpp b/src/widgets/helper/scrollbarhighlight.cpp
index 93f34c422..fa00987d3 100644
--- a/src/widgets/helper/scrollbarhighlight.cpp
+++ b/src/widgets/helper/scrollbarhighlight.cpp
@@ -9,7 +9,8 @@ ScrollBarHighlight::ScrollBarHighlight(double _position, int _colorIndex, Scroll
Style _style, QString _tag)
: themeManager(parent->themeManager)
, position(_position)
- , colorIndex(std::max(0, std::min(this->themeManager.HighlightColorCount, _colorIndex)))
+ // , colorIndex(std::max(0, std::min(this->themeManager.HighlightColorCount, _colorIndex)))
+ , colorIndex(0)
, style(_style)
, tag(_tag)
{
diff --git a/src/widgets/helper/splitheader.cpp b/src/widgets/helper/splitheader.cpp
index 646455f2c..3439fadda 100644
--- a/src/widgets/helper/splitheader.cpp
+++ b/src/widgets/helper/splitheader.cpp
@@ -119,9 +119,8 @@ void SplitHeader::updateChannelText()
"
"
"Live for " +
twitchChannel->streamUptime + " with " +
- twitchChannel->streamViewerCount +
- " viewers"
- "
";
+ twitchChannel->streamViewerCount + " viewers"
+ "";
this->channelNameLabel.setText(QString::fromStdString(channelName) + " (live)");
} else {
this->isLive = false;
@@ -135,8 +134,8 @@ void SplitHeader::paintEvent(QPaintEvent *)
{
QPainter painter(this);
- painter.fillRect(rect(), this->themeManager.ChatHeaderBackground);
- painter.setPen(this->themeManager.ChatHeaderBorder);
+ painter.fillRect(rect(), this->themeManager.splits.header.background);
+ painter.setPen(this->themeManager.splits.header.border);
painter.drawRect(0, 0, width() - 1, height() - 1);
}
@@ -217,7 +216,7 @@ void SplitHeader::rightButtonClicked()
void SplitHeader::refreshTheme()
{
QPalette palette;
- palette.setColor(QPalette::Foreground, this->themeManager.Text);
+ palette.setColor(QPalette::Foreground, this->themeManager.splits.header.text);
this->leftLabel.setPalette(palette);
this->channelNameLabel.setPalette(palette);
diff --git a/src/widgets/helper/splitinput.cpp b/src/widgets/helper/splitinput.cpp
index 5aa16baf2..4ec8e6274 100644
--- a/src/widgets/helper/splitinput.cpp
+++ b/src/widgets/helper/splitinput.cpp
@@ -210,11 +210,11 @@ void SplitInput::refreshTheme()
{
QPalette palette;
- palette.setColor(QPalette::Foreground, this->themeManager.Text);
+ palette.setColor(QPalette::Foreground, this->themeManager.splits.input.text);
this->textLengthLabel.setPalette(palette);
- this->textInput.setStyleSheet(this->themeManager.InputStyleSheet);
+ this->textInput.setStyleSheet(this->themeManager.splits.input.styleSheet);
this->hbox.setMargin((this->themeManager.isLightTheme() ? 4 : 2) * this->getDpiMultiplier());
}
@@ -244,9 +244,9 @@ void SplitInput::paintEvent(QPaintEvent *)
{
QPainter painter(this);
- painter.fillRect(this->rect(), this->themeManager.ChatInputBackground);
+ painter.fillRect(this->rect(), this->themeManager.splits.input.background);
- QPen pen(this->themeManager.ChatInputBorder);
+ QPen pen(this->themeManager.splits.input.border);
if (this->themeManager.isLightTheme()) {
pen.setWidth((int)(6 * this->getDpiMultiplier()));
}
diff --git a/src/widgets/scrollbar.cpp b/src/widgets/scrollbar.cpp
index d1608d41b..f34d06153 100644
--- a/src/widgets/scrollbar.cpp
+++ b/src/widgets/scrollbar.cpp
@@ -236,20 +236,21 @@ void ScrollBar::paintEvent(QPaintEvent *)
QPainter painter(this);
// painter.fillRect(rect(), this->themeManager.ScrollbarBG);
- painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight),
- this->themeManager.ScrollbarArrow);
- painter.fillRect(QRect(xOffset, height() - this->buttonHeight, width(), this->buttonHeight),
- this->themeManager.ScrollbarArrow);
+ // painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight),
+ // this->themeManager.ScrollbarArrow);
+ // painter.fillRect(QRect(xOffset, height() - this->buttonHeight, width(),
+ // this->buttonHeight),
+ // this->themeManager.ScrollbarArrow);
this->thumbRect.setX(xOffset);
// mouse over thumb
if (this->mouseDownIndex == 2) {
- painter.fillRect(this->thumbRect, this->themeManager.ScrollbarThumbSelected);
+ painter.fillRect(this->thumbRect, this->themeManager.scrollbars.thumbSelected);
}
// mouse not over thumb
else {
- painter.fillRect(this->thumbRect, this->themeManager.ScrollbarThumb);
+ painter.fillRect(this->thumbRect, this->themeManager.scrollbars.thumb);
}
// ScrollBarHighlight *highlight = highlights;
diff --git a/src/widgets/settingsdialog.cpp b/src/widgets/settingsdialog.cpp
index 81b47fa23..2b6dd8ec3 100644
--- a/src/widgets/settingsdialog.cpp
+++ b/src/widgets/settingsdialog.cpp
@@ -1,12 +1,12 @@
#include "widgets/settingsdialog.hpp"
-#include "singletons/accountmanager.hpp"
#include "const.hpp"
#include "debug/log.hpp"
+#include "singletons/accountmanager.hpp"
+#include "singletons/windowmanager.hpp"
#include "twitch/twitchmessagebuilder.hpp"
#include "twitch/twitchuser.hpp"
#include "widgets/helper/settingsdialogtab.hpp"
#include "widgets/logindialog.hpp"
-#include "singletons/windowmanager.hpp"
#include
#include
@@ -25,6 +25,8 @@
namespace chatterino {
namespace widgets {
+SettingsDialog *SettingsDialog::handle = nullptr;
+
SettingsDialog::SettingsDialog()
: BaseWidget()
, usernameDisplayMode(
@@ -71,6 +73,11 @@ SettingsDialog::SettingsDialog()
this->dpiMultiplierChanged(this->getDpiMultiplier(), this->getDpiMultiplier());
}
+SettingsDialog *SettingsDialog::getHandle()
+{
+ return SettingsDialog::handle;
+}
+
void SettingsDialog::addTabs()
{
this->addTab(this->createAccountsTab(), "Accounts", ":/images/Message_16xLG.png");
diff --git a/src/widgets/settingsdialog.hpp b/src/widgets/settingsdialog.hpp
index 2783e5705..2c1654798 100644
--- a/src/widgets/settingsdialog.hpp
+++ b/src/widgets/settingsdialog.hpp
@@ -33,6 +33,8 @@ class SettingsDialog : public BaseWidget
friend class SettingsDialogTab;
public:
+ static SettingsDialog *getHandle(); // may be NULL
+
enum class PreferredTab {
NoPreference,
Accounts,
@@ -45,6 +47,7 @@ protected:
private:
void refresh();
+ static SettingsDialog *handle;
std::vector tabs;
diff --git a/src/widgets/split.cpp b/src/widgets/split.cpp
index a5b8e78d5..1a3b94d84 100644
--- a/src/widgets/split.cpp
+++ b/src/widgets/split.cpp
@@ -108,13 +108,14 @@ Split::Split(SplitContainer *parent, const std::string &_uuid)
}
});
- singletons::SettingManager::getInstance().hideEmptyInput.connect([this](const bool &hideEmptyInput, auto) {
- if (hideEmptyInput && this->input.getInputText().length() == 0) {
- this->input.hide();
- } else {
- this->input.show();
- }
- });
+ singletons::SettingManager::getInstance().hideEmptyInput.connect(
+ [this](const bool &hideEmptyInput, auto) {
+ if (hideEmptyInput && this->input.getInputText().length() == 0) {
+ this->input.hide();
+ } else {
+ this->input.show();
+ }
+ });
}
Split::~Split()
@@ -236,7 +237,7 @@ void Split::paintEvent(QPaintEvent *)
// color the background of the chat
QPainter painter(this);
- painter.fillRect(this->rect(), this->themeManager.ChatBackground);
+ painter.fillRect(this->rect(), this->themeManager.splits.background);
}
/// Slots
@@ -395,7 +396,7 @@ void Split::doOpenViewerList()
QList labelList;
for (auto &x : labels) {
auto label = new QListWidgetItem(x);
- label->setBackgroundColor(this->themeManager.ChatHeaderBackground);
+ label->setBackgroundColor(this->themeManager.splits.header.background);
labelList.append(label);
}
auto loadingLabel = new QLabel("Loading...");
@@ -452,7 +453,7 @@ void Split::doOpenViewerList()
dockVbox->addWidget(resultList);
resultList->hide();
- multiWidget->setStyleSheet(this->themeManager.InputStyleSheet);
+ multiWidget->setStyleSheet(this->themeManager.splits.input.styleSheet);
multiWidget->setLayout(dockVbox);
viewerDock->setWidget(multiWidget);
viewerDock->show();
diff --git a/src/widgets/splitcontainer.cpp b/src/widgets/splitcontainer.cpp
index ece607e37..cfac0b7fd 100644
--- a/src/widgets/splitcontainer.cpp
+++ b/src/widgets/splitcontainer.cpp
@@ -385,17 +385,17 @@ void SplitContainer::paintEvent(QPaintEvent *)
QPainter painter(this);
if (this->ui.hbox.count() == 0) {
- painter.fillRect(rect(), this->themeManager.ChatBackground);
+ painter.fillRect(rect(), this->themeManager.splits.background);
- painter.setPen(this->themeManager.Text);
+ painter.setPen(this->themeManager.splits.header.text);
painter.drawText(rect(), "Add Chat", QTextOption(Qt::AlignCenter));
} else {
- painter.fillRect(rect(), this->themeManager.ChatSeperator);
+ painter.fillRect(rect(), this->themeManager.splits.messageSeperator);
}
- QColor accentColor = (QApplication::activeWindow() == this->window()
- ? this->themeManager.TabSelectedBackground
- : this->themeManager.TabSelectedUnfocusedBackground);
+ QBrush accentColor = (QApplication::activeWindow() == this->window()
+ ? this->themeManager.tabs.selected.backgrounds.regular
+ : this->themeManager.tabs.selected.backgrounds.unfocused);
painter.fillRect(0, 0, width(), 2, accentColor);
}
diff --git a/src/widgets/window.cpp b/src/widgets/window.cpp
index d9bd6e42e..f6d1b73df 100644
--- a/src/widgets/window.cpp
+++ b/src/widgets/window.cpp
@@ -14,7 +14,8 @@
namespace chatterino {
namespace widgets {
-Window::Window(const QString &windowName, singletons::ThemeManager &_themeManager, bool _isMainWindow)
+Window::Window(const QString &windowName, singletons::ThemeManager &_themeManager,
+ bool _isMainWindow)
: BaseWidget(_themeManager, nullptr)
, settingRoot(fS("/windows/{}", windowName))
, windowGeometry(this->settingRoot)
@@ -108,7 +109,8 @@ void Window::closeEvent(QCloseEvent *)
void Window::refreshTheme()
{
QPalette palette;
- palette.setColor(QPalette::Background, this->themeManager.TabBackground);
+ palette.setColor(QPalette::Background,
+ this->themeManager.tabs.regular.backgrounds.regular.color());
this->setPalette(palette);
}