From 599ef0ae62a2c525c04e0d4dfb336dc741699e12 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 19 Sep 2015 23:13:46 +0200 Subject: [PATCH] Confirmation to clear/restore shortcuts --- cockatrice/src/sequenceEdit/shortcutstab.cpp | 18 ++++++++++++------ cockatrice/src/sequenceEdit/ui_shortcutstab.h | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cockatrice/src/sequenceEdit/shortcutstab.cpp b/cockatrice/src/sequenceEdit/shortcutstab.cpp index 23d2e96c..d5c3091f 100644 --- a/cockatrice/src/sequenceEdit/shortcutstab.cpp +++ b/cockatrice/src/sequenceEdit/shortcutstab.cpp @@ -26,30 +26,36 @@ ShortcutsTab::~ShortcutsTab() void ShortcutsTab::resetShortcuts() { - settingsCache->shortcuts().resetAllShortcuts(); + if(QMessageBox::question(this,tr("Restore all default shortcuts"), + tr("Do you really want to restore all default shortcuts?")) == QMessageBox::Yes) + { + settingsCache->shortcuts().resetAllShortcuts(); + } } void ShortcutsTab::refreshEdits() -{ +{ QList edits = this->findChildren(); for(int i= 0; i < edits.length(); ++i) { edits.at(i)->refreshShortcut(); } - QMessageBox::information(this,tr("Shortcuts reset"),tr("All shortcuts have been reset")); } void ShortcutsTab::clearShortcuts() { - settingsCache->shortcuts().clearAllShortcuts(); + if(QMessageBox::question(this,tr("Clear all default shortcuts"), + tr("Do you really want to clear all shortcuts?")) == QMessageBox::Yes) + { + settingsCache->shortcuts().clearAllShortcuts(); + } } void ShortcutsTab::afterClear() -{ +{ QList edits = this->findChildren(); for(int i= 0; i < edits.length(); ++i) { edits.at(i)->clear(); } - QMessageBox::information(this,tr("Shortcuts reset"),tr("All shortcuts have been cleared")); } diff --git a/cockatrice/src/sequenceEdit/ui_shortcutstab.h b/cockatrice/src/sequenceEdit/ui_shortcutstab.h index e856b538..d642a9fc 100644 --- a/cockatrice/src/sequenceEdit/ui_shortcutstab.h +++ b/cockatrice/src/sequenceEdit/ui_shortcutstab.h @@ -1581,7 +1581,7 @@ public: tabWidget->setTabText(tabWidget->indexOf(tab_3), QApplication::translate("shortcutsTab", "Draw | Move | View | Gameplay", 0)); tabWidget->setTabText(tabWidget->indexOf(tab_4), QApplication::translate("shortcutsTab","Counters", 0)); faqLabel->setText(QString("%2").arg(WIKI).arg(QApplication::translate("shortcutsTab","How to set custom shortcuts",0))); - btnResetAll->setText(QApplication::translate("shortcutsTab","Reset all shortcuts",0)); + btnResetAll->setText(QApplication::translate("shortcutsTab","Restore all default shortcuts",0)); btnClearAll->setText(QApplication::translate("shortcutsTab","Clear all shortcuts",0)); } // retranslateUi