Fix 'First Message' scrollbar highlights not being disabled (#3325)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Ryan 2021-10-30 07:24:38 -04:00 committed by GitHub
parent 8ead95b959
commit e24dffa961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 3 deletions

View file

@ -42,6 +42,7 @@
- Bugfix: Fixed `QCharRef with an index pointing outside the valid range of a QString` warning that was emitted on every Tab press. (#3234)
- Bugfix: Fixed being unable to disable `First Message` highlights (#3293)
- Bugfix: Fixed `First Message` custom sound not persisting through restart. (#3303)
- Bugfix: Fixed `First Message` scrollbar highlights not being disabled. (#3325)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
- Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038)

View file

@ -46,7 +46,7 @@ SBHighlight Message::getScrollBarHighlight() const
{
return SBHighlight(
ColorProvider::instance().color(ColorType::FirstMessageHighlight),
SBHighlight::Default, true);
SBHighlight::Default, false, true);
}
return SBHighlight();
}

View file

@ -251,6 +251,8 @@ void Scrollbar::paintEvent(QPaintEvent *)
painter.fillRect(rect(), this->theme->scrollbars.background);
bool enableRedeemedHighlights = getSettings()->enableRedeemedHighlight;
bool enableFirstMessageHighlights =
getSettings()->enableFirstMessageHighlight;
// painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight),
// this->themeManager->ScrollbarArrow);
@ -301,6 +303,12 @@ void Scrollbar::paintEvent(QPaintEvent *)
continue;
}
if (highlight.isFirstMessageHighlight() &&
!enableFirstMessageHighlights)
{
continue;
}
QColor color = highlight.getColor();
color.setAlpha(255);

View file

@ -13,10 +13,12 @@ ScrollbarHighlight::ScrollbarHighlight()
}
ScrollbarHighlight::ScrollbarHighlight(const std::shared_ptr<QColor> color,
Style style, bool isRedeemedHighlight)
Style style, bool isRedeemedHighlight,
bool isFirstMessageHighlight)
: color_(color)
, style_(style)
, isRedeemedHighlight_(isRedeemedHighlight)
, isFirstMessageHighlight_(isFirstMessageHighlight)
{
}
@ -35,6 +37,11 @@ bool ScrollbarHighlight::isRedeemedHighlight() const
return this->isRedeemedHighlight_;
}
bool ScrollbarHighlight::isFirstMessageHighlight() const
{
return this->isFirstMessageHighlight_;
}
bool ScrollbarHighlight::isNull() const
{
return this->style_ == None;

View file

@ -21,17 +21,20 @@ public:
ScrollbarHighlight();
ScrollbarHighlight(const std::shared_ptr<QColor> color,
Style style = Default, bool isRedeemedHighlight = false);
Style style = Default, bool isRedeemedHighlight = false,
bool isFirstMessageHighlight = false);
QColor getColor() const;
Style getStyle() const;
bool isRedeemedHighlight() const;
bool isFirstMessageHighlight() const;
bool isNull() const;
private:
std::shared_ptr<QColor> color_;
Style style_;
bool isRedeemedHighlight_;
bool isFirstMessageHighlight_;
};
} // namespace chatterino