Reset & Clear all shortcuts

This closes #1517
This commit is contained in:
marco 2015-09-16 13:26:50 +02:00
parent 8eacd85d68
commit 0ce38ea88e
7 changed files with 95 additions and 3 deletions

View file

@ -1,10 +1,17 @@
#include "shortcutstab.h"
#include "ui_shortcutstab.h"
#include "../settingscache.h"
#include <QMessageBox>
ShortcutsTab::ShortcutsTab() :
ui(new Ui::shortcutsTab)
{
ui->setupUi(this);
connect(ui->btnResetAll,SIGNAL(clicked()),this,SLOT(resetShortcuts()));
connect(ui->btnClearAll,SIGNAL(clicked()),this,SLOT(clearShortcuts()));
connect(&settingsCache->shortcuts(),SIGNAL(allShortCutsReset()),this,SLOT(refreshEdits()));
connect(&settingsCache->shortcuts(),SIGNAL(allShortCutsClear()),this,SLOT(afterClear()));
}
void ShortcutsTab::retranslateUi()
@ -16,3 +23,33 @@ ShortcutsTab::~ShortcutsTab()
{
delete ui;
}
void ShortcutsTab::resetShortcuts()
{
settingsCache->shortcuts().resetAllShortcuts();
}
void ShortcutsTab::refreshEdits()
{
QList<SequenceEdit*> edits = this->findChildren<SequenceEdit*>();
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();
}
void ShortcutsTab::afterClear()
{
QList<SequenceEdit*> edits = this->findChildren<SequenceEdit*>();
for(int i= 0; i < edits.length(); ++i)
{
edits.at(i)->clear();
}
QMessageBox::information(this,tr("Shortcuts reset"),tr("All shortcuts have been cleared"));
}