From dcebcd4456dada1e9d8361d8b19fc91686a2a4dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82?= Date: Sat, 12 Dec 2020 14:58:59 +0100 Subject: [PATCH] Added Ctrl+1/2/3/... shortcuts to Emote Popup (#2263) --- CHANGELOG.md | 1 + src/widgets/Window.cpp | 5 ++--- src/widgets/dialogs/EmotePopup.cpp | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ab4321b0..c7056da7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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: 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) diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index eda642140..85e8946b8 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -305,12 +305,11 @@ void Window::addShortcuts() // CTRL + 1-8 to open corresponding tab. for (auto i = 0; i < 8; i++) { - char hotkey[7]; - std::sprintf(hotkey, "CTRL+%d", i + 1); const auto openTab = [this, i] { this->notebook_->selectIndex(i); }; - createWindowShortcut(this, hotkey, openTab); + createWindowShortcut(this, QString("CTRL+%1").arg(i + 1).toUtf8(), + openTab); } createWindowShortcut(this, "CTRL+9", [this] { diff --git a/src/widgets/dialogs/EmotePopup.cpp b/src/widgets/dialogs/EmotePopup.cpp index 3621eb7c4..df40b720e 100644 --- a/src/widgets/dialogs/EmotePopup.cpp +++ b/src/widgets/dialogs/EmotePopup.cpp @@ -156,6 +156,22 @@ EmotePopup::EmotePopup(QWidget *parent) 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", [=] { notebook->selectNextTab(); });