QTfrontend/ui/page/pageoptions.cpp
changeset 8387 f9d1191476ce
parent 8386 2aaa2995a32e
child 8434 4821897a0f10
equal deleted inserted replaced
8386:2aaa2995a32e 8387:f9d1191476ce
    37 
    37 
    38 #include "pageoptions.h"
    38 #include "pageoptions.h"
    39 #include "gameuiconfig.h"
    39 #include "gameuiconfig.h"
    40 #include "hwconsts.h"
    40 #include "hwconsts.h"
    41 #include "fpsedit.h"
    41 #include "fpsedit.h"
    42 #include "igbox.h"
       
    43 #include "DataManager.h"
    42 #include "DataManager.h"
    44 #include "LibavInteraction.h"
    43 #include "LibavInteraction.h"
    45 #include "AutoUpdater.h"
    44 #include "AutoUpdater.h"
    46 #include "HWApplication.h"
    45 #include "HWApplication.h"
    47 #include "keybinder.h"
    46 #include "keybinder.h"
    50 #ifdef SPARKLE_ENABLED
    49 #ifdef SPARKLE_ENABLED
    51 #include "SparkleAutoUpdater.h"
    50 #include "SparkleAutoUpdater.h"
    52 #endif
    51 #endif
    53 #endif
    52 #endif
    54 
    53 
       
    54 const int OPTION_BOX_SPACING = 10;
       
    55 
       
    56 OptionGroupBox::OptionGroupBox(const QString & iconName,
       
    57                                const QString & title,
       
    58                                QWidget * parent) : IconedGroupBox(parent)
       
    59 {
       
    60     setIcon(QIcon(iconName));
       
    61     setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
    62     setTitle(title);
       
    63     setMinimumWidth(300);
       
    64     m_layout = new QGridLayout(this);
       
    65     m_layout->setColumnStretch(0, 0);
       
    66     m_layout->setColumnStretch(1, 1);
       
    67 }
       
    68 
       
    69 QGridLayout * OptionGroupBox::layout()
       
    70 {
       
    71     return m_layout;
       
    72 }
       
    73 
       
    74 void OptionGroupBox::addDivider()
       
    75 {
       
    76     QFrame * hr = new QFrame(this);
       
    77     hr->setFrameStyle(QFrame::HLine);
       
    78     hr->setLineWidth(3);
       
    79     hr->setFixedHeight(10);
       
    80     m_layout->addWidget(hr, m_layout->rowCount(), 0, 1, m_layout->columnCount());
       
    81 }
       
    82 
    55 // TODO cleanup
    83 // TODO cleanup
    56 QLayout * PageOptions::bodyLayoutDefinition()
    84 QLayout * PageOptions::bodyLayoutDefinition()
    57 {
    85 {
    58     QVBoxLayout * pageLayout = new QVBoxLayout();
    86     QVBoxLayout * pageLayout = new QVBoxLayout();
    59 
    87 
    60     QTabWidget * tabs = new QTabWidget(this);
    88     QTabWidget * tabs = new QTabWidget(this);
    61     pageLayout->addWidget(tabs);
    89     pageLayout->addWidget(tabs);
    62     QWidget * page1 = new QWidget(this);
    90 
    63     QWidget * page2 = new QWidget(this);
       
    64     binder = new KeyBinder(this, tr("Select an action to change what key controls it"), tr("Reset to default"), tr("Reset all binds"));
    91     binder = new KeyBinder(this, tr("Select an action to change what key controls it"), tr("Reset to default"), tr("Reset all binds"));
    65     connect(binder, SIGNAL(bindUpdate(int)), this, SLOT(bindUpdated(int)));
    92     connect(binder, SIGNAL(bindUpdate(int)), this, SLOT(bindUpdated(int)));
    66     connect(binder, SIGNAL(resetAllBinds()), this, SLOT(resetAllBinds()));
    93     connect(binder, SIGNAL(resetAllBinds()), this, SLOT(resetAllBinds()));
    67     tabs->addTab(page1, tr("General"));
    94 
       
    95     QWidget * pageGame = new QWidget(this);
       
    96     tabs->addTab(pageGame, tr("Game"));
       
    97 
       
    98     QWidget * pageGraphics = new QWidget(this);
       
    99     tabs->addTab(pageGraphics, tr("Graphics"));
       
   100 
       
   101     QWidget * pageAudio = new QWidget(this);
       
   102     tabs->addTab(pageAudio, tr("Audio"));
       
   103 
    68     binderTab = tabs->addTab(binder, tr("Controls"));
   104     binderTab = tabs->addTab(binder, tr("Controls"));
    69     tabs->addTab(page2, tr("Advanced"));
   105 
       
   106 #ifdef VIDEOREC
       
   107     QWidget * pageVideoRec = new QWidget(this);
       
   108     tabs->addTab(pageVideoRec, tr("Video Recording"));
       
   109 #endif
       
   110 
       
   111     QWidget * pageNetwork = new QWidget(this);
       
   112     tabs->addTab(pageNetwork, tr("Network"));
       
   113 
       
   114     QWidget * pageAdvanced = new QWidget(this);
       
   115     tabs->addTab(pageAdvanced, tr("Advanced"));
    70 
   116 
    71     connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged(int)));
   117     connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged(int)));
    72 
   118 
    73 #ifdef VIDEOREC
   119     QPixmap pmNew(":/res/new.png");
    74     QWidget * page3 = new QWidget(this);
   120     QPixmap pmEdit(":/res/edit.png");
    75     tabs->addTab(page3, tr("Video Recording"));
   121     QPixmap pmDelete(":/res/delete.png");
    76 #endif
   122 
    77 
   123     { // game page
    78     { // page 1
   124         QVBoxLayout * leftColumn, * rightColumn;
    79         QGridLayout * page1Layout = new QGridLayout(page1);
   125         setupTabPage(pageGame, &leftColumn, &rightColumn);
    80         //gbTBLayout->setMargin(0);
   126 
    81         page1Layout->setSpacing(0);
   127         { // group: Teams
    82         page1Layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
   128             OptionGroupBox * groupTeams = new OptionGroupBox(":/res/teamicon.png", tr("Teams"), this);
    83 
   129             groupTeams->setMinimumWidth(400);
    84         QPixmap pmNew(":/res/new.png");
   130             rightColumn->addWidget(groupTeams);
    85         QPixmap pmEdit(":/res/edit.png");
   131 
    86         QPixmap pmDelete(":/res/delete.png");
   132             groupTeams->layout()->setColumnStretch(0, 1);
    87 
   133 
    88         {
   134             CBTeamName = new QComboBox(groupTeams);
    89             teamsBox = new IconedGroupBox(this);
   135             groupTeams->layout()->addWidget(CBTeamName, 0, 0);
    90             //teamsBox->setContentTopPadding(0);
   136 
    91             //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true);
   137             BtnNewTeam = new QPushButton(groupTeams);
    92             teamsBox->setIcon(QIcon(":/res/teamicon.png"));
       
    93             teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
    94             teamsBox->setTitle(QGroupBox::tr("Teams"));
       
    95 
       
    96             QGridLayout * GBTlayout = new QGridLayout(teamsBox);
       
    97 
       
    98             CBTeamName = new QComboBox(teamsBox);
       
    99             GBTlayout->addWidget(CBTeamName, 0, 0);
       
   100 
       
   101             BtnNewTeam = new QPushButton(teamsBox);
       
   102             BtnNewTeam->setWhatsThis(tr("New team"));
   138             BtnNewTeam->setWhatsThis(tr("New team"));
   103             BtnNewTeam->setIconSize(pmNew.size());
   139             BtnNewTeam->setIconSize(pmNew.size());
   104             BtnNewTeam->setIcon(pmNew);
   140             BtnNewTeam->setIcon(pmNew);
   105             BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
   141             BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
   106             connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested()));
   142             connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested()));
   107             GBTlayout->addWidget(BtnNewTeam, 0, 1);
   143             groupTeams->layout()->addWidget(BtnNewTeam, 0, 1);
   108 
   144 
   109             BtnEditTeam = new QPushButton(teamsBox);
   145             BtnEditTeam = new QPushButton(groupTeams);
   110             BtnEditTeam->setWhatsThis(tr("Edit team"));
   146             BtnEditTeam->setWhatsThis(tr("Edit team"));
   111             BtnEditTeam->setIconSize(pmEdit.size());
   147             BtnEditTeam->setIconSize(pmEdit.size());
   112             BtnEditTeam->setIcon(pmEdit);
   148             BtnEditTeam->setIcon(pmEdit);
   113             BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
   149             BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
   114             connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam()));
   150             connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam()));
   115             GBTlayout->addWidget(BtnEditTeam, 0, 2);
   151             groupTeams->layout()->addWidget(BtnEditTeam, 0, 2);
   116 
   152 
   117             BtnDeleteTeam = new QPushButton(teamsBox);
   153             BtnDeleteTeam = new QPushButton(groupTeams);
   118             BtnDeleteTeam->setWhatsThis(tr("Delete team"));
   154             BtnDeleteTeam->setWhatsThis(tr("Delete team"));
   119             BtnDeleteTeam->setIconSize(pmDelete.size());
   155             BtnDeleteTeam->setIconSize(pmDelete.size());
   120             BtnDeleteTeam->setIcon(pmDelete);
   156             BtnDeleteTeam->setIcon(pmDelete);
   121             BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
   157             BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
   122             connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam()));
   158             connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam()));
   123             GBTlayout->addWidget(BtnDeleteTeam, 0, 3);
   159             groupTeams->layout()->addWidget(BtnDeleteTeam, 0, 3);
   124 
   160 
   125             LblNoEditTeam = new QLabel(teamsBox);
   161             LblNoEditTeam = new QLabel(groupTeams);
   126             LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams."));
   162             LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams."));
   127             LblNoEditTeam->setWordWrap(true);
   163             LblNoEditTeam->setWordWrap(true);
   128             LblNoEditTeam->setVisible(false);
   164             LblNoEditTeam->setVisible(false);
   129             GBTlayout->addWidget(LblNoEditTeam, 0, 0);
   165             groupTeams->layout()->addWidget(LblNoEditTeam, 1, 0, 1, 4);
   130 
   166         }
   131             page1Layout->addWidget(teamsBox, 0, 0);
   167 
   132         }
   168         { // group: schemes
   133 
   169             OptionGroupBox * groupSchemes = new OptionGroupBox(":/res/weaponsicon.png", tr("Schemes"), this);
   134         {
   170             leftColumn->addWidget(groupSchemes);
   135             IconedGroupBox* groupWeapons = new IconedGroupBox(this);
   171 
   136 
   172             groupSchemes->layout()->setColumnStretch(0, 1);
   137             //groupWeapons->setContentTopPadding(0);
   173 
   138             //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   174             SchemesName = new QComboBox(groupSchemes);
   139             groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
   175             groupSchemes->layout()->addWidget(SchemesName, 0, 0);
   140             groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   176 
   141             groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons"));
   177             SchemeNew = new QPushButton(groupSchemes);
   142             QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
       
   143 
       
   144             QLabel* SchemeLabel = new QLabel(groupWeapons);
       
   145             SchemeLabel->setText(QLabel::tr("Game scheme"));
       
   146             WeaponsLayout->addWidget(SchemeLabel, 1, 0);
       
   147 
       
   148             SchemesName = new QComboBox(groupWeapons);
       
   149             WeaponsLayout->addWidget(SchemesName, 1, 1);
       
   150 
       
   151             SchemeNew = new QPushButton(groupWeapons);
       
   152             SchemeNew->setWhatsThis(tr("New scheme"));
   178             SchemeNew->setWhatsThis(tr("New scheme"));
   153             SchemeNew->setIconSize(pmNew.size());
   179             SchemeNew->setIconSize(pmNew.size());
   154             SchemeNew->setIcon(pmNew);
   180             SchemeNew->setIcon(pmNew);
   155             SchemeNew->setMaximumWidth(pmNew.width() + 6);
   181             SchemeNew->setMaximumWidth(pmNew.width() + 6);
   156             WeaponsLayout->addWidget(SchemeNew, 1, 2);
   182             groupSchemes->layout()->addWidget(SchemeNew, 0, 1);
   157 
   183 
   158             SchemeEdit = new QPushButton(groupWeapons);
   184             SchemeEdit = new QPushButton(groupSchemes);
   159             SchemeEdit->setWhatsThis(tr("Edit scheme"));
   185             SchemeEdit->setWhatsThis(tr("Edit scheme"));
   160             SchemeEdit->setIconSize(pmEdit.size());
   186             SchemeEdit->setIconSize(pmEdit.size());
   161             SchemeEdit->setIcon(pmEdit);
   187             SchemeEdit->setIcon(pmEdit);
   162             SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
   188             SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
   163             WeaponsLayout->addWidget(SchemeEdit, 1, 3);
   189             groupSchemes->layout()->addWidget(SchemeEdit, 0, 2);
   164 
   190 
   165             SchemeDelete = new QPushButton(groupWeapons);
   191             SchemeDelete = new QPushButton(groupSchemes);
   166             SchemeDelete->setWhatsThis(tr("Delete scheme"));
   192             SchemeDelete->setWhatsThis(tr("Delete scheme"));
   167             SchemeDelete->setIconSize(pmDelete.size());
   193             SchemeDelete->setIconSize(pmDelete.size());
   168             SchemeDelete->setIcon(pmDelete);
   194             SchemeDelete->setIcon(pmDelete);
   169             SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
   195             SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
   170             WeaponsLayout->addWidget(SchemeDelete, 1, 4);
   196             groupSchemes->layout()->addWidget(SchemeDelete, 0, 3);
   171 
   197         }
   172             QLabel* WeaponLabel = new QLabel(groupWeapons);
   198 
   173             WeaponLabel->setText(QLabel::tr("Weapons"));
   199         { // group: weapons
   174             WeaponsLayout->addWidget(WeaponLabel, 2, 0);
   200             OptionGroupBox * groupWeapons = new OptionGroupBox(":/res/weaponsicon.png", tr("Weapons"), this);
       
   201             leftColumn->addWidget(groupWeapons);
       
   202             
       
   203             groupWeapons->layout()->setColumnStretch(0, 1);
   175 
   204 
   176             WeaponsName = new QComboBox(groupWeapons);
   205             WeaponsName = new QComboBox(groupWeapons);
   177             WeaponsLayout->addWidget(WeaponsName, 2, 1);
   206             groupWeapons->layout()->addWidget(WeaponsName, 0, 0);
   178 
   207 
   179             WeaponNew = new QPushButton(groupWeapons);
   208             WeaponNew = new QPushButton(groupWeapons);
   180             WeaponNew->setWhatsThis(tr("New weapon set"));
   209             WeaponNew->setWhatsThis(tr("New weapon set"));
   181             WeaponNew->setIconSize(pmNew.size());
   210             WeaponNew->setIconSize(pmNew.size());
   182             WeaponNew->setIcon(pmNew);
   211             WeaponNew->setIcon(pmNew);
   183             WeaponNew->setMaximumWidth(pmNew.width() + 6);
   212             WeaponNew->setMaximumWidth(pmNew.width() + 6);
   184             WeaponsLayout->addWidget(WeaponNew, 2, 2);
   213             groupWeapons->layout()->addWidget(WeaponNew, 0, 1);
   185 
   214 
   186             WeaponEdit = new QPushButton(groupWeapons);
   215             WeaponEdit = new QPushButton(groupWeapons);
   187             WeaponEdit->setWhatsThis(tr("Edit weapon set"));
   216             WeaponEdit->setWhatsThis(tr("Edit weapon set"));
   188             WeaponEdit->setIconSize(pmEdit.size());
   217             WeaponEdit->setIconSize(pmEdit.size());
   189             WeaponEdit->setIcon(pmEdit);
   218             WeaponEdit->setIcon(pmEdit);
   190             WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
   219             WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
   191             WeaponsLayout->addWidget(WeaponEdit, 2, 3);
   220             groupWeapons->layout()->addWidget(WeaponEdit, 0, 2);
   192 
   221 
   193             WeaponDelete = new QPushButton(groupWeapons);
   222             WeaponDelete = new QPushButton(groupWeapons);
   194             WeaponDelete->setWhatsThis(tr("Delete weapon set"));
   223             WeaponDelete->setWhatsThis(tr("Delete weapon set"));
   195             WeaponDelete->setIconSize(pmDelete.size());
   224             WeaponDelete->setIconSize(pmDelete.size());
   196             WeaponDelete->setIcon(pmDelete);
   225             WeaponDelete->setIcon(pmDelete);
   197             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
   226             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
   198             WeaponsLayout->addWidget(WeaponDelete, 2, 4);
   227             groupWeapons->layout()->addWidget(WeaponDelete, 0, 3);
   199 
   228         }
   200             page1Layout->addWidget(groupWeapons, 1, 0);
   229 
   201         }
   230         leftColumn->addStretch(1);
   202 
   231         rightColumn->addStretch(1);
   203         {
   232     }
   204             IconedGroupBox* groupMisc = new IconedGroupBox(this);
   233 
   205             //groupMisc->setContentTopPadding(0);
   234     { // graphics page
   206             //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
   235         QVBoxLayout * leftColumn, * rightColumn;
   207             groupMisc->setIcon(QIcon(":/res/miscicon.png"));
   236         setupTabPage(pageGraphics, &leftColumn, &rightColumn);
   208             //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   237 
   209             groupMisc->setTitle(QGroupBox::tr("Misc"));
   238         { // group: game
   210             QGridLayout * MiscLayout = new QGridLayout(groupMisc);
   239             OptionGroupBox * groupGame = new OptionGroupBox(":/res/graphicsicon.png", tr("Game"), this);
   211 
   240             leftColumn->addWidget(groupGame);
   212             // Label for "Language"
   241 
   213             QLabel *labelLanguage = new QLabel(groupMisc);
   242             groupGame->layout()->setColumnStretch(0, 0);
   214             labelLanguage->setText(QLabel::tr("Locale") + " *");
   243             groupGame->layout()->setColumnStretch(1, 0);
   215             MiscLayout->addWidget(labelLanguage, 0, 0);
   244             groupGame->layout()->setColumnStretch(2, 1);
   216 
   245 
   217             // List of installed languages
   246             // Fullscreen
   218             CBLanguage = new QComboBox(groupMisc);
   247 
   219             QStringList locs = DataManager::instance().entryList("Locale", QDir::Files, QStringList("hedgewars_*.qm"));
   248             CBFullscreen = new QCheckBox(groupGame);
   220             CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
   249             groupGame->layout()->addWidget(CBFullscreen, 0, 0, 1, 2);
   221             for(int i = 0; i < locs.count(); i++)
       
   222             {
       
   223                 QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
       
   224                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
       
   225             }
       
   226 
       
   227             MiscLayout->addWidget(CBLanguage, 0, 1);
       
   228 
       
   229             // Label and field for net nick
       
   230             labelNN = new QLabel(groupMisc);
       
   231             labelNN->setText(QLabel::tr("Nickname"));
       
   232             MiscLayout->addWidget(labelNN, 1, 0);
       
   233 
       
   234             editNetNick = new QLineEdit(groupMisc);
       
   235             editNetNick->setMaxLength(20);
       
   236             editNetNick->setText(QLineEdit::tr("anonymous"));
       
   237             MiscLayout->addWidget(editNetNick, 1, 1);
       
   238 
       
   239             // checkbox and field for password
       
   240             CBSavePassword = new QCheckBox(groupMisc);
       
   241             CBSavePassword->setText(QCheckBox::tr("Save password"));
       
   242             MiscLayout->addWidget(CBSavePassword, 2, 0);
       
   243 
       
   244             editNetPassword = new QLineEdit(groupMisc);
       
   245             editNetPassword->setEchoMode(QLineEdit::Password);
       
   246             MiscLayout->addWidget(editNetPassword, 2, 1);
       
   247 
       
   248     #ifdef __APPLE__
       
   249     #ifdef SPARKLE_ENABLED
       
   250             CBAutoUpdate = new QCheckBox(groupMisc);
       
   251             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
       
   252             MiscLayout->addWidget(CBAutoUpdate, 7, 0, 1, 1);
       
   253 
       
   254             btnUpdateNow = new QPushButton(groupMisc);
       
   255             connect(btnUpdateNow, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
       
   256             btnUpdateNow->setWhatsThis(tr("Check for updates"));
       
   257             btnUpdateNow->setText("Check now");
       
   258             btnUpdateNow->setFixedSize(130, 30);
       
   259             MiscLayout->addWidget(btnUpdateNow, 7, 1, 1, 1);
       
   260     #endif
       
   261     #endif
       
   262             page1Layout->addWidget(groupMisc, 2, 0);
       
   263         }
       
   264 
       
   265         {
       
   266             AGGroupBox = new IconedGroupBox(this);
       
   267             //AGGroupBox->setContentTopPadding(0);
       
   268             AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
       
   269             //AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
       
   270             AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
       
   271 
       
   272             QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
       
   273             QGridLayout * GBAfrontendlayout = new QGridLayout(0);
       
   274             QGridLayout * GBAreslayout = new QGridLayout(0);
       
   275             QHBoxLayout * GBAfslayout = new QHBoxLayout(0);
       
   276             QVBoxLayout * GBArescolumn = new QVBoxLayout(0);
       
   277             QHBoxLayout * GBAstereolayout = new QHBoxLayout(0);
       
   278             QHBoxLayout * GBAqualayout = new QHBoxLayout(0);
       
   279 
       
   280             QLabel * frontend = new QLabel(AGGroupBox);
       
   281             frontend->setText(QLabel::tr("Frontend"));
       
   282             frontend->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
       
   283             GBAfrontendlayout->addWidget(frontend, 0, 0, 1, 2);
       
   284 
       
   285             CBFrontendFullscreen = new QCheckBox(AGGroupBox);
       
   286             CBFrontendFullscreen->setText(QCheckBox::tr("Fullscreen"));
       
   287             GBAfrontendlayout->addWidget(CBFrontendFullscreen, 1, 0);
       
   288 
       
   289             CBFrontendEffects = new QCheckBox(AGGroupBox);
       
   290             CBFrontendEffects->setText(QCheckBox::tr("Visual effects"));
       
   291             GBAfrontendlayout->addWidget(CBFrontendEffects, 2, 0);
       
   292 
       
   293             CBFrontendSound = new QCheckBox(AGGroupBox);
       
   294             CBFrontendSound->setText(QCheckBox::tr("Sound"));
       
   295             GBAfrontendlayout->addWidget(CBFrontendSound, 1, 1);
       
   296 
       
   297             CBFrontendMusic = new QCheckBox(AGGroupBox);
       
   298             CBFrontendMusic->setText(QCheckBox::tr("Music"));
       
   299             GBAfrontendlayout->addWidget(CBFrontendMusic, 2, 1);
       
   300 
       
   301             GBAlayout->addLayout(GBAfrontendlayout);
       
   302 
       
   303             QFrame * hr = new QFrame(AGGroupBox);
       
   304             hr->setFrameStyle(QFrame::HLine);
       
   305             hr->setLineWidth(3);
       
   306             hr->setFixedHeight(10);
       
   307             GBAlayout->addWidget(hr);
       
   308 
       
   309             CBFullscreen = new QCheckBox(AGGroupBox);
       
   310             GBAreslayout->addWidget(CBFullscreen, 0, 0);
       
   311             CBFullscreen->setText(QLabel::tr("Fullscreen"));
   250             CBFullscreen->setText(QLabel::tr("Fullscreen"));
       
   251 
       
   252             // Fullscreen resolution
       
   253             
       
   254             lblFullScreenRes = new QLabel(groupGame);
       
   255             lblFullScreenRes->setText(QLabel::tr("Fullscreen Resolution"));
       
   256             groupGame->layout()->addWidget(lblFullScreenRes, 1, 0);
       
   257 
       
   258             CBResolution = new QComboBox(groupGame);
       
   259             CBResolution->setFixedWidth(200);
       
   260             groupGame->layout()->addWidget(CBResolution, 1, 1, Qt::AlignLeft);
       
   261 
       
   262             // Windowed resolution
       
   263             
       
   264             lblWinScreenRes = new QLabel(groupGame);
       
   265             lblWinScreenRes->setText(QLabel::tr("Windowed Resolution"));
       
   266             groupGame->layout()->addWidget(lblWinScreenRes, 2, 0);
   312                         
   267                         
   313             CBResolution = new QComboBox(AGGroupBox);
   268             winResContainer = new QWidget();
   314             GBArescolumn->addWidget(CBResolution);
   269             QHBoxLayout * winResLayout = new QHBoxLayout(winResContainer);
       
   270             winResLayout->setSpacing(0);
       
   271             groupGame->layout()->addWidget(winResContainer, 2, 1);
   315             
   272             
   316             QLabel * fullscreenResolution = new QLabel(AGGroupBox);
   273             QLabel *winLabelX = new QLabel(groupGame);
   317             fullscreenResolution->setText(QLabel::tr("Fullscreen Resolution"));
   274             winLabelX->setText("x"); // decorational x
   318             GBAreslayout->addWidget(fullscreenResolution,1, 0);
   275             winLabelX->setFixedWidth(40);
       
   276             winLabelX->setAlignment(Qt::AlignCenter);
   319             
   277             
   320             QLabel * windowedResolution = new QLabel(AGGroupBox);
   278             windowWidthEdit = new QLineEdit(groupGame);
   321             windowedResolution->setText(QLabel::tr("Windowed Resolution"));
   279             windowWidthEdit->setValidator(new QIntValidator(this));
   322             GBAreslayout->addWidget(windowedResolution, 2, 0);
   280             windowWidthEdit->setFixedSize(55, CBResolution->height());
       
   281             windowHeightEdit = new QLineEdit(groupGame);
       
   282             windowHeightEdit->setValidator(new QIntValidator(this));
       
   283             windowHeightEdit->setFixedSize(55, CBResolution->height());
   323             
   284             
   324             // decorational X
   285             winResLayout->addWidget(windowWidthEdit, 0);
   325             QLabel *winLabelX = new QLabel(AGGroupBox);
   286             winResLayout->addWidget(winLabelX, 0);
   326             winLabelX->setText("X");
   287             winResLayout->addWidget(windowHeightEdit, 0);
   327             
   288             winResLayout->addStretch(1);
   328             windowWidthEdit = new QLineEdit(AGGroupBox);
   289 
   329             windowWidthEdit->setValidator(new QIntValidator(this));
   290             // Quality
   330             windowHeightEdit = new QLineEdit(AGGroupBox);
   291 
   331             windowHeightEdit->setValidator(new QIntValidator(this));
   292             QLabel * lblQuality = new QLabel(groupGame);
   332             
   293             lblQuality->setText(QLabel::tr("Quality"));
   333             GBAfslayout->addWidget(windowWidthEdit);
   294             lblQuality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   334             GBAfslayout->addWidget(winLabelX);
   295             groupGame->layout()->addWidget(lblQuality, 3, 0);
   335             GBAfslayout->addWidget(windowHeightEdit);
   296 
   336             
   297             SLQuality = new QSlider(Qt::Horizontal, groupGame);
   337             GBAfslayout->setAlignment(windowHeightEdit, Qt::AlignRight);
       
   338             GBAfslayout->setAlignment(windowWidthEdit, Qt::AlignRight);
       
   339             GBAfslayout->setAlignment(winLabelX, Qt::AlignRight);
       
   340             GBArescolumn->addLayout(GBAfslayout);
       
   341             GBAreslayout->addLayout(GBArescolumn, 1, 1, 2, 1);
       
   342             GBAreslayout->setAlignment(GBArescolumn, Qt::AlignRight);
       
   343             
       
   344             GBAlayout->addLayout(GBAreslayout);
       
   345             
       
   346             QLabel * quality = new QLabel(AGGroupBox);
       
   347             quality->setText(QLabel::tr("Quality"));
       
   348             quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
   349             GBAqualayout->addWidget(quality);
       
   350 
       
   351             SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
       
   352             SLQuality->setTickPosition(QSlider::TicksBelow);
   298             SLQuality->setTickPosition(QSlider::TicksBelow);
   353             SLQuality->setMaximum(5);
   299             SLQuality->setMaximum(5);
   354             SLQuality->setMinimum(0);
   300             SLQuality->setMinimum(0);
   355             SLQuality->setFixedWidth(150);
   301             SLQuality->setFixedWidth(150);
   356             GBAqualayout->addWidget(SLQuality);
   302             groupGame->layout()->addWidget(SLQuality, 3, 1, Qt::AlignLeft);
   357             GBAlayout->addLayout(GBAqualayout);
   303 
   358 
   304             // Stereo spacing
   359             QLabel * stereo = new QLabel(AGGroupBox);
   305 
   360             stereo->setText(QLabel::tr("Stereo rendering"));
   306             QLabel * lblStereo = new QLabel(groupGame);
   361             GBAstereolayout->addWidget(stereo);
   307             lblStereo->setText(QLabel::tr("Stereo rendering"));
   362 
   308             groupGame->layout()->addWidget(lblStereo, 4, 0);
   363             CBStereoMode = new QComboBox(AGGroupBox);
   309 
       
   310             CBStereoMode = new QComboBox(groupGame);
   364             CBStereoMode->addItem(QComboBox::tr("Disabled"));
   311             CBStereoMode->addItem(QComboBox::tr("Disabled"));
   365             CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
   312             CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
   366             CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
   313             CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
   367             CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
   314             CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
   368             CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
   315             CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
   374             CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
   321             CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
   375             CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
   322             CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
   376             CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
   323             CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
   377             CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
   324             CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
   378             CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
   325             CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
   379 
   326             CBStereoMode->setFixedWidth(CBResolution->width());
   380             GBAstereolayout->addWidget(CBStereoMode);
   327             groupGame->layout()->addWidget(CBStereoMode, 4, 1);
   381             GBAlayout->addLayout(GBAstereolayout);
   328 
   382 
   329             // Divider
   383             hr = new QFrame(AGGroupBox);
   330 
   384             hr->setFrameStyle(QFrame::HLine);
   331             groupGame->addDivider(); // row 5
   385             hr->setLineWidth(3);
   332 
   386             hr->setFixedHeight(10);
   333             // FPS limit
   387             GBAlayout->addWidget(hr);
   334 
   388 
   335             QHBoxLayout * fpsLayout = new QHBoxLayout();
   389             QGridLayout * GBAvollayout = new QGridLayout();
   336             groupGame->layout()->addLayout(fpsLayout, 6, 0, 1, 2);
   390             QLabel * vol = new QLabel(AGGroupBox);
   337             QLabel * maxfps = new QLabel(groupGame);
   391             vol->setText(QLabel::tr("Initial sound volume"));
   338             maxfps->setText(QLabel::tr("FPS limit"));
   392             GBAvollayout->addWidget(vol, 0, 0, 1, 2);
   339             fpsLayout->addWidget(maxfps);
   393             GBAlayout->addLayout(GBAvollayout);
   340             fpsLayout->addSpacing(30);
   394             volumeBox = new QSpinBox(AGGroupBox);
   341             fpsedit = new FPSEdit(groupGame);
   395             volumeBox->setRange(0, 100);
   342             fpsLayout->addWidget(fpsedit);
   396             volumeBox->setSingleStep(5);
   343 
   397             GBAvollayout->addWidget(volumeBox, 0, 2);
   344             // Show FPS
   398 
   345 
   399             CBSound = new QCheckBox(AGGroupBox);
   346             CBShowFPS = new QCheckBox(groupGame);
   400             CBSound->setText(QCheckBox::tr("Sound"));
   347             CBShowFPS->setText(QCheckBox::tr("Show FPS"));
   401             CBSound->setWhatsThis(QCheckBox::tr("In-game sound effects"));
   348             fpsLayout->addWidget(CBShowFPS);
   402             GBAvollayout->addWidget(CBSound, 1, 0);
   349             fpsLayout->addStretch(1);
   403 
   350 
   404             CBMusic = new QCheckBox(AGGroupBox);
   351             // Divider
   405             CBMusic->setText(QCheckBox::tr("Music"));
   352 
   406             CBMusic->setWhatsThis(QCheckBox::tr("In-game music"));
   353             groupGame->addDivider(); // row 7
   407             GBAvollayout->addWidget(CBMusic, 1, 1, 1, 2);
   354 
   408 
   355             // Alternative damage show
   409             GBAvollayout->setSizeConstraint(QLayout::SetMinimumSize);
   356 
   410 
   357             CBAltDamage = new QCheckBox(groupGame);
   411             hr = new QFrame(AGGroupBox);
       
   412             hr->setFrameStyle(QFrame::HLine);
       
   413             hr->setLineWidth(3);
       
   414             hr->setFixedHeight(10);
       
   415             GBAlayout->addWidget(hr);
       
   416 
       
   417             CBAltDamage = new QCheckBox(AGGroupBox);
       
   418             CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
   358             CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
   419             GBAlayout->addWidget(CBAltDamage);
   359             groupGame->layout()->addWidget(CBAltDamage, 8, 0, 1, 2);
   420 
   360 
   421             page1Layout->addWidget(AGGroupBox, 0, 1, 3, 1);
   361             // Show ammo menu tooltips
   422         }
   362 
   423 
   363             WeaponTooltip = new QCheckBox(groupGame);
   424         page1Layout->addWidget(new QWidget(this), 3, 0);
   364             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
   425 
   365             groupGame->layout()->addWidget(WeaponTooltip, 9, 0, 1, 2);
   426     }
   366         }
   427 
   367 
   428     { // page 2
   368         { // group: frontend
   429         QGridLayout * page2Layout = new QGridLayout(page2);
   369             OptionGroupBox * groupFrontend = new OptionGroupBox(":/res/graphicsicon.png", tr("Frontend"), this);
   430 
   370             rightColumn->addWidget(groupFrontend);
   431         {
   371 
   432             IconedGroupBox * gbColors = new IconedGroupBox(this);
   372             // Fullscreen
   433             gbColors->setIcon(QIcon(":/res/lightbulb_on.png"));
   373 
   434             gbColors->setTitle(QGroupBox::tr("Custom colors"));
   374             CBFrontendFullscreen = new QCheckBox(groupFrontend);
   435             page2Layout->addWidget(gbColors, 0, 0);
   375             CBFrontendFullscreen->setText(QCheckBox::tr("Fullscreen"));
   436             QGridLayout * gbCLayout = new QGridLayout(gbColors);
   376             groupFrontend->layout()->addWidget(CBFrontendFullscreen, 0, 0);
       
   377 
       
   378             // Visual effects
       
   379 
       
   380             CBFrontendEffects = new QCheckBox(groupFrontend);
       
   381             CBFrontendEffects->setText(QCheckBox::tr("Visual effects"));
       
   382             groupFrontend->layout()->addWidget(CBFrontendEffects, 1, 0);
       
   383         }
       
   384 
       
   385         { // group: colors
       
   386             OptionGroupBox * groupColors = new OptionGroupBox(":/res/lightbulb_on.png", tr("Custom colors"), this);
       
   387             rightColumn->addWidget(groupColors);
       
   388 
       
   389             groupColors->layout()->setColumnStretch(0, 1);
       
   390             groupColors->layout()->setColumnStretch(1, 1);
       
   391             groupColors->layout()->setColumnStretch(2, 1);
       
   392 
       
   393             // Color buttons
   437 
   394 
   438             QSignalMapper * mapper = new QSignalMapper(this);
   395             QSignalMapper * mapper = new QSignalMapper(this);
   439 
       
   440             QStandardItemModel * model = DataManager::instance().colorsModel();
   396             QStandardItemModel * model = DataManager::instance().colorsModel();
   441 
   397 
   442             connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(onColorModelDataChanged(QModelIndex,QModelIndex)));
   398             connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(onColorModelDataChanged(QModelIndex,QModelIndex)));
   443             for(int i = 0; i < model->rowCount(); ++i)
   399             for(int i = 0; i < model->rowCount(); ++i)
   444             {
   400             {
   445                 QPushButton * btn = new QPushButton(this);
   401                 QPushButton * btn = new QPushButton(this);
   446                 btn->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
   402                 btn->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
   447                 gbCLayout->addWidget(btn, i / 3, i % 3);
   403                 groupColors->layout()->addWidget(btn, i / 3, i % 3);
   448                 btn->setStyleSheet(QString("background: %1").arg(model->item(i)->data().value<QColor>().name()));
   404                 btn->setStyleSheet(QString("background: %1").arg(model->item(i)->data().value<QColor>().name()));
   449                 m_colorButtons.append(btn);
   405                 m_colorButtons.append(btn);
   450                 connect(btn, SIGNAL(clicked()), mapper, SLOT(map()));
   406                 connect(btn, SIGNAL(clicked()), mapper, SLOT(map()));
   451                 mapper->setMapping(btn, i);
   407                 mapper->setMapping(btn, i);
   452             }
   408             }
   453 
   409 
   454             connect(mapper, SIGNAL(mapped(int)), this, SLOT(colorButtonClicked(int)));
   410             connect(mapper, SIGNAL(mapped(int)), this, SLOT(colorButtonClicked(int)));
   455 
   411 
       
   412             // Reset default colors
       
   413 
   456             QPushButton * btn = new QPushButton(this);
   414             QPushButton * btn = new QPushButton(this);
   457             gbCLayout->addWidget(btn, (model->rowCount() - 1) / 3 + 1, 0, 1, 3);
   415             groupColors->layout()->addWidget(btn, (model->rowCount() - 1) / 3 + 1, 0, 1, 3);
   458             btn->setText(tr("Reset to default colors"));
   416             btn->setText(tr("Reset to default colors"));
   459             connect(btn, SIGNAL(clicked()), &DataManager::instance(), SLOT(resetColors()));
   417             connect(btn, SIGNAL(clicked()), &DataManager::instance(), SLOT(resetColors()));
   460         }
   418         }
   461 
   419 
   462         {
   420         leftColumn->addStretch(1);
   463             IconedGroupBox * gbMisc = new IconedGroupBox(this);
   421         rightColumn->addStretch(1);
   464             gbMisc->setIcon(QIcon(":/res/Settings.png"));
   422     }
   465             gbMisc->setTitle(QGroupBox::tr("Miscellaneous"));
   423 
   466             page2Layout->addWidget(gbMisc, 0, 1);
   424     { // audio page
   467             QVBoxLayout * gbCLayout = new QVBoxLayout(gbMisc);
   425         QVBoxLayout * leftColumn, * rightColumn;
   468 
   426         setupTabPage(pageAudio, &leftColumn, &rightColumn);
   469             QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
   427 
   470             QLabel * maxfps = new QLabel(AGGroupBox);
   428         { // group: game
   471             maxfps->setText(QLabel::tr("FPS limit"));
   429             OptionGroupBox * groupGame = new OptionGroupBox(":/res/audio.png", tr("Game audio"), this);
   472             GBAfpslayout->addWidget(maxfps);
   430             leftColumn->addWidget(groupGame);
   473             fpsedit = new FPSEdit(AGGroupBox);
   431             groupGame->layout()->setColumnStretch(1, 0);
   474             GBAfpslayout->addWidget(fpsedit);
   432             groupGame->layout()->setColumnStretch(2, 1);
   475 
   433 
   476             CBShowFPS = new QCheckBox(AGGroupBox);
   434             // Initial sound volume
   477             CBShowFPS->setText(QCheckBox::tr("Show FPS"));
   435 
   478             GBAfpslayout->addWidget(CBShowFPS);
   436             QLabel * vol = new QLabel(groupGame);
   479 
   437             vol->setText(QLabel::tr("Initial sound volume"));
   480             gbCLayout->addLayout(GBAfpslayout);
   438             groupGame->layout()->addWidget(vol, 0, 0);
   481 
   439 
   482 
   440             SLVolume = new QSlider(Qt::Horizontal, groupGame);
   483             WeaponTooltip = new QCheckBox(this);
   441             SLVolume->setTickPosition(QSlider::TicksBelow);
   484             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
   442             SLVolume->setMaximum(100);
   485             gbCLayout->addWidget(WeaponTooltip);
   443             SLVolume->setMinimum(0);
   486 
   444             SLVolume->setFixedWidth(150);
   487 
   445             groupGame->layout()->addWidget(SLVolume, 0, 1, 1, 2);
   488             CBNameWithDate = new QCheckBox(this);
   446 
   489             CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
   447             lblVolumeLevel = new QLabel(groupGame);
   490             gbCLayout->addWidget(CBNameWithDate);
   448             lblVolumeLevel->setFixedWidth(40);
   491 
   449             groupGame->layout()->addWidget(lblVolumeLevel, 0, 3);
   492             BtnAssociateFiles = new QPushButton(this);
   450 
   493             BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
   451             // Sound
   494             BtnAssociateFiles->setVisible(!custom_data && !custom_config);
   452 
   495             gbCLayout->addWidget(BtnAssociateFiles);
   453             CBSound = new QCheckBox(groupGame);
   496         }
   454             CBSound->setText(QCheckBox::tr("Sound"));
   497 
   455             CBSound->setWhatsThis(QCheckBox::tr("In-game sound effects"));
   498         {
   456             groupGame->layout()->addWidget(CBSound, 1, 1);
   499             IconedGroupBox * gbProxy = new IconedGroupBox(this);
   457 
   500             gbProxy->setIcon(QIcon(":/res/Settings.png"));
   458             // Music
   501             gbProxy->setTitle(QGroupBox::tr("Proxy settings"));
   459 
   502             page2Layout->addWidget(gbProxy, 1, 0);
   460             CBMusic = new QCheckBox(groupGame);
   503             QGridLayout * gbLayout = new QGridLayout(gbProxy);
   461             CBMusic->setText(QCheckBox::tr("Music"));
       
   462             CBMusic->setWhatsThis(QCheckBox::tr("In-game music"));
       
   463             groupGame->layout()->addWidget(CBMusic, 1, 2, 1, 2, Qt::AlignLeft);
       
   464         }
       
   465 
       
   466         { // group: frontend
       
   467             OptionGroupBox * groupFrontend = new OptionGroupBox(":/res/audio.png", tr("Frontend audio"), this);
       
   468             rightColumn->addWidget(groupFrontend);
       
   469 
       
   470             CBFrontendSound = new QCheckBox(groupFrontend);
       
   471             CBFrontendSound->setText(QCheckBox::tr("Sound"));
       
   472             CBFrontendSound->setWhatsThis(QCheckBox::tr("Frontend sound effects"));
       
   473             groupFrontend->layout()->addWidget(CBFrontendSound, 0, 0);
       
   474 
       
   475             CBFrontendMusic = new QCheckBox(groupFrontend);
       
   476             CBFrontendMusic->setText(QCheckBox::tr("Music"));
       
   477             CBFrontendMusic->setWhatsThis(QCheckBox::tr("Frontend music"));
       
   478             groupFrontend->layout()->addWidget(CBFrontendMusic, 0, 1);
       
   479         }
       
   480 
       
   481         leftColumn->addStretch(1);
       
   482         rightColumn->addStretch(1);
       
   483     }
       
   484 
       
   485     { // network page
       
   486         QVBoxLayout * leftColumn, * rightColumn;
       
   487         setupTabPage(pageNetwork, &leftColumn, &rightColumn);
       
   488 
       
   489         { // group: account
       
   490             OptionGroupBox * groupAccount = new OptionGroupBox(":/res/teamicon.png", tr("Account"), this);
       
   491             leftColumn->addWidget(groupAccount);
       
   492 
       
   493             // Label and field for net nick
       
   494 
       
   495             labelNN = new QLabel(groupAccount);
       
   496             labelNN->setText(QLabel::tr("Nickname"));
       
   497             groupAccount->layout()->addWidget(labelNN, 0, 0);
       
   498 
       
   499             editNetNick = new QLineEdit(groupAccount);
       
   500             editNetNick->setMaxLength(20);
       
   501             editNetNick->setText(QLineEdit::tr("anonymous"));
       
   502             groupAccount->layout()->addWidget(editNetNick, 0, 1);
       
   503 
       
   504             // Checkbox and field for password
       
   505 
       
   506             CBSavePassword = new QCheckBox(groupAccount);
       
   507             CBSavePassword->setText(QCheckBox::tr("Save password"));
       
   508             groupAccount->layout()->addWidget(CBSavePassword, 1, 0);
       
   509 
       
   510             editNetPassword = new QLineEdit(groupAccount);
       
   511             editNetPassword->setEchoMode(QLineEdit::Password);
       
   512             groupAccount->layout()->addWidget(editNetPassword, 1, 1);
       
   513         }
       
   514 
       
   515         { // group: proxy
       
   516             OptionGroupBox * groupProxy = new OptionGroupBox(":/res/net.png", tr("Proxy settings"), this);
       
   517             rightColumn->addWidget(groupProxy);
       
   518 
       
   519             // Labels
   504 
   520 
   505             QStringList sl;
   521             QStringList sl;
   506             sl
   522             sl << tr("Proxy host")
   507                     << tr("Proxy host")
   523                << tr("Proxy port")
   508                     << tr("Proxy port")
   524                << tr("Proxy login")
   509                     << tr("Proxy login")
   525                << tr("Proxy password");
   510                     << tr("Proxy password")
   526 
   511                        ;
       
   512             for(int i = 0; i < sl.size(); ++i)
   527             for(int i = 0; i < sl.size(); ++i)
   513             {
   528             {
   514                 QLabel * l = new QLabel(gbProxy);
   529                 QLabel * l = new QLabel(groupProxy);
   515                 l->setText(sl[i]);
   530                 l->setText(sl[i]);
   516                 gbLayout->addWidget(l, i + 1, 0);
   531                 groupProxy->layout()->addWidget(l, i + 1, 0);
   517             }
   532             }
   518 
   533 
   519             cbProxyType = new QComboBox(gbProxy);
   534             // Proxy type
       
   535 
       
   536             cbProxyType = new QComboBox(groupProxy);
   520             cbProxyType->addItems(QStringList()
   537             cbProxyType->addItems(QStringList()
   521                                   << tr("No proxy")
   538                                   << tr("No proxy")
   522                                   << tr("System proxy settings")
   539                                   << tr("System proxy settings")
   523                                   << tr("Socks5 proxy")
   540                                   << tr("Socks5 proxy")
   524                                   << tr("HTTP proxy"));
   541                                   << tr("HTTP proxy"));
   525             gbLayout->addWidget(cbProxyType, 0, 1);
   542             groupProxy->layout()->addWidget(cbProxyType, 0, 0, 1, 2);
   526 
   543 
   527             leProxy = new QLineEdit(gbProxy);
   544             // Proxy
   528             gbLayout->addWidget(leProxy, 1, 1);
   545 
   529 
   546             leProxy = new QLineEdit(groupProxy);
   530             sbProxyPort = new QSpinBox(gbProxy);
   547             groupProxy->layout()->addWidget(leProxy, 1, 1);
       
   548 
       
   549             // Proxy
       
   550 
       
   551             sbProxyPort = new QSpinBox(groupProxy);
   531             sbProxyPort->setMaximum(65535);
   552             sbProxyPort->setMaximum(65535);
   532             gbLayout->addWidget(sbProxyPort, 2, 1);
   553             groupProxy->layout()->addWidget(sbProxyPort, 2, 1);
   533 
   554 
   534             leProxyLogin = new QLineEdit(gbProxy);
   555             leProxyLogin = new QLineEdit(groupProxy);
   535             gbLayout->addWidget(leProxyLogin, 3, 1);
   556             groupProxy->layout()->addWidget(leProxyLogin, 3, 1);
   536 
   557 
   537             leProxyPassword = new QLineEdit(gbProxy);
   558             leProxyPassword = new QLineEdit(groupProxy);
   538             leProxyPassword->setEchoMode(QLineEdit::Password);
   559             leProxyPassword->setEchoMode(QLineEdit::Password);
   539             gbLayout->addWidget(leProxyPassword, 4, 1);
   560             groupProxy->layout()->addWidget(leProxyPassword, 4, 1);
   540 
   561 
   541 
   562 
   542             connect(cbProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged()));
   563             connect(cbProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged()));
   543             onProxyTypeChanged();
   564             onProxyTypeChanged();
   544         }
   565         }
   545 
   566 
   546         page2Layout->addWidget(new QWidget(this), 2, 0);
   567         leftColumn->addStretch(1);
   547     }
   568         rightColumn->addStretch(1);
       
   569     }
       
   570 
       
   571     { // advanced page
       
   572         QVBoxLayout * leftColumn, * rightColumn;
       
   573         setupTabPage(pageAdvanced, &leftColumn, &rightColumn);
       
   574 
       
   575         { // group: miscellaneous
       
   576             OptionGroupBox * groupMisc = new OptionGroupBox(":/res/Settings.png", tr("Miscellaneous"), this);
       
   577             leftColumn->addWidget(groupMisc);
       
   578 
       
   579             // Language
       
   580 
       
   581             QLabel *labelLanguage = new QLabel(groupMisc);
       
   582             labelLanguage->setText(QLabel::tr("Locale"));
       
   583             groupMisc->layout()->addWidget(labelLanguage, 0, 0);
       
   584 
       
   585             CBLanguage = new QComboBox(groupMisc);
       
   586             groupMisc->layout()->addWidget(CBLanguage, 0, 1);
       
   587             QStringList locs = DataManager::instance().entryList("Locale", QDir::Files, QStringList("hedgewars_*.qm"));
       
   588             CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
       
   589             for(int i = 0; i < locs.count(); i++)
       
   590             {
       
   591                 QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
       
   592                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
       
   593             }
       
   594 
       
   595             // Divider
       
   596 
       
   597             groupMisc->addDivider(); // row 1
       
   598 
       
   599             // Append date and time to record file name
       
   600 
       
   601             CBNameWithDate = new QCheckBox(groupMisc);
       
   602             CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
       
   603             groupMisc->layout()->addWidget(CBNameWithDate, 2, 0, 1, 2);
       
   604 
       
   605             // Associate file extensions
       
   606 
       
   607             BtnAssociateFiles = new QPushButton(groupMisc);
       
   608             BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
       
   609             BtnAssociateFiles->setVisible(!custom_data && !custom_config);
       
   610             groupMisc->layout()->addWidget(BtnAssociateFiles, 3, 0, 1, 2);
       
   611         }
       
   612 
       
   613 #ifdef __APPLE__
       
   614 #ifdef SPARKLE_ENABLED
       
   615         { // group: updates
       
   616             OptionGroupBox * groupUpdates = new OptionGroupBox(":/res/net.png", tr("Updates"), this);
       
   617             rightColumn->addWidget(groupUpdates);
       
   618 
       
   619             // Check for updates at startup
       
   620 
       
   621             CBAutoUpdate = new QCheckBox(groupUpdates);
       
   622             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
       
   623             groupUpdates->layout()->addWidget(CBAutoUpdate, 0, 0);
       
   624 
       
   625             // Check for updates now
       
   626 
       
   627             btnUpdateNow = new QPushButton(groupUpdates);
       
   628             connect(btnUpdateNow, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
       
   629             btnUpdateNow->setWhatsThis(tr("Check for updates"));
       
   630             btnUpdateNow->setText("Check now");
       
   631             btnUpdateNow->setFixedSize(130, 30);
       
   632             groupUpdates->layout()->addWidget(btnUpdateNow, 0, 1);
       
   633         }
       
   634 #endif
       
   635 #endif
       
   636 
       
   637         leftColumn->addStretch(1);
       
   638         rightColumn->addStretch(1);
       
   639     }
       
   640 
   548 #ifdef VIDEOREC
   641 #ifdef VIDEOREC
   549     { // page 3
   642     { // video recording page
   550         QGridLayout * page3Layout = new QGridLayout(page3);
   643         OptionGroupBox * groupVideoRec = new OptionGroupBox(":/res/camera.png", tr("Video recording options"), this);
   551 
   644         groupVideoRec->setMinimumWidth(500);
   552         IconedGroupBox* pOptionsGroup = new IconedGroupBox(this);
   645         groupVideoRec->setMaximumWidth(650);
   553         pOptionsGroup->setIcon(QIcon(":/res/Settings.png")); // FIXME
   646         QHBoxLayout * layoutVideoRec = new QHBoxLayout(pageVideoRec);
   554         pOptionsGroup->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
   647         layoutVideoRec->addWidget(groupVideoRec, 1, Qt::AlignTop | Qt::AlignHCenter);
   555         pOptionsGroup->setTitle(QGroupBox::tr("Video recording options"));
       
   556         QGridLayout * pOptLayout = new QGridLayout(pOptionsGroup);
       
   557 
   648 
   558         // label for format
   649         // label for format
   559         QLabel *labelFormat = new QLabel(pOptionsGroup);
   650 
       
   651         QLabel *labelFormat = new QLabel(groupVideoRec);
   560         labelFormat->setText(QLabel::tr("Format"));
   652         labelFormat->setText(QLabel::tr("Format"));
   561         pOptLayout->addWidget(labelFormat, 0, 0);
   653         groupVideoRec->layout()->addWidget(labelFormat, 0, 0);
   562 
   654 
   563         // list of supported formats
   655         // list of supported formats
   564         comboAVFormats = new QComboBox(pOptionsGroup);
   656 
   565         pOptLayout->addWidget(comboAVFormats, 0, 1, 1, 4);
   657         comboAVFormats = new QComboBox(groupVideoRec);
       
   658         groupVideoRec->layout()->addWidget(comboAVFormats, 0, 1, 1, 4);
   566         LibavInteraction::instance().fillFormats(comboAVFormats);
   659         LibavInteraction::instance().fillFormats(comboAVFormats);
   567 
   660 
   568         // separator
   661         // separator
   569         QFrame * hr = new QFrame(pOptionsGroup);
   662 
       
   663         QFrame * hr = new QFrame(groupVideoRec);
   570         hr->setFrameStyle(QFrame::HLine);
   664         hr->setFrameStyle(QFrame::HLine);
   571         hr->setLineWidth(3);
   665         hr->setLineWidth(3);
   572         hr->setFixedHeight(10);
   666         hr->setFixedHeight(10);
   573         pOptLayout->addWidget(hr, 1, 0, 1, 5);
   667         groupVideoRec->layout()->addWidget(hr, 1, 0, 1, 5);
   574 
   668 
   575         // label for audio codec
   669         // label for audio codec
   576         QLabel *labelACodec = new QLabel(pOptionsGroup);
   670 
       
   671         QLabel *labelACodec = new QLabel(groupVideoRec);
   577         labelACodec->setText(QLabel::tr("Audio codec"));
   672         labelACodec->setText(QLabel::tr("Audio codec"));
   578         pOptLayout->addWidget(labelACodec, 2, 0);
   673         groupVideoRec->layout()->addWidget(labelACodec, 2, 0);
   579 
   674 
   580         // list of supported audio codecs
   675         // list of supported audio codecs
   581         comboAudioCodecs = new QComboBox(pOptionsGroup);
   676 
   582         pOptLayout->addWidget(comboAudioCodecs, 2, 1, 1, 3);
   677         comboAudioCodecs = new QComboBox(groupVideoRec);
       
   678         groupVideoRec->layout()->addWidget(comboAudioCodecs, 2, 1, 1, 3);
   583 
   679 
   584         // checkbox 'record audio'
   680         // checkbox 'record audio'
   585         checkRecordAudio = new QCheckBox(pOptionsGroup);
   681 
       
   682         checkRecordAudio = new QCheckBox(groupVideoRec);
   586         checkRecordAudio->setText(QCheckBox::tr("Record audio"));
   683         checkRecordAudio->setText(QCheckBox::tr("Record audio"));
   587         pOptLayout->addWidget(checkRecordAudio, 2, 4);
   684         groupVideoRec->layout()->addWidget(checkRecordAudio, 2, 4);
   588 
   685 
   589         // separator
   686         // separator
   590         hr = new QFrame(pOptionsGroup);
   687 
       
   688         hr = new QFrame(groupVideoRec);
   591         hr->setFrameStyle(QFrame::HLine);
   689         hr->setFrameStyle(QFrame::HLine);
   592         hr->setLineWidth(3);
   690         hr->setLineWidth(3);
   593         hr->setFixedHeight(10);
   691         hr->setFixedHeight(10);
   594         pOptLayout->addWidget(hr, 3, 0, 1, 5);
   692         groupVideoRec->layout()->addWidget(hr, 3, 0, 1, 5);
   595 
   693 
   596         // label for video codec
   694         // label for video codec
   597         QLabel *labelVCodec = new QLabel(pOptionsGroup);
   695 
       
   696         QLabel *labelVCodec = new QLabel(groupVideoRec);
   598         labelVCodec->setText(QLabel::tr("Video codec"));
   697         labelVCodec->setText(QLabel::tr("Video codec"));
   599         pOptLayout->addWidget(labelVCodec, 4, 0);
   698         groupVideoRec->layout()->addWidget(labelVCodec, 4, 0);
   600 
   699 
   601         // list of supported video codecs
   700         // list of supported video codecs
   602         comboVideoCodecs = new QComboBox(pOptionsGroup);
   701 
   603         pOptLayout->addWidget(comboVideoCodecs, 4, 1, 1, 4);
   702         comboVideoCodecs = new QComboBox(groupVideoRec);
       
   703         groupVideoRec->layout()->addWidget(comboVideoCodecs, 4, 1, 1, 4);
   604 
   704 
   605         // label for resolution
   705         // label for resolution
   606         QLabel *labelRes = new QLabel(pOptionsGroup);
   706 
       
   707         QLabel *labelRes = new QLabel(groupVideoRec);
   607         labelRes->setText(QLabel::tr("Resolution"));
   708         labelRes->setText(QLabel::tr("Resolution"));
   608         pOptLayout->addWidget(labelRes, 5, 0);
   709         groupVideoRec->layout()->addWidget(labelRes, 5, 0);
   609 
   710 
   610         // width
   711         // width
   611         widthEdit = new QLineEdit(pOptionsGroup);
   712 
       
   713         widthEdit = new QLineEdit(groupVideoRec);
   612         widthEdit->setValidator(new QIntValidator(this));
   714         widthEdit->setValidator(new QIntValidator(this));
   613         pOptLayout->addWidget(widthEdit, 5, 1);
   715         groupVideoRec->layout()->addWidget(widthEdit, 5, 1);
   614 
   716 
   615         // x
   717         // x
   616         QLabel *labelX = new QLabel(pOptionsGroup);
   718 
       
   719         QLabel *labelX = new QLabel(groupVideoRec);
   617         labelX->setText("X");
   720         labelX->setText("X");
   618         pOptLayout->addWidget(labelX, 5, 2);
   721         groupVideoRec->layout()->addWidget(labelX, 5, 2);
   619 
   722 
   620         // height
   723         // height
   621         heightEdit = new QLineEdit(pOptionsGroup);
   724 
   622         heightEdit->setValidator(new QIntValidator(pOptionsGroup));
   725         heightEdit = new QLineEdit(groupVideoRec);
   623         pOptLayout->addWidget(heightEdit, 5, 3);
   726         heightEdit->setValidator(new QIntValidator(groupVideoRec));
       
   727         groupVideoRec->layout()->addWidget(heightEdit, 5, 3);
   624 
   728 
   625         // checkbox 'use game resolution'
   729         // checkbox 'use game resolution'
   626         checkUseGameRes = new QCheckBox(pOptionsGroup);
   730 
       
   731         checkUseGameRes = new QCheckBox(groupVideoRec);
   627         checkUseGameRes->setText(QCheckBox::tr("Use game resolution"));
   732         checkUseGameRes->setText(QCheckBox::tr("Use game resolution"));
   628         pOptLayout->addWidget(checkUseGameRes, 5, 4);
   733         groupVideoRec->layout()->addWidget(checkUseGameRes, 5, 4);
   629 
   734 
   630         // label for framerate
   735         // label for framerate
   631         QLabel *labelFramerate = new QLabel(pOptionsGroup);
   736 
       
   737         QLabel *labelFramerate = new QLabel(groupVideoRec);
   632         labelFramerate->setText(QLabel::tr("Framerate"));
   738         labelFramerate->setText(QLabel::tr("Framerate"));
   633         pOptLayout->addWidget(labelFramerate, 6, 0);
   739         groupVideoRec->layout()->addWidget(labelFramerate, 6, 0);
   634 
   740 
   635         framerateBox = new QComboBox(pOptionsGroup);
   741         framerateBox = new QComboBox(groupVideoRec);
   636         framerateBox->addItem("24 fps", 24);
   742         framerateBox->addItem("24 fps", 24);
   637         framerateBox->addItem("25 fps", 25);
   743         framerateBox->addItem("25 fps", 25);
   638         framerateBox->addItem("30 fps", 30);
   744         framerateBox->addItem("30 fps", 30);
   639         framerateBox->addItem("50 fps", 50);
   745         framerateBox->addItem("50 fps", 50);
   640         framerateBox->addItem("60 fps", 60);
   746         framerateBox->addItem("60 fps", 60);
   641         pOptLayout->addWidget(framerateBox, 6, 1);
   747         groupVideoRec->layout()->addWidget(framerateBox, 6, 1);
   642 
   748 
   643         // label for Bitrate
   749         // label for Bitrate
   644         QLabel *labelBitrate = new QLabel(pOptionsGroup);
   750 
       
   751         QLabel *labelBitrate = new QLabel(groupVideoRec);
   645         labelBitrate->setText(QLabel::tr("Bitrate (Kbps)"));
   752         labelBitrate->setText(QLabel::tr("Bitrate (Kbps)"));
   646         pOptLayout->addWidget(labelBitrate, 6, 2);
   753         groupVideoRec->layout()->addWidget(labelBitrate, 6, 2);
   647 
   754 
   648         // bitrate
   755         // bitrate
   649         bitrateBox = new QSpinBox(pOptionsGroup);
   756 
       
   757         bitrateBox = new QSpinBox(groupVideoRec);
   650         bitrateBox->setRange(100, 5000);
   758         bitrateBox->setRange(100, 5000);
   651         bitrateBox->setSingleStep(100);
   759         bitrateBox->setSingleStep(100);
   652         pOptLayout->addWidget(bitrateBox, 6, 3);
   760         groupVideoRec->layout()->addWidget(bitrateBox, 6, 3);
   653 
   761 
   654         // button 'set default options'
   762         // button 'set default options'
   655         btnDefaults = new QPushButton(pOptionsGroup);
   763 
       
   764         btnDefaults = new QPushButton(groupVideoRec);
   656         btnDefaults->setText(QPushButton::tr("Set default options"));
   765         btnDefaults->setText(QPushButton::tr("Set default options"));
   657         btnDefaults->setWhatsThis(QPushButton::tr("Restore default coding parameters"));
   766         btnDefaults->setWhatsThis(QPushButton::tr("Restore default coding parameters"));
   658         pOptLayout->addWidget(btnDefaults, 7, 0, 1, 5);
   767         groupVideoRec->layout()->addWidget(btnDefaults, 7, 0, 1, 5);
   659 
       
   660         page3Layout->addWidget(pOptionsGroup, 1, 0);
       
   661     }
   768     }
   662 #endif
   769 #endif
   663 
   770 
   664     previousQuality = this->SLQuality->value();
   771     previousQuality = this->SLQuality->value();
   665     previousResolutionIndex = this->CBResolution->currentIndex();
   772     previousResolutionIndex = this->CBResolution->currentIndex();
   666     previousFullscreenValue = this->CBFullscreen->isChecked();
   773     previousFullscreenValue = this->CBFullscreen->isChecked();
       
   774 
       
   775     setFullscreen(CBFullscreen->isChecked());
       
   776     setVolume(SLVolume->value());
       
   777 
   667     // mutually exclude window and fullscreen resolution
   778     // mutually exclude window and fullscreen resolution
   668     return pageLayout;
   779     return pageLayout;
   669 }
   780 }
   670 
   781 
   671 QLayout * PageOptions::footerLayoutDefinition()
   782 QLayout * PageOptions::footerLayoutDefinition()
   679     connect(checkUseGameRes, SIGNAL(stateChanged(int)), this, SLOT(changeUseGameRes(int)));
   790     connect(checkUseGameRes, SIGNAL(stateChanged(int)), this, SLOT(changeUseGameRes(int)));
   680     connect(checkRecordAudio, SIGNAL(stateChanged(int)), this, SLOT(changeRecordAudio(int)));
   791     connect(checkRecordAudio, SIGNAL(stateChanged(int)), this, SLOT(changeRecordAudio(int)));
   681     connect(comboAVFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAVFormat(int)));
   792     connect(comboAVFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAVFormat(int)));
   682     connect(btnDefaults, SIGNAL(clicked()), this, SLOT(setDefaultOptions()));
   793     connect(btnDefaults, SIGNAL(clicked()), this, SLOT(setDefaultOptions()));
   683 #endif
   794 #endif
   684 
       
   685     //connect(this, SIGNAL(pageEnter()), this, SLOT(setTeamOptionsEnabled()));
   795     //connect(this, SIGNAL(pageEnter()), this, SLOT(setTeamOptionsEnabled()));
       
   796     connect(SLVolume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
   686     connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int)));
   797     connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int)));
   687     connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int)));
   798     connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int)));
   688     connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int)));
   799     connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int)));
   689     connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
   800     connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
   690     connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick()));
   801     connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick()));
   691     connect(CBSavePassword, SIGNAL(stateChanged(int)), this, SLOT(savePwdChanged(int)));
   802     connect(CBSavePassword, SIGNAL(stateChanged(int)), this, SLOT(savePwdChanged(int)));
       
   803 }
       
   804 
       
   805 void PageOptions::setVolume(int volume)
       
   806 {
       
   807     lblVolumeLevel->setText(QString("%1\%").arg(volume));
       
   808 }
       
   809 
       
   810 void PageOptions::setupTabPage(QWidget * tabpage, QVBoxLayout ** leftColumn, QVBoxLayout ** rightColumn)
       
   811 {
       
   812     QHBoxLayout * twoColumns = new QHBoxLayout(tabpage);
       
   813     twoColumns->setSpacing(0);
       
   814     *leftColumn = new QVBoxLayout();
       
   815     *rightColumn = new QVBoxLayout();
       
   816     (*leftColumn)->setSpacing(OPTION_BOX_SPACING);
       
   817     (*rightColumn)->setSpacing(OPTION_BOX_SPACING);
       
   818     twoColumns->addStretch(4);
       
   819     twoColumns->addLayout(*leftColumn, 0);
       
   820     twoColumns->addStretch(1);
       
   821     twoColumns->addLayout(*rightColumn, 0);
       
   822     twoColumns->addStretch(4);
   692 }
   823 }
   693 
   824 
   694 PageOptions::PageOptions(QWidget* parent) : AbstractPage(parent), config(0)
   825 PageOptions::PageOptions(QWidget* parent) : AbstractPage(parent), config(0)
   695 {
   826 {
   696     initPage();
   827     initPage();
   703     if (index != 0)
   834     if (index != 0)
   704     {
   835     {
   705         this->SLQuality->setValue(this->SLQuality->maximum());
   836         this->SLQuality->setValue(this->SLQuality->maximum());
   706         this->SLQuality->setEnabled(false);
   837         this->SLQuality->setEnabled(false);
   707         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
   838         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
       
   839         setFullscreen(forced ? true : previousFullscreenValue);
   708         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
   840         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
   709     }
   841     }
   710     else
   842     else
   711     {
   843     {
   712         this->SLQuality->setEnabled(true);
   844         this->SLQuality->setEnabled(true);
   713         this->SLQuality->setValue(previousQuality);
   845         this->SLQuality->setValue(previousQuality);
   714         this->CBFullscreen->setChecked(previousFullscreenValue);
   846         this->CBFullscreen->setChecked(previousFullscreenValue);
       
   847         setFullscreen(previousFullscreenValue);
   715         this->CBResolution->setCurrentIndex(previousResolutionIndex);
   848         this->CBResolution->setCurrentIndex(previousResolutionIndex);
   716     }
   849     }
   717 }
   850 }
   718 
   851 
   719 void PageOptions::setQuality(int value)
   852 void PageOptions::setQuality(int value)
   727 
   860 
   728 void PageOptions::setFullscreen(int state)
   861 void PageOptions::setFullscreen(int state)
   729 {
   862 {
   730     Q_UNUSED(state);
   863     Q_UNUSED(state);
   731 
   864 
   732     
   865     lblFullScreenRes->setVisible(state);
       
   866     CBResolution->setVisible(state);
       
   867     lblWinScreenRes->setVisible(!state);
       
   868     winResContainer->setVisible(!state);
       
   869 
   733     int index = this->CBStereoMode->currentIndex();
   870     int index = this->CBStereoMode->currentIndex();
   734     if (index != 7 && index != 8 && index != 9)
   871     if (index != 7 && index != 8 && index != 9)
   735         previousFullscreenValue = this->CBFullscreen->isChecked();
   872         previousFullscreenValue = this->CBFullscreen->isChecked();
   736 }
   873 }
   737 
   874