author | Medo <smaxein@googlemail.com> |
Mon, 27 Aug 2012 17:40:16 +0200 | |
changeset 7613 | ce6ead3327b2 |
parent 7541 | e51b11349637 |
child 7565 | 00568d3054d0 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
6952 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include <QMessageBox> |
|
471 | 20 |
#include <QCheckBox> |
21 |
#include <QLineEdit> |
|
603 | 22 |
#include <QDesktopWidget> |
2334
3cf9290a518e
Ask user for a nickname on first run, suggest login name
unc0rr
parents:
2276
diff
changeset
|
23 |
#include <QInputDialog> |
5229
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
24 |
#include <QCryptographicHash> |
7541
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
25 |
#include <QStandardItemModel> |
471 | 26 |
|
184 | 27 |
#include "gameuiconfig.h" |
28 |
#include "hwform.h" |
|
5204 | 29 |
#include "pageoptions.h" |
30 |
#include "pagenetserver.h" |
|
184 | 31 |
#include "hwconsts.h" |
297 | 32 |
#include "fpsedit.h" |
5252 | 33 |
#include "HWApplication.h" |
7541
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
34 |
#include "DataManager.h" |
184 | 35 |
|
301 | 36 |
GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
37 |
: QSettings(fileName, QSettings::IniFormat) |
184 | 38 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
39 |
Form = FormWidgets; |
184 | 40 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
41 |
connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool))); |
1235 | 42 |
|
3019 | 43 |
//Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
44 |
resizeToConfigValues(); |
674 | 45 |
|
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
46 |
reloadValues(); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
47 |
} |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
48 |
|
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
49 |
void GameUIConfig::reloadValues(void) |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
50 |
{ |
3019 | 51 |
Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool()); |
2747 | 52 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
53 |
int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString()); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
54 |
if (t < 0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
55 |
{ |
5237
963d787a25c2
If 2 or more resolutions are available, use the 2nd in the list. This should (usually) be smaller than the desktop resolution, which should reduce noob fail (not realising part of interface is obscured)
nemo
parents:
5229
diff
changeset
|
56 |
if (Form->ui.pageOptions->CBResolution->count() > 1) |
963d787a25c2
If 2 or more resolutions are available, use the 2nd in the list. This should (usually) be smaller than the desktop resolution, which should reduce noob fail (not realising part of interface is obscured)
nemo
parents:
5229
diff
changeset
|
57 |
Form->ui.pageOptions->CBResolution->setCurrentIndex(1); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
58 |
else |
5237
963d787a25c2
If 2 or more resolutions are available, use the 2nd in the list. This should (usually) be smaller than the desktop resolution, which should reduce noob fail (not realising part of interface is obscured)
nemo
parents:
5229
diff
changeset
|
59 |
Form->ui.pageOptions->CBResolution->setCurrentIndex(0); |
963d787a25c2
If 2 or more resolutions are available, use the 2nd in the list. This should (usually) be smaller than the desktop resolution, which should reduce noob fail (not realising part of interface is obscured)
nemo
parents:
5229
diff
changeset
|
60 |
} |
963d787a25c2
If 2 or more resolutions are available, use the 2nd in the list. This should (usually) be smaller than the desktop resolution, which should reduce noob fail (not realising part of interface is obscured)
nemo
parents:
5229
diff
changeset
|
61 |
else Form->ui.pageOptions->CBResolution->setCurrentIndex(t); |
963d787a25c2
If 2 or more resolutions are available, use the 2nd in the list. This should (usually) be smaller than the desktop resolution, which should reduce noob fail (not realising part of interface is obscured)
nemo
parents:
5229
diff
changeset
|
62 |
Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 1 : t); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
63 |
Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool()); |
3019 | 64 |
bool ffscr=value("frontend/fullscreen", false).toBool(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
65 |
Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr); |
301 | 66 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
67 |
Form->ui.pageOptions->SLQuality->setValue(value("video/quality", 5).toUInt()); |
3696 | 68 |
Form->ui.pageOptions->CBStereoMode->setCurrentIndex(value("video/stereo", 0).toUInt()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
69 |
Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
70 |
Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool()); |
3019 | 71 |
Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool()); |
7153
f0d055645ab2
minor tweaks for options page; should improve readability at small window size... a bit...
sheepluva
parents:
6952
diff
changeset
|
72 |
Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool()); |
3019 | 73 |
Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
74 |
Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt()); |
184 | 75 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
76 |
QString netNick = value("net/nick", "").toString(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
77 |
Form->ui.pageOptions->editNetNick->setText(netNick); |
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
78 |
bool savePwd = value("net/savepassword",true).toBool(); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
79 |
Form->ui.pageOptions->CBSavePassword->setChecked(savePwd); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
80 |
|
5260
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
81 |
Form->ui.pageOptions->editNetPassword->installEventFilter(this); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
82 |
|
5229
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
83 |
int passLength = value("net/passwordlength", 0).toInt(); |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
84 |
setNetPasswordLength(passLength); |
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
85 |
if (savePwd == false) { |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
86 |
Form->ui.pageOptions->editNetPassword->setEnabled(savePwd); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
87 |
Form->ui.pageOptions->editNetPassword->setText(""); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
88 |
setNetPasswordLength(0); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
89 |
} |
654 | 90 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
91 |
delete netHost; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
92 |
netHost = new QString(value("net/ip", "").toString()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
93 |
netPort = value("net/port", 46631).toUInt(); |
529 | 94 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
95 |
Form->ui.pageNetServer->leServerDescr->setText(value("net/servername", "hedgewars server").toString()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
96 |
Form->ui.pageNetServer->sbPort->setValue(value("net/serverport", 46631).toUInt()); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
654
diff
changeset
|
97 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
98 |
Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool()); |
3019 | 99 |
Form->ui.pageOptions->fpsedit->setValue(value("fps/limit", 27).toUInt()); |
529 | 100 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
101 |
Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
102 |
Form->ui.pageOptions->CBNameWithDate->setChecked(value("misc/appendTimeToRecords", false).toBool()); |
2377 | 103 |
|
2395 | 104 |
#ifdef SPARKLE_ENABLED |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
105 |
Form->ui.pageOptions->CBAutoUpdate->setChecked(value("misc/autoUpdate", true).toBool()); |
2261 | 106 |
#endif |
2377 | 107 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
108 |
Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString())); |
2898 | 109 |
|
5252 | 110 |
depth = HWApplication::desktop()->depth(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
111 |
if (depth < 16) depth = 16; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
112 |
else if (depth > 16) depth = 32; |
7541
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
113 |
|
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
114 |
{ // load colors |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
115 |
QStandardItemModel * model = DataManager::instance().colorsModel(); |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
116 |
for(int i = model->rowCount() - 1; i >= 0; --i) |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
117 |
model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data().value<QColor>()).value<QColor>())); |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
118 |
} |
184 | 119 |
} |
120 |
||
121 |
QStringList GameUIConfig::GetTeamsList() |
|
122 |
{ |
|
3333 | 123 |
QDir teamdir; |
124 |
teamdir.cd(cfgdir->absolutePath() + "/Teams"); |
|
4817 | 125 |
QStringList teamslist = teamdir.entryList(QStringList("*.hwt"),QDir::Files|QDir::Hidden); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
126 |
QStringList cleanedList; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
127 |
for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
128 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
129 |
QString tmpTeamStr=(*it).replace(QRegExp("^(.*)\\.hwt$"), "\\1"); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
130 |
cleanedList.push_back(tmpTeamStr); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
131 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
132 |
return cleanedList; |
184 | 133 |
} |
134 |
||
1165
40eeae82e70b
correct restoring window size after fullscreen mode
displacer
parents:
1162
diff
changeset
|
135 |
void GameUIConfig::resizeToConfigValues() |
40eeae82e70b
correct restoring window size after fullscreen mode
displacer
parents:
1162
diff
changeset
|
136 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
137 |
Form->resize(value("frontend/width", 800).toUInt(), value("frontend/height", 600).toUInt()); |
1165
40eeae82e70b
correct restoring window size after fullscreen mode
displacer
parents:
1162
diff
changeset
|
138 |
} |
40eeae82e70b
correct restoring window size after fullscreen mode
displacer
parents:
1162
diff
changeset
|
139 |
|
184 | 140 |
void GameUIConfig::SaveOptions() |
141 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
142 |
setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
143 |
setValue("video/fullscreen", vid_Fullscreen()); |
1812 | 144 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
145 |
setValue("video/quality", Form->ui.pageOptions->SLQuality->value()); |
3696 | 146 |
setValue("video/stereo", stereoMode()); |
1812 | 147 |
|
3019 | 148 |
setValue("frontend/effects", isFrontendEffects()); |
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
1812
diff
changeset
|
149 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
150 |
setValue("misc/weaponTooltips", Form->ui.pageOptions->WeaponTooltip->isChecked()); |
2747 | 151 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
152 |
bool ffscr = isFrontendFullscreen(); |
3019 | 153 |
setValue("frontend/fullscreen", ffscr); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
154 |
emit frontendFullscreen(ffscr); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
155 |
if (!ffscr) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
156 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
157 |
setValue("frontend/width", Form->width()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
158 |
setValue("frontend/height", Form->height()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
159 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
160 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
161 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
162 |
//resizeToConfigValues(); // TODO: why this has been made? |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
163 |
} |
301 | 164 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
165 |
setValue("audio/sound", isSoundEnabled()); |
3019 | 166 |
setValue("frontend/sound", isFrontendSoundEnabled()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
167 |
setValue("audio/music", isMusicEnabled()); |
3019 | 168 |
setValue("frontend/music", isFrontendMusicEnabled()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
169 |
setValue("audio/volume", Form->ui.pageOptions->volumeBox->value()); |
301 | 170 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
171 |
setValue("net/nick", netNick()); |
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
172 |
if (netPasswordIsValid() && Form->ui.pageOptions->CBSavePassword->isChecked()) |
5229
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
173 |
{ |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
174 |
setValue("net/passwordhash", netPasswordHash()); |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
175 |
setValue("net/passwordlength", netPasswordLength()); |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
176 |
} |
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
177 |
setValue("net/savepassword", Form->ui.pageOptions->CBSavePassword->isChecked()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
178 |
setValue("net/ip", *netHost); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
179 |
setValue("net/port", netPort); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
180 |
setValue("net/servername", Form->ui.pageNetServer->leServerDescr->text()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
181 |
setValue("net/serverport", Form->ui.pageNetServer->sbPort->value()); |
301 | 182 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
183 |
setValue("fps/show", isShowFPSEnabled()); |
3019 | 184 |
setValue("fps/limit", Form->ui.pageOptions->fpsedit->value()); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
185 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
186 |
setValue("misc/altdamage", isAltDamageEnabled()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
187 |
setValue("misc/appendTimeToRecords", appendDateTimeToRecordName()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
188 |
setValue("misc/locale", language()); |
2377 | 189 |
|
2395 | 190 |
#ifdef SPARKLE_ENABLED |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
191 |
setValue("misc/autoUpdate", isAutoUpdateEnabled()); |
2377 | 192 |
#endif |
7541
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
193 |
|
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
194 |
{ // save colors |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
195 |
QStandardItemModel * model = DataManager::instance().colorsModel(); |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
196 |
for(int i = model->rowCount() - 1; i >= 0; --i) |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
197 |
setValue(QString("colors/color%1").arg(i), model->item(i)->data()); |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
198 |
} |
e51b11349637
Allow customization of colors in ui, store custom colors in config
unc0rr
parents:
7313
diff
changeset
|
199 |
|
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2747
diff
changeset
|
200 |
Form->gameSettings->sync(); |
184 | 201 |
} |
202 |
||
2898 | 203 |
QString GameUIConfig::language() |
204 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
205 |
return Form->ui.pageOptions->CBLanguage->itemData(Form->ui.pageOptions->CBLanguage->currentIndex()).toString(); |
2898 | 206 |
} |
207 |
||
555 | 208 |
QRect GameUIConfig::vid_Resolution() |
184 | 209 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
210 |
QRect result(0, 0, 640, 480); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
211 |
QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x'); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
212 |
if (wh.size() == 2) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
213 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
214 |
result.setWidth(wh[0].toInt()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
215 |
result.setHeight(wh[1].toInt()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
216 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
217 |
return result; |
184 | 218 |
} |
219 |
||
220 |
bool GameUIConfig::vid_Fullscreen() |
|
221 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
222 |
return Form->ui.pageOptions->CBFullscreen->isChecked(); |
184 | 223 |
} |
224 |
||
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
225 |
quint32 GameUIConfig::translateQuality() |
1812 | 226 |
{ |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
227 |
quint32 rqNone = 0x00000000; // don't reduce quality |
3937 | 228 |
//quint32 rqLowRes = 0x00000001; // use half land array |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
229 |
quint32 rqBlurryLand = 0x00000002; // downscaled terrain |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
230 |
quint32 rqNoBackground = 0x00000004; // don't draw background |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
231 |
quint32 rqSimpleRope = 0x00000008; // avoid drawing rope |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
232 |
quint32 rq2DWater = 0x00000010; // disabe 3D water effect |
4809
9c7d5f802618
rearrange quality flags a little, disable snow rendering on rqLowRes
koda
parents:
3937
diff
changeset
|
233 |
quint32 rqAntiBoom = 0x00000020; // no fancy explosion effects |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
234 |
quint32 rqKillFlakes = 0x00000040; // no flakes |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
235 |
quint32 rqSlowMenu = 0x00000080; // ammomenu appears with no animation |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
236 |
quint32 rqPlainSplash = 0x00000100; // no droplets |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
237 |
quint32 rqClampLess = 0x00000200; // don't clamp textures |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
238 |
quint32 rqTooltipsOff = 0x00000400; // tooltips are not drawn |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
239 |
quint32 rqDesyncVBlank = 0x00000800; // don't sync on vblank |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
240 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
241 |
quint32 result = (Form->ui.pageOptions->WeaponTooltip->isChecked()) ? rqNone : rqTooltipsOff; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
242 |
|
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
243 |
switch (Form->ui.pageOptions->SLQuality->value()) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
244 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
245 |
case 5: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
246 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
247 |
case 4: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
248 |
result |= rqBlurryLand; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
249 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
250 |
case 3: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
251 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
252 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
253 |
case 2: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
254 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
255 |
rqAntiBoom | rqSlowMenu; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
256 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
257 |
case 1: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
258 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
259 |
rqAntiBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
260 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
261 |
case 0: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
262 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
263 |
rqAntiBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
264 |
rqNoBackground | rqClampLess; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
265 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
266 |
default: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
267 |
fprintf(stderr,"unset value from slider"); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
268 |
break; |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
269 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
270 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
271 |
return result; |
1812 | 272 |
} |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
273 |
|
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
1812
diff
changeset
|
274 |
bool GameUIConfig::isFrontendEffects() const |
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
1812
diff
changeset
|
275 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
276 |
return Form->ui.pageOptions->CBFrontendEffects->isChecked(); |
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
1812
diff
changeset
|
277 |
} |
1812 | 278 |
|
1162 | 279 |
bool GameUIConfig::isFrontendFullscreen() const |
280 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
281 |
return Form->ui.pageOptions->CBFrontendFullscreen->isChecked(); |
1162 | 282 |
} |
283 |
||
184 | 284 |
bool GameUIConfig::isSoundEnabled() |
285 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
286 |
return Form->ui.pageOptions->CBEnableSound->isChecked(); |
184 | 287 |
} |
2776 | 288 |
bool GameUIConfig::isFrontendSoundEnabled() |
289 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
290 |
return Form->ui.pageOptions->CBEnableFrontendSound->isChecked(); |
2776 | 291 |
} |
184 | 292 |
|
1129 | 293 |
bool GameUIConfig::isMusicEnabled() |
294 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
295 |
return Form->ui.pageOptions->CBEnableMusic->isChecked(); |
1129 | 296 |
} |
2776 | 297 |
bool GameUIConfig::isFrontendMusicEnabled() |
298 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
299 |
return Form->ui.pageOptions->CBEnableFrontendMusic->isChecked(); |
2776 | 300 |
} |
1129 | 301 |
|
297 | 302 |
bool GameUIConfig::isShowFPSEnabled() |
303 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
304 |
return Form->ui.pageOptions->CBShowFPS->isChecked(); |
297 | 305 |
} |
306 |
||
529 | 307 |
bool GameUIConfig::isAltDamageEnabled() |
308 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
309 |
return Form->ui.pageOptions->CBAltDamage->isChecked(); |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
310 |
} |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
311 |
|
3696 | 312 |
quint32 GameUIConfig::stereoMode() const |
3691 | 313 |
{ |
3696 | 314 |
return Form->ui.pageOptions->CBStereoMode->currentIndex(); |
3691 | 315 |
} |
316 |
||
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
317 |
bool GameUIConfig::appendDateTimeToRecordName() |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
318 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
319 |
return Form->ui.pageOptions->CBNameWithDate->isChecked(); |
529 | 320 |
} |
321 |
||
2395 | 322 |
#ifdef SPARKLE_ENABLED |
2261 | 323 |
bool GameUIConfig::isAutoUpdateEnabled() |
324 |
{ |
|
325 |
return Form->ui.pageOptions->CBAutoUpdate->isChecked(); |
|
326 |
} |
|
327 |
#endif |
|
328 |
||
297 | 329 |
quint8 GameUIConfig::timerInterval() |
330 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
331 |
return 35 - Form->ui.pageOptions->fpsedit->value(); |
297 | 332 |
} |
603 | 333 |
|
334 |
quint8 GameUIConfig::bitDepth() |
|
335 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
336 |
return depth; |
603 | 337 |
} |
949 | 338 |
|
339 |
QString GameUIConfig::netNick() |
|
340 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
341 |
return Form->ui.pageOptions->editNetNick->text(); |
949 | 342 |
} |
1777 | 343 |
|
5390
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
344 |
void GameUIConfig::updNetNick() |
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
345 |
{ |
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
346 |
Form->ui.pageOptions->editNetNick->setText(value("net/nick", "").toString()); |
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
347 |
} |
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
348 |
|
5229
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
349 |
QByteArray GameUIConfig::netPasswordHash() |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
350 |
{ |
7313
162bc562335b
Use toUtf8 instead TODO - find out 'sactly what the website is using for hashes.
nemo
parents:
7153
diff
changeset
|
351 |
return QCryptographicHash::hash(Form->ui.pageOptions->editNetPassword->text().toUtf8(), QCryptographicHash::Md5).toHex(); |
5229
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
352 |
} |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
353 |
|
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
354 |
int GameUIConfig::netPasswordLength() |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
355 |
{ |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
356 |
return Form->ui.pageOptions->editNetPassword->text().size(); |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
357 |
} |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
358 |
|
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
359 |
bool GameUIConfig::netPasswordIsValid() |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
360 |
{ |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
361 |
return (netPasswordLength() == 0 || Form->ui.pageOptions->editNetPassword->text() != QString(netPasswordLength(), '\0')); |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
362 |
} |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
363 |
|
5260
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
364 |
// When hedgewars launches, the password field is set with null characters. If the user tries to edit the field and there are such characters, then clear the field |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
365 |
bool GameUIConfig::eventFilter(QObject *object, QEvent *event) |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
366 |
{ |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
367 |
if (event->type() == QEvent::FocusIn) |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
368 |
{ |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
369 |
if ((QLineEdit *)object == Form->ui.pageOptions->editNetPassword) |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
370 |
{ |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
371 |
if (!netPasswordIsValid()) |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
372 |
{ |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
373 |
Form->ui.pageOptions->editNetPassword->clear(); |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
374 |
} |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
375 |
} |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
376 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
377 |
|
5260
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
378 |
// Don't filter anything |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
379 |
return false; |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
380 |
} |
f50f620771ee
When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents:
5252
diff
changeset
|
381 |
|
5229
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
382 |
void GameUIConfig::setNetPasswordLength(int passwordLength) |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
383 |
{ |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
384 |
if (passwordLength > 0) |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
385 |
{ |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
386 |
Form->ui.pageOptions->editNetPassword->setText(QString(passwordLength, '\0')); |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
387 |
} |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
388 |
else |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
389 |
{ |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
390 |
Form->ui.pageOptions->editNetPassword->setText(""); |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
391 |
} |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
392 |
} |
148d581b17ab
Attempt to fix issue 125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
Zorg <zorgiepoo@gmail.com>
parents:
5204
diff
changeset
|
393 |
|
1777 | 394 |
quint8 GameUIConfig::volume() |
395 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
396 |
return Form->ui.pageOptions->volumeBox->value() * 128 / 100; |
1777 | 397 |
} |