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()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user