feat: Add setting to hide scrollbar highlights (#5732)
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
- Minor: Mentions of FrankerFaceZ and BetterTTV in settings are standardized as such. (#5698)
|
- Minor: Mentions of FrankerFaceZ and BetterTTV in settings are standardized as such. (#5698)
|
||||||
- Minor: Emote names are no longer duplicated when using smarter emote completion. (#5705)
|
- Minor: Emote names are no longer duplicated when using smarter emote completion. (#5705)
|
||||||
- Minor: Added a setting to hide the scrollbar thumb (the handle you can drag). Hiding the scrollbar thumb will disable mouse click & drag interactions in the scrollbar. (#5731)
|
- Minor: Added a setting to hide the scrollbar thumb (the handle you can drag). Hiding the scrollbar thumb will disable mouse click & drag interactions in the scrollbar. (#5731)
|
||||||
|
- Minor: Added a setting to hide the scrollbar highlights. (#5732)
|
||||||
- Minor: The window layout is now backed up like the other settings. (#5647)
|
- Minor: The window layout is now backed up like the other settings. (#5647)
|
||||||
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612)
|
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612)
|
||||||
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
||||||
|
|||||||
@@ -229,6 +229,10 @@ public:
|
|||||||
"/appearance/scrollbar/hideThumb",
|
"/appearance/scrollbar/hideThumb",
|
||||||
false,
|
false,
|
||||||
};
|
};
|
||||||
|
BoolSetting hideScrollbarHighlights = {
|
||||||
|
"/appearance/scrollbar/hideHighlights",
|
||||||
|
false,
|
||||||
|
};
|
||||||
|
|
||||||
/// Behaviour
|
/// Behaviour
|
||||||
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages",
|
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages",
|
||||||
|
|||||||
+58
-48
@@ -48,6 +48,13 @@ Scrollbar::Scrollbar(size_t messagesLimit, ChannelView *parent)
|
|||||||
this->update();
|
this->update();
|
||||||
},
|
},
|
||||||
this->signalHolder);
|
this->signalHolder);
|
||||||
|
|
||||||
|
getSettings()->hideScrollbarHighlights.connect(
|
||||||
|
[this](bool newValue) {
|
||||||
|
this->settingHideHighlights = newValue;
|
||||||
|
this->update();
|
||||||
|
},
|
||||||
|
this->signalHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::circular_buffer<ScrollbarHighlight> Scrollbar::getHighlights() const
|
boost::circular_buffer<ScrollbarHighlight> Scrollbar::getHighlights() const
|
||||||
@@ -309,62 +316,60 @@ void Scrollbar::paintEvent(QPaintEvent * /*event*/)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw highlights
|
if (this->shouldShowHighlights() && !this->highlights_.empty())
|
||||||
if (this->highlights_.empty())
|
|
||||||
{
|
{
|
||||||
return;
|
size_t nHighlights = this->highlights_.size();
|
||||||
}
|
int w = this->width();
|
||||||
|
float dY = static_cast<float>(this->height()) /
|
||||||
|
static_cast<float>(nHighlights);
|
||||||
|
int highlightHeight =
|
||||||
|
static_cast<int>(std::ceil(std::max(this->scale() * 2.0F, dY)));
|
||||||
|
|
||||||
size_t nHighlights = this->highlights_.size();
|
for (size_t i = 0; i < nHighlights; i++)
|
||||||
int w = this->width();
|
|
||||||
float dY =
|
|
||||||
static_cast<float>(this->height()) / static_cast<float>(nHighlights);
|
|
||||||
int highlightHeight =
|
|
||||||
static_cast<int>(std::ceil(std::max(this->scale() * 2.0F, dY)));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nHighlights; i++)
|
|
||||||
{
|
|
||||||
const auto &highlight = this->highlights_[i];
|
|
||||||
|
|
||||||
if (highlight.isNull())
|
|
||||||
{
|
{
|
||||||
continue;
|
const auto &highlight = this->highlights_[i];
|
||||||
}
|
|
||||||
|
|
||||||
if (highlight.isRedeemedHighlight() && !enableRedeemedHighlights)
|
if (highlight.isNull())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (highlight.isFirstMessageHighlight() &&
|
|
||||||
!enableFirstMessageHighlights)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (highlight.isElevatedMessageHighlight() &&
|
|
||||||
!enableElevatedMessageHighlights)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor color = highlight.getColor();
|
|
||||||
color.setAlpha(255);
|
|
||||||
|
|
||||||
int y = static_cast<int>(dY * static_cast<float>(i));
|
|
||||||
switch (highlight.getStyle())
|
|
||||||
{
|
|
||||||
case ScrollbarHighlight::Default: {
|
|
||||||
painter.fillRect(w / 8 * 3, y, w / 4, highlightHeight, color);
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case ScrollbarHighlight::Line: {
|
if (highlight.isRedeemedHighlight() && !enableRedeemedHighlights)
|
||||||
painter.fillRect(0, y, w, 1, color);
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case ScrollbarHighlight::None:;
|
if (highlight.isFirstMessageHighlight() &&
|
||||||
|
!enableFirstMessageHighlights)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (highlight.isElevatedMessageHighlight() &&
|
||||||
|
!enableElevatedMessageHighlights)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor color = highlight.getColor();
|
||||||
|
color.setAlpha(255);
|
||||||
|
|
||||||
|
int y = static_cast<int>(dY * static_cast<float>(i));
|
||||||
|
switch (highlight.getStyle())
|
||||||
|
{
|
||||||
|
case ScrollbarHighlight::Default: {
|
||||||
|
painter.fillRect(w / 8 * 3, y, w / 4, highlightHeight,
|
||||||
|
color);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ScrollbarHighlight::Line: {
|
||||||
|
painter.fillRect(0, y, w, 1, color);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ScrollbarHighlight::None:;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -490,6 +495,11 @@ bool Scrollbar::shouldShowThumb() const
|
|||||||
return !(this->hideThumb || this->settingHideThumb);
|
return !(this->hideThumb || this->settingHideThumb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Scrollbar::shouldShowHighlights() const
|
||||||
|
{
|
||||||
|
return !this->settingHideHighlights;
|
||||||
|
}
|
||||||
|
|
||||||
bool Scrollbar::shouldHandleMouseEvents() const
|
bool Scrollbar::shouldHandleMouseEvents() const
|
||||||
{
|
{
|
||||||
return this->shouldShowThumb();
|
return this->shouldShowThumb();
|
||||||
|
|||||||
@@ -133,6 +133,9 @@ public:
|
|||||||
/// Returns true if we should show the thumb (the handle you can drag)
|
/// Returns true if we should show the thumb (the handle you can drag)
|
||||||
bool shouldShowThumb() const;
|
bool shouldShowThumb() const;
|
||||||
|
|
||||||
|
/// Returns true if we should show the highlights
|
||||||
|
bool shouldShowHighlights() const;
|
||||||
|
|
||||||
bool shouldHandleMouseEvents() const;
|
bool shouldHandleMouseEvents() const;
|
||||||
|
|
||||||
// offset the desired value without breaking smooth scolling
|
// offset the desired value without breaking smooth scolling
|
||||||
@@ -181,6 +184,9 @@ private:
|
|||||||
/// Controlled by the "Hide scrollbar thumb" setting
|
/// Controlled by the "Hide scrollbar thumb" setting
|
||||||
bool settingHideThumb{false};
|
bool settingHideThumb{false};
|
||||||
|
|
||||||
|
/// Controlled by the "Hide scrollbar highlights" setting
|
||||||
|
bool settingHideHighlights{false};
|
||||||
|
|
||||||
MouseLocation mouseOverLocation_ = MouseLocation::Outside;
|
MouseLocation mouseOverLocation_ = MouseLocation::Outside;
|
||||||
MouseLocation mouseDownLocation_ = MouseLocation::Outside;
|
MouseLocation mouseDownLocation_ = MouseLocation::Outside;
|
||||||
QPoint lastMousePosition_;
|
QPoint lastMousePosition_;
|
||||||
|
|||||||
@@ -463,6 +463,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
|||||||
"Hiding the scrollbar thumb (the handle you can drag) will disable "
|
"Hiding the scrollbar thumb (the handle you can drag) will disable "
|
||||||
"all mouse interaction in the scrollbar.");
|
"all mouse interaction in the scrollbar.");
|
||||||
|
|
||||||
|
layout.addCheckbox("Hide scrollbar highlights", s.hideScrollbarHighlights,
|
||||||
|
false);
|
||||||
|
|
||||||
layout.addTitle("Messages");
|
layout.addTitle("Messages");
|
||||||
layout.addCheckbox(
|
layout.addCheckbox(
|
||||||
"Separate with lines", s.separateMessages, false,
|
"Separate with lines", s.separateMessages, false,
|
||||||
|
|||||||
Reference in New Issue
Block a user