QTfrontend/ui/page/pageoptions.cpp
author unc0rr
Tue, 20 Nov 2012 00:10:12 +0400
changeset 8070 66bc20d089fc
parent 7703 78d2ac987f41
child 8098 4efee370e2de
permissions -rw-r--r--
Okay, remove previous request only if it has same parent as this one. Fixes the last note of previous commit (which was nearly impossible to hit, but whatever, just cleaning implementation)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     1
/*
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6911
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     4
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     8
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    13
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    17
 */
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    18
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    19
#include <QGridLayout>
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
    20
#include <QHBoxLayout>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    21
#include <QPushButton>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    22
#include <QGroupBox>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    23
#include <QComboBox>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    24
#include <QCheckBox>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    25
#include <QLabel>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    26
#include <QLineEdit>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    27
#include <QSpinBox>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    28
#include <QTextBrowser>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    29
#include <QTableWidget>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
#include <QSlider>
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    31
#include <QSignalMapper>
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    32
#include <QColorDialog>
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    33
#include <QStandardItemModel>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    34
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5078
diff changeset
    35
#include "pageoptions.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    36
#include "hwconsts.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    37
#include "fpsedit.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    38
#include "igbox.h"
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    39
#include "DataManager.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    40
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
    41
// TODO cleanup
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
    42
QLayout * PageOptions::bodyLayoutDefinition()
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    43
{
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    44
    QVBoxLayout * pageLayout = new QVBoxLayout();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    45
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    46
    QTabWidget * tabs = new QTabWidget(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    47
    pageLayout->addWidget(tabs);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    48
    QWidget * page1 = new QWidget(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    49
    QWidget * page2 = new QWidget(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    50
    tabs->addTab(page1, tr("General"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    51
    tabs->addTab(page2, tr("Advanced"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    52
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    53
    { // page 1
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    54
        QGridLayout * page1Layout = new QGridLayout(page1);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    55
        //gbTBLayout->setMargin(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    56
        page1Layout->setSpacing(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    57
        page1Layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    58
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    59
        QPixmap pmNew(":/res/new.png");
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    60
        QPixmap pmEdit(":/res/edit.png");
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    61
        QPixmap pmDelete(":/res/delete.png");
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    62
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    63
        {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    64
            teamsBox = new IconedGroupBox(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    65
            //teamsBox->setContentTopPadding(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    66
            //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    67
            teamsBox->setIcon(QIcon(":/res/teamicon.png"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    68
            teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    69
            teamsBox->setTitle(QGroupBox::tr("Teams"));
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
    70
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    71
            QGridLayout * GBTlayout = new QGridLayout(teamsBox);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
    72
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    73
            CBTeamName = new QComboBox(teamsBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    74
            GBTlayout->addWidget(CBTeamName, 0, 0);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    75
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    76
            BtnNewTeam = new QPushButton(teamsBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    77
            BtnNewTeam->setToolTip(tr("New team"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    78
            BtnNewTeam->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    79
            BtnNewTeam->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    80
            BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    81
            connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested()));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    82
            GBTlayout->addWidget(BtnNewTeam, 0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
    83
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    84
            BtnEditTeam = new QPushButton(teamsBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    85
            BtnEditTeam->setToolTip(tr("Edit team"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    86
            BtnEditTeam->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    87
            BtnEditTeam->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    88
            BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    89
            connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam()));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    90
            GBTlayout->addWidget(BtnEditTeam, 0, 2);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
    91
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    92
            BtnDeleteTeam = new QPushButton(teamsBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    93
            BtnDeleteTeam->setToolTip(tr("Delete team"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    94
            BtnDeleteTeam->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    95
            BtnDeleteTeam->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    96
            BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    97
            connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam()));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    98
            GBTlayout->addWidget(BtnDeleteTeam, 0, 3);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
    99
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   100
            LblNoEditTeam = new QLabel(teamsBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   101
            LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams."));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   102
            LblNoEditTeam->setWordWrap(true);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   103
            LblNoEditTeam->setVisible(false);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   104
            GBTlayout->addWidget(LblNoEditTeam, 0, 0);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   105
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   106
            page1Layout->addWidget(teamsBox, 0, 0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   107
        }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   108
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   109
        {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   110
            IconedGroupBox* groupWeapons = new IconedGroupBox(this);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   111
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   112
            //groupWeapons->setContentTopPadding(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   113
            //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   114
            groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   115
            groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   116
            groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   117
            QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   118
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   119
            QLabel* SchemeLabel = new QLabel(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   120
            SchemeLabel->setText(QLabel::tr("Game scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   121
            WeaponsLayout->addWidget(SchemeLabel, 1, 0);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   122
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   123
            SchemesName = new QComboBox(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   124
            WeaponsLayout->addWidget(SchemesName, 1, 1);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   125
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   126
            SchemeNew = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   127
            SchemeNew->setWhatsThis(tr("New scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   128
            SchemeNew->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   129
            SchemeNew->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   130
            SchemeNew->setMaximumWidth(pmNew.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   131
            WeaponsLayout->addWidget(SchemeNew, 1, 2);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   132
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   133
            SchemeEdit = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   134
            SchemeEdit->setWhatsThis(tr("Edit scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   135
            SchemeEdit->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   136
            SchemeEdit->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   137
            SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   138
            WeaponsLayout->addWidget(SchemeEdit, 1, 3);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   139
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   140
            SchemeDelete = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   141
            SchemeDelete->setWhatsThis(tr("Delete scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   142
            SchemeDelete->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   143
            SchemeDelete->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   144
            SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   145
            WeaponsLayout->addWidget(SchemeDelete, 1, 4);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   146
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   147
            QLabel* WeaponLabel = new QLabel(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   148
            WeaponLabel->setText(QLabel::tr("Weapons"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   149
            WeaponsLayout->addWidget(WeaponLabel, 2, 0);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   150
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   151
            WeaponsName = new QComboBox(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   152
            WeaponsLayout->addWidget(WeaponsName, 2, 1);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   153
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   154
            WeaponNew = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   155
            WeaponNew->setWhatsThis(tr("New weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   156
            WeaponNew->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   157
            WeaponNew->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   158
            WeaponNew->setMaximumWidth(pmNew.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   159
            WeaponsLayout->addWidget(WeaponNew, 2, 2);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   160
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   161
            WeaponEdit = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   162
            WeaponEdit->setWhatsThis(tr("Edit weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   163
            WeaponEdit->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   164
            WeaponEdit->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   165
            WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   166
            WeaponsLayout->addWidget(WeaponEdit, 2, 3);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   167
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   168
            WeaponDelete = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   169
            WeaponDelete->setWhatsThis(tr("Delete weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   170
            WeaponDelete->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   171
            WeaponDelete->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   172
            WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   173
            WeaponsLayout->addWidget(WeaponDelete, 2, 4);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   174
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   175
            page1Layout->addWidget(groupWeapons, 1, 0);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   176
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   177
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   178
        {
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   179
            IconedGroupBox* groupMisc = new IconedGroupBox(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   180
            //groupMisc->setContentTopPadding(0);
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   181
            //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   182
            groupMisc->setIcon(QIcon(":/res/miscicon.png"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   183
            //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   184
            groupMisc->setTitle(QGroupBox::tr("Misc"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   185
            QGridLayout * MiscLayout = new QGridLayout(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   186
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   187
            // Label for "Language"
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   188
            QLabel *labelLanguage = new QLabel(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   189
            labelLanguage->setText(QLabel::tr("Locale") + " *");
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   190
            MiscLayout->addWidget(labelLanguage, 0, 0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   191
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   192
            // List of installed languages
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   193
            CBLanguage = new QComboBox(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   194
            QDir tmpdir;
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   195
            tmpdir.cd(cfgdir->absolutePath());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   196
            tmpdir.cd("Data/Locale");
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   197
            tmpdir.setFilter(QDir::Files);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   198
            QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   199
            CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   200
            for(int i = 0; i < locs.count(); i++)
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   201
            {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   202
                QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   203
                CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   204
            }
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   205
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   206
            tmpdir.cd(datadir->absolutePath());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   207
            tmpdir.cd("Locale");
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   208
            tmpdir.setFilter(QDir::Files);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   209
            QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   210
            for(int i = 0; i < tmplist.count(); i++)
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   211
            {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   212
                if (locs.contains(tmplist[i])) continue;
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   213
                QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   214
                CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   215
            }
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   216
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   217
            MiscLayout->addWidget(CBLanguage, 0, 1);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   218
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   219
            // Label and field for net nick
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   220
            labelNN = new QLabel(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   221
            labelNN->setText(QLabel::tr("Nickname"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   222
            MiscLayout->addWidget(labelNN, 1, 0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   223
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   224
            editNetNick = new QLineEdit(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   225
            editNetNick->setMaxLength(20);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   226
            editNetNick->setText(QLineEdit::tr("anonymous"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   227
            MiscLayout->addWidget(editNetNick, 1, 1);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   228
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   229
            // checkbox and field for password
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   230
            CBSavePassword = new QCheckBox(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   231
            CBSavePassword->setText(QCheckBox::tr("Save password"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   232
            MiscLayout->addWidget(CBSavePassword, 2, 0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   233
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   234
            editNetPassword = new QLineEdit(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   235
            editNetPassword->setEchoMode(QLineEdit::Password);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   236
            MiscLayout->addWidget(editNetPassword, 2, 1);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   237
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   238
    #ifdef __APPLE__
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   239
    #ifdef SPARKLE_ENABLED
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   240
            CBAutoUpdate = new QCheckBox(groupMisc);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   241
            CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   242
            MiscLayout->addWidget(CBAutoUpdate, 7, 0, 1, 3);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   243
    #endif
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   244
    #endif
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   245
            page1Layout->addWidget(groupMisc, 2, 0);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   246
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   247
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   248
        {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   249
            AGGroupBox = new IconedGroupBox(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   250
            //AGGroupBox->setContentTopPadding(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   251
            AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   252
            //AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   253
            AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   254
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   255
            QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   256
            QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   257
            QHBoxLayout * GBAstereolayout = new QHBoxLayout(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   258
            QHBoxLayout * GBAqualayout = new QHBoxLayout(0);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   259
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   260
            CBFrontendFullscreen = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   261
            CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   262
            GBAlayout->addWidget(CBFrontendFullscreen);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   263
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   264
            CBFrontendEffects = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   265
            CBFrontendEffects->setText(QCheckBox::tr("Frontend effects"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   266
            GBAlayout->addWidget(CBFrontendEffects);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   267
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   268
            CBEnableFrontendSound = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   269
            CBEnableFrontendSound->setText(QCheckBox::tr("Enable frontend sounds"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   270
            GBAlayout->addWidget(CBEnableFrontendSound);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   271
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   272
            CBEnableFrontendMusic = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   273
            CBEnableFrontendMusic->setText(QCheckBox::tr("Enable frontend music"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   274
            GBAlayout->addWidget(CBEnableFrontendMusic);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   275
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   276
            QFrame * hr = new QFrame(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   277
            hr->setFrameStyle(QFrame::HLine);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   278
            hr->setLineWidth(3);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   279
            hr->setFixedHeight(10);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   280
            GBAlayout->addWidget(hr);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   281
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   282
            QLabel * resolution = new QLabel(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   283
            resolution->setText(QLabel::tr("Resolution"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   284
            GBAreslayout->addWidget(resolution);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   285
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   286
            CBResolution = new QComboBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   287
            GBAreslayout->addWidget(CBResolution);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   288
            GBAlayout->addLayout(GBAreslayout);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   289
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   290
            CBFullscreen = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   291
            CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   292
            GBAreslayout->addWidget(CBFullscreen);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   293
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   294
            QLabel * quality = new QLabel(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   295
            quality->setText(QLabel::tr("Quality"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   296
            quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   297
            GBAqualayout->addWidget(quality);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   298
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   299
            SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   300
            SLQuality->setTickPosition(QSlider::TicksBelow);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   301
            SLQuality->setMaximum(5);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   302
            SLQuality->setMinimum(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   303
            SLQuality->setFixedWidth(150);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   304
            GBAqualayout->addWidget(SLQuality);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   305
            GBAlayout->addLayout(GBAqualayout);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   306
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   307
            QLabel * stereo = new QLabel(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   308
            stereo->setText(QLabel::tr("Stereo rendering"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   309
            GBAstereolayout->addWidget(stereo);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   310
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   311
            CBStereoMode = new QComboBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   312
            CBStereoMode->addItem(QComboBox::tr("Disabled"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   313
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   314
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   315
            CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   316
            CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   317
            CBStereoMode->addItem(QComboBox::tr("Red/Green"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   318
            CBStereoMode->addItem(QComboBox::tr("Green/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   319
            CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   320
            CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   321
            CBStereoMode->addItem(QComboBox::tr("Wiggle"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   322
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   323
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   324
            CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   325
            CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   326
            CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   327
            CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   328
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   329
            GBAstereolayout->addWidget(CBStereoMode);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   330
            GBAlayout->addLayout(GBAstereolayout);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   331
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   332
            hr = new QFrame(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   333
            hr->setFrameStyle(QFrame::HLine);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   334
            hr->setLineWidth(3);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   335
            hr->setFixedHeight(10);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   336
            GBAlayout->addWidget(hr);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   337
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   338
            QGridLayout * GBAvollayout = new QGridLayout();
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   339
            QLabel * vol = new QLabel(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   340
            vol->setText(QLabel::tr("Initial sound volume"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   341
            GBAvollayout->addWidget(vol, 0, 0, 1, 2);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   342
            GBAlayout->addLayout(GBAvollayout);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   343
            volumeBox = new QSpinBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   344
            volumeBox->setRange(0, 100);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   345
            volumeBox->setSingleStep(5);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   346
            GBAvollayout->addWidget(volumeBox, 0, 2);
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   347
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   348
            CBEnableSound = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   349
            CBEnableSound->setText(QCheckBox::tr("Enable sound"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   350
            GBAvollayout->addWidget(CBEnableSound, 1, 0, 1, 1);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   351
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   352
            CBEnableMusic = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   353
            CBEnableMusic->setText(QCheckBox::tr("Enable music"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   354
            GBAvollayout->addWidget(CBEnableMusic, 1, 1, 1, 2);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   355
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   356
            GBAvollayout->setSizeConstraint(QLayout::SetMinimumSize);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   357
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   358
            hr = new QFrame(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   359
            hr->setFrameStyle(QFrame::HLine);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   360
            hr->setLineWidth(3);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   361
            hr->setFixedHeight(10);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   362
            GBAlayout->addWidget(hr);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   363
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   364
            CBAltDamage = new QCheckBox(AGGroupBox);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   365
            CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   366
            GBAlayout->addWidget(CBAltDamage);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   367
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   368
            page1Layout->addWidget(AGGroupBox, 0, 1, 3, 1);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   369
        }
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   370
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   371
        page1Layout->addWidget(new QWidget(this), 3, 0);
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   372
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   373
    }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   374
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   375
    { // page 2
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   376
        QGridLayout * page2Layout = new QGridLayout(page2);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   377
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   378
        {
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   379
            IconedGroupBox * gbColors = new IconedGroupBox(this);
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   380
            gbColors->setIcon(QIcon(":/res/lightbulb_on.png"));
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   381
            gbColors->setTitle(QGroupBox::tr("Custom colors"));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   382
            page2Layout->addWidget(gbColors, 0, 0);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   383
            QGridLayout * gbCLayout = new QGridLayout(gbColors);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   384
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   385
            QSignalMapper * mapper = new QSignalMapper(this);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   386
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   387
            QStandardItemModel * model = DataManager::instance().colorsModel();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   388
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   389
            connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(onColorModelDataChanged(QModelIndex,QModelIndex)));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   390
            for(int i = 0; i < model->rowCount(); ++i)
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   391
            {
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   392
                QPushButton * btn = new QPushButton(this);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   393
                btn->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   394
                gbCLayout->addWidget(btn, i / 3, i % 3);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   395
                btn->setStyleSheet(QString("background: %1").arg(model->item(i)->data().value<QColor>().name()));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   396
                m_colorButtons.append(btn);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   397
                connect(btn, SIGNAL(clicked()), mapper, SLOT(map()));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   398
                mapper->setMapping(btn, i);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   399
            }
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   400
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   401
            connect(mapper, SIGNAL(mapped(int)), this, SLOT(colorButtonClicked(int)));
7680
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   402
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   403
            QPushButton * btn = new QPushButton(this);
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   404
            gbCLayout->addWidget(btn, (model->rowCount() - 1) / 3 + 1, 0, 1, 3);
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   405
            btn->setText(tr("Reset to default colors"));
7681
26978d581070 Reset to default colors button
unc0rr
parents: 7680
diff changeset
   406
            connect(btn, SIGNAL(clicked()), &DataManager::instance(), SLOT(resetColors()));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   407
        }
7153
f0d055645ab2 minor tweaks for options page; should improve readability at small window size... a bit...
sheepluva
parents: 6952
diff changeset
   408
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   409
        {
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   410
            IconedGroupBox * gbMisc = new IconedGroupBox(this);
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   411
            gbMisc->setIcon(QIcon(":/res/Settings.png"));
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   412
            gbMisc->setTitle(QGroupBox::tr("Miscellaneous"));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   413
            page2Layout->addWidget(gbMisc, 0, 1);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   414
            QVBoxLayout * gbCLayout = new QVBoxLayout(gbMisc);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   415
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   416
            QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   417
            QLabel * maxfps = new QLabel(AGGroupBox);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   418
            maxfps->setText(QLabel::tr("FPS limit"));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   419
            GBAfpslayout->addWidget(maxfps);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   420
            fpsedit = new FPSEdit(AGGroupBox);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   421
            GBAfpslayout->addWidget(fpsedit);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   422
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   423
            CBShowFPS = new QCheckBox(AGGroupBox);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   424
            CBShowFPS->setText(QCheckBox::tr("Show FPS"));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   425
            GBAfpslayout->addWidget(CBShowFPS);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   426
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   427
            gbCLayout->addLayout(GBAfpslayout);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   428
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   429
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   430
            WeaponTooltip = new QCheckBox(this);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   431
            WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   432
            gbCLayout->addWidget(WeaponTooltip);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   433
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   434
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   435
            CBNameWithDate = new QCheckBox(this);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   436
            CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   437
            gbCLayout->addWidget(CBNameWithDate);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   438
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   439
            BtnAssociateFiles = new QPushButton(this);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   440
            BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   441
            BtnAssociateFiles->setVisible(!custom_data && !custom_config);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   442
            gbCLayout->addWidget(BtnAssociateFiles);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   443
        }
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   444
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   445
        {
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   446
            IconedGroupBox * gbProxy = new IconedGroupBox(this);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   447
            gbProxy->setIcon(QIcon(":/res/Settings.png"));
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   448
            gbProxy->setTitle(QGroupBox::tr("Proxy settings"));
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   449
            page2Layout->addWidget(gbProxy, 1, 0);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   450
            QGridLayout * gbLayout = new QGridLayout(gbProxy);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   451
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   452
            QStringList sl;
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   453
            sl
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   454
                    << tr("Proxy host")
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   455
                    << tr("Proxy port")
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   456
                    << tr("Proxy login")
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   457
                    << tr("Proxy password")
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   458
                       ;
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   459
            for(int i = 0; i < sl.size(); ++i)
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   460
            {
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   461
                QLabel * l = new QLabel(gbProxy);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   462
                l->setText(sl[i]);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   463
                gbLayout->addWidget(l, i + 1, 0);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   464
            }
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   465
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   466
            cbProxyType = new QComboBox(gbProxy);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   467
            cbProxyType->addItems(QStringList()
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   468
                                  << tr("No proxy")
7702
c8906c3a2aeb Allow using system proxy settings
unc0rr
parents: 7701
diff changeset
   469
                                  << tr("System proxy settings")
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   470
                                  << tr("Socks5 proxy")
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   471
                                  << tr("HTTP proxy"));
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   472
            gbLayout->addWidget(cbProxyType, 0, 1);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   473
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   474
            leProxy = new QLineEdit(gbProxy);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   475
            gbLayout->addWidget(leProxy, 1, 1);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   476
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   477
            sbProxyPort = new QSpinBox(gbProxy);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   478
            sbProxyPort->setMaximum(65535);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   479
            gbLayout->addWidget(sbProxyPort, 2, 1);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   480
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   481
            leProxyLogin = new QLineEdit(gbProxy);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   482
            gbLayout->addWidget(leProxyLogin, 3, 1);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   483
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   484
            leProxyPassword = new QLineEdit(gbProxy);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   485
            leProxyPassword->setEchoMode(QLineEdit::Password);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   486
            gbLayout->addWidget(leProxyPassword, 4, 1);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   487
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   488
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   489
            connect(cbProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged()));
7701
2b9017ffc72f - Small fix
unc0rr
parents: 7700
diff changeset
   490
            onProxyTypeChanged();
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   491
        }
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   492
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   493
        page2Layout->addWidget(new QWidget(this), 2, 0);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   494
    }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   495
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   496
    previousQuality = this->SLQuality->value();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   497
    previousResolutionIndex = this->CBResolution->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   498
    previousFullscreenValue = this->CBFullscreen->isChecked();
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   499
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   500
    return pageLayout;
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   501
}
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   502
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   503
QLayout * PageOptions::footerLayoutDefinition()
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   504
{
6525
6c97379c584b [GCI] backz task: unify the back button functionality, avoid using the save button
m4tx
parents: 6218
diff changeset
   505
    return NULL;
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   506
}
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   507
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   508
void PageOptions::connectSignals()
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   509
{
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   510
    connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int)));
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   511
    connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int)));
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   512
    connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int)));
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   513
    connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int)));
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   514
    connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick()));
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   515
    connect(CBSavePassword, SIGNAL(stateChanged(int)), this, SLOT(savePwdChanged(int)));
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   516
}
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   517
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   518
PageOptions::PageOptions(QWidget* parent) : AbstractPage(parent)
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   519
{
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6024
diff changeset
   520
    initPage();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   521
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   522
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   523
void PageOptions::forceFullscreen(int index)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   524
{
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   525
    bool forced = (index == 7 || index == 8 || index == 9);
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   526
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   527
    if (index != 0)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   528
    {
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   529
        this->SLQuality->setValue(this->SLQuality->maximum());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   530
        this->SLQuality->setEnabled(false);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   531
        this->CBFullscreen->setEnabled(!forced);
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   532
        this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   533
        this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   534
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   535
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   536
    {
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   537
        this->SLQuality->setEnabled(true);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   538
        this->CBFullscreen->setEnabled(true);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   539
        this->SLQuality->setValue(previousQuality);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   540
        this->CBFullscreen->setChecked(previousFullscreenValue);
5877
514b639c40da remove the forced fullscreen resolution since everyone is hating it; kept it around only for stereo rendering (where it's mandatory)
koda
parents: 5745
diff changeset
   541
        this->CBResolution->setCurrentIndex(previousResolutionIndex);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   542
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   543
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   544
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   545
void PageOptions::setQuality(int value)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   546
{
6218
999215ca87d7 actually the those if(...); weren't supposed to be if statements in the first place, since the result is always true at that point of code anyway.
sheepluva
parents: 6217
diff changeset
   547
    Q_UNUSED(value);
6217
ef53ba841791 - Remove some old unused code
unc0rr
parents: 6060
diff changeset
   548
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   549
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   550
    if (index == 0)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   551
        previousQuality = this->SLQuality->value();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   552
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   553
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   554
void PageOptions::setFullscreen(int state)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   555
{
6218
999215ca87d7 actually the those if(...); weren't supposed to be if statements in the first place, since the result is always true at that point of code anyway.
sheepluva
parents: 6217
diff changeset
   556
    Q_UNUSED(state);
6217
ef53ba841791 - Remove some old unused code
unc0rr
parents: 6060
diff changeset
   557
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   558
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   559
    if (index != 7 && index != 8 && index != 9)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   560
        previousFullscreenValue = this->CBFullscreen->isChecked();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   561
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   562
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   563
void PageOptions::setResolution(int state)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   564
{
6218
999215ca87d7 actually the those if(...); weren't supposed to be if statements in the first place, since the result is always true at that point of code anyway.
sheepluva
parents: 6217
diff changeset
   565
    Q_UNUSED(state);
6217
ef53ba841791 - Remove some old unused code
unc0rr
parents: 6060
diff changeset
   566
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   567
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   568
    if (index != 7 && index != 8 && index != 9)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   569
        previousResolutionIndex = this->CBResolution->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   570
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   571
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   572
void PageOptions::trimNetNick()
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   573
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   574
    editNetNick->setText(editNetNick->text().trimmed());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   575
}
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   576
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   577
void PageOptions::savePwdChanged(int state) {
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   578
    if (state == 0) {
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   579
        editNetPassword->setEnabled(false);
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   580
        editNetPassword->setText("");
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   581
    } else
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   582
        editNetPassword->setEnabled(true);
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   583
}
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   584
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   585
void PageOptions::requestEditSelectedTeam()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   586
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   587
    emit editTeamRequested(CBTeamName->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   588
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   589
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   590
void PageOptions::requestDeleteSelectedTeam()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   591
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   592
    emit deleteTeamRequested(CBTeamName->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   593
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   594
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   595
void PageOptions::setTeamOptionsEnabled(bool enabled)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   596
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   597
    BtnNewTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   598
    BtnEditTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   599
    BtnDeleteTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   600
    CBTeamName->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   601
    LblNoEditTeam->setVisible(!enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   602
}
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   603
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   604
void PageOptions::colorButtonClicked(int i)
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   605
{
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   606
    if(i < 0 || i >= m_colorButtons.size())
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   607
        return;
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   608
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   609
    QPalette p = m_colorButtons[i]->palette();
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   610
    QColor c = QColorDialog::getColor(p.color(QPalette::Button));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   611
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   612
    if(c.isValid())
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   613
    {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   614
        DataManager::instance().colorsModel()->item(i)->setData(c);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   615
        m_colorButtons[i]->setStyleSheet(QString("background: %1").arg(c.name()));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   616
    }
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   617
}
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   618
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   619
void PageOptions::onColorModelDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight)
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   620
{
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   621
    Q_UNUSED(bottomRight);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   622
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   623
    QStandardItemModel * model = DataManager::instance().colorsModel();
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   624
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   625
    m_colorButtons[topLeft.row()]->setStyleSheet(QString("background: %1").arg(model->item(topLeft.row())->data().value<QColor>().name()));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   626
}
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   627
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   628
void PageOptions::onProxyTypeChanged()
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   629
{
7703
78d2ac987f41 Make sheepluva happy
unc0rr
parents: 7702
diff changeset
   630
    bool b = cbProxyType->currentIndex() != NoProxy && cbProxyType->currentIndex() != SystemProxy ;
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   631
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   632
    sbProxyPort->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   633
    leProxy->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   634
    leProxyLogin->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   635
    leProxyPassword->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   636
}