~ubuntu-branches/ubuntu/trusty/hedgewars/trusty-proposed

« back to all changes in this revision

Viewing changes to QTfrontend/pageoptions.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry E. Oboukhov
  • Date: 2011-11-20 18:31:17 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20111120183117-pjhz1n2pvnmxa246
Tags: 0.9.17-1
* [Paul Wise]
 * Mention the homing bee in the package description (Closes: #577092)
 * Also install the hwengine desktop file (LP: #811770)
 * Depend on ttf-dejavu-core since it is smaller
 * Depend on ttf-wqy-zenhei instead of embedding a copy of it
* [Dmitry E. Oboukhov]
 * New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Hedgewars, a free turn based strategy game
3
 
 * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com>
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 <QGridLayout>
20
 
#include <QPushButton>
21
 
#include <QGroupBox>
22
 
#include <QComboBox>
23
 
#include <QCheckBox>
24
 
#include <QLabel>
25
 
#include <QLineEdit>
26
 
#include <QSpinBox>
27
 
#include <QTextBrowser>
28
 
#include <QTableWidget>
29
 
#include <QSlider>
30
 
 
31
 
#include "pageoptions.h"
32
 
#include "hwconsts.h"
33
 
#include "fpsedit.h"
34
 
#include "igbox.h"
35
 
 
36
 
PageOptions::PageOptions(QWidget* parent) :
37
 
  AbstractPage(parent)
38
 
{
39
 
    QGridLayout * pageLayout = new QGridLayout(this);
40
 
    pageLayout->setColumnStretch(0, 100);
41
 
    pageLayout->setColumnStretch(1, 100);
42
 
    pageLayout->setColumnStretch(2, 100);
43
 
    pageLayout->setRowStretch(0, 0);
44
 
    //pageLayout->setRowStretch(1, 100);
45
 
    pageLayout->setRowStretch(2, 0);
46
 
    pageLayout->setContentsMargins(7, 7, 7, 0);
47
 
    pageLayout->setSpacing(0);
48
 
 
49
 
 
50
 
    QGroupBox * gbTwoBoxes = new QGroupBox(this);
51
 
    pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3);
52
 
    QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes);
53
 
    gbTBLayout->setMargin(0);
54
 
    gbTBLayout->setSpacing(0);
55
 
    gbTBLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
56
 
 
57
 
    QPixmap pmNew(":/res/new.png");
58
 
    QPixmap pmEdit(":/res/edit.png");
59
 
    QPixmap pmDelete(":/res/delete.png");
60
 
 
61
 
        {
62
 
            teamsBox = new IconedGroupBox(this);
63
 
            //teamsBox->setContentTopPadding(0);
64
 
            //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true);
65
 
            teamsBox->setIcon(QIcon(":/res/teamicon.png"));
66
 
            teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
67
 
            teamsBox->setTitle(QGroupBox::tr("Teams"));
68
 
 
69
 
            QGridLayout * GBTlayout = new QGridLayout(teamsBox);
70
 
 
71
 
            CBTeamName = new QComboBox(teamsBox);
72
 
            GBTlayout->addWidget(CBTeamName, 0, 0);
73
 
 
74
 
            BtnNewTeam = new QPushButton(teamsBox);
75
 
            BtnNewTeam->setToolTip(tr("New team"));
76
 
            BtnNewTeam->setIconSize(pmNew.size());
77
 
            BtnNewTeam->setIcon(pmNew);
78
 
            BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
79
 
            GBTlayout->addWidget(BtnNewTeam, 0, 1);
80
 
 
81
 
            BtnEditTeam = new QPushButton(teamsBox);
82
 
            BtnEditTeam->setToolTip(tr("Edit team"));
83
 
            BtnEditTeam->setIconSize(pmEdit.size());
84
 
            BtnEditTeam->setIcon(pmEdit);
85
 
            BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
86
 
            GBTlayout->addWidget(BtnEditTeam, 0, 2);
87
 
 
88
 
            BtnDeleteTeam = new QPushButton(teamsBox);
89
 
            BtnDeleteTeam->setToolTip(tr("Delete team"));
90
 
            BtnDeleteTeam->setIconSize(pmDelete.size());
91
 
            BtnDeleteTeam->setIcon(pmDelete);
92
 
            BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
93
 
            GBTlayout->addWidget(BtnDeleteTeam, 0, 3);
94
 
 
95
 
            LblNoEditTeam = new QLabel(teamsBox);
96
 
            LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams."));
97
 
            LblNoEditTeam->setWordWrap(true);
98
 
            LblNoEditTeam->setVisible(false);
99
 
            GBTlayout->addWidget(LblNoEditTeam, 0, 0);
100
 
 
101
 
            gbTBLayout->addWidget(teamsBox, 0, 0);
102
 
        }
103
 
 
104
 
        {
105
 
            IconedGroupBox* groupWeapons = new IconedGroupBox(this);
106
 
            
107
 
            //groupWeapons->setContentTopPadding(0);
108
 
            //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
109
 
            groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
110
 
            groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
111
 
            groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons"));
112
 
            QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
113
 
 
114
 
            QLabel* SchemeLabel = new QLabel(groupWeapons);
115
 
            SchemeLabel->setText(QLabel::tr("Game scheme"));
116
 
            WeaponsLayout->addWidget(SchemeLabel, 1, 0);
117
 
 
118
 
            SchemesName = new QComboBox(groupWeapons);
119
 
            WeaponsLayout->addWidget(SchemesName, 1, 1);
120
 
 
121
 
            SchemeNew = new QPushButton(groupWeapons);
122
 
            SchemeNew->setToolTip(tr("New scheme"));
123
 
            SchemeNew->setIconSize(pmNew.size());
124
 
            SchemeNew->setIcon(pmNew);
125
 
            SchemeNew->setMaximumWidth(pmNew.width() + 6);
126
 
            WeaponsLayout->addWidget(SchemeNew, 1, 2);
127
 
 
128
 
            SchemeEdit = new QPushButton(groupWeapons);
129
 
            SchemeEdit->setToolTip(tr("Edit scheme"));
130
 
            SchemeEdit->setIconSize(pmEdit.size());
131
 
            SchemeEdit->setIcon(pmEdit);
132
 
            SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
133
 
            WeaponsLayout->addWidget(SchemeEdit, 1, 3);
134
 
 
135
 
            SchemeDelete = new QPushButton(groupWeapons);
136
 
            SchemeDelete->setToolTip(tr("Delete scheme"));
137
 
            SchemeDelete->setIconSize(pmDelete.size());
138
 
            SchemeDelete->setIcon(pmDelete);
139
 
            SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
140
 
            WeaponsLayout->addWidget(SchemeDelete, 1, 4);
141
 
 
142
 
            QLabel* WeaponLabel = new QLabel(groupWeapons);
143
 
            WeaponLabel->setText(QLabel::tr("Weapons"));
144
 
            WeaponsLayout->addWidget(WeaponLabel, 2, 0);
145
 
 
146
 
            WeaponsName = new QComboBox(groupWeapons);
147
 
            WeaponsLayout->addWidget(WeaponsName, 2, 1);
148
 
 
149
 
            WeaponNew = new QPushButton(groupWeapons);
150
 
            WeaponNew->setToolTip(tr("New weapon set"));
151
 
            WeaponNew->setIconSize(pmNew.size());
152
 
            WeaponNew->setIcon(pmNew);
153
 
            WeaponNew->setMaximumWidth(pmNew.width() + 6);
154
 
            WeaponsLayout->addWidget(WeaponNew, 2, 2);
155
 
 
156
 
            WeaponEdit = new QPushButton(groupWeapons);
157
 
            WeaponEdit->setToolTip(tr("Edit weapon set"));
158
 
            WeaponEdit->setIconSize(pmEdit.size());
159
 
            WeaponEdit->setIcon(pmEdit);
160
 
            WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
161
 
            WeaponsLayout->addWidget(WeaponEdit, 2, 3);
162
 
 
163
 
            WeaponDelete = new QPushButton(groupWeapons);
164
 
            WeaponDelete->setToolTip(tr("Delete weapon set"));
165
 
            WeaponDelete->setIconSize(pmDelete.size());
166
 
            WeaponDelete->setIcon(pmDelete);
167
 
            WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
168
 
            WeaponsLayout->addWidget(WeaponDelete, 2, 4);
169
 
 
170
 
            WeaponTooltip = new QCheckBox(this);
171
 
            WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
172
 
            WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4);
173
 
 
174
 
            gbTBLayout->addWidget(groupWeapons, 1, 0);
175
 
        }
