QTfrontend/ui/page/pageoptions.cpp
changeset 8352 ab7f22530ae0
parent 8350 14b938faec69
child 8356 b5cf1f29ab14
equal deleted inserted replaced
8350:14b938faec69 8352:ab7f22530ae0
   304             hr->setFrameStyle(QFrame::HLine);
   304             hr->setFrameStyle(QFrame::HLine);
   305             hr->setLineWidth(3);
   305             hr->setLineWidth(3);
   306             hr->setFixedHeight(10);
   306             hr->setFixedHeight(10);
   307             GBAlayout->addWidget(hr);
   307             GBAlayout->addWidget(hr);
   308 
   308 
   309             QLabel * resolution = new QLabel(AGGroupBox);
   309             QLabel * resolutionLabel = new QLabel(AGGroupBox);
   310             resolution->setText(QLabel::tr("Resolution"));
   310             resolutionLabel->setText(QLabel::tr("Resolution"));
   311             GBAreslayout->addWidget(resolution, 0, 0);
   311             GBAreslayout->addWidget(resolutionLabel, 0, 0);
       
   312             
       
   313             QLabel * fullscreenResolution = new QLabel(AGGroupBox);
       
   314             fullscreenResolution->setText(QLabel::tr("Fullscreen"));
       
   315             GBAreslayout->addWidget(fullscreenResolution, 1, 0);
   312 
   316 
   313             CBResolution = new QComboBox(AGGroupBox);
   317             CBResolution = new QComboBox(AGGroupBox);
   314             GBAfullreslayout->addWidget(CBResolution);
   318             GBAfullreslayout->addWidget(CBResolution);
   315 
   319 
   316             CBFullscreen = new QCheckBox(AGGroupBox);
   320             CBFullscreen = new QCheckBox(AGGroupBox);
   317             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
       
   318             GBAfullreslayout->addWidget(CBFullscreen);
   321             GBAfullreslayout->addWidget(CBFullscreen);
   319             GBAreslayout->addLayout(GBAfullreslayout, 0, 1);
   322             CBFullscreen->setText(QLabel::tr("Fullscreen"));
       
   323             GBAreslayout->addLayout(GBAfullreslayout, 1, 1);
   320             
   324             
   321             QLabel * windowedResolution = new QLabel(AGGroupBox);
   325             QLabel * windowedResolution = new QLabel(AGGroupBox);
   322             windowedResolution->setText(QLabel::tr("Windowed Resolution"));
   326             windowedResolution->setText(QLabel::tr("Windowed"));
   323             GBAreslayout->addWidget(windowedResolution, 1, 0);
   327             GBAreslayout->addWidget(windowedResolution, 2, 0);
   324             
   328             
   325             // decorational X
   329             // decorational X
   326             QLabel *winLabelX = new QLabel(AGGroupBox);
   330             QLabel *winLabelX = new QLabel(AGGroupBox);
   327             winLabelX->setText("X");
   331             winLabelX->setText("X");
   328             
   332             
   332             windowHeightEdit->setValidator(new QIntValidator(this));
   336             windowHeightEdit->setValidator(new QIntValidator(this));
   333             
   337             
   334             GBAwindowedreslayout->addWidget(windowWidthEdit);
   338             GBAwindowedreslayout->addWidget(windowWidthEdit);
   335             GBAwindowedreslayout->addWidget(winLabelX);
   339             GBAwindowedreslayout->addWidget(winLabelX);
   336             GBAwindowedreslayout->addWidget(windowHeightEdit);
   340             GBAwindowedreslayout->addWidget(windowHeightEdit);
   337             GBAreslayout->addLayout(GBAwindowedreslayout, 1, 1);
   341             GBAreslayout->addLayout(GBAwindowedreslayout, 2, 1);
   338             
   342             
   339             GBAlayout->addLayout(GBAreslayout);
   343             GBAlayout->addLayout(GBAreslayout);
   340             
   344             
   341             QLabel * quality = new QLabel(AGGroupBox);
   345             QLabel * quality = new QLabel(AGGroupBox);
   342             quality->setText(QLabel::tr("Quality"));
   346             quality->setText(QLabel::tr("Quality"));
   659 
   663 
   660     previousQuality = this->SLQuality->value();
   664     previousQuality = this->SLQuality->value();
   661     previousResolutionIndex = this->CBResolution->currentIndex();
   665     previousResolutionIndex = this->CBResolution->currentIndex();
   662     previousFullscreenValue = this->CBFullscreen->isChecked();
   666     previousFullscreenValue = this->CBFullscreen->isChecked();
   663     // mutually exclude window and fullscreen resolution
   667     // mutually exclude window and fullscreen resolution
   664     CBResolution->setEnabled(this->CBFullscreen->isChecked());
       
   665     windowHeightEdit->setEnabled(!this->CBFullscreen->isChecked());
       
   666     windowWidthEdit->setEnabled(!this->CBFullscreen->isChecked());
       
   667 
       
   668     return pageLayout;
   668     return pageLayout;
   669 }
   669 }
   670 
   670 
   671 QLayout * PageOptions::footerLayoutDefinition()
   671 QLayout * PageOptions::footerLayoutDefinition()
   672 {
   672 {
   696 }
   696 }
   697 
   697 
   698 void PageOptions::forceFullscreen(int index)
   698 void PageOptions::forceFullscreen(int index)
   699 {
   699 {
   700     bool forced = (index == 7 || index == 8 || index == 9);
   700     bool forced = (index == 7 || index == 8 || index == 9);
   701     CBResolution->setEnabled(this->CBFullscreen->isChecked());
       
   702     windowHeightEdit->setEnabled(!this->CBFullscreen->isChecked());
       
   703     windowWidthEdit->setEnabled(!this->CBFullscreen->isChecked());
       
   704     
   701     
   705     if (index != 0)
   702     if (index != 0)
   706     {
   703     {
   707         this->SLQuality->setValue(this->SLQuality->maximum());
   704         this->SLQuality->setValue(this->SLQuality->maximum());
   708         this->SLQuality->setEnabled(false);
   705         this->SLQuality->setEnabled(false);
   709         this->CBFullscreen->setEnabled(!forced);
       
   710         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
   706         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
   711         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
   707         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
   712     }
   708     }
   713     else
   709     else
   714     {
   710     {
   715         this->SLQuality->setEnabled(true);
   711         this->SLQuality->setEnabled(true);
   716         this->CBFullscreen->setEnabled(true);
       
   717         this->SLQuality->setValue(previousQuality);
   712         this->SLQuality->setValue(previousQuality);
   718         this->CBFullscreen->setChecked(previousFullscreenValue);
   713         this->CBFullscreen->setChecked(previousFullscreenValue);
   719         this->CBResolution->setCurrentIndex(previousResolutionIndex);
   714         this->CBResolution->setCurrentIndex(previousResolutionIndex);
   720     }
   715     }
   721 }
   716 }
   730 }
   725 }
   731 
   726 
   732 void PageOptions::setFullscreen(int state)
   727 void PageOptions::setFullscreen(int state)
   733 {
   728 {
   734     Q_UNUSED(state);
   729     Q_UNUSED(state);
   735     CBResolution->setEnabled(this->CBFullscreen->isChecked());
   730 
   736     windowHeightEdit->setEnabled(!this->CBFullscreen->isChecked());
       
   737     windowWidthEdit->setEnabled(!this->CBFullscreen->isChecked());
       
   738     
   731     
   739     int index = this->CBStereoMode->currentIndex();
   732     int index = this->CBStereoMode->currentIndex();
   740     if (index != 7 && index != 8 && index != 9)
   733     if (index != 7 && index != 8 && index != 9)
   741         previousFullscreenValue = this->CBFullscreen->isChecked();
   734         previousFullscreenValue = this->CBFullscreen->isChecked();
   742 }
   735 }