mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
parent
8eacd85d68
commit
0ce38ea88e
7 changed files with 95 additions and 3 deletions
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue