added libs and oalist
[mines3d.git] / ui / qt / SettingsForm.cpp
blob69f8599689889fa14afd3e044ac4d20ecffd08f5
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()));
23 QObject::connect(ui.soundEffectsBtn, SIGNAL(clicked()), this, SLOT(soundEffectsBtn_Clicked()));
24 QObject::connect(ui.soundMusicBtn, SIGNAL(clicked()), this, SLOT(soundMusicBtn_Clicked()));
27 /* -------------------------------------------------------------------------- */
29 SettingsForm::~SettingsForm() {
33 /* -------------------------------------------------------------------------- */
35 /* nastavi vsem 4 spinum stejnou hodnotu enabled, tu vraci */
36 bool SettingsForm::setSpinsEnabled(bool value) {
37 ui.layersSpinBox->setEnabled(value);
38 ui.rowsSpinBox->setEnabled(value);
39 ui.columnsSpinBox->setEnabled(value);
40 ui.minesSpinBox->setEnabled(value);
41 return value;
44 /* -------------------------------------------------------------------------- */
46 /* nastavi vsem 4 spinum zadane hodnoty */
47 void SettingsForm::setSpinsValues(int layers, int rows, int columns, int mines) {
48 ui.layersSpinBox->setValue(layers);
49 ui.rowsSpinBox->setValue(rows);
50 ui.columnsSpinBox->setValue(columns);
51 ui.minesSpinBox->setValue(mines);
54 /* -------------------------------------------------------------------------- */
56 void SettingsForm::setSoundEffectsOn(bool value) {
57 ui.soundEffectsBtn->setText(value ? "Effects On" : "Effects Off");
58 ui.soundEffectsBtn->setChecked(value);
61 /* -------------------------------------------------------------------------- */
63 void SettingsForm::setSoundMusicType(EMusicType type) {
64 musicType = type;
66 switch(musicType) {
67 case MUSIC_NO:
68 ui.soundMusicBtn->setText("Music Off");
69 ui.soundMusicBtn->setChecked(false);
70 break;
71 case MUSIC_1:
72 ui.soundMusicBtn->setText("Music 1");
73 ui.soundMusicBtn->setChecked(true);
74 break;
75 case MUSIC_2:
76 ui.soundMusicBtn->setText("Music 2");
77 ui.soundMusicBtn->setChecked(true);
78 break;
82 /* -------------------------------------------------------------------------- */
84 bool SettingsForm::getSoundEffectsOn(void) {
85 return ui.soundEffectsBtn->isChecked();
88 /* -------------------------------------------------------------------------- */
90 EMusicType SettingsForm::getSoundMusicType(void) {
91 return musicType;
94 /* -------------------------------------------------------------------------- */
96 void SettingsForm::rookieRadio_Clicked(void) {
97 setSpinsEnabled(false);
98 setSpinsValues(PRESETS[0][0], PRESETS[0][1], PRESETS[0][2], PRESETS[0][3]);
101 /* -------------------------------------------------------------------------- */
103 void SettingsForm::advancedRadio_Clicked(void) {
104 setSpinsEnabled(false);
105 setSpinsValues(PRESETS[1][0], PRESETS[1][1], PRESETS[1][2], PRESETS[1][3]);
108 /* -------------------------------------------------------------------------- */
110 void SettingsForm::suicideRadio_Clicked(void) {
111 setSpinsEnabled(false);
112 setSpinsValues(PRESETS[2][0], PRESETS[2][1], PRESETS[2][2], PRESETS[2][3]);
115 /* -------------------------------------------------------------------------- */
117 void SettingsForm::customRadio_Clicked(void) {
118 setSpinsEnabled(true);
121 /* -------------------------------------------------------------------------- */
123 void SettingsForm::soundEffectsBtn_Clicked(void) {
124 setSoundEffectsOn(ui.soundEffectsBtn->isChecked());
127 /* -------------------------------------------------------------------------- */
129 void SettingsForm::soundMusicBtn_Clicked(void) {
130 switch(musicType) {
131 case MUSIC_NO: setSoundMusicType(MUSIC_1); break;
132 case MUSIC_1: setSoundMusicType(MUSIC_2); break;
133 case MUSIC_2: setSoundMusicType(MUSIC_NO); break;
137 /* -------------------------------------------------------------------------- */