the rewrite that nobody wanted
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
+11
-10
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user