author | unc0rr |
Mon, 18 Jun 2012 23:45:21 +0400 | |
changeset 7262 | 33e703cc7a7f |
parent 7153 | f0d055645ab2 |
child 7235 | baa69bd025d9 |
child 7313 | 162bc562335b |
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> |
471 | 25 |
|
184 | 26 |
#include "gameuiconfig.h" |
27 |
#include "hwform.h" |
|
5204 | 28 |
#include "pageoptions.h" |
29 |
#include "pagenetserver.h" |
|
184 | 30 |
#include "hwconsts.h" |
297 | 31 |
#include "fpsedit.h" |
5252 | 32 |
#include "HWApplication.h" |
184 | 33 |
|
301 | 34 |
GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
35 |
: QSettings(fileName, QSettings::IniFormat) |
184 | 36 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
37 |
Form = FormWidgets; |
184 | 38 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
39 |
connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool))); |
1235 | 40 |
|
3019 | 41 |
//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
|
42 |
resizeToConfigValues(); |
674 | 43 |
|
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
44 |
reloadValues(); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
45 |
} |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
46 |
|
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
47 |
void GameUIConfig::reloadValues(void) |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
48 |
{ |
3019 | 49 |
Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool()); |
2747 | 50 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
51 |
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
|
52 |
if (t < 0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
53 |
{ |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
} |
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 |
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
|
60 |
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
|
61 |
Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool()); |
3019 | 62 |
bool ffscr=value("frontend/fullscreen", false).toBool(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
63 |
Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr); |
301 | 64 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
65 |
Form->ui.pageOptions->SLQuality->setValue(value("video/quality", 5).toUInt()); |
3696 | 66 |
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
|
67 |
Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
68 |
Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool()); |
3019 | 69 |
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
|
70 |
Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool()); |
3019 | 71 |
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
|
72 |
Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt()); |
184 | 73 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
74 |
QString netNick = value("net/nick", "").toString(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
75 |
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
|
76 |
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
|
77 |
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
|
78 |
|
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
|
79 |
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
|
80 |
|
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
|
81 |
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
|
82 |
setNetPasswordLength(passLength); |
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
83 |
if (savePwd == false) { |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
84 |
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
|
85 |
Form->ui.pageOptions->editNetPassword->setText(""); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
86 |
setNetPasswordLength(0); |
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
87 |
} |
654 | 88 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
89 |
delete netHost; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
90 |
netHost = new QString(value("net/ip", "").toString()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
91 |
netPort = value("net/port", 46631).toUInt(); |
529 | 92 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
93 |
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
|
94 |
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
|
95 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
96 |
Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool()); |
3019 | 97 |
Form->ui.pageOptions->fpsedit->setValue(value("fps/limit", 27).toUInt()); |
529 | 98 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
99 |
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
|
100 |
Form->ui.pageOptions->CBNameWithDate->setChecked(value("misc/appendTimeToRecords", false).toBool()); |
2377 | 101 |
|
2395 | 102 |
#ifdef SPARKLE_ENABLED |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
103 |
Form->ui.pageOptions->CBAutoUpdate->setChecked(value("misc/autoUpdate", true).toBool()); |
2261 | 104 |
#endif |
2377 | 105 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
106 |
Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString())); |
2898 | 107 |
|
5252 | 108 |
depth = HWApplication::desktop()->depth(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
109 |
if (depth < 16) depth = 16; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
110 |
else if (depth > 16) depth = 32; |
184 | 111 |
} |
112 |
||
113 |
QStringList GameUIConfig::GetTeamsList() |
|
114 |
{ |
|
3333 | 115 |
QDir teamdir; |
116 |
teamdir.cd(cfgdir->absolutePath() + "/Teams"); |
|
4817 | 117 |
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
|
118 |
QStringList cleanedList; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
119 |
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
|
120 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
121 |
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
|
122 |
cleanedList.push_back(tmpTeamStr); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
123 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
124 |
return cleanedList; |
184 | 125 |
} |
126 |
||
1165
40eeae82e70b
correct restoring window size after fullscreen mode
displacer
parents:
1162
diff
changeset
|
127 |
void GameUIConfig::resizeToConfigValues() |
40eeae82e70b
correct restoring window size after fullscreen mode
displacer
parents:
1162
diff
changeset
|
128 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
129 |
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
|
130 |
} |
40eeae82e70b
correct restoring window size after fullscreen mode
displacer
parents:
1162
diff
changeset
|
131 |
|
184 | 132 |
void GameUIConfig::SaveOptions() |
133 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
134 |
setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
135 |
setValue("video/fullscreen", vid_Fullscreen()); |
1812 | 136 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
137 |
setValue("video/quality", Form->ui.pageOptions->SLQuality->value()); |
3696 | 138 |
setValue("video/stereo", stereoMode()); |
1812 | 139 |
|
3019 | 140 |
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
|
141 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
142 |
setValue("misc/weaponTooltips", Form->ui.pageOptions->WeaponTooltip->isChecked()); |
2747 | 143 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
144 |
bool ffscr = isFrontendFullscreen(); |
3019 | 145 |
setValue("frontend/fullscreen", ffscr); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
146 |
emit frontendFullscreen(ffscr); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
147 |
if (!ffscr) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
148 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
149 |
setValue("frontend/width", Form->width()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
150 |
setValue("frontend/height", Form->height()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
151 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
152 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
153 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
154 |
//resizeToConfigValues(); // TODO: why this has been made? |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
155 |
} |
301 | 156 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
157 |
setValue("audio/sound", isSoundEnabled()); |
3019 | 158 |
setValue("frontend/sound", isFrontendSoundEnabled()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
159 |
setValue("audio/music", isMusicEnabled()); |
3019 | 160 |
setValue("frontend/music", isFrontendMusicEnabled()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
161 |
setValue("audio/volume", Form->ui.pageOptions->volumeBox->value()); |
301 | 162 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
163 |
setValue("net/nick", netNick()); |
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
164 |
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
|
165 |
{ |
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
|
166 |
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
|
167 |
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
|
168 |
} |
6911
1cda333286e0
added savepassword checkbox to options page, which now reloads values at every acces
koda
parents:
6700
diff
changeset
|
169 |
setValue("net/savepassword", Form->ui.pageOptions->CBSavePassword->isChecked()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
170 |
setValue("net/ip", *netHost); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
171 |
setValue("net/port", netPort); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
172 |
setValue("net/servername", Form->ui.pageNetServer->leServerDescr->text()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
173 |
setValue("net/serverport", Form->ui.pageNetServer->sbPort->value()); |
301 | 174 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
175 |
setValue("fps/show", isShowFPSEnabled()); |
3019 | 176 |
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
|
177 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
178 |
setValue("misc/altdamage", isAltDamageEnabled()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
179 |
setValue("misc/appendTimeToRecords", appendDateTimeToRecordName()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
180 |
setValue("misc/locale", language()); |
2377 | 181 |
|
2395 | 182 |
#ifdef SPARKLE_ENABLED |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
183 |
setValue("misc/autoUpdate", isAutoUpdateEnabled()); |
2377 | 184 |
#endif |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2747
diff
changeset
|
185 |
Form->gameSettings->sync(); |
184 | 186 |
} |
187 |
||
2898 | 188 |
QString GameUIConfig::language() |
189 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
190 |
return Form->ui.pageOptions->CBLanguage->itemData(Form->ui.pageOptions->CBLanguage->currentIndex()).toString(); |
2898 | 191 |
} |
192 |
||
555 | 193 |
QRect GameUIConfig::vid_Resolution() |
184 | 194 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
195 |
QRect result(0, 0, 640, 480); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
196 |
QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x'); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
197 |
if (wh.size() == 2) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
198 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
199 |
result.setWidth(wh[0].toInt()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
200 |
result.setHeight(wh[1].toInt()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
201 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
202 |
return result; |
184 | 203 |
} |
204 |
||
205 |
bool GameUIConfig::vid_Fullscreen() |
|
206 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
207 |
return Form->ui.pageOptions->CBFullscreen->isChecked(); |
184 | 208 |
} |
209 |
||
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
210 |
quint32 GameUIConfig::translateQuality() |
1812 | 211 |
{ |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
212 |
quint32 rqNone = 0x00000000; // don't reduce quality |
3937 | 213 |
//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
|
214 |
quint32 rqBlurryLand = 0x00000002; // downscaled terrain |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
215 |
quint32 rqNoBackground = 0x00000004; // don't draw background |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
216 |
quint32 rqSimpleRope = 0x00000008; // avoid drawing rope |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
217 |
quint32 rq2DWater = 0x00000010; // disabe 3D water effect |
4809
9c7d5f802618
rearrange quality flags a little, disable snow rendering on rqLowRes
koda
parents:
3937
diff
changeset
|
218 |
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
|
219 |
quint32 rqKillFlakes = 0x00000040; // no flakes |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
220 |
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
|
221 |
quint32 rqPlainSplash = 0x00000100; // no droplets |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
222 |
quint32 rqClampLess = 0x00000200; // don't clamp textures |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
223 |
quint32 rqTooltipsOff = 0x00000400; // tooltips are not drawn |
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
224 |
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
|
225 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
226 |
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
|
227 |
|
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
228 |
switch (Form->ui.pageOptions->SLQuality->value()) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
229 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
230 |
case 5: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
231 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
232 |
case 4: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
233 |
result |= rqBlurryLand; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
234 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
235 |
case 3: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
236 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
237 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
238 |
case 2: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
239 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
240 |
rqAntiBoom | rqSlowMenu; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
241 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
242 |
case 1: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
243 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
244 |
rqAntiBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
245 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
246 |
case 0: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
247 |
result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
248 |
rqAntiBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank | |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
249 |
rqNoBackground | rqClampLess; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
250 |
break; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
251 |
default: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
252 |
fprintf(stderr,"unset value from slider"); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
253 |
break; |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
254 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
255 |
|
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
256 |
return result; |
1812 | 257 |
} |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
258 |
|
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
1812
diff
changeset
|
259 |
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
|
260 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
261 |
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
|
262 |
} |
1812 | 263 |
|
1162 | 264 |
bool GameUIConfig::isFrontendFullscreen() const |
265 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
266 |
return Form->ui.pageOptions->CBFrontendFullscreen->isChecked(); |
1162 | 267 |
} |
268 |
||
184 | 269 |
bool GameUIConfig::isSoundEnabled() |
270 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
271 |
return Form->ui.pageOptions->CBEnableSound->isChecked(); |
184 | 272 |
} |
2776 | 273 |
bool GameUIConfig::isFrontendSoundEnabled() |
274 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
275 |
return Form->ui.pageOptions->CBEnableFrontendSound->isChecked(); |
2776 | 276 |
} |
184 | 277 |
|
1129 | 278 |
bool GameUIConfig::isMusicEnabled() |
279 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
280 |
return Form->ui.pageOptions->CBEnableMusic->isChecked(); |
1129 | 281 |
} |
2776 | 282 |
bool GameUIConfig::isFrontendMusicEnabled() |
283 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
284 |
return Form->ui.pageOptions->CBEnableFrontendMusic->isChecked(); |
2776 | 285 |
} |
1129 | 286 |
|
297 | 287 |
bool GameUIConfig::isShowFPSEnabled() |
288 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
289 |
return Form->ui.pageOptions->CBShowFPS->isChecked(); |
297 | 290 |
} |
291 |
||
529 | 292 |
bool GameUIConfig::isAltDamageEnabled() |
293 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
294 |
return Form->ui.pageOptions->CBAltDamage->isChecked(); |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
295 |
} |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
296 |
|
3696 | 297 |
quint32 GameUIConfig::stereoMode() const |
3691 | 298 |
{ |
3696 | 299 |
return Form->ui.pageOptions->CBStereoMode->currentIndex(); |
3691 | 300 |
} |
301 |
||
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
302 |
bool GameUIConfig::appendDateTimeToRecordName() |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1235
diff
changeset
|
303 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
304 |
return Form->ui.pageOptions->CBNameWithDate->isChecked(); |
529 | 305 |
} |
306 |
||
2395 | 307 |
#ifdef SPARKLE_ENABLED |
2261 | 308 |
bool GameUIConfig::isAutoUpdateEnabled() |
309 |
{ |
|
310 |
return Form->ui.pageOptions->CBAutoUpdate->isChecked(); |
|
311 |
} |
|
312 |
#endif |
|
313 |
||
297 | 314 |
quint8 GameUIConfig::timerInterval() |
315 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
316 |
return 35 - Form->ui.pageOptions->fpsedit->value(); |
297 | 317 |
} |
603 | 318 |
|
319 |
quint8 GameUIConfig::bitDepth() |
|
320 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
321 |
return depth; |
603 | 322 |
} |
949 | 323 |
|
324 |
QString GameUIConfig::netNick() |
|
325 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
326 |
return Form->ui.pageOptions->editNetNick->text(); |
949 | 327 |
} |
1777 | 328 |
|
5390
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
329 |
void GameUIConfig::updNetNick() |
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
330 |
{ |
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
331 |
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
|
332 |
} |
f41e87de8989
(fix issue 126) moved initial nickname popup to the netconnection page
koda
parents:
5262
diff
changeset
|
333 |
|
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
|
334 |
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
|
335 |
{ |
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
|
336 |
return QCryptographicHash::hash(Form->ui.pageOptions->editNetPassword->text().toLatin1(), QCryptographicHash::Md5).toHex(); |
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
|
337 |
} |
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
|
338 |
|
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
|
339 |
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
|
340 |
{ |
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
|
341 |
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
|
342 |
} |
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
|
343 |
|
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
|
344 |
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
|
345 |
{ |
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
|
346 |
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
|
347 |
} |
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
|
348 |
|
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
|
349 |
// 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
|
350 |
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
|
351 |
{ |
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
|
352 |
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
|
353 |
{ |
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
|
354 |
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
|
355 |
{ |
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
|
356 |
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
|
357 |
{ |
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
|
358 |
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
|
359 |
} |
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
|
360 |
} |
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
|
361 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6583
diff
changeset
|
362 |
|
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
|
363 |
// 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
|
364 |
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
|
365 |
} |
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 |
|
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
|
367 |
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
|
368 |
{ |
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
|
369 |
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
|
370 |
{ |
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
|
371 |
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
|
372 |
} |
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
|
373 |
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
|
374 |
{ |
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
|
375 |
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
|
376 |
} |
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
|
377 |
} |
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
|
378 |
|
1777 | 379 |
quint8 GameUIConfig::volume() |
380 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
381 |
return Form->ui.pageOptions->volumeBox->value() * 128 / 100; |
1777 | 382 |
} |