mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
the rewrite that nobody wanted
This commit is contained in:
parent
0ef08378cc
commit
3e5937011a
18 changed files with 217 additions and 175 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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<QPixmap> 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;
|
||||
|
|
|
@ -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 *)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <QApplication>
|
||||
|
@ -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<int>(16) * scale);
|
||||
int rectW = (settingManager.hideTabX ? 0 : static_cast<int>(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));
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -119,9 +119,8 @@ void SplitHeader::updateChannelText()
|
|||
"<br>"
|
||||
"Live for " +
|
||||
twitchChannel->streamUptime + " with " +
|
||||
twitchChannel->streamViewerCount +
|
||||
" viewers"
|
||||
"</p>";
|
||||
twitchChannel->streamViewerCount + " viewers"
|
||||
"</p>";
|
||||
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);
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <QComboBox>
|
||||
#include <QDebug>
|
||||
|
@ -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");
|
||||
|
|
|
@ -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<SettingsDialogTab *> tabs;
|
||||
|
||||
|
|
|
@ -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<QListWidgetItem *> 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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue