Added test (passed windows)

This commit is contained in:
Skycoder42
2016-02-05 23:25:36 +01:00
parent 4d71726f03
commit 3fe92f4859
6 changed files with 1392 additions and 68 deletions
+163 -1
View File
@@ -3,12 +3,174 @@
HotTestWidget::HotTestWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::HotTestWidget)
ui(new Ui::HotTestWidget),
hotkey_1(new QHotkey(this)),
hotkey_2(new QHotkey(this)),
hotkey_3(new QHotkey(this)),
hotkey_4(new QHotkey(this)),
hotkey_5(new QHotkey(this)),
testHotkeys()
{
ui->setupUi(this);
//1
connect(this->ui->hotkeyCheckbox_1, &QCheckBox::toggled,
this->hotkey_1, &QHotkey::setRegistered);
connect(this->ui->hotkeySequenceEdit_1, &QKeySequenceEdit::keySequenceChanged,
this, &HotTestWidget::setShortcut_1);
connect(this->hotkey_1, &QHotkey::activated,
this, &HotTestWidget::increase_1);
//2
connect(this->ui->hotkeyCheckbox_2, &QCheckBox::toggled,
this->hotkey_2, &QHotkey::setRegistered);
connect(this->ui->hotkeySequenceEdit_2, &QKeySequenceEdit::keySequenceChanged,
this, &HotTestWidget::setShortcut_2);
connect(this->hotkey_2, &QHotkey::activated,
this, &HotTestWidget::increase_2);
//3
connect(this->ui->hotkeyCheckbox_3, &QCheckBox::toggled,
this->hotkey_3, &QHotkey::setRegistered);
connect(this->ui->hotkeySequenceEdit_3, &QKeySequenceEdit::keySequenceChanged,
this, &HotTestWidget::setShortcut_3);
connect(this->hotkey_3, &QHotkey::activated,
this, &HotTestWidget::increase_3);
//4
connect(this->ui->hotkeyCheckbox_4, &QCheckBox::toggled,
this->hotkey_4, &QHotkey::setRegistered);
connect(this->ui->hotkeySequenceEdit_4, &QKeySequenceEdit::keySequenceChanged,
this, &HotTestWidget::setShortcut_4);
connect(this->hotkey_4, &QHotkey::activated,
this, &HotTestWidget::increase_4);
//5
connect(this->ui->hotkeyCheckbox_5, &QCheckBox::toggled,
this->hotkey_5, &QHotkey::setRegistered);
connect(this->ui->hotkeySequenceEdit_5, &QKeySequenceEdit::keySequenceChanged,
this, &HotTestWidget::setShortcut_5);
connect(this->hotkey_5, &QHotkey::activated,
this, &HotTestWidget::increase_5);
//test connections
this->testHotkeys += new QHotkey(Qt::Key_F, Qt::NoModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyFCheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_F12, Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyCtrlAltMetaF12CheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_Cancel, Qt::ControlModifier | Qt::ShiftModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyCtrlShiftCancelCheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_Delete, Qt::MetaModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyMetaDelCheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_NumLock, Qt::NoModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyNumlockCheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_5, Qt::ControlModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyCtrl5CheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_Tab, Qt::ShiftModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyShiftTabCheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_Comma, Qt::ShiftModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyShiftCheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_Semicolon, Qt::ShiftModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyShiftCheckBox_2, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_K, Qt::ShiftModifier | Qt::AltModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyShiftAltKCheckBox, &QCheckBox::toggle);
this->testHotkeys += new QHotkey(Qt::Key_K, Qt::ShiftModifier | Qt::AltModifier, false, this);
connect(this->testHotkeys.last(), &QHotkey::activated,
this->ui->hotkeyShiftAltKCheckBox_2, &QCheckBox::toggle);
}
HotTestWidget::~HotTestWidget()
{
delete ui;
}
void HotTestWidget::setShortcut_1(const QKeySequence &sequence)
{
this->hotkey_1->setShortcut(sequence, false);
}
void HotTestWidget::setShortcut_2(const QKeySequence &sequence)
{
this->hotkey_2->setShortcut(sequence, false);
}
void HotTestWidget::setShortcut_3(const QKeySequence &sequence)
{
this->hotkey_3->setShortcut(sequence, false);
}
void HotTestWidget::setShortcut_4(const QKeySequence &sequence)
{
this->hotkey_4->setShortcut(sequence, false);
}
void HotTestWidget::setShortcut_5(const QKeySequence &sequence)
{
this->hotkey_5->setShortcut(sequence, false);
}
void HotTestWidget::increase_1()
{
this->ui->hotkeyCount_1->display(this->ui->hotkeyCount_1->intValue() + 1);
}
void HotTestWidget::increase_2()
{
this->ui->hotkeyCount_2->display(this->ui->hotkeyCount_2->intValue() + 1);
}
void HotTestWidget::increase_3()
{
this->ui->hotkeyCount_3->display(this->ui->hotkeyCount_3->intValue() + 1);
}
void HotTestWidget::increase_4()
{
this->ui->hotkeyCount_4->display(this->ui->hotkeyCount_4->intValue() + 1);
}
void HotTestWidget::increase_5()
{
this->ui->hotkeyCount_5->display(this->ui->hotkeyCount_5->intValue() + 1);
}
void HotTestWidget::on_resetButton_1_clicked()
{
this->ui->hotkeyCount_1->display(0);
}
void HotTestWidget::on_resetButton_2_clicked()
{
this->ui->hotkeyCount_2->display(0);
}
void HotTestWidget::on_resetButton_3_clicked()
{
this->ui->hotkeyCount_3->display(0);
}
void HotTestWidget::on_resetButton_4_clicked()
{
this->ui->hotkeyCount_4->display(0);
}
void HotTestWidget::on_resetButton_5_clicked()
{
this->ui->hotkeyCount_5->display(0);
}
void HotTestWidget::on_groupBox_toggled(bool checked)
{
for(QHotkey *hotkey : this->testHotkeys)
hotkey->setRegistered(checked);
}
+30
View File
@@ -2,6 +2,7 @@
#define HOTTESTWIDGET_H
#include <QWidget>
#include <QHotkey>
namespace Ui {
class HotTestWidget;
@@ -15,8 +16,37 @@ public:
explicit HotTestWidget(QWidget *parent = 0);
~HotTestWidget();
private slots:
void setShortcut_1(const QKeySequence &sequence);
void setShortcut_2(const QKeySequence &sequence);
void setShortcut_3(const QKeySequence &sequence);
void setShortcut_4(const QKeySequence &sequence);
void setShortcut_5(const QKeySequence &sequence);
void increase_1();
void increase_2();
void increase_3();
void increase_4();
void increase_5();
void on_resetButton_1_clicked();
void on_resetButton_2_clicked();
void on_resetButton_3_clicked();
void on_resetButton_4_clicked();
void on_resetButton_5_clicked();
void on_groupBox_toggled(bool checked);
private:
Ui::HotTestWidget *ui;
QHotkey *hotkey_1;
QHotkey *hotkey_2;
QHotkey *hotkey_3;
QHotkey *hotkey_4;
QHotkey *hotkey_5;
QList<QHotkey*> testHotkeys;
};
#endif // HOTTESTWIDGET_H
File diff suppressed because it is too large Load Diff