+2
-1
@@ -93,7 +93,8 @@ SOURCES += \
|
|||||||
src/twitch/twitchuser.cpp \
|
src/twitch/twitchuser.cpp \
|
||||||
src/ircaccount.cpp \
|
src/ircaccount.cpp \
|
||||||
src/widgets/accountpopup.cpp \
|
src/widgets/accountpopup.cpp \
|
||||||
src/messagefactory.cpp
|
src/messagefactory.cpp \
|
||||||
|
src/widgets/basewidget.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/asyncexec.hpp \
|
src/asyncexec.hpp \
|
||||||
|
|||||||
+1
-1
@@ -118,7 +118,7 @@ void ColorScheme::setColors(double hue, double multiplier)
|
|||||||
"border:" + TabSelectedBackground.name() + ";" + "color:" + Text.name() +
|
"border:" + TabSelectedBackground.name() + ";" + "color:" + Text.name() +
|
||||||
";" + "selection-background-color:" + TabSelectedBackground.name();
|
";" + "selection-background-color:" + TabSelectedBackground.name();
|
||||||
|
|
||||||
updated();
|
this->updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorScheme::fillLookupTableValues(double (&array)[360], double from, double to,
|
void ColorScheme::fillLookupTableValues(double (&array)[360], double from, double to,
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public:
|
|||||||
const int HighlightColorCount = 3;
|
const int HighlightColorCount = 3;
|
||||||
QColor HighlightColors[3];
|
QColor HighlightColors[3];
|
||||||
|
|
||||||
void init(WindowManager &windowManager);
|
|
||||||
void normalizeColor(QColor &color);
|
void normalizeColor(QColor &color);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include "widgets/basewidget.hpp"
|
||||||
|
#include "colorscheme.hpp"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <boost/signals2.hpp>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
|
BaseWidget::BaseWidget(ColorScheme &_colorScheme, QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
, colorScheme(_colorScheme)
|
||||||
|
{
|
||||||
|
this->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseWidget::BaseWidget(BaseWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
, colorScheme(parent->colorScheme)
|
||||||
|
{
|
||||||
|
this->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseWidget::init()
|
||||||
|
{
|
||||||
|
this->colorScheme.updated.connect([this]() {
|
||||||
|
this->refreshTheme();
|
||||||
|
|
||||||
|
this->update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseWidget::refreshTheme()
|
||||||
|
{
|
||||||
|
// Do any color scheme updates here
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace widgets
|
||||||
|
} // namespace chatterino
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "colorscheme.hpp"
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -15,19 +13,16 @@ class BaseWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BaseWidget(ColorScheme &_colorScheme, QWidget *parent)
|
explicit BaseWidget(ColorScheme &_colorScheme, QWidget *parent);
|
||||||
: QWidget(parent)
|
|
||||||
, colorScheme(_colorScheme)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit BaseWidget(BaseWidget *parent)
|
explicit BaseWidget(BaseWidget *parent);
|
||||||
: QWidget(parent)
|
|
||||||
, colorScheme(parent->colorScheme)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorScheme &colorScheme;
|
ColorScheme &colorScheme;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init();
|
||||||
|
|
||||||
|
virtual void refreshTheme();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
void giveFocus();
|
void giveFocus();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *) override;
|
virtual void paintEvent(QPaintEvent *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *_chatWidget)
|
|||||||
{
|
{
|
||||||
this->setFixedHeight(32);
|
this->setFixedHeight(32);
|
||||||
|
|
||||||
this->updateColors();
|
this->refreshTheme();
|
||||||
|
|
||||||
this->updateChannelText();
|
this->updateChannelText();
|
||||||
|
|
||||||
this->setLayout(&this->hbox);
|
this->setLayout(&this->hbox);
|
||||||
@@ -67,16 +68,6 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *_chatWidget)
|
|||||||
this->rightLabel.getLabel().setText("ayy");
|
this->rightLabel.getLabel().setText("ayy");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::updateColors()
|
|
||||||
{
|
|
||||||
QPalette palette;
|
|
||||||
palette.setColor(QPalette::Foreground, this->colorScheme.Text);
|
|
||||||
|
|
||||||
this->leftLabel.setPalette(palette);
|
|
||||||
this->channelNameLabel.setPalette(palette);
|
|
||||||
this->rightLabel.setPalette(palette);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatWidgetHeader::updateChannelText()
|
void ChatWidgetHeader::updateChannelText()
|
||||||
{
|
{
|
||||||
const QString &c = this->chatWidget->getChannelName();
|
const QString &c = this->chatWidget->getChannelName();
|
||||||
@@ -151,6 +142,16 @@ void ChatWidgetHeader::rightButtonClicked()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatWidgetHeader::refreshTheme()
|
||||||
|
{
|
||||||
|
QPalette palette;
|
||||||
|
palette.setColor(QPalette::Foreground, this->colorScheme.Text);
|
||||||
|
|
||||||
|
this->leftLabel.setPalette(palette);
|
||||||
|
this->channelNameLabel.setPalette(palette);
|
||||||
|
this->rightLabel.setPalette(palette);
|
||||||
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::menuMoveSplit()
|
void ChatWidgetHeader::menuMoveSplit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ class ChatWidgetHeader : public BaseWidget
|
|||||||
public:
|
public:
|
||||||
explicit ChatWidgetHeader(ChatWidget *_chatWidget);
|
explicit ChatWidgetHeader(ChatWidget *_chatWidget);
|
||||||
|
|
||||||
// Update palette from global color scheme
|
|
||||||
void updateColors();
|
|
||||||
|
|
||||||
// Update channel text from chat widget
|
// Update channel text from chat widget
|
||||||
void updateChannelText();
|
void updateChannelText();
|
||||||
|
|
||||||
@@ -62,6 +59,8 @@ private:
|
|||||||
void leftButtonClicked();
|
void leftButtonClicked();
|
||||||
void rightButtonClicked();
|
void rightButtonClicked();
|
||||||
|
|
||||||
|
virtual void refreshTheme() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void menuMoveSplit();
|
void menuMoveSplit();
|
||||||
void menuReloadChannelEmotes();
|
void menuReloadChannelEmotes();
|
||||||
|
|||||||
@@ -39,8 +39,9 @@ private:
|
|||||||
QLabel textLengthLabel;
|
QLabel textLengthLabel;
|
||||||
ChatWidgetHeaderButton emotesLabel;
|
ChatWidgetHeaderButton emotesLabel;
|
||||||
|
|
||||||
|
virtual void refreshTheme() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void refreshTheme();
|
|
||||||
void setMessageLengthVisisble(bool value)
|
void setMessageLengthVisisble(bool value)
|
||||||
{
|
{
|
||||||
textLengthLabel.setHidden(!value);
|
textLengthLabel.setHidden(!value);
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ protected:
|
|||||||
virtual void paintEvent(QPaintEvent *) override;
|
virtual void paintEvent(QPaintEvent *) override;
|
||||||
virtual void wheelEvent(QWheelEvent *event) override;
|
virtual void wheelEvent(QWheelEvent *event) override;
|
||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
bool tryGetMessageAt(QPoint p, std::shared_ptr<messages::MessageRef> &message,
|
bool tryGetMessageAt(QPoint p, std::shared_ptr<messages::MessageRef> &message,
|
||||||
QPoint &relativePos);
|
QPoint &relativePos);
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ MainWindow::MainWindow(ChannelManager &_channelManager, ColorScheme &_colorSchem
|
|||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
QPalette palette;
|
this->refreshTheme();
|
||||||
palette.setColor(QPalette::Background, this->colorScheme.TabPanelBackground);
|
|
||||||
setPalette(palette);
|
|
||||||
|
|
||||||
if (this->windowGeometry->isFilled()) {
|
if (this->windowGeometry->isFilled()) {
|
||||||
// Load geometry from settings file
|
// Load geometry from settings file
|
||||||
@@ -160,11 +158,18 @@ Notebook &MainWindow::getNotebook()
|
|||||||
return this->notebook;
|
return this->notebook;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *)
|
||||||
{
|
{
|
||||||
// Save closing window position
|
// Save closing window position
|
||||||
this->windowGeometry = this->geometry();
|
this->windowGeometry = this->geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::refreshTheme()
|
||||||
|
{
|
||||||
|
QPalette palette;
|
||||||
|
palette.setColor(QPalette::Background, this->colorScheme.TabPanelBackground);
|
||||||
|
this->setPalette(palette);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ protected:
|
|||||||
virtual void closeEvent(QCloseEvent *event) override;
|
virtual void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual void refreshTheme() override;
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
ColorScheme &colorScheme;
|
ColorScheme &colorScheme;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "widgets/notebookpagedroppreview.hpp"
|
#include "widgets/notebookpagedroppreview.hpp"
|
||||||
|
#include "colorscheme.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@@ -18,7 +19,8 @@ void NotebookPageDropPreview::paintEvent(QPaintEvent *)
|
|||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
painter.fillRect(8, 8, width() - 17, height() - 17, this->colorScheme.DropPreviewBackground);
|
painter.fillRect(8, 8, this->width() - 17, this->height() - 17,
|
||||||
|
this->colorScheme.DropPreviewBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPageDropPreview::hideEvent(QHideEvent *)
|
void NotebookPageDropPreview::hideEvent(QHideEvent *)
|
||||||
|
|||||||
Reference in New Issue
Block a user