Improve editing of hotkeys (#4628)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user