176
 
 
177
 
        {
178
 
            IconedGroupBox* groupMisc = new IconedGroupBox(this);
179
 
            //groupMisc->setContentTopPadding(0);
180
 
            groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
181
 
            groupMisc->setIcon(QIcon(":/res/miscicon.png"));
182
 
            //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
183
 
            groupMisc->setTitle(QGroupBox::tr("Misc"));
184
 
            QGridLayout * MiscLayout = new QGridLayout(groupMisc);
185
 
 
186
 
            labelNN = new QLabel(groupMisc);
187
 
            labelNN->setText(QLabel::tr("Net nick"));
188
 
            MiscLayout->addWidget(labelNN, 0, 0);
189
 
 
190
 
            editNetNick = new QLineEdit(groupMisc);
191
 
            editNetNick->setMaxLength(20);
192
 
            editNetNick->setText(QLineEdit::tr("unnamed"));
193
 
            connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick()));
194
 
            MiscLayout->addWidget(editNetNick, 0, 1);
195
 
            
196
 
            labelNetPassword = new QLabel(groupMisc);
197
 
            labelNetPassword->setText(QLabel::tr("Password"));
198
 
            MiscLayout->addWidget(labelNetPassword, 1, 0);
199
 
            
200
 
            editNetPassword = new QLineEdit(groupMisc);
