mirror of https://github.com/WerWolv/ImHex
impr: Add option to ShortcutManager to get a shortcut by its name
This commit is contained in:
parent
a75947e611
commit
989f7f7678
|
|
@ -151,6 +151,8 @@ EXPORT_MODULE namespace hex {
|
|||
*/
|
||||
static void clearShortcuts();
|
||||
|
||||
static Shortcut getShortcutByName(const std::vector<UnlocalizedString> &unlocalizedName, const View *view = nullptr);
|
||||
|
||||
static void resumeShortcuts();
|
||||
static void pauseShortcuts();
|
||||
|
||||
|
|
|
|||
|
|
@ -387,6 +387,24 @@ namespace hex {
|
|||
s_globalShortcuts->clear();
|
||||
}
|
||||
|
||||
Shortcut ShortcutManager::getShortcutByName(const std::vector<UnlocalizedString> &unlocalizedName, const View *view) {
|
||||
if (view != nullptr) {
|
||||
for (const auto &[shortcut, entry] : view->m_shortcuts) {
|
||||
if (entry.unlocalizedName == unlocalizedName) {
|
||||
return entry.shortcut;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const auto &[shortcut, entry] : *s_globalShortcuts) {
|
||||
if (entry.unlocalizedName == unlocalizedName) {
|
||||
return entry.shortcut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Shortcut::None;
|
||||
}
|
||||
|
||||
void ShortcutManager::resumeShortcuts() {
|
||||
s_paused = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue