AboutForm.ui: About dialog for mines3d v2.
[mines3d.git] / ui / qt / SettingsForm.cpp
blobe22ce151c7c20792df56dbac698ecff95e31449a
1 /*
2 * File: SettingsForm.cpp
3 * Created: 11.1.2010
4 * Author: Petr Kubizňák
5 * Purpose:
6 */
8 /* -------------------------------------------------------------------------- */
10 #include "SettingsForm.h"
11 #include "../../core/board.h"
13 /* -------------------------------------------------------------------------- */
15 SettingsForm::SettingsForm() {
16 ui.setupUi(this);
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);
38 return 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 /* -------------------------------------------------------------------------- */