mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
Improve error messages
* Show information about shortcut. * Make errors translatable.
This commit is contained in:
+10
-4
@@ -279,8 +279,10 @@ bool QHotkeyPrivate::addShortcutInvoked(QHotkey *hotkey)
|
||||
QHotkey::NativeShortcut shortcut = hotkey->_nativeShortcut;
|
||||
|
||||
if(!shortcuts.contains(shortcut)) {
|
||||
if(!registerShortcut(shortcut))
|
||||
if(!registerShortcut(shortcut)) {
|
||||
qCWarning(logQHotkey) << QHotkey::tr("Failed to register %1. Error: %2").arg(hotkey->shortcut().toString(), error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
shortcuts.insert(shortcut, hotkey);
|
||||
@@ -296,9 +298,13 @@ bool QHotkeyPrivate::removeShortcutInvoked(QHotkey *hotkey)
|
||||
return false;
|
||||
hotkey->_registered = false;
|
||||
emit hotkey->registeredChanged(true);
|
||||
if(shortcuts.count(shortcut) == 0)
|
||||
return unregisterShortcut(shortcut);
|
||||
else
|
||||
if(shortcuts.count(shortcut) == 0) {
|
||||
if (!unregisterShortcut(shortcut)) {
|
||||
qCWarning(logQHotkey) << QHotkey::tr("Failed to unregister %1. Error: %2").arg(hotkey->shortcut().toString(), error);
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user