diff --git a/include/buttonmanager.h b/include/buttonmanager.h index f5e2474..83b94f6 100644 --- a/include/buttonmanager.h +++ b/include/buttonmanager.h @@ -36,6 +36,7 @@ private slots: void itemChanged(QTreeWidgetItem* item, int column); void itemDoubleClicked(QTreeWidgetItem* item); void dialogButtonPressed(QAbstractButton* btn); + void saveChanges(); private: Ui::ButtonManager *ui; @@ -45,7 +46,6 @@ private: Config::RootConfig workingConfig; void loadConfig(); - void saveChanges(); void select(QTreeWidgetItem* item); diff --git a/src/buttonmanager.cpp b/src/buttonmanager.cpp index 699d141..367504e 100644 --- a/src/buttonmanager.cpp +++ b/src/buttonmanager.cpp @@ -6,6 +6,7 @@ #include "sound.h" #include +#include #include @@ -21,6 +22,10 @@ ButtonManager::ButtonManager(Config& conf, MainWindow* parent) : QDialog(parent) labels.push_back("File"); ui->buttonTreeWidget->setHeaderLabels(labels); + + QShortcut* sc = new QShortcut(QKeySequence(QKeySequence::Save), this); + + QObject::connect(sc, SIGNAL( activated() ), this, SLOT( saveChanges() )); } ButtonManager::~ButtonManager() { @@ -203,6 +208,14 @@ void ButtonManager::dialogButtonPressed(QAbstractButton* btn) { } } +void ButtonManager::saveChanges() { + // store working config to main config and save + mainConfig.rootConfig = workingConfig; + mainConfig.save(); + + mainW->reloadButtonConfig(); +} + void ButtonManager::loadConfig() { workingConfig = mainConfig.rootConfig; @@ -218,14 +231,6 @@ void ButtonManager::loadConfig() { } } -void ButtonManager::saveChanges() { - // store working config to main config and save - mainConfig.rootConfig = workingConfig; - mainConfig.save(); - - mainW->reloadButtonConfig(); -} - void ButtonManager::select(QTreeWidgetItem* item) { QList selected = ui->buttonTreeWidget->selectedItems(); for(QTreeWidgetItem* selectedItem : selected) {