QTfrontend/pageoptions.cpp
changeset 5878 404ca990793a
parent 5877 514b639c40da
child 6009 14f6fc9869f2
--- a/QTfrontend/pageoptions.cpp	Mon Sep 12 15:58:59 2011 +0200
+++ b/QTfrontend/pageoptions.cpp	Mon Sep 12 18:53:28 2011 +0200
@@ -295,10 +295,12 @@
             CBResolution = new QComboBox(AGGroupBox);
             GBAreslayout->addWidget(CBResolution);
             GBAlayout->addLayout(GBAreslayout);
+            connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int)));
 
             CBFullscreen = new QCheckBox(AGGroupBox);
             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
             GBAlayout->addWidget(CBFullscreen);
+            connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int)));
 
             QLabel * quality = new QLabel(AGGroupBox);
             quality->setText(QLabel::tr("Quality"));
@@ -312,6 +314,8 @@
             SLQuality->setFixedWidth(150);
             GBAqualayout->addWidget(SLQuality);
             GBAlayout->addLayout(GBAqualayout);
+            connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int)));
+
             QLabel * stereo = new QLabel(AGGroupBox);
             stereo->setText(QLabel::tr("Stereo rendering"));
             GBAstereolayout->addWidget(stereo);
@@ -401,30 +405,52 @@
     BtnBack->setFixedHeight(BtnSaveOptions->height());
     BtnBack->setFixedWidth(BtnBack->width()+2);
     BtnBack->setStyleSheet("QPushButton{margin: 22px 0 9px 2px;}");
+
+    previousQuality = this->SLQuality->value();
+    previousResolutionIndex = this->CBResolution->currentIndex();
+    previousFullscreenValue = this->CBFullscreen->isChecked();
 }
 
 void PageOptions::forceFullscreen(int index)
 {
+    bool forced = (index == 7 || index == 8 || index == 9);
+
     if (index != 0) {
-        previousFullscreenValue = this->CBFullscreen->isChecked();
-        this->CBFullscreen->setChecked(true);
-        this->CBFullscreen->setEnabled(false);
-        previousQuality = this->SLQuality->value();
         this->SLQuality->setValue(this->SLQuality->maximum());
         this->SLQuality->setEnabled(false);
-        previousResolutionIndex = this->CBResolution->currentIndex();
-        this->CBResolution->setCurrentIndex(0);
-        this->CBResolution->setEnabled(false);
+        this->CBFullscreen->setEnabled(!forced);
+        this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
+        this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
     } else {
-        this->CBFullscreen->setChecked(previousFullscreenValue);
+        this->SLQuality->setEnabled(true);
         this->CBFullscreen->setEnabled(true);
         this->SLQuality->setValue(previousQuality);
-        this->SLQuality->setEnabled(true);
+        this->CBFullscreen->setChecked(previousFullscreenValue);
         this->CBResolution->setCurrentIndex(previousResolutionIndex);
-        this->CBResolution->setEnabled(true);
     }
 }
 
+void PageOptions::setQuality(int value)
+{
+    int index = this->CBStereoMode->currentIndex();
+    if (index == 0)
+        previousQuality = this->SLQuality->value();
+}
+
+void PageOptions::setFullscreen(int state)
+{
+    int index = this->CBStereoMode->currentIndex();
+    if (index != 7 && index != 8 && index != 9)
+        previousFullscreenValue = this->CBFullscreen->isChecked();
+}
+
+void PageOptions::setResolution(int state)
+{
+    int index = this->CBStereoMode->currentIndex();
+    if (index != 7 && index != 8 && index != 9)
+        previousResolutionIndex = this->CBResolution->currentIndex();
+}
+
 void PageOptions::trimNetNick()
 {
     editNetNick->setText(editNetNick->text().trimmed());