Added Ctrl+1/2/3/... shortcuts to Emote Popup (#2263)

This commit is contained in:
Paweł 2020-12-12 14:58:59 +01:00 committed by GitHub
parent eb8eecdfed
commit dcebcd4456
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -4,6 +4,7 @@
- Major: Added "Channel Filters". See https://wiki.chatterino.com/Filters/ for how they work or how to configure them. (#1748, #2083, #2090, #2200) - Major: Added "Channel Filters". See https://wiki.chatterino.com/Filters/ for how they work or how to configure them. (#1748, #2083, #2090, #2200)
- Major: Added Streamer Mode configuration (under `Settings -> General`), where you can select which features of Chatterino should behave differently when you are in Streamer Mode. (#2001) - Major: Added Streamer Mode configuration (under `Settings -> General`), where you can select which features of Chatterino should behave differently when you are in Streamer Mode. (#2001)
- Minor: Added Ctrl + 1/2/3/... and Ctrl+9 shortcuts to Emote Popup (activated with Ctrl+E). They work exactly the same as shortcuts in main window. (#2263)
- Minor: Added reconnect link to the "You are banned" message. (#2266) - Minor: Added reconnect link to the "You are banned" message. (#2266)
- Minor: Improved search popup window titles. (#2268) - Minor: Improved search popup window titles. (#2268)
- Minor: Made "#channel" in `/mentions` tab a clickable link which takes you to the channel that you were mentioned in. (#2220) - Minor: Made "#channel" in `/mentions` tab a clickable link which takes you to the channel that you were mentioned in. (#2220)

View file

@ -305,12 +305,11 @@ void Window::addShortcuts()
// CTRL + 1-8 to open corresponding tab. // CTRL + 1-8 to open corresponding tab.
for (auto i = 0; i < 8; i++) for (auto i = 0; i < 8; i++)
{ {
char hotkey[7];
std::sprintf(hotkey, "CTRL+%d", i + 1);
const auto openTab = [this, i] { const auto openTab = [this, i] {
this->notebook_->selectIndex(i); this->notebook_->selectIndex(i);
}; };
createWindowShortcut(this, hotkey, openTab); createWindowShortcut(this, QString("CTRL+%1").arg(i + 1).toUtf8(),
openTab);
} }
createWindowShortcut(this, "CTRL+9", [this] { createWindowShortcut(this, "CTRL+9", [this] {

View file

@ -156,6 +156,22 @@ EmotePopup::EmotePopup(QWidget *parent)
this->loadEmojis(); this->loadEmojis();
// CTRL + 1-8 to open corresponding tab
for (auto i = 0; i < 8; i++)
{
const auto openTab = [this, i, notebook] {
notebook->selectIndex(i);
};
createWindowShortcut(this, QString("CTRL+%1").arg(i + 1).toUtf8(),
openTab);
}
// Open last tab (first one from right)
createWindowShortcut(this, "CTRL+9", [=] {
notebook->selectLastTab();
});
// Cycle through tabs
createWindowShortcut(this, "CTRL+Tab", [=] { createWindowShortcut(this, "CTRL+Tab", [=] {
notebook->selectNextTab(); notebook->selectNextTab();
}); });