1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Qt/shortcuts: add handler id to log messages

This commit is contained in:
Megamouse 2024-09-27 16:54:18 +02:00
parent 2661b6a71c
commit 4ba4268282
2 changed files with 20 additions and 5 deletions

View File

@ -38,7 +38,7 @@ shortcut_handler::shortcut_handler(gui::shortcuts::shortcut_handler_id handler_i
// TODO: do not allow same shortcuts and remove this connect
// activatedAmbiguously will trigger if you have the same key sequence for several shortcuts
const QKeySequence& key_sequence = m_shortcuts[key].key_sequence;
shortcut_log.error("Shortcut activated ambiguously: %s (%s)", key, key_sequence.toString());
shortcut_log.error("%s: Shortcut activated ambiguously: %s (%s)", m_handler_id, key, key_sequence.toString());
handle_shortcut(key, key_sequence);
});
}
@ -46,7 +46,7 @@ shortcut_handler::shortcut_handler(gui::shortcuts::shortcut_handler_id handler_i
void shortcut_handler::update()
{
shortcut_log.notice("Updating shortcuts");
shortcut_log.notice("%s: Updating shortcuts", m_handler_id);
shortcut_settings sc_settings{};
@ -71,7 +71,7 @@ void shortcut_handler::update()
void shortcut_handler::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKeySequence& key_sequence)
{
shortcut_log.notice("Shortcut pressed: %s (%s)", shortcut_key, key_sequence.toString());
shortcut_log.notice("%s: Shortcut pressed: %s (%s)", m_handler_id, shortcut_key, key_sequence.toString());
Q_EMIT shortcut_activated(shortcut_key, key_sequence);
}

View File

@ -3,9 +3,9 @@
using namespace gui::shortcuts;
template <>
void fmt_class_string<gui::shortcuts::shortcut>::format(std::string& out, u64 arg)
void fmt_class_string<shortcut>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](gui::shortcuts::shortcut value)
format_enum(out, arg, [](shortcut value)
{
switch (value)
{
@ -35,6 +35,21 @@ void fmt_class_string<gui::shortcuts::shortcut>::format(std::string& out, u64 ar
});
}
template <>
void fmt_class_string<shortcut_handler_id>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](gui::shortcuts::shortcut_handler_id value)
{
switch (value)
{
case shortcut_handler_id::main_window: return "main_window";
case shortcut_handler_id::game_window: return "game_window";
}
return unknown;
});
}
shortcut_settings::shortcut_settings()
: shortcut_map({
{ shortcut::mw_start, shortcut_info{ "main_window_start", tr("Start"), "Ctrl+E", shortcut_handler_id::main_window } },