refactored BaseWidget

This commit is contained in:
fourtf
2018-07-06 17:11:37 +02:00
parent 741c1f7820
commit b639604a47
31 changed files with 121 additions and 134 deletions
+3 -3
View File
@@ -131,9 +131,9 @@ ChannelView::~ChannelView()
{
}
void ChannelView::themeRefreshEvent()
void ChannelView::themeChangedEvent()
{
BaseWidget::themeRefreshEvent();
BaseWidget::themeChangedEvent();
this->layoutMessages();
}
@@ -575,7 +575,7 @@ void ChannelView::paintEvent(QPaintEvent * /*event*/)
QPainter painter(this);
painter.fillRect(rect(), this->themeManager->splits.background);
painter.fillRect(rect(), this->theme->splits.background);
// draw messages
this->drawMessages(painter);
+1 -1
View File
@@ -53,7 +53,7 @@ public:
pajlada::Signals::Signal<const Link &> linkClicked;
protected:
void themeRefreshEvent() override;
void themeChangedEvent() override;
void resizeEvent(QResizeEvent *) override;
+6 -6
View File
@@ -32,9 +32,9 @@ NotebookButton::Icon NotebookButton::getIcon() const
return this->icon_;
}
void NotebookButton::themeRefreshEvent()
void NotebookButton::themeChangedEvent()
{
this->setMouseEffectColor(this->themeManager->tabs.regular.text);
this->setMouseEffectColor(this->theme->tabs.regular.text);
}
void NotebookButton::paintEvent(QPaintEvent *event)
@@ -45,11 +45,11 @@ void NotebookButton::paintEvent(QPaintEvent *event)
QColor foreground;
if (mouseDown_ || mouseOver_) {
background = this->themeManager->tabs.regular.backgrounds.hover.color();
foreground = this->themeManager->tabs.regular.text;
background = this->theme->tabs.regular.backgrounds.hover.color();
foreground = this->theme->tabs.regular.text;
} else {
background = this->themeManager->tabs.regular.backgrounds.regular.color();
foreground = this->themeManager->tabs.regular.text;
background = this->theme->tabs.regular.backgrounds.regular.color();
foreground = this->theme->tabs.regular.text;
}
painter.setPen(Qt::NoPen);
+1 -1
View File
@@ -21,7 +21,7 @@ public:
Icon getIcon() const;
protected:
virtual void themeRefreshEvent() override;
virtual void themeChangedEvent() override;
virtual void paintEvent(QPaintEvent *) override;
virtual void mouseReleaseEvent(QMouseEvent *) override;
virtual void dragEnterEvent(QDragEnterEvent *) override;
+7 -7
View File
@@ -64,12 +64,12 @@ NotebookTab::NotebookTab(Notebook *notebook)
// });
}
void NotebookTab::themeRefreshEvent()
void NotebookTab::themeChangedEvent()
{
this->update();
// this->setMouseEffectColor(QColor("#999"));
this->setMouseEffectColor(this->themeManager->tabs.regular.text);
this->setMouseEffectColor(this->theme->tabs.regular.text);
}
void NotebookTab::updateSize()
@@ -222,16 +222,16 @@ void NotebookTab::paintEvent(QPaintEvent *)
// select the right tab colors
Theme::TabColors colors;
Theme::TabColors regular = this->themeManager->tabs.regular;
Theme::TabColors regular = this->theme->tabs.regular;
if (this->selected_) {
colors = this->themeManager->tabs.selected;
colors = this->theme->tabs.selected;
} else if (this->highlightState_ == HighlightState::Highlighted) {
colors = this->themeManager->tabs.highlighted;
colors = this->theme->tabs.highlighted;
} else if (this->highlightState_ == HighlightState::NewMessage) {
colors = this->themeManager->tabs.newMessage;
colors = this->theme->tabs.newMessage;
} else {
colors = this->themeManager->tabs.regular;
colors = this->theme->tabs.regular;
}
bool windowFocused = this->window() == QApplication::activeWindow();
+1 -1
View File
@@ -47,7 +47,7 @@ public:
void hideTabXChanged(bool);
protected:
virtual void themeRefreshEvent() override;
virtual void themeChangedEvent() override;
virtual void paintEvent(QPaintEvent *) override;
+1 -1
View File
@@ -121,7 +121,7 @@ void RippleEffectButton::fancyPaint(QPainter &painter)
if (this->mouseEffectColor_) {
c = this->mouseEffectColor_.get();
} else {
c = this->themeManager->isLightTheme() ? QColor(0, 0, 0) : QColor(255, 255, 255);
c = this->theme->isLightTheme() ? QColor(0, 0, 0) : QColor(255, 255, 255);
}
if (this->hoverMultiplier_ > 0) {
+3 -3
View File
@@ -26,8 +26,8 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
painter.setOpacity(this->getCurrentDimAmount());
QColor color = this->themeManager->window.text;
QColor background = this->themeManager->window.background;
QColor color = this->theme->window.text;
QColor background = this->theme->window.background;
int xD = this->height() / 3;
int centerX = this->width() / 2;
@@ -50,7 +50,7 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
painter.drawRect(centerX - xD / 2 + xD2, xD, xD3, xD3);
painter.fillRect(centerX - xD / 2, xD + xD2, xD3, xD3,
this->themeManager->window.background);
this->theme->window.background);
painter.drawRect(centerX - xD / 2, xD + xD2, xD3, xD3);
break;
}