Make menus and placeholders display appropriate custom key combos. (#4045)

* Add initial support for finding hotkey display key sequences

* Make neededArguments work

* Implement displaying key combos in SplitHeader main menu

* Make Settings search text dynamic

* Make tab hide notice use a custom hotkeys key sequence

* Make Notebook menus use custom hotkeys key combo lookup for hiding tabs

* shut up changelog ci

* Make NotebookTab menus show custom hotkeys. SCUFFED:
this does not update dynamically!

* Scuffed: Make the show prefs button setting show the key bind

* Scuffed: Make the R9K description refer to hotkeys

* @pajlada, is something like this ok?

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL
2022-10-09 17:20:44 +02:00
committed by GitHub
parent 4e2da540d2
commit e604a36777
10 changed files with 248 additions and 41 deletions
+24 -2
View File
@@ -3,6 +3,8 @@
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "singletons/Fonts.hpp"
#include "singletons/NativeMessaging.hpp"
#include "singletons/Paths.hpp"
@@ -193,7 +195,17 @@ void GeneralPage::initLayout(GeneralPageView &layout)
#endif
if (!BaseWindow::supportsCustomWindowFrame())
{
layout.addCheckbox("Show preferences button (Ctrl+P to show)",
auto settingsSeq = getApp()->hotkeys->getDisplaySequence(
HotkeyCategory::Window, "openSettings");
QString shortcut = " (no key bound to open them otherwise)";
// TODO: maybe prevent the user from locking themselves out of the settings?
if (!settingsSeq.isEmpty())
{
shortcut = QStringLiteral(" (%1 to show)")
.arg(settingsSeq.toString(
QKeySequence::SequenceFormat::NativeText));
}
layout.addCheckbox("Show preferences button" + shortcut,
s.hidePreferencesButton, true);
layout.addCheckbox("Show user button", s.hideUserButton, true);
}
@@ -559,8 +571,18 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Title", s.headerStreamTitle);
layout.addSubtitle("R9K");
auto toggleLocalr9kSeq = getApp()->hotkeys->getDisplaySequence(
HotkeyCategory::Window, "toggleLocalR9K");
QString toggleLocalr9kShortcut =
"an assigned hotkey (Window -> Toggle local R9K)";
if (!toggleLocalr9kSeq.isEmpty())
{
toggleLocalr9kShortcut = toggleLocalr9kSeq.toString(
QKeySequence::SequenceFormat::NativeText);
}
layout.addDescription("Hide similar messages. Toggle hidden "
"messages by pressing Ctrl+H.");
"messages by pressing " +
toggleLocalr9kShortcut + ".");
layout.addCheckbox("Hide similar messages", s.similarityEnabled);
//layout.addCheckbox("Gray out matches", s.colorSimilarDisabled);
layout.addCheckbox("By the same user", s.hideSimilarBySameUser);