Added a Scroll to top keyboard shortcut for splits (#3802)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Brian 2022-06-18 07:48:55 -04:00 committed by GitHub
parent fd87cbb626
commit 9583b49653
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 0 deletions

View file

@ -5,6 +5,7 @@
- Major: Added multi-channel searching to search dialog via keyboard shortcut. [Ctrl+Shift+F by default] (#3694) - Major: Added multi-channel searching to search dialog via keyboard shortcut. [Ctrl+Shift+F by default] (#3694)
- Minor: Added `is:first-msg` search option. (#3700) - Minor: Added `is:first-msg` search option. (#3700)
- Minor: Added quotation marks in the permitted/blocked Automod messages for clarity. (#3654) - Minor: Added quotation marks in the permitted/blocked Automod messages for clarity. (#3654)
- Minor: Added a `Scroll to top` keyboard shortcut for splits. (#3802)
- Minor: Adjust large stream thumbnail to 16:9 (#3655) - Minor: Adjust large stream thumbnail to 16:9 (#3655)
- Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623) - Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623)
- Minor: Add information about the user's operating system in the About page. (#3663) - Minor: Add information about the user's operating system in the About page. (#3663)

View file

@ -89,6 +89,7 @@ inline const std::map<HotkeyCategory, ActionDefinitionMap> actionNames{
1, 1,
}}, }},
{"scrollToBottom", ActionDefinition{"Scroll to the bottom"}}, {"scrollToBottom", ActionDefinition{"Scroll to the bottom"}},
{"scrollToTop", ActionDefinition{"Scroll to the top"}},
{"setChannelNotification", {"setChannelNotification",
ActionDefinition{ ActionDefinition{
"Set channel live notification", "Set channel live notification",

View file

@ -375,6 +375,9 @@ void HotkeyController::addDefaults(std::set<QString> &addedHotkeys)
this->tryAddDefault(addedHotkeys, HotkeyCategory::Split, this->tryAddDefault(addedHotkeys, HotkeyCategory::Split,
QKeySequence("Ctrl+End"), "scrollToBottom", QKeySequence("Ctrl+End"), "scrollToBottom",
std::vector<QString>(), "scroll to bottom"); std::vector<QString>(), "scroll to bottom");
this->tryAddDefault(addedHotkeys, HotkeyCategory::Split,
QKeySequence("Ctrl+Home"), "scrollToTop",
std::vector<QString>(), "scroll to top");
this->tryAddDefault(addedHotkeys, HotkeyCategory::Split, this->tryAddDefault(addedHotkeys, HotkeyCategory::Split,
QKeySequence("F10"), "debug", QKeySequence("F10"), "debug",
std::vector<QString>(), "open debug popup"); std::vector<QString>(), "open debug popup");

View file

@ -76,6 +76,11 @@ void Scrollbar::scrollToBottom(bool animate)
this->setDesiredValue(this->maximum_ - this->getLargeChange(), animate); this->setDesiredValue(this->maximum_ - this->getLargeChange(), animate);
} }
void Scrollbar::scrollToTop(bool animate)
{
this->setDesiredValue(this->minimum_ - this->getLargeChange(), animate);
}
bool Scrollbar::isAtBottom() const bool Scrollbar::isAtBottom() const
{ {
return this->atBottom_; return this->atBottom_;

View file

@ -30,6 +30,7 @@ public:
void clearHighlights(); void clearHighlights();
void scrollToBottom(bool animate = false); void scrollToBottom(bool animate = false);
void scrollToTop(bool animate = false);
bool isAtBottom() const; bool isAtBottom() const;
void setMaximum(qreal value); void setMaximum(qreal value);

View file

@ -333,6 +333,12 @@ void Split::addShortcuts()
getSettings()->enableSmoothScrollingNewMessages.getValue()); getSettings()->enableSmoothScrollingNewMessages.getValue());
return ""; return "";
}}, }},
{"scrollToTop",
[this](std::vector<QString>) -> QString {
this->getChannelView().getScrollBar().scrollToTop(
getSettings()->enableSmoothScrollingNewMessages.getValue());
return "";
}},
{"scrollPage", {"scrollPage",
[this](std::vector<QString> arguments) -> QString { [this](std::vector<QString> arguments) -> QString {
if (arguments.size() == 0) if (arguments.size() == 0)