aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2014-01-07 09:10:56 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2014-01-07 09:10:56 +0000
commitc12d72d9e0249a11236d009d077f91c443423ab0 (patch)
treed7d92ca3612be0c26acb1614edb0901e0192d1bb /src
parent3ea31a16aaae64f087a7fec0c58ff8849a0389a4 (diff)
downloadqmmp-c12d72d9e0249a11236d009d077f91c443423ab0.tar.gz
qmmp-c12d72d9e0249a11236d009d077f91c443423ab0.tar.bz2
qmmp-c12d72d9e0249a11236d009d077f91c443423ab0.zip
hotkey plugin: do not allow to assign same key for the different
commands git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4010 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/plugins/General/hotkey/settingsdialog.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/plugins/General/hotkey/settingsdialog.cpp b/src/plugins/General/hotkey/settingsdialog.cpp
index 8f3748c85..0634d8c32 100644
--- a/src/plugins/General/hotkey/settingsdialog.cpp
+++ b/src/plugins/General/hotkey/settingsdialog.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2009-2013 by Ilya Kotov *
+ * Copyright (C) 2009-2014 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -20,6 +20,7 @@
#include <QSettings>
#include <QHeaderView>
+#include <QMessageBox>
#include <qmmp/qmmp.h>
#include "hotkeydialog.h"
#include "settingsdialog.h"
@@ -98,9 +99,15 @@ void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item)
if (item->type() >= QTableWidgetItem::UserType &&
dialog->exec() == QDialog::Accepted)
{
- item->setText(HotkeyManager::getKeyString(dialog->keySym (), dialog->nativeModifiers ()));
- k->key = dialog->keySym ();
- k->mod = dialog->nativeModifiers ();
+ QString keyString = HotkeyManager::getKeyString(dialog->keySym (), dialog->nativeModifiers ());
+ if(ui.tableWidget->findItems(keyString, Qt::MatchFixedString).isEmpty())
+ {
+ item->setText(keyString);
+ k->key = dialog->keySym ();
+ k->mod = dialog->nativeModifiers ();
+ }
+ else
+ QMessageBox::warning(this, tr("Warning"), tr("Key sequence '%1' is already used").arg(keyString));
}
delete dialog;
}