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