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 `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 being unable to disable `First Message` highlights (#3293)
- Bugfix: Fixed `First Message` custom sound not persisting through restart. (#3303) - 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: 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) - 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( return SBHighlight(
ColorProvider::instance().color(ColorType::FirstMessageHighlight), ColorProvider::instance().color(ColorType::FirstMessageHighlight),
SBHighlight::Default, true); SBHighlight::Default, false, true);
} }
return SBHighlight(); return SBHighlight();
} }

View file

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

View file

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

View file

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