201
 
            editNetPassword->setEchoMode(QLineEdit::Password);
202
 
            MiscLayout->addWidget(editNetPassword, 1, 1);
203
 
 
204
 
            QLabel *labelLanguage = new QLabel(groupMisc);
205
 
            labelLanguage->setText(QLabel::tr("Locale") + " *");
206
 
            MiscLayout->addWidget(labelLanguage, 2, 0);
207
 
 
208
 
            CBLanguage = new QComboBox(groupMisc);
209
 
            QDir tmpdir;
210
 
            tmpdir.cd(cfgdir->absolutePath());
211
 
            tmpdir.cd("Data/Locale");
212
 
            tmpdir.setFilter(QDir::Files);
213
 
            QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm"));
214
 
            CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
215
 
            for(int i = 0; i < locs.count(); i++)
216
 
            {
217
 
                QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
218
 
                CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
219
 
            }
220
 
 
221
 
            tmpdir.cd(datadir->absolutePath());
222
 
            tmpdir.cd("Locale");
223
 
            tmpdir.setFilter(QDir::Files);
224
 
            QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm"));
225
 
            for(int i = 0; i < tmplist.count(); i++)
226
 
            {
227
 
                if (locs.contains(tmplist[i])) continue;
228
 
                QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
229
 
                CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
230
 
            }
231
 
 
232
 
            MiscLayout->addWidget(CBLanguage, 2, 1);
233
 
 
234
 
            CBAltDamage = new QCheckBox(groupMisc);
235
 
            CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
236
 
            MiscLayout->addWidget(CBAltDamage, 3, 0, 1, 2);
237
 
 
238
 
            CBNameWithDate = new QCheckBox(groupMisc);
239
 
            CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
240
 
            MiscLayout->addWidget(CBNameWithDate, 4, 0, 1, 2);
241
 
 
242
 
            BtnAssociateFiles = new QPushButton(groupMisc);
243
 
            BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
244
 
            BtnAssociateFiles->setEnabled(!custom_data && !custom_config);
245
 
            MiscLayout->addWidget(BtnAssociateFiles, 5, 0, 1, 2);
246
 
 
247
 
#ifdef __APPLE__
248
 
#ifdef SPARKLE_ENABLED
249
 
            CBAutoUpdate = new QCheckBox(groupMisc);
250
 
            CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
251
 
            MiscLayout->addWidget(CBAutoUpdate, 6, 0, 1, 3);
252
 
#endif
253
 
#endif
254
 
            gbTBLayout->addWidget(groupMisc, 2, 0);
255
 
        }
