QTfrontend/ui/page/pageoptions.cpp
changeset 6616 f77bb02b669f
parent 6575 b92d7c144038
child 6699 83dd3447a212
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
    57 
    57 
    58     QPixmap pmNew(":/res/new.png");
    58     QPixmap pmNew(":/res/new.png");
    59     QPixmap pmEdit(":/res/edit.png");
    59     QPixmap pmEdit(":/res/edit.png");
    60     QPixmap pmDelete(":/res/delete.png");
    60     QPixmap pmDelete(":/res/delete.png");
    61 
    61 
       
    62     {
       
    63         teamsBox = new IconedGroupBox(this);
       
    64         //teamsBox->setContentTopPadding(0);
       
    65         //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true);
       
    66         teamsBox->setIcon(QIcon(":/res/teamicon.png"));
       
    67         teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
    68         teamsBox->setTitle(QGroupBox::tr("Teams"));
       
    69 
       
    70         QGridLayout * GBTlayout = new QGridLayout(teamsBox);
       
    71 
       
    72         CBTeamName = new QComboBox(teamsBox);
       
    73         GBTlayout->addWidget(CBTeamName, 0, 0);
       
    74 
       
    75         BtnNewTeam = new QPushButton(teamsBox);
       
    76         BtnNewTeam->setToolTip(tr("New team"));
       
    77         BtnNewTeam->setIconSize(pmNew.size());
       
    78         BtnNewTeam->setIcon(pmNew);
       
    79         BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
       
    80         connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested()));
       
    81         GBTlayout->addWidget(BtnNewTeam, 0, 1);
       
    82 
       
    83         BtnEditTeam = new QPushButton(teamsBox);
       
    84         BtnEditTeam->setToolTip(tr("Edit team"));
       
    85         BtnEditTeam->setIconSize(pmEdit.size());
       
    86         BtnEditTeam->setIcon(pmEdit);
       
    87         BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
       
    88         connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam()));
       
    89         GBTlayout->addWidget(BtnEditTeam, 0, 2);
       
    90 
       
    91         BtnDeleteTeam = new QPushButton(teamsBox);
       
    92         BtnDeleteTeam->setToolTip(tr("Delete team"));
       
    93         BtnDeleteTeam->setIconSize(pmDelete.size());
       
    94         BtnDeleteTeam->setIcon(pmDelete);
       
    95         BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
       
    96         connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam()));
       
    97         GBTlayout->addWidget(BtnDeleteTeam, 0, 3);
       
    98 
       
    99         LblNoEditTeam = new QLabel(teamsBox);
       
   100         LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams."));
       
   101         LblNoEditTeam->setWordWrap(true);
       
   102         LblNoEditTeam->setVisible(false);
       
   103         GBTlayout->addWidget(LblNoEditTeam, 0, 0);
       
   104 
       
   105         gbTBLayout->addWidget(teamsBox, 0, 0);
       
   106     }
       
   107 
       
   108     {
       
   109         IconedGroupBox* groupWeapons = new IconedGroupBox(this);
       
   110 
       
   111         //groupWeapons->setContentTopPadding(0);
       
   112         //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
       
   113         groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
       
   114         groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
   115         groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons"));
       
   116         QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
       
   117 
       
   118         QLabel* SchemeLabel = new QLabel(groupWeapons);
       
   119         SchemeLabel->setText(QLabel::tr("Game scheme"));
       
   120         WeaponsLayout->addWidget(SchemeLabel, 1, 0);
       
   121 
       
   122         SchemesName = new QComboBox(groupWeapons);
       
   123         WeaponsLayout->addWidget(SchemesName, 1, 1);
       
   124 
       
   125         SchemeNew = new QPushButton(groupWeapons);
       
   126         SchemeNew->setToolTip(tr("New scheme"));
       
   127         SchemeNew->setIconSize(pmNew.size());
       
   128         SchemeNew->setIcon(pmNew);
       
   129         SchemeNew->setMaximumWidth(pmNew.width() + 6);
       
   130         WeaponsLayout->addWidget(SchemeNew, 1, 2);
       
   131 
       
   132         SchemeEdit = new QPushButton(groupWeapons);
       
   133         SchemeEdit->setToolTip(tr("Edit scheme"));
       
   134         SchemeEdit->setIconSize(pmEdit.size());
       
   135         SchemeEdit->setIcon(pmEdit);
       
   136         SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
       
   137         WeaponsLayout->addWidget(SchemeEdit, 1, 3);
       
   138 
       
   139         SchemeDelete = new QPushButton(groupWeapons);
       
   140         SchemeDelete->setToolTip(tr("Delete scheme"));
       
   141         SchemeDelete->setIconSize(pmDelete.size());
       
   142         SchemeDelete->setIcon(pmDelete);
       
   143         SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
       
   144         WeaponsLayout->addWidget(SchemeDelete, 1, 4);
       
   145 
       
   146         QLabel* WeaponLabel = new QLabel(groupWeapons);
       
   147         WeaponLabel->setText(QLabel::tr("Weapons"));
       
   148         WeaponsLayout->addWidget(WeaponLabel, 2, 0);
       
   149 
       
   150         WeaponsName = new QComboBox(groupWeapons);
       
   151         WeaponsLayout->addWidget(WeaponsName, 2, 1);
       
   152 
       
   153         WeaponNew = new QPushButton(groupWeapons);
       
   154         WeaponNew->setToolTip(tr("New weapon set"));
       
   155         WeaponNew->setIconSize(pmNew.size());
       
   156         WeaponNew->setIcon(pmNew);
       
   157         WeaponNew->setMaximumWidth(pmNew.width() + 6);
       
   158         WeaponsLayout->addWidget(WeaponNew, 2, 2);
       
   159 
       
   160         WeaponEdit = new QPushButton(groupWeapons);
       
   161         WeaponEdit->setToolTip(tr("Edit weapon set"));
       
   162         WeaponEdit->setIconSize(pmEdit.size());
       
   163         WeaponEdit->setIcon(pmEdit);
       
   164         WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
       
   165         WeaponsLayout->addWidget(WeaponEdit, 2, 3);
       
   166 
       
   167         WeaponDelete = new QPushButton(groupWeapons);
       
   168         WeaponDelete->setToolTip(tr("Delete weapon set"));
       
   169         WeaponDelete->setIconSize(pmDelete.size());
       
   170         WeaponDelete->setIcon(pmDelete);
       
   171         WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
       
   172         WeaponsLayout->addWidget(WeaponDelete, 2, 4);
       
   173 
       
   174         WeaponTooltip = new QCheckBox(this);
       
   175         WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
       
   176         WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4);
       
   177 
       
   178         gbTBLayout->addWidget(groupWeapons, 1, 0);
       
   179     }
       
   180 
       
   181     {
       
   182         IconedGroupBox* groupMisc = new IconedGroupBox(this);
       
   183         //groupMisc->setContentTopPadding(0);
       
   184         groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
       
   185         groupMisc->setIcon(QIcon(":/res/miscicon.png"));
       
   186         //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
   187         groupMisc->setTitle(QGroupBox::tr("Misc"));
       
   188         QGridLayout * MiscLayout = new QGridLayout(groupMisc);
       
   189 
       
   190         labelNN = new QLabel(groupMisc);
       
   191         labelNN->setText(QLabel::tr("Net nick"));
       
   192         MiscLayout->addWidget(labelNN, 0, 0);
       
   193 
       
   194         editNetNick = new QLineEdit(groupMisc);
       
   195         editNetNick->setMaxLength(20);
       
   196         editNetNick->setText(QLineEdit::tr("unnamed"));
       
   197         connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick()));
       
   198         MiscLayout->addWidget(editNetNick, 0, 1);
       
   199 
       
   200         labelNetPassword = new QLabel(groupMisc);
       
   201         labelNetPassword->setText(QLabel::tr("Password"));
       
   202         MiscLayout->addWidget(labelNetPassword, 1, 0);
       
   203 
       
   204         editNetPassword = new QLineEdit(groupMisc);
       
   205         editNetPassword->setEchoMode(QLineEdit::Password);
       
   206         MiscLayout->addWidget(editNetPassword, 1, 1);
       
   207 
       
   208         QLabel *labelLanguage = new QLabel(groupMisc);
       
   209         labelLanguage->setText(QLabel::tr("Locale") + " *");
       
   210         MiscLayout->addWidget(labelLanguage, 2, 0);
       
   211 
       
   212         CBLanguage = new QComboBox(groupMisc);
       
   213         QDir tmpdir;
       
   214         tmpdir.cd(cfgdir->absolutePath());
       
   215         tmpdir.cd("Data/Locale");
       
   216         tmpdir.setFilter(QDir::Files);
       
   217         QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm"));
       
   218         CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
       
   219         for(int i = 0; i < locs.count(); i++)
    62         {
   220         {
    63             teamsBox = new IconedGroupBox(this);
   221             QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
    64             //teamsBox->setContentTopPadding(0);
   222             CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
    65             //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true);
       
    66             teamsBox->setIcon(QIcon(":/res/teamicon.png"));
       
    67             teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
    68             teamsBox->setTitle(QGroupBox::tr("Teams"));
       
    69 
       
    70             QGridLayout * GBTlayout = new QGridLayout(teamsBox);
       
    71 
       
    72             CBTeamName = new QComboBox(teamsBox);
       
    73             GBTlayout->addWidget(CBTeamName, 0, 0);
       
    74 
       
    75             BtnNewTeam = new QPushButton(teamsBox);
       
    76             BtnNewTeam->setToolTip(tr("New team"));
       
    77             BtnNewTeam->setIconSize(pmNew.size());
       
    78             BtnNewTeam->setIcon(pmNew);
       
    79             BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
       
    80             connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested()));
       
    81             GBTlayout->addWidget(BtnNewTeam, 0, 1);
       
    82 
       
    83             BtnEditTeam = new QPushButton(teamsBox);
       
    84             BtnEditTeam->setToolTip(tr("Edit team"));
       
    85             BtnEditTeam->setIconSize(pmEdit.size());
       
    86             BtnEditTeam->setIcon(pmEdit);
       
    87             BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
       
    88             connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam()));
       
    89             GBTlayout->addWidget(BtnEditTeam, 0, 2);
       
    90 
       
    91             BtnDeleteTeam = new QPushButton(teamsBox);
       
    92             BtnDeleteTeam->setToolTip(tr("Delete team"));
       
    93             BtnDeleteTeam->setIconSize(pmDelete.size());
       
    94             BtnDeleteTeam->setIcon(pmDelete);
       
    95             BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
       
    96             connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam()));
       
    97             GBTlayout->addWidget(BtnDeleteTeam, 0, 3);
       
    98 
       
    99             LblNoEditTeam = new QLabel(teamsBox);
       
   100             LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams."));
       
   101             LblNoEditTeam->setWordWrap(true);
       
   102             LblNoEditTeam->setVisible(false);
       
   103             GBTlayout->addWidget(LblNoEditTeam, 0, 0);
       
   104 
       
   105             gbTBLayout->addWidget(teamsBox, 0, 0);
       
   106         }
   223         }
   107 
   224 
       
   225         tmpdir.cd(datadir->absolutePath());
       
   226         tmpdir.cd("Locale");
       
   227         tmpdir.setFilter(QDir::Files);
       
   228         QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm"));
       
   229         for(int i = 0; i < tmplist.count(); i++)
   108         {
   230         {
   109             IconedGroupBox* groupWeapons = new IconedGroupBox(this);
   231             if (locs.contains(tmplist[i])) continue;
   110             
   232             QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
   111             //groupWeapons->setContentTopPadding(0);
   233             CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
   112             //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
       
   113             groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
       
   114             groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
   115             groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons"));
       
   116             QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
       
   117 
       
   118             QLabel* SchemeLabel = new QLabel(groupWeapons);
       
   119             SchemeLabel->setText(QLabel::tr("Game scheme"));
       
   120             WeaponsLayout->addWidget(SchemeLabel, 1, 0);
       
   121 
       
   122             SchemesName = new QComboBox(groupWeapons);
       
   123             WeaponsLayout->addWidget(SchemesName, 1, 1);
       
   124 
       
   125             SchemeNew = new QPushButton(groupWeapons);
       
   126             SchemeNew->setToolTip(tr("New scheme"));
       
   127             SchemeNew->setIconSize(pmNew.size());
       
   128             SchemeNew->setIcon(pmNew);
       
   129             SchemeNew->setMaximumWidth(pmNew.width() + 6);
       
   130             WeaponsLayout->addWidget(SchemeNew, 1, 2);
       
   131 
       
   132             SchemeEdit = new QPushButton(groupWeapons);
       
   133             SchemeEdit->setToolTip(tr("Edit scheme"));
       
   134             SchemeEdit->setIconSize(pmEdit.size());
       
   135             SchemeEdit->setIcon(pmEdit);
       
   136             SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
       
   137             WeaponsLayout->addWidget(SchemeEdit, 1, 3);
       
   138 
       
   139             SchemeDelete = new QPushButton(groupWeapons);
       
   140             SchemeDelete->setToolTip(tr("Delete scheme"));
       
   141             SchemeDelete->setIconSize(pmDelete.size());
       
   142             SchemeDelete->setIcon(pmDelete);
       
   143             SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
       
   144             WeaponsLayout->addWidget(SchemeDelete, 1, 4);
       
   145 
       
   146             QLabel* WeaponLabel = new QLabel(groupWeapons);
       
   147             WeaponLabel->setText(QLabel::tr("Weapons"));
       
   148             WeaponsLayout->addWidget(WeaponLabel, 2, 0);
       
   149 
       
   150             WeaponsName = new QComboBox(groupWeapons);
       
   151             WeaponsLayout->addWidget(WeaponsName, 2, 1);
       
   152 
       
   153             WeaponNew = new QPushButton(groupWeapons);
       
   154             WeaponNew->setToolTip(tr("New weapon set"));
       
   155             WeaponNew->setIconSize(pmNew.size());
       
   156             WeaponNew->setIcon(pmNew);
       
   157             WeaponNew->setMaximumWidth(pmNew.width() + 6);
       
   158             WeaponsLayout->addWidget(WeaponNew, 2, 2);
       
   159 
       
   160             WeaponEdit = new QPushButton(groupWeapons);
       
   161             WeaponEdit->setToolTip(tr("Edit weapon set"));
       
   162             WeaponEdit->setIconSize(pmEdit.size());
       
   163             WeaponEdit->setIcon(pmEdit);
       
   164             WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
       
   165             WeaponsLayout->addWidget(WeaponEdit, 2, 3);
       
   166 
       
   167             WeaponDelete = new QPushButton(groupWeapons);
       
   168             WeaponDelete->setToolTip(tr("Delete weapon set"));
       
   169             WeaponDelete->setIconSize(pmDelete.size());
       
   170             WeaponDelete->setIcon(pmDelete);
       
   171             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
       
   172             WeaponsLayout->addWidget(WeaponDelete, 2, 4);
       
   173 
       
   174             WeaponTooltip = new QCheckBox(this);
       
   175             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
       
   176             WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4);
       
   177 
       
   178             gbTBLayout->addWidget(groupWeapons, 1, 0);
       
   179         }
   234         }
   180 
   235 
   181         {
   236         MiscLayout->addWidget(CBLanguage, 2, 1);
   182             IconedGroupBox* groupMisc = new IconedGroupBox(this);
   237 
   183             //groupMisc->setContentTopPadding(0);
   238         CBAltDamage = new QCheckBox(groupMisc);
   184             groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   239         CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
   185             groupMisc->setIcon(QIcon(":/res/miscicon.png"));
   240         MiscLayout->addWidget(CBAltDamage, 3, 0, 1, 2);
   186             //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   241 
   187             groupMisc->setTitle(QGroupBox::tr("Misc"));
   242         CBNameWithDate = new QCheckBox(groupMisc);
   188             QGridLayout * MiscLayout = new QGridLayout(groupMisc);
   243         CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
   189 
   244         MiscLayout->addWidget(CBNameWithDate, 4, 0, 1, 2);
   190             labelNN = new QLabel(groupMisc);
   245 
   191             labelNN->setText(QLabel::tr("Net nick"));
   246         BtnAssociateFiles = new QPushButton(groupMisc);
   192             MiscLayout->addWidget(labelNN, 0, 0);
   247         BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
   193 
   248         BtnAssociateFiles->setEnabled(!custom_data && !custom_config);
   194             editNetNick = new QLineEdit(groupMisc);
   249         MiscLayout->addWidget(BtnAssociateFiles, 5, 0, 1, 2);
   195             editNetNick->setMaxLength(20);
       
   196             editNetNick->setText(QLineEdit::tr("unnamed"));
       
   197             connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick()));
       
   198             MiscLayout->addWidget(editNetNick, 0, 1);
       
   199             
       
   200             labelNetPassword = new QLabel(groupMisc);
       
   201             labelNetPassword->setText(QLabel::tr("Password"));
       
   202             MiscLayout->addWidget(labelNetPassword, 1, 0);
       
   203             
       
   204             editNetPassword = new QLineEdit(groupMisc);
       
   205             editNetPassword->setEchoMode(QLineEdit::Password);
       
   206             MiscLayout->addWidget(editNetPassword, 1, 1);
       
   207 
       
   208             QLabel *labelLanguage = new QLabel(groupMisc);
       
   209             labelLanguage->setText(QLabel::tr("Locale") + " *");
       
   210             MiscLayout->addWidget(labelLanguage, 2, 0);
       
   211 
       
   212             CBLanguage = new QComboBox(groupMisc);
       
   213             QDir tmpdir;
       
   214             tmpdir.cd(cfgdir->absolutePath());
       
   215             tmpdir.cd("Data/Locale");
       
   216             tmpdir.setFilter(QDir::Files);
       
   217             QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm"));
       
   218             CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
       
   219             for(int i = 0; i < locs.count(); i++)
       
   220             {
       
   221                 QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
       
   222                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
       
   223             }
       
   224 
       
   225             tmpdir.cd(datadir->absolutePath());
       
   226             tmpdir.cd("Locale");
       
   227             tmpdir.setFilter(QDir::Files);
       
   228             QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm"));
       
   229             for(int i = 0; i < tmplist.count(); i++)
       
   230             {
       
   231                 if (locs.contains(tmplist[i])) continue;
       
   232                 QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
       
   233                 CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
       
   234             }
       
   235 
       
   236             MiscLayout->addWidget(CBLanguage, 2, 1);
       
   237 
       
   238             CBAltDamage = new QCheckBox(groupMisc);
       
   239             CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
       
   240             MiscLayout->addWidget(CBAltDamage, 3, 0, 1, 2);
       
   241 
       
   242             CBNameWithDate = new QCheckBox(groupMisc);
       
   243             CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
       
   244             MiscLayout->addWidget(CBNameWithDate, 4, 0, 1, 2);
       
   245 
       
   246             BtnAssociateFiles = new QPushButton(groupMisc);
       
   247             BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
       
   248             BtnAssociateFiles->setEnabled(!custom_data && !custom_config);
       
   249             MiscLayout->addWidget(BtnAssociateFiles, 5, 0, 1, 2);
       
   250 
   250 
   251 #ifdef __APPLE__
   251 #ifdef __APPLE__
   252 #ifdef SPARKLE_ENABLED
   252 #ifdef SPARKLE_ENABLED
   253             CBAutoUpdate = new QCheckBox(groupMisc);
   253         CBAutoUpdate = new QCheckBox(groupMisc);
   254             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   254         CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   255             MiscLayout->addWidget(CBAutoUpdate, 6, 0, 1, 3);
   255         MiscLayout->addWidget(CBAutoUpdate, 6, 0, 1, 3);
   256 #endif
   256 #endif
   257 #endif
   257 #endif
   258             gbTBLayout->addWidget(groupMisc, 2, 0);
   258         gbTBLayout->addWidget(groupMisc, 2, 0);
   259         }
   259     }
   260 
   260 
   261         {
   261     {
   262             AGGroupBox = new IconedGroupBox(this);
   262         AGGroupBox = new IconedGroupBox(this);
   263             //AGGroupBox->setContentTopPadding(0);
   263         //AGGroupBox->setContentTopPadding(0);
   264             AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
   264         AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
   265             //AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
   265         //AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
   266             AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
   266         AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
   267 
   267 
   268             QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
   268         QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
   269             QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
   269         QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
   270             QHBoxLayout * GBAstereolayout = new QHBoxLayout(0);
   270         QHBoxLayout * GBAstereolayout = new QHBoxLayout(0);
   271             QHBoxLayout * GBAqualayout = new QHBoxLayout(0);
   271         QHBoxLayout * GBAqualayout = new QHBoxLayout(0);
   272 
   272 
   273             CBFrontendFullscreen = new QCheckBox(AGGroupBox);
   273         CBFrontendFullscreen = new QCheckBox(AGGroupBox);
   274             CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen"));
   274         CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen"));
   275             GBAlayout->addWidget(CBFrontendFullscreen);
   275         GBAlayout->addWidget(CBFrontendFullscreen);
   276 
   276 
   277             CBFrontendEffects = new QCheckBox(AGGroupBox);
   277         CBFrontendEffects = new QCheckBox(AGGroupBox);
   278             CBFrontendEffects->setText(QCheckBox::tr("Frontend effects"));
   278         CBFrontendEffects->setText(QCheckBox::tr("Frontend effects"));
   279             GBAlayout->addWidget(CBFrontendEffects);
   279         GBAlayout->addWidget(CBFrontendEffects);
   280 
   280 
   281             CBEnableFrontendSound = new QCheckBox(AGGroupBox);
   281         CBEnableFrontendSound = new QCheckBox(AGGroupBox);
   282             CBEnableFrontendSound->setText(QCheckBox::tr("Enable frontend sounds"));
   282         CBEnableFrontendSound->setText(QCheckBox::tr("Enable frontend sounds"));
   283             GBAlayout->addWidget(CBEnableFrontendSound);
   283         GBAlayout->addWidget(CBEnableFrontendSound);
   284 
   284 
   285             CBEnableFrontendMusic = new QCheckBox(AGGroupBox);
   285         CBEnableFrontendMusic = new QCheckBox(AGGroupBox);
   286             CBEnableFrontendMusic->setText(QCheckBox::tr("Enable frontend music"));
   286         CBEnableFrontendMusic->setText(QCheckBox::tr("Enable frontend music"));
   287             GBAlayout->addWidget(CBEnableFrontendMusic);
   287         GBAlayout->addWidget(CBEnableFrontendMusic);
   288 
   288 
   289             QFrame * hr = new QFrame(AGGroupBox);
   289         QFrame * hr = new QFrame(AGGroupBox);
   290             hr->setFrameStyle(QFrame::HLine);
   290         hr->setFrameStyle(QFrame::HLine);
   291             hr->setLineWidth(3);
   291         hr->setLineWidth(3);
   292             hr->setFixedHeight(10);
   292         hr->setFixedHeight(10);
   293             GBAlayout->addWidget(hr);
   293         GBAlayout->addWidget(hr);
   294 
   294 
   295             QLabel * resolution = new QLabel(AGGroupBox);
   295         QLabel * resolution = new QLabel(AGGroupBox);
   296             resolution->setText(QLabel::tr("Resolution"));
   296         resolution->setText(QLabel::tr("Resolution"));
   297             GBAreslayout->addWidget(resolution);
   297         GBAreslayout->addWidget(resolution);
   298 
   298 
   299             CBResolution = new QComboBox(AGGroupBox);
   299         CBResolution = new QComboBox(AGGroupBox);
   300             GBAreslayout->addWidget(CBResolution);
   300         GBAreslayout->addWidget(CBResolution);
   301             GBAlayout->addLayout(GBAreslayout);
   301         GBAlayout->addLayout(GBAreslayout);
   302 
   302 
   303             CBFullscreen = new QCheckBox(AGGroupBox);
   303         CBFullscreen = new QCheckBox(AGGroupBox);
   304             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
   304         CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
   305             GBAlayout->addWidget(CBFullscreen);
   305         GBAlayout->addWidget(CBFullscreen);
   306 
   306 
   307             QLabel * quality = new QLabel(AGGroupBox);
   307         QLabel * quality = new QLabel(AGGroupBox);
   308             quality->setText(QLabel::tr("Quality"));
   308         quality->setText(QLabel::tr("Quality"));
   309             quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   309         quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   310             GBAqualayout->addWidget(quality);
   310         GBAqualayout->addWidget(quality);
   311             
   311 
   312             SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
   312         SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
   313             SLQuality->setTickPosition(QSlider::TicksBelow);
   313         SLQuality->setTickPosition(QSlider::TicksBelow);
   314             SLQuality->setMaximum(5);
   314         SLQuality->setMaximum(5);
   315             SLQuality->setMinimum(0);
   315         SLQuality->setMinimum(0);
   316             SLQuality->setFixedWidth(150);
   316         SLQuality->setFixedWidth(150);
   317             GBAqualayout->addWidget(SLQuality);
   317         GBAqualayout->addWidget(SLQuality);
   318             GBAlayout->addLayout(GBAqualayout);
   318         GBAlayout->addLayout(GBAqualayout);
   319 
   319 
   320             QLabel * stereo = new QLabel(AGGroupBox);
   320         QLabel * stereo = new QLabel(AGGroupBox);
   321             stereo->setText(QLabel::tr("Stereo rendering"));
   321         stereo->setText(QLabel::tr("Stereo rendering"));
   322             GBAstereolayout->addWidget(stereo);
   322         GBAstereolayout->addWidget(stereo);
   323 
   323 
   324             CBStereoMode = new QComboBox(AGGroupBox);
   324         CBStereoMode = new QComboBox(AGGroupBox);
   325             CBStereoMode->addItem(QComboBox::tr("Disabled"));
   325         CBStereoMode->addItem(QComboBox::tr("Disabled"));
   326             CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
   326         CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
   327             CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
   327         CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
   328             CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
   328         CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
   329             CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
   329         CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
   330             CBStereoMode->addItem(QComboBox::tr("Red/Green"));
   330         CBStereoMode->addItem(QComboBox::tr("Red/Green"));
   331             CBStereoMode->addItem(QComboBox::tr("Green/Red"));
   331         CBStereoMode->addItem(QComboBox::tr("Green/Red"));
   332             CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
   332         CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
   333             CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
   333         CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
   334             CBStereoMode->addItem(QComboBox::tr("Wiggle"));
   334         CBStereoMode->addItem(QComboBox::tr("Wiggle"));
   335             CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale"));
   335         CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale"));
   336             CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale"));
   336         CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale"));
   337             CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale"));
   337         CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale"));
   338             CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
   338         CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
   339             CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
   339         CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
   340             CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
   340         CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
   341             connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
   341         connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
   342 
   342 
   343             GBAstereolayout->addWidget(CBStereoMode);
   343         GBAstereolayout->addWidget(CBStereoMode);
   344             GBAlayout->addLayout(GBAstereolayout);
   344         GBAlayout->addLayout(GBAstereolayout);
   345 
   345 
   346             hr = new QFrame(AGGroupBox);
   346         hr = new QFrame(AGGroupBox);
   347             hr->setFrameStyle(QFrame::HLine);
   347         hr->setFrameStyle(QFrame::HLine);
   348             hr->setLineWidth(3);
   348         hr->setLineWidth(3);
   349             hr->setFixedHeight(10);
   349         hr->setFixedHeight(10);
   350             GBAlayout->addWidget(hr);
   350         GBAlayout->addWidget(hr);
   351 
   351 
   352             QHBoxLayout * GBAvollayout = new QHBoxLayout(0);
   352         QHBoxLayout * GBAvollayout = new QHBoxLayout(0);
   353             QLabel * vol = new QLabel(AGGroupBox);
   353         QLabel * vol = new QLabel(AGGroupBox);
   354             vol->setText(QLabel::tr("Initial sound volume"));
   354         vol->setText(QLabel::tr("Initial sound volume"));
   355             GBAvollayout->addWidget(vol);
   355         GBAvollayout->addWidget(vol);
   356             GBAlayout->addLayout(GBAvollayout);
   356         GBAlayout->addLayout(GBAvollayout);
   357             volumeBox = new QSpinBox(AGGroupBox);
   357         volumeBox = new QSpinBox(AGGroupBox);
   358             volumeBox->setRange(0, 100);
   358         volumeBox->setRange(0, 100);
   359             volumeBox->setSingleStep(5);
   359         volumeBox->setSingleStep(5);
   360             GBAvollayout->addWidget(volumeBox);
   360         GBAvollayout->addWidget(volumeBox);
   361 
   361 
   362             CBEnableSound = new QCheckBox(AGGroupBox);
   362         CBEnableSound = new QCheckBox(AGGroupBox);
   363             CBEnableSound->setText(QCheckBox::tr("Enable sound"));
   363         CBEnableSound->setText(QCheckBox::tr("Enable sound"));
   364             GBAlayout->addWidget(CBEnableSound);
   364         GBAlayout->addWidget(CBEnableSound);
   365 
   365 
   366             CBEnableMusic = new QCheckBox(AGGroupBox);
   366         CBEnableMusic = new QCheckBox(AGGroupBox);
   367             CBEnableMusic->setText(QCheckBox::tr("Enable music"));
   367         CBEnableMusic->setText(QCheckBox::tr("Enable music"));
   368             GBAlayout->addWidget(CBEnableMusic);
   368         GBAlayout->addWidget(CBEnableMusic);
   369 
   369 
   370             hr = new QFrame(AGGroupBox);
   370         hr = new QFrame(AGGroupBox);
   371             hr->setFrameStyle(QFrame::HLine);
   371         hr->setFrameStyle(QFrame::HLine);
   372             hr->setLineWidth(3);
   372         hr->setLineWidth(3);
   373             hr->setFixedHeight(10);
   373         hr->setFixedHeight(10);
   374             GBAlayout->addWidget(hr);
   374         GBAlayout->addWidget(hr);
   375 
   375 
   376             QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
   376         QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
   377             QLabel * maxfps = new QLabel(AGGroupBox);
   377         QLabel * maxfps = new QLabel(AGGroupBox);
   378             maxfps->setText(QLabel::tr("FPS limit"));
   378         maxfps->setText(QLabel::tr("FPS limit"));
   379             GBAfpslayout->addWidget(maxfps);
   379         GBAfpslayout->addWidget(maxfps);
   380             GBAlayout->addLayout(GBAfpslayout);
   380         GBAlayout->addLayout(GBAfpslayout);
   381             fpsedit = new FPSEdit(AGGroupBox);
   381         fpsedit = new FPSEdit(AGGroupBox);
   382             GBAfpslayout->addWidget(fpsedit);
   382         GBAfpslayout->addWidget(fpsedit);
   383 
   383 
   384             CBShowFPS = new QCheckBox(AGGroupBox);
   384         CBShowFPS = new QCheckBox(AGGroupBox);
   385             CBShowFPS->setText(QCheckBox::tr("Show FPS"));
   385         CBShowFPS->setText(QCheckBox::tr("Show FPS"));
   386             GBAlayout->addWidget(CBShowFPS);
   386         GBAlayout->addWidget(CBShowFPS);
   387 
   387 
   388             gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1);
   388         gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1);
   389         }
   389     }
   390 
   390 
   391     previousQuality = this->SLQuality->value();
   391     previousQuality = this->SLQuality->value();
   392     previousResolutionIndex = this->CBResolution->currentIndex();
   392     previousResolutionIndex = this->CBResolution->currentIndex();
   393     previousFullscreenValue = this->CBFullscreen->isChecked();
   393     previousFullscreenValue = this->CBFullscreen->isChecked();
   394 
   394 
   414 
   414 
   415 void PageOptions::forceFullscreen(int index)
   415 void PageOptions::forceFullscreen(int index)
   416 {
   416 {
   417     bool forced = (index == 7 || index == 8 || index == 9);
   417     bool forced = (index == 7 || index == 8 || index == 9);
   418 
   418 
   419     if (index != 0) {
   419     if (index != 0)
       
   420     {
   420         this->SLQuality->setValue(this->SLQuality->maximum());
   421         this->SLQuality->setValue(this->SLQuality->maximum());
   421         this->SLQuality->setEnabled(false);
   422         this->SLQuality->setEnabled(false);
   422         this->CBFullscreen->setEnabled(!forced);
   423         this->CBFullscreen->setEnabled(!forced);
   423         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
   424         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
   424         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
   425         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
   425     } else {
   426     }
       
   427     else
       
   428     {
   426         this->SLQuality->setEnabled(true);
   429         this->SLQuality->setEnabled(true);
   427         this->CBFullscreen->setEnabled(true);
   430         this->CBFullscreen->setEnabled(true);
   428         this->SLQuality->setValue(previousQuality);
   431         this->SLQuality->setValue(previousQuality);
   429         this->CBFullscreen->setChecked(previousFullscreenValue);
   432         this->CBFullscreen->setChecked(previousFullscreenValue);
   430         this->CBResolution->setCurrentIndex(previousResolutionIndex);
   433         this->CBResolution->setCurrentIndex(previousResolutionIndex);