15 * along with this program; if not, write to the Free Software |
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 |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 */ |
17 */ |
18 |
18 |
19 #include <QGridLayout> |
19 #include <QGridLayout> |
|
20 #include <QHBoxLayout> |
20 #include <QPushButton> |
21 #include <QPushButton> |
21 #include <QGroupBox> |
22 #include <QGroupBox> |
22 #include <QComboBox> |
23 #include <QComboBox> |
23 #include <QCheckBox> |
24 #include <QCheckBox> |
24 #include <QLabel> |
25 #include <QLabel> |
31 #include "pageoptions.h" |
32 #include "pageoptions.h" |
32 #include "hwconsts.h" |
33 #include "hwconsts.h" |
33 #include "fpsedit.h" |
34 #include "fpsedit.h" |
34 #include "igbox.h" |
35 #include "igbox.h" |
35 |
36 |
36 PageOptions::PageOptions(QWidget* parent) : |
37 // TODO cleanup |
37 AbstractPage(parent) |
38 QLayout * PageOptions::bodyLayoutDefinition() |
38 { |
39 { |
39 QGridLayout * pageLayout = new QGridLayout(this); |
40 QGridLayout * pageLayout = new QGridLayout(); |
40 pageLayout->setColumnStretch(0, 100); |
41 pageLayout->setColumnStretch(0, 100); |
41 pageLayout->setColumnStretch(1, 100); |
42 pageLayout->setColumnStretch(1, 100); |
42 pageLayout->setColumnStretch(2, 100); |
43 pageLayout->setColumnStretch(2, 100); |
43 pageLayout->setRowStretch(0, 0); |
44 pageLayout->setRowStretch(0, 0); |
44 //pageLayout->setRowStretch(1, 100); |
45 //pageLayout->setRowStretch(1, 100); |
296 GBAreslayout->addWidget(resolution); |
297 GBAreslayout->addWidget(resolution); |
297 |
298 |
298 CBResolution = new QComboBox(AGGroupBox); |
299 CBResolution = new QComboBox(AGGroupBox); |
299 GBAreslayout->addWidget(CBResolution); |
300 GBAreslayout->addWidget(CBResolution); |
300 GBAlayout->addLayout(GBAreslayout); |
301 GBAlayout->addLayout(GBAreslayout); |
301 connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int))); |
|
302 |
302 |
303 CBFullscreen = new QCheckBox(AGGroupBox); |
303 CBFullscreen = new QCheckBox(AGGroupBox); |
304 CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
304 CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
305 GBAlayout->addWidget(CBFullscreen); |
305 GBAlayout->addWidget(CBFullscreen); |
306 connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int))); |
|
307 |
306 |
308 QLabel * quality = new QLabel(AGGroupBox); |
307 QLabel * quality = new QLabel(AGGroupBox); |
309 quality->setText(QLabel::tr("Quality")); |
308 quality->setText(QLabel::tr("Quality")); |
310 quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
309 quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
311 GBAqualayout->addWidget(quality); |
310 GBAqualayout->addWidget(quality); |
315 SLQuality->setMaximum(5); |
314 SLQuality->setMaximum(5); |
316 SLQuality->setMinimum(0); |
315 SLQuality->setMinimum(0); |
317 SLQuality->setFixedWidth(150); |
316 SLQuality->setFixedWidth(150); |
318 GBAqualayout->addWidget(SLQuality); |
317 GBAqualayout->addWidget(SLQuality); |
319 GBAlayout->addLayout(GBAqualayout); |
318 GBAlayout->addLayout(GBAqualayout); |
320 connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int))); |
|
321 |
319 |
322 QLabel * stereo = new QLabel(AGGroupBox); |
320 QLabel * stereo = new QLabel(AGGroupBox); |
323 stereo->setText(QLabel::tr("Stereo rendering")); |
321 stereo->setText(QLabel::tr("Stereo rendering")); |
324 GBAstereolayout->addWidget(stereo); |
322 GBAstereolayout->addWidget(stereo); |
325 |
323 |
399 GBAlayout->addWidget(restartNote); |
397 GBAlayout->addWidget(restartNote); |
400 |
398 |
401 gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1); |
399 gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1); |
402 } |
400 } |
403 |
401 |
404 BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true); |
|
405 BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
406 |
|
407 |
|
408 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
|
409 BtnBack->setFixedHeight(BtnSaveOptions->height()); |
|
410 BtnBack->setFixedWidth(BtnBack->width()+2); |
|
411 BtnBack->setStyleSheet("QPushButton{margin: 22px 0 9px 2px;}"); |
|
412 connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); |
|
413 |
|
414 previousQuality = this->SLQuality->value(); |
402 previousQuality = this->SLQuality->value(); |
415 previousResolutionIndex = this->CBResolution->currentIndex(); |
403 previousResolutionIndex = this->CBResolution->currentIndex(); |
416 previousFullscreenValue = this->CBFullscreen->isChecked(); |
404 previousFullscreenValue = this->CBFullscreen->isChecked(); |
|
405 |
|
406 return pageLayout; |
|
407 } |
|
408 |
|
409 QLayout * PageOptions::footerLayoutDefinition() |
|
410 { |
|
411 QHBoxLayout * bottomLayout = new QHBoxLayout(); |
|
412 btnSave = addButton(":/res/Save.png", bottomLayout, 0, true); |
|
413 btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}"); |
|
414 bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom); |
|
415 return bottomLayout; |
|
416 } |
|
417 |
|
418 void PageOptions::connectSignals() |
|
419 { |
|
420 connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int))); |
|
421 connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int))); |
|
422 connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int))); |
|
423 } |
|
424 |
|
425 PageOptions::PageOptions(QWidget* parent) : AbstractPage(parent) |
|
426 { |
|
427 initPage(); |
417 } |
428 } |
418 |
429 |
419 void PageOptions::forceFullscreen(int index) |
430 void PageOptions::forceFullscreen(int index) |
420 { |
431 { |
421 bool forced = (index == 7 || index == 8 || index == 9); |
432 bool forced = (index == 7 || index == 8 || index == 9); |