256
 
 
257
 
        {
258
 
            AGGroupBox = new IconedGroupBox(this);
259
 
            //AGGroupBox->setContentTopPadding(0);
260
 
            AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
261
 
            //AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
262
 
            AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
263
 
 
264
 
            QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
265
 
            QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
266
 
            QHBoxLayout * GBAstereolayout = new QHBoxLayout(0);
267
 
            QHBoxLayout * GBAqualayout = new QHBoxLayout(0);
268
 
 
269
 
            CBFrontendFullscreen = new QCheckBox(AGGroupBox);
270
 
            CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen"));
271
 
            GBAlayout->addWidget(CBFrontendFullscreen);
272
 
 
273
 
            CBFrontendEffects = new QCheckBox(AGGroupBox);
274
 
            CBFrontendEffects->setText(QCheckBox::tr("Frontend effects") + " *");
275
 
            GBAlayout->addWidget(CBFrontendEffects);
276
 
 
277
 
            CBEnableFrontendSound = new QCheckBox(AGGroupBox);
278
 
            CBEnableFrontendSound->setText(QCheckBox::tr("Enable frontend sounds"));
279
 
            GBAlayout->addWidget(CBEnableFrontendSound);
280
 
 
281
 
            CBEnableFrontendMusic = new QCheckBox(AGGroupBox);
282
 
            CBEnableFrontendMusic->setText(QCheckBox::tr("Enable frontend music"));
283
 
            GBAlayout->addWidget(CBEnableFrontendMusic);
284
 
 
285
 
            QFrame * hr = new QFrame(AGGroupBox);
286
 
            hr->setFrameStyle(QFrame::HLine);
287
 
            hr->setLineWidth(3);
288
 
            hr->setFixedHeight(10);
289
 
            GBAlayout->addWidget(hr);
290
 
 
291
 
            QLabel * resolution = new QLabel(AGGroupBox);
292
 
            resolution->setText(QLabel::tr("Resolution"));
293
 
            GBAreslayout->addWidget(resolution);
294
 
 
295
 
            CBResolution = new QComboBox(AGGroupBox);
296
 
            GBAreslayout->addWidget(CBResolution);
297
 
            GBAlayout->addLayout(GBAreslayout);
298
 
            connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int)));
299
 
 
300
 
            CBFullscreen = new QCheckBox(AGGroupBox);
301
 
            CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
302
 
            GBAlayout->addWidget(CBFullscreen);
303
 
            connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int)));
304
 
 
305
 
            QLabel * quality = new QLabel(AGGroupBox);
306
 
            quality->setText(QLabel::tr("Quality"));
307
 
            quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
308
 
            GBAqualayout->addWidget(quality);
309
 
            
310
 
            SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
311
 
            SLQuality->setTickPosition(QSlider::TicksBelow);
312
 
            SLQuality->setMaximum(5);
313
 
            SLQuality->setMinimum(0);
314
 
            SLQuality->setFixedWidth(150);
315
 
            GBAqualayout->addWidget(SLQuality);
316
 
            GBAlayout->addLayout(GBAqualayout);
317
 
            connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int)));
318
 
 
319
 
            QLabel * stereo = new QLabel(AGGroupBox);
320
 
            stereo->setText(QLabel::tr("Stereo rendering"));
321
 
            GBAstereolayout->addWidget(stereo);
322
 
 
323
 
            CBStereoMode = new QComboBox(AGGroupBox);
324
 
            CBStereoMode->addItem(QComboBox::tr("Disabled"));
325
 
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
326
 
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
327
 
            CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
328
 
            CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
329
 
            CBStereoMode->addItem(QComboBox::tr("Red/Green"));
330
 
            CBStereoMode->addItem(QComboBox::tr("Green/Red"));
331
 
            CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
332
 
            CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
333
 
            CBStereoMode->addItem(QComboBox::tr("Wiggle"));
334
 
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale"));
335
 
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale"));
336
 
            CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale"));
337
 
            CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
338
 
            CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
339
 
            CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
340
 
            connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
341
 
 
342
 
            GBAstereolayout->addWidget(CBStereoMode);
343
 
            GBAlayout->addLayout(GBAstereolayout);
344
 
 
345
 
            hr = new QFrame(AGGroupBox);
346
 
            hr->setFrameStyle(QFrame::HLine);
347
 
            hr->setLineWidth(3);
348
 
            hr->setFixedHeight(10);
349
 
            GBAlayout->addWidget(hr);
350
 
 
351
 
            QHBoxLayout * GBAvollayout = new QHBoxLayout(0);
352
 
            QLabel * vol = new QLabel(AGGroupBox);
353
 
            vol->setText(QLabel::tr("Initial sound volume"));
354
 
            GBAvollayout->addWidget(vol);
355
 
            GBAlayout->addLayout(GBAvollayout);
356
 
            volumeBox = new QSpinBox(AGGroupBox);
357
 
            volumeBox->setRange(0, 100);
358
 
            volumeBox->setSingleStep(5);
359
 
            GBAvollayout->addWidget(volumeBox);
