2 * File: SettingsForm.cpp
4 * Author: Petr Kubizňák
8 /* -------------------------------------------------------------------------- */
10 #include "SettingsForm.h"
11 #include "../../core/board.h"
13 /* -------------------------------------------------------------------------- */
15 SettingsForm::SettingsForm() {
18 QObject::connect(ui
.rookieRadio
, SIGNAL(clicked()), this, SLOT(rookieRadio_Clicked()));
19 QObject::connect(ui
.advancedRadio
, SIGNAL(clicked()), this, SLOT(advancedRadio_Clicked()));
20 QObject::connect(ui
.suicideRadio
, SIGNAL(clicked()), this, SLOT(suicideRadio_Clicked()));
21 QObject::connect(ui
.customRadio
, SIGNAL(clicked()), this, SLOT(customRadio_Clicked()));
24 /* -------------------------------------------------------------------------- */
26 SettingsForm::~SettingsForm() {
30 /* -------------------------------------------------------------------------- */
32 /* nastavi vsem 4 spinum stejnou hodnotu enabled, tu vraci */
33 bool SettingsForm::setSpinsEnabled(bool value
) {
34 ui
.layersSpinBox
->setEnabled(value
);
35 ui
.rowsSpinBox
->setEnabled(value
);
36 ui
.columnsSpinBox
->setEnabled(value
);
37 ui
.minesSpinBox
->setEnabled(value
);
41 /* -------------------------------------------------------------------------- */
43 /* nastavi vsem 4 spinum zadane hodnoty */
44 void SettingsForm::setSpinsValues(int layers
, int rows
, int columns
, int mines
) {
45 ui
.layersSpinBox
->setValue(layers
);
46 ui
.rowsSpinBox
->setValue(rows
);
47 ui
.columnsSpinBox
->setValue(columns
);
48 ui
.minesSpinBox
->setValue(mines
);
51 /* -------------------------------------------------------------------------- */
53 void SettingsForm::rookieRadio_Clicked(void) {
54 setSpinsEnabled(false);
55 setSpinsValues(PRESETS
[0][0], PRESETS
[0][1], PRESETS
[0][2], PRESETS
[0][3]);
58 /* -------------------------------------------------------------------------- */
60 void SettingsForm::advancedRadio_Clicked(void) {
61 setSpinsEnabled(false);
62 setSpinsValues(PRESETS
[1][0], PRESETS
[1][1], PRESETS
[1][2], PRESETS
[1][3]);
65 /* -------------------------------------------------------------------------- */
67 void SettingsForm::suicideRadio_Clicked(void) {
68 setSpinsEnabled(false);
69 setSpinsValues(PRESETS
[2][0], PRESETS
[2][1], PRESETS
[2][2], PRESETS
[2][3]);
72 /* -------------------------------------------------------------------------- */
74 void SettingsForm::customRadio_Clicked(void) {
75 setSpinsEnabled(true);
78 /* -------------------------------------------------------------------------- */