I.Fight.For.The.Users
authorkoda
Mon, 12 Sep 2011 18:53:28 +0200
changeset 5878 404ca990793a
parent 5877 514b639c40da
child 5879 42cf124c305b
I.Fight.For.The.Users
QTfrontend/pageoptions.cpp
QTfrontend/pageoptions.h
--- 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());
--- a/QTfrontend/pageoptions.h	Mon Sep 12 15:58:59 2011 +0200
+++ b/QTfrontend/pageoptions.h	Mon Sep 12 18:53:28 2011 +0200
@@ -84,6 +84,9 @@
 
 private slots:
     void forceFullscreen(int index);
+    void setFullscreen(int state);
+    void setResolution(int state);
+    void setQuality(int value);
     void trimNetNick();
 };