360
 
 
361
 
            CBEnableSound = new QCheckBox(AGGroupBox);
362
 
            CBEnableSound->setText(QCheckBox::tr("Enable sound"));
363
 
            GBAlayout->addWidget(CBEnableSound);
364
 
 
365
 
            CBEnableMusic = new QCheckBox(AGGroupBox);
366
 
            CBEnableMusic->setText(QCheckBox::tr("Enable music"));
367
 
            GBAlayout->addWidget(CBEnableMusic);
368
 
 
369
 
            hr = new QFrame(AGGroupBox);
370
 
            hr->setFrameStyle(QFrame::HLine);
371
 
            hr->setLineWidth(3);
372
 
            hr->setFixedHeight(10);
373
 
            GBAlayout->addWidget(hr);
374
 
 
375
 
            QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
376
 
            QLabel * maxfps = new QLabel(AGGroupBox);
377
 
            maxfps->setText(QLabel::tr("FPS limit"));
378
 
            GBAfpslayout->addWidget(maxfps);
379
 
            GBAlayout->addLayout(GBAfpslayout);
380
 
            fpsedit = new FPSEdit(AGGroupBox);
381
 
            GBAfpslayout->addWidget(fpsedit);
382
 
 
383
 
            CBShowFPS = new QCheckBox(AGGroupBox);
384
 
            CBShowFPS->setText(QCheckBox::tr("Show FPS"));
385
 
            GBAlayout->addWidget(CBShowFPS);
386
 
 
387
 
            hr = new QFrame(AGGroupBox);
388
 
            hr->setFrameStyle(QFrame::HLine);
389
 
            hr->setLineWidth(3);
390
 
            hr->setFixedHeight(10);
391
 
            GBAlayout->addWidget(hr);
392
 
 
393
 
            QLabel *restartNote = new QLabel(this);
394
 
            restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply"));
395
 
            restartNote->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
396
 
            GBAlayout->addWidget(restartNote);
397
 
 
398
 
            gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1);
399
 
        }
400
 
 
401
 
    BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true);
402
 
    BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
403
 
 
404
 
    BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true);
405
 
    BtnBack->setFixedHeight(BtnSaveOptions->height());
406
 
    BtnBack->setFixedWidth(BtnBack->width()+2);
407
 
    BtnBack->setStyleSheet("QPushButton{margin: 22px 0 9px 2px;}");
408
 
 
409
 
    previousQuality = this->SLQuality->value();
410
 
    previousResolutionIndex = this->CBResolution->currentIndex();
411
 
    previousFullscreenValue = this->CBFullscreen->isChecked();
412
 
}
413
 
 
414
 
void PageOptions::forceFullscreen(int index)
415
 
{
416
 
    bool forced = (index == 7 || index == 8 || index == 9);
417
 
 
418
 
    if (index != 0) {
419
 
        this->SLQuality->setValue(this->SLQuality->maximum());
420
 
        this->SLQuality->setEnabled(false);
421
 
        this->CBFullscreen->setEnabled(!forced);
422
 
        this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
423
 
        this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
424
 
    } else {
425
 
        this->SLQuality->setEnabled(true);
426
 
        this->CBFullscreen->setEnabled(true);
427
 
        this->SLQuality->setValue(previousQuality);
428
 
        this->CBFullscreen->setChecked(previousFullscreenValue);
429
 
        this->CBResolution->setCurrentIndex(previousResolutionIndex);
430
 
    }
431
 
}
432
 
 
433
 
void PageOptions::setQuality(int value)
434
 
{
435
 
    int index = this->CBStereoMode->currentIndex();
436
 
    if (index == 0)
437
 
        previousQuality = this->SLQuality->value();
438
 
}
439
 
 
440
 
void PageOptions::setFullscreen(int state)
441
 
{
442
 
    int index = this->CBStereoMode->currentIndex();
443
 
    if (index != 7 && index != 8 && index != 9)
444
 
        previousFullscreenValue = this->CBFullscreen->isChecked();
445
 
}
446
 
 
447
 
void PageOptions::setResolution(int state)
448
 
{
449
 
    int index = this->CBStereoMode->currentIndex();
450
 
    if (index != 7 && index != 8 && index != 9)
451
 
        previousResolutionIndex = this->CBResolution->currentIndex();
452
 
}
453
 
 
454
 
void PageOptions::trimNetNick()
455
 
{
456
 
    editNetNick->setText(editNetNick->text().trimmed());
457
 
}