mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added dim effect to the titlebar buttons
This commit is contained in:
parent
19fdfaef42
commit
06ff6e6479
|
@ -34,18 +34,23 @@ const QPixmap &RippleEffectButton::getPixmap() const
|
||||||
return this->pixmap_;
|
return this->pixmap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RippleEffectButton::setDimPixmap(bool value)
|
void RippleEffectButton::setDim(bool value)
|
||||||
{
|
{
|
||||||
this->dimPixmap_ = value;
|
this->dimPixmap_ = value;
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RippleEffectButton::getDimPixmap() const
|
bool RippleEffectButton::getDim() const
|
||||||
{
|
{
|
||||||
return this->dimPixmap_;
|
return this->dimPixmap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal RippleEffectButton::getCurrentDimAmount() const
|
||||||
|
{
|
||||||
|
return this->dimPixmap_ && !this->mouseOver_ ? 0.7 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
void RippleEffectButton::setBorderColor(const QColor &color)
|
void RippleEffectButton::setBorderColor(const QColor &color)
|
||||||
{
|
{
|
||||||
this->borderColor_ = color;
|
this->borderColor_ = color;
|
||||||
|
@ -64,7 +69,7 @@ void RippleEffectButton::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
if (!this->pixmap_.isNull()) {
|
if (!this->pixmap_.isNull()) {
|
||||||
if (!this->mouseOver_ && this->dimPixmap_) {
|
if (!this->mouseOver_ && this->dimPixmap_) {
|
||||||
painter.setOpacity(0.7);
|
painter.setOpacity(this->getCurrentDimAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect rect = this->rect();
|
QRect rect = this->rect();
|
||||||
|
|
|
@ -33,8 +33,9 @@ public:
|
||||||
void setPixmap(const QPixmap &pixmap_);
|
void setPixmap(const QPixmap &pixmap_);
|
||||||
const QPixmap &getPixmap() const;
|
const QPixmap &getPixmap() const;
|
||||||
|
|
||||||
void setDimPixmap(bool value);
|
void setDim(bool value);
|
||||||
bool getDimPixmap() const;
|
bool getDim() const;
|
||||||
|
qreal getCurrentDimAmount() const;
|
||||||
|
|
||||||
void setBorderColor(const QColor &color);
|
void setBorderColor(const QColor &color);
|
||||||
const QColor &getBorderColor() const;
|
const QColor &getBorderColor() const;
|
||||||
|
|
|
@ -24,6 +24,8 @@ void TitleBarButton::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
|
painter.setOpacity(this->getCurrentDimAmount());
|
||||||
|
|
||||||
QColor color = this->themeManager->window.text;
|
QColor color = this->themeManager->window.text;
|
||||||
QColor background = this->themeManager->window.background;
|
QColor background = this->themeManager->window.background;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ SplitHeader::SplitHeader(Split *_split)
|
||||||
[this, moderator]() mutable {
|
[this, moderator]() mutable {
|
||||||
this->split->setModerationMode(!this->split->getModerationMode());
|
this->split->setModerationMode(!this->split->getModerationMode());
|
||||||
|
|
||||||
moderator->setDimPixmap(!this->split->getModerationMode());
|
moderator->setDim(!this->split->getModerationMode());
|
||||||
});
|
});
|
||||||
|
|
||||||
this->updateModerationModeIcon();
|
this->updateModerationModeIcon();
|
||||||
|
|
Loading…
Reference in a new issue