Improve editing of hotkeys (#4628)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL
2023-05-27 14:04:30 +00:00
committed by GitHub
parent fb02d59b48
commit c7b22939d5
7 changed files with 412 additions and 125 deletions
+20
View File
@@ -1,5 +1,9 @@
#include "controllers/hotkeys/HotkeyHelpers.hpp"
#include "controllers/hotkeys/ActionNames.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include <boost/optional/optional.hpp>
#include <QStringList>
namespace chatterino {
@@ -27,4 +31,20 @@ std::vector<QString> parseHotkeyArguments(QString argumentString)
return arguments;
}
boost::optional<ActionDefinition> findHotkeyActionDefinition(
HotkeyCategory category, const QString &action)
{
auto allActions = actionNames.find(category);
if (allActions != actionNames.end())
{
const auto &actionsMap = allActions->second;
auto definition = actionsMap.find(action);
if (definition != actionsMap.end())
{
return {definition->second};
}
}
return {};
}
} // namespace chatterino