aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/hotkey
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/General/hotkey')
-rw-r--r--src/plugins/General/hotkey/hotkeydialog.cpp2
-rw-r--r--src/plugins/General/hotkey/hotkeymanager_win.cpp2
-rw-r--r--src/plugins/General/hotkey/hotkeymanager_x11.cpp4
-rw-r--r--src/plugins/General/hotkey/settingsdialog.cpp17
4 files changed, 14 insertions, 11 deletions
diff --git a/src/plugins/General/hotkey/hotkeydialog.cpp b/src/plugins/General/hotkey/hotkeydialog.cpp
index e522acc77..4d0c9ac00 100644
--- a/src/plugins/General/hotkey/hotkeydialog.cpp
+++ b/src/plugins/General/hotkey/hotkeydialog.cpp
@@ -38,7 +38,7 @@ void HotkeyDialog::keyPressEvent (QKeyEvent *event)
{
m_key = HotkeyManager::keycodeToKeysym(event->nativeScanCode ());
m_modifiers = event->nativeModifiers ();
- foreach(long mask_mod, HotkeyManager::ignModifiersList())
+ for(long mask_mod : HotkeyManager::ignModifiersList())
m_modifiers &= ~mask_mod; //remove ignored modifiers (num lock, caps lock, etc)
m_ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers));
diff --git a/src/plugins/General/hotkey/hotkeymanager_win.cpp b/src/plugins/General/hotkey/hotkeymanager_win.cpp
index aa0cdd6b5..950b57438 100644
--- a/src/plugins/General/hotkey/hotkeymanager_win.cpp
+++ b/src/plugins/General/hotkey/hotkeymanager_win.cpp
@@ -226,7 +226,7 @@ bool HotkeyManager::nativeEventFilter(const QByteArray &eventType, void *message
{
SoundCore *core = SoundCore::instance();
MediaPlayer *player = MediaPlayer::instance();
- foreach(Hotkey *hotkey, m_grabbedKeys)
+ for(const Hotkey *hotkey : qAsConst(m_grabbedKeys))
{
if(hotkey->id != m->wParam)
continue;
diff --git a/src/plugins/General/hotkey/hotkeymanager_x11.cpp b/src/plugins/General/hotkey/hotkeymanager_x11.cpp
index 26aac352b..6819523c6 100644
--- a/src/plugins/General/hotkey/hotkeymanager_x11.cpp
+++ b/src/plugins/General/hotkey/hotkeymanager_x11.cpp
@@ -95,7 +95,7 @@ HotkeyManager::HotkeyManager(QObject *parent) : QObject(parent)
if (key)
{
- foreach(long mask_mod, ignModifiersList())
+ for(long mask_mod : ignModifiersList())
{
Hotkey *hotkey = new Hotkey;
hotkey->action = i;
@@ -155,7 +155,7 @@ bool HotkeyManager::nativeEventFilter(const QByteArray &eventType, void *message
quint32 mod = ke->state;
SoundCore *core = SoundCore::instance();
MediaPlayer *player = MediaPlayer::instance();
- foreach(Hotkey *hotkey, m_grabbedKeys)
+ for(const Hotkey *hotkey : qAsConst(m_grabbedKeys))
{
if (hotkey->key != key || hotkey->mod != mod)
continue;
diff --git a/src/plugins/General/hotkey/settingsdialog.cpp b/src/plugins/General/hotkey/settingsdialog.cpp
index 7a5bd612d..1255790e2 100644
--- a/src/plugins/General/hotkey/settingsdialog.cpp
+++ b/src/plugins/General/hotkey/settingsdialog.cpp
@@ -75,7 +75,7 @@ void SettingsDialog::accept()
{
QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
settings.beginGroup("Hotkey");
- foreach(Hotkey *k, m_hotkeys)
+ for(const Hotkey *k : qAsConst(m_hotkeys))
{
settings.setValue(QString("key_%1").arg(k->action), k->key);
settings.setValue(QString("modifiers_%1").arg(k->action), k->mod);
@@ -86,16 +86,19 @@ void SettingsDialog::accept()
void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item)
{
- Hotkey *k = nullptr;
- foreach(k, m_hotkeys)
+ Hotkey *key = nullptr;
+ for(Hotkey *k : m_hotkeys)
{
if (k->action == item->type())
+ {
+ key = k;
break;
+ }
}
- if (!k)
+ if (!key)
return;
- HotkeyDialog *dialog = new HotkeyDialog(k->key, k->mod, this);
+ HotkeyDialog *dialog = new HotkeyDialog(key->key, key->mod, this);
if (item->type() >= QTableWidgetItem::UserType &&
dialog->exec() == QDialog::Accepted)
{
@@ -104,8 +107,8 @@ void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item)
if(keyString.isEmpty() || items.isEmpty() || items.first() == item)
{
item->setText(keyString);
- k->key = dialog->keySym ();
- k->mod = dialog->nativeModifiers ();
+ key->key = dialog->keySym ();
+ key->mod = dialog->nativeModifiers ();
}
else
QMessageBox::warning(this, tr("Warning"), tr("Key sequence '%1' is already used").arg(keyString));