From c12d72d9e0249a11236d009d077f91c443423ab0 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 7 Jan 2014 09:10:56 +0000 Subject: 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 --- src/plugins/General/hotkey/settingsdialog.cpp | 15 +++++++++++---- 1 file 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 #include +#include #include #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; } -- cgit v1.2.3-13-gbd6f