QTfrontend/ui/page/pageoptions.cpp
changeset 7630 13fa53bb3134
parent 7541 e51b11349637
child 7678 8aabba680598
equal deleted inserted replaced
7629:d624030abf24 7630:13fa53bb3134
   170             WeaponDelete->setIconSize(pmDelete.size());
   170             WeaponDelete->setIconSize(pmDelete.size());
   171             WeaponDelete->setIcon(pmDelete);
   171             WeaponDelete->setIcon(pmDelete);
   172             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
   172             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
   173             WeaponsLayout->addWidget(WeaponDelete, 2, 4);
   173             WeaponsLayout->addWidget(WeaponDelete, 2, 4);
   174 
   174 
   175             WeaponTooltip = new QCheckBox(this);
       
   176             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
       
   177             WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4);
       
   178 
       
   179             page1Layout->addWidget(groupWeapons, 1, 0);
   175             page1Layout->addWidget(groupWeapons, 1, 0);
   180         }
   176         }
   181 
   177 
   182         {
   178         {
   183             IconedGroupBox* groupMisc = new IconedGroupBox(this);
   179             IconedGroupBox* groupMisc = new IconedGroupBox(this);
   236             MiscLayout->addWidget(CBSavePassword, 2, 0);
   232             MiscLayout->addWidget(CBSavePassword, 2, 0);
   237 
   233 
   238             editNetPassword = new QLineEdit(groupMisc);
   234             editNetPassword = new QLineEdit(groupMisc);
   239             editNetPassword->setEchoMode(QLineEdit::Password);
   235             editNetPassword->setEchoMode(QLineEdit::Password);
   240             MiscLayout->addWidget(editNetPassword, 2, 1);
   236             MiscLayout->addWidget(editNetPassword, 2, 1);
   241 
       
   242             CBNameWithDate = new QCheckBox(groupMisc);
       
   243             CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
       
   244             MiscLayout->addWidget(CBNameWithDate, 5, 0, 1, 2);
       
   245 
       
   246             BtnAssociateFiles = new QPushButton(groupMisc);
       
   247             BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
       
   248             BtnAssociateFiles->setVisible(!custom_data && !custom_config);
       
   249             MiscLayout->addWidget(BtnAssociateFiles, 6, 0, 1, 2);
       
   250 
   237 
   251     #ifdef __APPLE__
   238     #ifdef __APPLE__
   252     #ifdef SPARKLE_ENABLED
   239     #ifdef SPARKLE_ENABLED
   253             CBAutoUpdate = new QCheckBox(groupMisc);
   240             CBAutoUpdate = new QCheckBox(groupMisc);
   254             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   241             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   340             CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
   327             CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
   341 
   328 
   342             GBAstereolayout->addWidget(CBStereoMode);
   329             GBAstereolayout->addWidget(CBStereoMode);
   343             GBAlayout->addLayout(GBAstereolayout);
   330             GBAlayout->addLayout(GBAstereolayout);
   344 
   331 
   345             QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
       
   346             QLabel * maxfps = new QLabel(AGGroupBox);
       
   347             maxfps->setText(QLabel::tr("FPS limit"));
       
   348             GBAfpslayout->addWidget(maxfps);
       
   349             GBAlayout->addLayout(GBAfpslayout);
       
   350             fpsedit = new FPSEdit(AGGroupBox);
       
   351             GBAfpslayout->addWidget(fpsedit);
       
   352 
       
   353             CBShowFPS = new QCheckBox(AGGroupBox);
       
   354             CBShowFPS->setText(QCheckBox::tr("Show FPS"));
       
   355             GBAfpslayout->addWidget(CBShowFPS);
       
   356 
       
   357             hr = new QFrame(AGGroupBox);
   332             hr = new QFrame(AGGroupBox);
   358             hr->setFrameStyle(QFrame::HLine);
   333             hr->setFrameStyle(QFrame::HLine);
   359             hr->setLineWidth(3);
   334             hr->setLineWidth(3);
   360             hr->setFixedHeight(10);
   335             hr->setFixedHeight(10);
   361             GBAlayout->addWidget(hr);
   336             GBAlayout->addWidget(hr);
   395     }
   370     }
   396 
   371 
   397     { // page 2
   372     { // page 2
   398         QGridLayout * page2Layout = new QGridLayout(page2);
   373         QGridLayout * page2Layout = new QGridLayout(page2);
   399 
   374 
   400         IconedGroupBox * gbColors = new IconedGroupBox(this);
       
   401         //gbColors->setIcon(QIcon(":/res/teamicon.png"));
       
   402         gbColors->setTitle(QGroupBox::tr("Custom colors"));
       
   403         page2Layout->addWidget(gbColors, 0, 0, 1, 3);
       
   404         QVBoxLayout * gbCLayout = new QVBoxLayout(gbColors);
       
   405 
       
   406         QSignalMapper * mapper = new QSignalMapper(this);
       
   407 
       
   408         QStandardItemModel * model = DataManager::instance().colorsModel();
       
   409 
       
   410         connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(onColorModelDataChanged(QModelIndex,QModelIndex)));
       
   411         for(int i = 0; i < model->rowCount(); ++i)
       
   412         {
   375         {
   413             QPushButton * btn = new QPushButton(this);
   376             IconedGroupBox * gbColors = new IconedGroupBox(this);
   414             gbCLayout->addWidget(btn);
   377             //gbColors->setIcon(QIcon(":/res/teamicon.png"));
   415             btn->setStyleSheet(QString("background: %1").arg(model->item(i)->data().value<QColor>().name()));
   378             gbColors->setTitle(QGroupBox::tr("Custom colors"));
   416             m_colorButtons.append(btn);
   379             page2Layout->addWidget(gbColors, 0, 0);
   417             connect(btn, SIGNAL(clicked()), mapper, SLOT(map()));
   380             QGridLayout * gbCLayout = new QGridLayout(gbColors);
   418             mapper->setMapping(btn, i);
   381 
       
   382             QSignalMapper * mapper = new QSignalMapper(this);
       
   383 
       
   384             QStandardItemModel * model = DataManager::instance().colorsModel();
       
   385 
       
   386             connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(onColorModelDataChanged(QModelIndex,QModelIndex)));
       
   387             for(int i = 0; i < model->rowCount(); ++i)
       
   388             {
       
   389                 QPushButton * btn = new QPushButton(this);
       
   390                 btn->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
       
   391                 gbCLayout->addWidget(btn, i / 3, i % 3);
       
   392                 btn->setStyleSheet(QString("background: %1").arg(model->item(i)->data().value<QColor>().name()));
       
   393                 m_colorButtons.append(btn);
       
   394                 connect(btn, SIGNAL(clicked()), mapper, SLOT(map()));
       
   395                 mapper->setMapping(btn, i);
       
   396             }
       
   397 
       
   398             connect(mapper, SIGNAL(mapped(int)), this, SLOT(colorButtonClicked(int)));
   419         }
   399         }
   420 
   400 
   421         connect(mapper, SIGNAL(mapped(int)), this, SLOT(colorButtonClicked(int)));
   401         {
       
   402             IconedGroupBox * gbMisc = new IconedGroupBox(this);
       
   403             gbMisc->setTitle(QGroupBox::tr("Miscellaneous"));
       
   404             page2Layout->addWidget(gbMisc, 0, 1);
       
   405             QVBoxLayout * gbCLayout = new QVBoxLayout(gbMisc);
       
   406 
       
   407             QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
       
   408             QLabel * maxfps = new QLabel(AGGroupBox);
       
   409             maxfps->setText(QLabel::tr("FPS limit"));
       
   410             GBAfpslayout->addWidget(maxfps);
       
   411             fpsedit = new FPSEdit(AGGroupBox);
       
   412             GBAfpslayout->addWidget(fpsedit);
       
   413 
       
   414             CBShowFPS = new QCheckBox(AGGroupBox);
       
   415             CBShowFPS->setText(QCheckBox::tr("Show FPS"));
       
   416             GBAfpslayout->addWidget(CBShowFPS);
       
   417 
       
   418             gbCLayout->addLayout(GBAfpslayout);
       
   419 
       
   420 
       
   421             WeaponTooltip = new QCheckBox(this);
       
   422             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
       
   423             gbCLayout->addWidget(WeaponTooltip);
       
   424 
       
   425 
       
   426             CBNameWithDate = new QCheckBox(this);
       
   427             CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
       
   428             gbCLayout->addWidget(CBNameWithDate);
       
   429 
       
   430             BtnAssociateFiles = new QPushButton(this);
       
   431             BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
       
   432             BtnAssociateFiles->setVisible(!custom_data && !custom_config);
       
   433             gbCLayout->addWidget(BtnAssociateFiles);
       
   434         }
       
   435 
       
   436         page2Layout->addWidget(new QWidget(this), 1, 0);
   422     }
   437     }
   423 
   438 
   424     previousQuality = this->SLQuality->value();
   439     previousQuality = this->SLQuality->value();
   425     previousResolutionIndex = this->CBResolution->currentIndex();
   440     previousResolutionIndex = this->CBResolution->currentIndex();
   426     previousFullscreenValue = this->CBFullscreen->isChecked();
   441     previousFullscreenValue = this->CBFullscreen->isChecked();
   544     }
   559     }
   545 }
   560 }
   546 
   561 
   547 void PageOptions::onColorModelDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight)
   562 void PageOptions::onColorModelDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight)
   548 {
   563 {
       
   564     Q_UNUSED(bottomRight);
       
   565 
   549     QStandardItemModel * model = DataManager::instance().colorsModel();
   566     QStandardItemModel * model = DataManager::instance().colorsModel();
   550 
   567 
   551     m_colorButtons[topLeft.row()]->setStyleSheet(QString("background: %1").arg(model->item(topLeft.row())->data().value<QColor>().name()));
   568     m_colorButtons[topLeft.row()]->setStyleSheet(QString("background: %1").arg(model->item(topLeft.row())->data().value<QColor>().name()));
   552 }
   569 }