QTfrontend/pageoptions.cpp
changeset 5906 ed9676dc8cb4
parent 5878 404ca990793a
child 6009 14f6fc9869f2
equal deleted inserted replaced
5713:190d6bb075c5 5906:ed9676dc8cb4
   293             GBAreslayout->addWidget(resolution);
   293             GBAreslayout->addWidget(resolution);
   294 
   294 
   295             CBResolution = new QComboBox(AGGroupBox);
   295             CBResolution = new QComboBox(AGGroupBox);
   296             GBAreslayout->addWidget(CBResolution);
   296             GBAreslayout->addWidget(CBResolution);
   297             GBAlayout->addLayout(GBAreslayout);
   297             GBAlayout->addLayout(GBAreslayout);
       
   298             connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int)));
   298 
   299 
   299             CBFullscreen = new QCheckBox(AGGroupBox);
   300             CBFullscreen = new QCheckBox(AGGroupBox);
   300             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
   301             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
   301             GBAlayout->addWidget(CBFullscreen);
   302             GBAlayout->addWidget(CBFullscreen);
   302             connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(void)));
   303             connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int)));
   303 
   304 
   304             QLabel * quality = new QLabel(AGGroupBox);
   305             QLabel * quality = new QLabel(AGGroupBox);
   305             quality->setText(QLabel::tr("Quality"));
   306             quality->setText(QLabel::tr("Quality"));
   306             quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   307             quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   307             GBAqualayout->addWidget(quality);
   308             GBAqualayout->addWidget(quality);
   311             SLQuality->setMaximum(5);
   312             SLQuality->setMaximum(5);
   312             SLQuality->setMinimum(0);
   313             SLQuality->setMinimum(0);
   313             SLQuality->setFixedWidth(150);
   314             SLQuality->setFixedWidth(150);
   314             GBAqualayout->addWidget(SLQuality);
   315             GBAqualayout->addWidget(SLQuality);
   315             GBAlayout->addLayout(GBAqualayout);
   316             GBAlayout->addLayout(GBAqualayout);
       
   317             connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int)));
       
   318 
   316             QLabel * stereo = new QLabel(AGGroupBox);
   319             QLabel * stereo = new QLabel(AGGroupBox);
   317             stereo->setText(QLabel::tr("Stereo rendering"));
   320             stereo->setText(QLabel::tr("Stereo rendering"));
   318             GBAstereolayout->addWidget(stereo);
   321             GBAstereolayout->addWidget(stereo);
   319 
   322 
   320             CBStereoMode = new QComboBox(AGGroupBox);
   323             CBStereoMode = new QComboBox(AGGroupBox);
   400 
   403 
   401     BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true);
   404     BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true);
   402     BtnBack->setFixedHeight(BtnSaveOptions->height());
   405     BtnBack->setFixedHeight(BtnSaveOptions->height());
   403     BtnBack->setFixedWidth(BtnBack->width()+2);
   406     BtnBack->setFixedWidth(BtnBack->width()+2);
   404     BtnBack->setStyleSheet("QPushButton{margin: 22px 0 9px 2px;}");
   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();
   405 }
   412 }
   406 
   413 
   407 void PageOptions::forceFullscreen(int index)
   414 void PageOptions::forceFullscreen(int index)
   408 {
   415 {
       
   416     bool forced = (index == 7 || index == 8 || index == 9);
       
   417 
   409     if (index != 0) {
   418     if (index != 0) {
   410         previousFullscreenValue = this->CBFullscreen->isChecked();
       
   411         this->CBFullscreen->setChecked(true);
       
   412         this->CBFullscreen->setEnabled(false);
       
   413         previousQuality = this->SLQuality->value();
       
   414         this->SLQuality->setValue(this->SLQuality->maximum());
   419         this->SLQuality->setValue(this->SLQuality->maximum());
   415         this->SLQuality->setEnabled(false);
   420         this->SLQuality->setEnabled(false);
       
   421         this->CBFullscreen->setEnabled(!forced);
       
   422         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
       
   423         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
   416     } else {
   424     } else {
   417         this->CBFullscreen->setChecked(previousFullscreenValue);
   425         this->SLQuality->setEnabled(true);
   418         this->CBFullscreen->setEnabled(true);
   426         this->CBFullscreen->setEnabled(true);
   419         this->SLQuality->setValue(previousQuality);
   427         this->SLQuality->setValue(previousQuality);
   420         this->SLQuality->setEnabled(true);
   428         this->CBFullscreen->setChecked(previousFullscreenValue);
       
   429         this->CBResolution->setCurrentIndex(previousResolutionIndex);
   421     }
   430     }
   422 }
   431 }
   423 
   432 
   424 void PageOptions::setFullscreen(void)
   433 void PageOptions::setQuality(int value)
   425 {
   434 {
   426     int tmp = this->CBResolution->currentIndex();
   435     int index = this->CBStereoMode->currentIndex();
   427     if (this->CBFullscreen->isChecked())
   436     if (index == 0)
   428         this->CBResolution->setCurrentIndex(0);
   437         previousQuality = this->SLQuality->value();
   429     else
   438 }
   430         this->CBResolution->setCurrentIndex(previousResolutionIndex);
   439 
   431     previousResolutionIndex = tmp;
   440 void PageOptions::setFullscreen(int state)
   432     this->CBResolution->setEnabled(!this->CBFullscreen->isChecked());
   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();
   433 }
   452 }
   434 
   453 
   435 void PageOptions::trimNetNick()
   454 void PageOptions::trimNetNick()
   436 {
   455 {
   437     editNetNick->setText(editNetNick->text().trimmed());
   456     editNetNick->setText(editNetNick->text().trimmed());