-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSettingsWindow.cpp
More file actions
162 lines (136 loc) · 4.73 KB
/
SettingsWindow.cpp
File metadata and controls
162 lines (136 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#include "SettingsWindow.h"
#include "ui_SettingsWindow.h"
#include "Game.h"
#include "Defines.h"
#include "StyleSheet.h"
#include <QMessageBox>
#include <QDebug>
#include <QTimer>
SettingsWindow::SettingsWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::SettingsWindow)
{
ui->setupUi(this);
if(gameInfo.getIsLTARGame()) ui->radioButton_LtarMode ->setChecked(true);
else ui->radioButton_NormalMode ->setChecked(true);
if(gameInfo.getIsIndoorViewMode()) ui->radioButton_IndoorMode ->setChecked(true);
else ui->radioButton_OutdoorMode ->setChecked(true);
qDebug() << "SettingsWindow::SettingsWindow() - isIndoorViewMode =" << gameInfo.getIsIndoorViewMode();
if(gameInfo.getCumulativeScoreMode()) ui->btn_CumulativeScores ->setChecked(true);
else ui->btn_CumulativeScores ->setChecked(false);
if(gameInfo.getPowerSaveMode()) ui->btn_PowerSaveMode ->setChecked(true);
else ui->btn_PowerSaveMode ->setChecked(false);
int timeOutValue = gameInfo.getCountDownTime();
ui->sldr_CountDownTime->setValue(timeOutValue);
ui->btn_About->setText("About\n" + VERSION_NUMBER + " - " + BUILD_NUMBER);
}
SettingsWindow::~SettingsWindow()
{
delete ui;
}
void SettingsWindow::on_btn_Close_clicked()
{
delete(this);
}
void SettingsWindow::on_btn_AdjustScoring_clicked()
{
emit adjustScoring();
}
void SettingsWindow::on_btn_LoadFile_clicked()
{
emit loadFile();
}
void SettingsWindow::on_btn_SaveFile_clicked()
{
emit saveFile();
}
void SettingsWindow::on_btn_About_clicked()
{
emit showAboutBox();
}
void SettingsWindow::on_radioButton_NormalMode_clicked()
{
emit setLtarMode(false);
qInfo() << "SettingsWindow::on_radioButton_NormalMode_clicked() - Normal Mode Active";
}
void SettingsWindow::on_radioButton_LtarMode_clicked()
{
emit setLtarMode(true);
qInfo() << "SettingsWindow::on_radioButton_LtarMode_clicked() - LTAR Mode Active";
}
void SettingsWindow::on_radioButton_IndoorMode_clicked()
{
emit setOutdoorMode(false);
qDebug() << "TimerStart";
QTimer::singleShot(100, this, SLOT(refreshDisplay( )));
}
void SettingsWindow::on_radioButton_OutdoorMode_clicked()
{
emit setOutdoorMode(true);
qDebug() << "TimerStart";
QTimer::singleShot(100, this, SLOT(refreshDisplay( )));
}
void SettingsWindow::on_sldr_CountDownTime_valueChanged(int value)
{
//gameInfo.setCountDownTime(value);
qDebug() << "SettingsWindow::on_sldr_CountDownTime_valueChanged(int value)" << value;
ui->label_CountDownTime->setText(QString::number(value));
gameInfo.setCountDownTime(value);
}
void SettingsWindow::on_btn_ShutDown_clicked()
{
ui->btn_About ->setEnabled(false);
ui->btn_AdjustScoring ->setEnabled(false);
ui->btn_Close ->setEnabled(false);
ui->btn_LoadFile ->setEnabled(false);
ui->btn_SaveFile ->setEnabled(false);
ui->btn_ShutDown ->setEnabled(false);
ui->sldr_CountDownTime ->setEnabled(false);
ui->frame ->setEnabled(false);
ui->frame_2 ->setEnabled(false);
ui->radioButton_IndoorMode ->setEnabled(false);
ui->radioButton_OutdoorMode ->setEnabled(false);
ui->radioButton_LtarMode ->setEnabled(false);
ui->radioButton_NormalMode ->setEnabled(false);
emit exitApp();
}
void SettingsWindow::refreshDisplay()
{
qDebug() << "SettingsWindow::refreshDisplay() called";
QWidget::update();
}
void SettingsWindow::on_btn_CumulativeScores_clicked()
{
if(ui->btn_CumulativeScores->isChecked()) gameInfo.setCumulativeScoreMode(true);
else gameInfo.setCumulativeScoreMode(false);
if(gameInfo.getCumulativeScoreMode()) qInfo() << "SettingsWindow::on_btn_CumulativeScores_clicked() - Cumulative Scoring is Active";
else qInfo() << "SettingsWindow::on_btn_CumulativeScores_clicked() - Cumulative Scoring is Disabled";
}
void SettingsWindow::on_btn_DoNotPressThisButton_clicked()
{
//I always wanted to add this homage to HHGG into a product, so here it is.
QMessageBox::critical(this,"WARNING","Please do not press this button again.");
}
void SettingsWindow::on_btn_IncFont_clicked()
{
gameInfo.setFontSize((gameInfo.getFontSize()+5));
myStyleSheet.setFontSizes();
myStyleSheet.updateStyleSheet();
myStyleSheet.setCurrentCSS(myStyleSheet.getCurrentCSS());
if (myStyleSheet.getCurrentCSS() == myStyleSheet.CssDark) emit setOutdoorMode(false);
else emit setOutdoorMode(true);
}
void SettingsWindow::on_btn_DecFont_clicked()
{
gameInfo.setFontSize(gameInfo.getFontSize()-5);
myStyleSheet.setFontSizes();
myStyleSheet.updateStyleSheet();
myStyleSheet.setCurrentCSS(myStyleSheet.getCurrentCSS());
if (myStyleSheet.getCurrentCSS() == myStyleSheet.CssDark) emit setOutdoorMode(false);
else emit setOutdoorMode(true);
}
void SettingsWindow::on_btn_PowerSaveMode_clicked()
{
if(ui->btn_PowerSaveMode->isChecked()) gameInfo.setPowerSaveMode(true);
else gameInfo.setPowerSaveMode(false);
}