QTfrontend/ui/page/pageoptions.cpp
author nemo
Fri, 29 Mar 2013 10:54:12 -0400
changeset 8818 8f317ba10675
parent 8434 4821897a0f10
child 8880 71ed64b18540
child 8902 a94c074fd483
permissions -rw-r--r--
This should ensure rope can still be aimed quickly when an alt weapon is active.
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>
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    26
#include <QTableWidget>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    27
#include <QLineEdit>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    28
#include <QSpinBox>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    29
#include <QTextBrowser>
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    30
#include <QScrollArea>
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    31
#include <QHeaderView>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    32
#include <QSlider>
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    33
#include <QSignalMapper>
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    34
#include <QColorDialog>
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    35
#include <QStandardItemModel>
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    36
#include <QDebug>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    37
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5078
diff changeset
    38
#include "pageoptions.h"
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
    39
#include "gameuiconfig.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    40
#include "hwconsts.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    41
#include "fpsedit.h"
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    42
#include "DataManager.h"
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
    43
#include "LibavInteraction.h"
8284
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    44
#include "AutoUpdater.h"
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    45
#include "HWApplication.h"
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    46
#include "keybinder.h"
8284
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    47
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    48
#ifdef __APPLE__
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    49
#ifdef SPARKLE_ENABLED
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    50
#include "SparkleAutoUpdater.h"
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    51
#endif
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    52
#endif
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    53
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    54
const int OPTION_BOX_SPACING = 10;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    55
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    56
OptionGroupBox::OptionGroupBox(const QString & iconName,
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    57
                               const QString & title,
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    58
                               QWidget * parent) : IconedGroupBox(parent)
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    59
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    60
    setIcon(QIcon(iconName));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    61
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    62
    setTitle(title);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    63
    setMinimumWidth(300);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    64
    m_layout = new QGridLayout(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    65
    m_layout->setColumnStretch(0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    66
    m_layout->setColumnStretch(1, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    67
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    68
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    69
QGridLayout * OptionGroupBox::layout()
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    70
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    71
    return m_layout;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    72
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    73
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    74
void OptionGroupBox::addDivider()
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    75
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    76
    QFrame * hr = new QFrame(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    77
    hr->setFrameStyle(QFrame::HLine);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    78
    hr->setLineWidth(3);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    79
    hr->setFixedHeight(10);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    80
    m_layout->addWidget(hr, m_layout->rowCount(), 0, 1, m_layout->columnCount());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    81
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    82
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
    83
// 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
    84
QLayout * PageOptions::bodyLayoutDefinition()
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    85
{
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    86
    QVBoxLayout * pageLayout = new QVBoxLayout();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    87
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    88
    QTabWidget * tabs = new QTabWidget(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    89
    pageLayout->addWidget(tabs);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    90
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    91
    binder = new KeyBinder(this, tr("Select an action to change what key controls it"), tr("Reset to default"), tr("Reset all binds"));
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    92
    connect(binder, SIGNAL(bindUpdate(int)), this, SLOT(bindUpdated(int)));
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    93
    connect(binder, SIGNAL(resetAllBinds()), this, SLOT(resetAllBinds()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    94
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    95
    QWidget * pageGame = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    96
    tabs->addTab(pageGame, tr("Game"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    97
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    98
    QWidget * pageGraphics = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    99
    tabs->addTab(pageGraphics, tr("Graphics"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   100
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   101
    QWidget * pageAudio = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   102
    tabs->addTab(pageAudio, tr("Audio"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   103
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
   104
    binderTab = tabs->addTab(binder, tr("Controls"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   105
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   106
#ifdef VIDEOREC
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   107
    QWidget * pageVideoRec = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   108
    tabs->addTab(pageVideoRec, tr("Video Recording"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   109
#endif
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   110
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   111
    QWidget * pageNetwork = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   112
    tabs->addTab(pageNetwork, tr("Network"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   113
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   114
    QWidget * pageAdvanced = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   115
    tabs->addTab(pageAdvanced, tr("Advanced"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   116
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
   117
    connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged(int)));
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
   118
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   119
    QPixmap pmNew(":/res/new.png");
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   120
    QPixmap pmEdit(":/res/edit.png");
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   121
    QPixmap pmDelete(":/res/delete.png");
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   122
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   123
    { // game page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   124
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   125
        setupTabPage(pageGame, &leftColumn, &rightColumn);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   126
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   127
        { // group: Teams
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   128
            OptionGroupBox * groupTeams = new OptionGroupBox(":/res/teamicon.png", tr("Teams"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   129
            groupTeams->setMinimumWidth(400);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   130
            rightColumn->addWidget(groupTeams);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   131
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   132
            groupTeams->layout()->setColumnStretch(0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   133
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   134
            CBTeamName = new QComboBox(groupTeams);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   135
            groupTeams->layout()->addWidget(CBTeamName, 0, 0);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   136
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   137
            BtnNewTeam = new QPushButton(groupTeams);
8382
67e257b98422 GCI2012: No More Hovering
dag10
parents: 8359
diff changeset
   138
            BtnNewTeam->setWhatsThis(tr("New team"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   139
            BtnNewTeam->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   140
            BtnNewTeam->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   141
            BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   142
            connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   143
            groupTeams->layout()->addWidget(BtnNewTeam, 0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   144
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   145
            BtnEditTeam = new QPushButton(groupTeams);
8382
67e257b98422 GCI2012: No More Hovering
dag10
parents: 8359
diff changeset
   146
            BtnEditTeam->setWhatsThis(tr("Edit team"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   147
            BtnEditTeam->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   148
            BtnEditTeam->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   149
            BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   150
            connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   151
            groupTeams->layout()->addWidget(BtnEditTeam, 0, 2);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   152
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   153
            BtnDeleteTeam = new QPushButton(groupTeams);
8382
67e257b98422 GCI2012: No More Hovering
dag10
parents: 8359
diff changeset
   154
            BtnDeleteTeam->setWhatsThis(tr("Delete team"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   155
            BtnDeleteTeam->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   156
            BtnDeleteTeam->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   157
            BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   158
            connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   159
            groupTeams->layout()->addWidget(BtnDeleteTeam, 0, 3);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   160
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   161
            LblNoEditTeam = new QLabel(groupTeams);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   162
            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
   163
            LblNoEditTeam->setWordWrap(true);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   164
            LblNoEditTeam->setVisible(false);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   165
            groupTeams->layout()->addWidget(LblNoEditTeam, 1, 0, 1, 4);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   166
        }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   167
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   168
        { // group: schemes
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   169
            OptionGroupBox * groupSchemes = new OptionGroupBox(":/res/weaponsicon.png", tr("Schemes"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   170
            leftColumn->addWidget(groupSchemes);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   171
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   172
            groupSchemes->layout()->setColumnStretch(0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   173
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   174
            SchemesName = new QComboBox(groupSchemes);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   175
            groupSchemes->layout()->addWidget(SchemesName, 0, 0);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   176
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   177
            SchemeNew = new QPushButton(groupSchemes);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   178
            SchemeNew->setWhatsThis(tr("New scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   179
            SchemeNew->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   180
            SchemeNew->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   181
            SchemeNew->setMaximumWidth(pmNew.width() + 6);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   182
            groupSchemes->layout()->addWidget(SchemeNew, 0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   183
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   184
            SchemeEdit = new QPushButton(groupSchemes);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   185
            SchemeEdit->setWhatsThis(tr("Edit scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   186
            SchemeEdit->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   187
            SchemeEdit->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   188
            SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   189
            groupSchemes->layout()->addWidget(SchemeEdit, 0, 2);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   190
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   191
            SchemeDelete = new QPushButton(groupSchemes);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   192
            SchemeDelete->setWhatsThis(tr("Delete scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   193
            SchemeDelete->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   194
            SchemeDelete->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   195
            SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   196
            groupSchemes->layout()->addWidget(SchemeDelete, 0, 3);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   197
        }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   198
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   199
        { // group: weapons
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   200
            OptionGroupBox * groupWeapons = new OptionGroupBox(":/res/weaponsicon.png", tr("Weapons"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   201
            leftColumn->addWidget(groupWeapons);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   202
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   203
            groupWeapons->layout()->setColumnStretch(0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   204
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   205
            WeaponsName = new QComboBox(groupWeapons);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   206
            groupWeapons->layout()->addWidget(WeaponsName, 0, 0);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   207
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   208
            WeaponNew = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   209
            WeaponNew->setWhatsThis(tr("New weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   210
            WeaponNew->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   211
            WeaponNew->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   212
            WeaponNew->setMaximumWidth(pmNew.width() + 6);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   213
            groupWeapons->layout()->addWidget(WeaponNew, 0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   214
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   215
            WeaponEdit = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   216
            WeaponEdit->setWhatsThis(tr("Edit weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   217
            WeaponEdit->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   218
            WeaponEdit->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   219
            WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   220
            groupWeapons->layout()->addWidget(WeaponEdit, 0, 2);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   221
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   222
            WeaponDelete = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   223
            WeaponDelete->setWhatsThis(tr("Delete weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   224
            WeaponDelete->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   225
            WeaponDelete->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   226
            WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   227
            groupWeapons->layout()->addWidget(WeaponDelete, 0, 3);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   228
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   229
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   230
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   231
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   232
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   233
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   234
    { // graphics page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   235
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   236
        setupTabPage(pageGraphics, &leftColumn, &rightColumn);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   237
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   238
        { // group: game
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   239
            OptionGroupBox * groupGame = new OptionGroupBox(":/res/graphicsicon.png", tr("Game"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   240
            leftColumn->addWidget(groupGame);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   241
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   242
            groupGame->layout()->setColumnStretch(0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   243
            groupGame->layout()->setColumnStretch(1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   244
            groupGame->layout()->setColumnStretch(2, 1);
8229
251f38da9935 Cleaned up frontend options a bit and added a couple WhatsThis messages.
Mitchell Kember <mk12360@gmail.com>
parents: 8226
diff changeset
   245
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   246
            // Fullscreen
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   247
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   248
            CBFullscreen = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   249
            groupGame->layout()->addWidget(CBFullscreen, 0, 0, 1, 2);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   250
            CBFullscreen->setText(QLabel::tr("Fullscreen"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   251
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   252
            // Fullscreen resolution
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   253
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   254
            lblFullScreenRes = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   255
            lblFullScreenRes->setText(QLabel::tr("Fullscreen Resolution"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   256
            groupGame->layout()->addWidget(lblFullScreenRes, 1, 0);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   257
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   258
            CBResolution = new QComboBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   259
            CBResolution->setFixedWidth(200);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   260
            groupGame->layout()->addWidget(CBResolution, 1, 1, Qt::AlignLeft);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   261
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   262
            // Windowed resolution
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   263
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   264
            lblWinScreenRes = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   265
            lblWinScreenRes->setText(QLabel::tr("Windowed Resolution"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   266
            groupGame->layout()->addWidget(lblWinScreenRes, 2, 0);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   267
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   268
            winResContainer = new QWidget();
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   269
            QHBoxLayout * winResLayout = new QHBoxLayout(winResContainer);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   270
            winResLayout->setSpacing(0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   271
            groupGame->layout()->addWidget(winResContainer, 2, 1);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   272
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   273
            QLabel *winLabelX = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   274
            winLabelX->setText("x"); // decorational x
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   275
            winLabelX->setFixedWidth(40);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   276
            winLabelX->setAlignment(Qt::AlignCenter);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   277
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   278
            windowWidthEdit = new QLineEdit(groupGame);
8343
aa4ea3cade3c Added Support for variable windowed resolution.
vitiv <nikita.utiu@gmail.com>
parents: 8284
diff changeset
   279
            windowWidthEdit->setValidator(new QIntValidator(this));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   280
            windowWidthEdit->setFixedSize(55, CBResolution->height());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   281
            windowHeightEdit = new QLineEdit(groupGame);
8343
aa4ea3cade3c Added Support for variable windowed resolution.
vitiv <nikita.utiu@gmail.com>
parents: 8284
diff changeset
   282
            windowHeightEdit->setValidator(new QIntValidator(this));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   283
            windowHeightEdit->setFixedSize(55, CBResolution->height());
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   284
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   285
            winResLayout->addWidget(windowWidthEdit, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   286
            winResLayout->addWidget(winLabelX, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   287
            winResLayout->addWidget(windowHeightEdit, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   288
            winResLayout->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   289
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   290
            // Quality
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   291
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   292
            QLabel * lblQuality = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   293
            lblQuality->setText(QLabel::tr("Quality"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   294
            lblQuality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   295
            groupGame->layout()->addWidget(lblQuality, 3, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   296
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   297
            SLQuality = new QSlider(Qt::Horizontal, groupGame);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   298
            SLQuality->setTickPosition(QSlider::TicksBelow);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   299
            SLQuality->setMaximum(5);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   300
            SLQuality->setMinimum(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   301
            SLQuality->setFixedWidth(150);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   302
            groupGame->layout()->addWidget(SLQuality, 3, 1, Qt::AlignLeft);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   303
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   304
            // Stereo spacing
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   305
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   306
            QLabel * lblStereo = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   307
            lblStereo->setText(QLabel::tr("Stereo rendering"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   308
            groupGame->layout()->addWidget(lblStereo, 4, 0);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   309
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   310
            CBStereoMode = new QComboBox(groupGame);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   311
            CBStereoMode->addItem(QComboBox::tr("Disabled"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   312
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   313
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   314
            CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   315
            CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   316
            CBStereoMode->addItem(QComboBox::tr("Red/Green"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   317
            CBStereoMode->addItem(QComboBox::tr("Green/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   318
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   319
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   320
            CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   321
            CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   322
            CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   323
            CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale"));
8359
9a7024b2a4d3 Removed wiggle 3D mode, reorder the list of 3D modes.
martin_bede
parents: 8356
diff changeset
   324
            CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
9a7024b2a4d3 Removed wiggle 3D mode, reorder the list of 3D modes.
martin_bede
parents: 8356
diff changeset
   325
            CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   326
            CBStereoMode->setFixedWidth(CBResolution->width());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   327
            groupGame->layout()->addWidget(CBStereoMode, 4, 1);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   328
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   329
            // Divider
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   330
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   331
            groupGame->addDivider(); // row 5
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   332
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   333
            // FPS limit
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   334
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   335
            QHBoxLayout * fpsLayout = new QHBoxLayout();
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   336
            groupGame->layout()->addLayout(fpsLayout, 6, 0, 1, 2);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   337
            QLabel * maxfps = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   338
            maxfps->setText(QLabel::tr("FPS limit"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   339
            fpsLayout->addWidget(maxfps);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   340
            fpsLayout->addSpacing(30);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   341
            fpsedit = new FPSEdit(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   342
            fpsLayout->addWidget(fpsedit);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   343
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   344
            // Show FPS
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   345
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   346
            CBShowFPS = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   347
            CBShowFPS->setText(QCheckBox::tr("Show FPS"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   348
            fpsLayout->addWidget(CBShowFPS);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   349
            fpsLayout->addStretch(1);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   350
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   351
            // Divider
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   352
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   353
            groupGame->addDivider(); // row 7
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   354
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   355
            // Alternative damage show
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   356
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   357
            CBAltDamage = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   358
            CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   359
            groupGame->layout()->addWidget(CBAltDamage, 8, 0, 1, 2);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   360
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   361
            // Show ammo menu tooltips
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   362
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   363
            WeaponTooltip = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   364
            WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   365
            groupGame->layout()->addWidget(WeaponTooltip, 9, 0, 1, 2);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   366
        }
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   367
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   368
        { // group: frontend
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   369
            OptionGroupBox * groupFrontend = new OptionGroupBox(":/res/graphicsicon.png", tr("Frontend"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   370
            rightColumn->addWidget(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   371
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   372
            // Fullscreen
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   373
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   374
            CBFrontendFullscreen = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   375
            CBFrontendFullscreen->setText(QCheckBox::tr("Fullscreen"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   376
            groupFrontend->layout()->addWidget(CBFrontendFullscreen, 0, 0);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   377
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   378
            // Visual effects
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   379
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   380
            CBFrontendEffects = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   381
            CBFrontendEffects->setText(QCheckBox::tr("Visual effects"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   382
            groupFrontend->layout()->addWidget(CBFrontendEffects, 1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   383
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   384
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   385
        { // group: colors
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   386
            OptionGroupBox * groupColors = new OptionGroupBox(":/res/lightbulb_on.png", tr("Custom colors"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   387
            rightColumn->addWidget(groupColors);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   388
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   389
            groupColors->layout()->setColumnStretch(0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   390
            groupColors->layout()->setColumnStretch(1, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   391
            groupColors->layout()->setColumnStretch(2, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   392
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   393
            // Color buttons
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   394
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   395
            QSignalMapper * mapper = new QSignalMapper(this);
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   396
            QStandardItemModel * model = DataManager::instance().colorsModel();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   397
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   398
            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
   399
            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
   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
                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
   402
                btn->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   403
                groupColors->layout()->addWidget(btn, i / 3, i % 3);
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   404
                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
   405
                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
   406
                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
   407
                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
   408
            }
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
            connect(mapper, SIGNAL(mapped(int)), this, SLOT(colorButtonClicked(int)));
7680
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   411
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   412
            // Reset default colors
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   413
7680
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   414
            QPushButton * btn = new QPushButton(this);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   415
            groupColors->layout()->addWidget(btn, (model->rowCount() - 1) / 3 + 1, 0, 1, 3);
7680
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   416
            btn->setText(tr("Reset to default colors"));
7681
26978d581070 Reset to default colors button
unc0rr
parents: 7680
diff changeset
   417
            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
   418
        }
7153
f0d055645ab2 minor tweaks for options page; should improve readability at small window size... a bit...
sheepluva
parents: 6952
diff changeset
   419
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   420
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   421
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   422
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   423
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   424
    { // audio page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   425
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   426
        setupTabPage(pageAudio, &leftColumn, &rightColumn);
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   427
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   428
        { // group: game
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   429
            OptionGroupBox * groupGame = new OptionGroupBox(":/res/audio.png", tr("Game audio"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   430
            leftColumn->addWidget(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   431
            groupGame->layout()->setColumnStretch(1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   432
            groupGame->layout()->setColumnStretch(2, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   433
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   434
            // Initial sound volume
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   435
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   436
            QLabel * vol = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   437
            vol->setText(QLabel::tr("Initial sound volume"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   438
            groupGame->layout()->addWidget(vol, 0, 0);
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   439
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   440
            SLVolume = new QSlider(Qt::Horizontal, groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   441
            SLVolume->setTickPosition(QSlider::TicksBelow);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   442
            SLVolume->setMaximum(100);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   443
            SLVolume->setMinimum(0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   444
            SLVolume->setFixedWidth(150);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   445
            groupGame->layout()->addWidget(SLVolume, 0, 1, 1, 2);
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   446
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   447
            lblVolumeLevel = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   448
            lblVolumeLevel->setFixedWidth(40);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   449
            groupGame->layout()->addWidget(lblVolumeLevel, 0, 3);
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   450
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   451
            // Sound
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   452
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   453
            CBSound = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   454
            CBSound->setText(QCheckBox::tr("Sound"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   455
            CBSound->setWhatsThis(QCheckBox::tr("In-game sound effects"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   456
            groupGame->layout()->addWidget(CBSound, 1, 1);
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   457
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   458
            // Music
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   459
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   460
            CBMusic = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   461
            CBMusic->setText(QCheckBox::tr("Music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   462
            CBMusic->setWhatsThis(QCheckBox::tr("In-game music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   463
            groupGame->layout()->addWidget(CBMusic, 1, 2, 1, 2, Qt::AlignLeft);
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   464
        }
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   465
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   466
        { // group: frontend
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   467
            OptionGroupBox * groupFrontend = new OptionGroupBox(":/res/audio.png", tr("Frontend audio"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   468
            rightColumn->addWidget(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   469
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   470
            CBFrontendSound = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   471
            CBFrontendSound->setText(QCheckBox::tr("Sound"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   472
            CBFrontendSound->setWhatsThis(QCheckBox::tr("Frontend sound effects"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   473
            groupFrontend->layout()->addWidget(CBFrontendSound, 0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   474
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   475
            CBFrontendMusic = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   476
            CBFrontendMusic->setText(QCheckBox::tr("Music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   477
            CBFrontendMusic->setWhatsThis(QCheckBox::tr("Frontend music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   478
            groupFrontend->layout()->addWidget(CBFrontendMusic, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   479
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   480
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   481
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   482
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   483
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   484
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   485
    { // network page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   486
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   487
        setupTabPage(pageNetwork, &leftColumn, &rightColumn);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   488
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   489
        { // group: account
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   490
            OptionGroupBox * groupAccount = new OptionGroupBox(":/res/teamicon.png", tr("Account"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   491
            leftColumn->addWidget(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   492
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   493
            // Label and field for net nick
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   494
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   495
            labelNN = new QLabel(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   496
            labelNN->setText(QLabel::tr("Nickname"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   497
            groupAccount->layout()->addWidget(labelNN, 0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   498
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   499
            editNetNick = new QLineEdit(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   500
            editNetNick->setMaxLength(20);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   501
            editNetNick->setText(QLineEdit::tr("anonymous"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   502
            groupAccount->layout()->addWidget(editNetNick, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   503
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   504
            // Checkbox and field for password
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   505
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   506
            CBSavePassword = new QCheckBox(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   507
            CBSavePassword->setText(QCheckBox::tr("Save password"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   508
            groupAccount->layout()->addWidget(CBSavePassword, 1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   509
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   510
            editNetPassword = new QLineEdit(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   511
            editNetPassword->setEchoMode(QLineEdit::Password);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   512
            groupAccount->layout()->addWidget(editNetPassword, 1, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   513
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   514
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   515
        { // group: proxy
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   516
            OptionGroupBox * groupProxy = new OptionGroupBox(":/res/net.png", tr("Proxy settings"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   517
            rightColumn->addWidget(groupProxy);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   518
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   519
            // Labels
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   520
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   521
            QStringList sl;
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   522
            sl << tr("Proxy host")
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   523
               << tr("Proxy port")
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   524
               << tr("Proxy login")
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   525
               << tr("Proxy password");
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   526
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   527
            for(int i = 0; i < sl.size(); ++i)
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   528
            {
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   529
                QLabel * l = new QLabel(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   530
                l->setText(sl[i]);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   531
                groupProxy->layout()->addWidget(l, i + 1, 0);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   532
            }
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   533
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   534
            // Proxy type
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   535
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   536
            cbProxyType = new QComboBox(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   537
            cbProxyType->addItems(QStringList()
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   538
                                  << tr("No proxy")
7702
c8906c3a2aeb Allow using system proxy settings
unc0rr
parents: 7701
diff changeset
   539
                                  << tr("System proxy settings")
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   540
                                  << tr("Socks5 proxy")
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   541
                                  << tr("HTTP proxy"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   542
            groupProxy->layout()->addWidget(cbProxyType, 0, 0, 1, 2);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   543
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   544
            // Proxy
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   545
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   546
            leProxy = new QLineEdit(groupProxy);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   547
            groupProxy->layout()->addWidget(leProxy, 1, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   548
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   549
            // Proxy
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   550
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   551
            sbProxyPort = new QSpinBox(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   552
            sbProxyPort->setMaximum(65535);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   553
            groupProxy->layout()->addWidget(sbProxyPort, 2, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   554
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   555
            leProxyLogin = new QLineEdit(groupProxy);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   556
            groupProxy->layout()->addWidget(leProxyLogin, 3, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   557
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   558
            leProxyPassword = new QLineEdit(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   559
            leProxyPassword->setEchoMode(QLineEdit::Password);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   560
            groupProxy->layout()->addWidget(leProxyPassword, 4, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   561
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   562
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   563
            connect(cbProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged()));
7701
2b9017ffc72f - Small fix
unc0rr
parents: 7700
diff changeset
   564
            onProxyTypeChanged();
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   565
        }
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   566
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   567
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   568
        rightColumn->addStretch(1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   569
    }
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   570
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   571
    { // advanced page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   572
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   573
        setupTabPage(pageAdvanced, &leftColumn, &rightColumn);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   574
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   575
        { // group: miscellaneous
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   576
            OptionGroupBox * groupMisc = new OptionGroupBox(":/res/Settings.png", tr("Miscellaneous"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   577
            leftColumn->addWidget(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   578
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   579
            // Language
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   580
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   581
            QLabel *labelLanguage = new QLabel(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   582
            labelLanguage->setText(QLabel::tr("Locale"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   583
            groupMisc->layout()->addWidget(labelLanguage, 0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   584
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   585
            CBLanguage = new QComboBox(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   586
            groupMisc->layout()->addWidget(CBLanguage, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   587
            QStringList locs = DataManager::instance().entryList("Locale", QDir::Files, QStringList("hedgewars_*.qm"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   588
            CBLanguage->addItem(QComboBox::tr("(System default)"), QString(""));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   589
            for(int i = 0; i < locs.count(); i++)
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   590
            {
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   591
                QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   592
                CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   593
            }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   594
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   595
            // Divider
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   596
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   597
            groupMisc->addDivider(); // row 1
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   598
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   599
            // Append date and time to record file name
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   600
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   601
            CBNameWithDate = new QCheckBox(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   602
            CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   603
            groupMisc->layout()->addWidget(CBNameWithDate, 2, 0, 1, 2);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   604
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   605
            // Associate file extensions
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   606
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   607
            BtnAssociateFiles = new QPushButton(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   608
            BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   609
            BtnAssociateFiles->setVisible(!custom_data && !custom_config);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   610
            groupMisc->layout()->addWidget(BtnAssociateFiles, 3, 0, 1, 2);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   611
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   612
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   613
#ifdef __APPLE__
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   614
#ifdef SPARKLE_ENABLED
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   615
        { // group: updates
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   616
            OptionGroupBox * groupUpdates = new OptionGroupBox(":/res/net.png", tr("Updates"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   617
            rightColumn->addWidget(groupUpdates);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   618
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   619
            // Check for updates at startup
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   620
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   621
            CBAutoUpdate = new QCheckBox(groupUpdates);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   622
            CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   623
            groupUpdates->layout()->addWidget(CBAutoUpdate, 0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   624
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   625
            // Check for updates now
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   626
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   627
            btnUpdateNow = new QPushButton(groupUpdates);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   628
            connect(btnUpdateNow, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   629
            btnUpdateNow->setWhatsThis(tr("Check for updates"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   630
            btnUpdateNow->setText("Check now");
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   631
            btnUpdateNow->setFixedSize(130, 30);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   632
            groupUpdates->layout()->addWidget(btnUpdateNow, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   633
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   634
#endif
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   635
#endif
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   636
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   637
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   638
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   639
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   640
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   641
#ifdef VIDEOREC
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   642
    { // video recording page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   643
        OptionGroupBox * groupVideoRec = new OptionGroupBox(":/res/camera.png", tr("Video recording options"), this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   644
        groupVideoRec->setMinimumWidth(500);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   645
        groupVideoRec->setMaximumWidth(650);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   646
        QHBoxLayout * layoutVideoRec = new QHBoxLayout(pageVideoRec);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   647
        layoutVideoRec->addWidget(groupVideoRec, 1, Qt::AlignTop | Qt::AlignHCenter);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   648
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   649
        // label for format
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   650
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   651
        QLabel *labelFormat = new QLabel(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   652
        labelFormat->setText(QLabel::tr("Format"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   653
        groupVideoRec->layout()->addWidget(labelFormat, 0, 0);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   654
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   655
        // list of supported formats
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   656
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   657
        comboAVFormats = new QComboBox(groupVideoRec);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   658
        groupVideoRec->layout()->addWidget(comboAVFormats, 0, 1, 1, 4);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   659
        LibavInteraction::instance().fillFormats(comboAVFormats);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   660
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   661
        // separator
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   662
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   663
        QFrame * hr = new QFrame(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   664
        hr->setFrameStyle(QFrame::HLine);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   665
        hr->setLineWidth(3);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   666
        hr->setFixedHeight(10);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   667
        groupVideoRec->layout()->addWidget(hr, 1, 0, 1, 5);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   668
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   669
        // label for audio codec
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   670
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   671
        QLabel *labelACodec = new QLabel(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   672
        labelACodec->setText(QLabel::tr("Audio codec"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   673
        groupVideoRec->layout()->addWidget(labelACodec, 2, 0);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   674
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   675
        // list of supported audio codecs
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   676
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   677
        comboAudioCodecs = new QComboBox(groupVideoRec);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   678
        groupVideoRec->layout()->addWidget(comboAudioCodecs, 2, 1, 1, 3);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   679
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   680
        // checkbox 'record audio'
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   681
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   682
        checkRecordAudio = new QCheckBox(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   683
        checkRecordAudio->setText(QCheckBox::tr("Record audio"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   684
        groupVideoRec->layout()->addWidget(checkRecordAudio, 2, 4);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   685
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   686
        // separator
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   687
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   688
        hr = new QFrame(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   689
        hr->setFrameStyle(QFrame::HLine);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   690
        hr->setLineWidth(3);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   691
        hr->setFixedHeight(10);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   692
        groupVideoRec->layout()->addWidget(hr, 3, 0, 1, 5);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   693
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   694
        // label for video codec
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   695
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   696
        QLabel *labelVCodec = new QLabel(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   697
        labelVCodec->setText(QLabel::tr("Video codec"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   698
        groupVideoRec->layout()->addWidget(labelVCodec, 4, 0);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   699
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   700
        // list of supported video codecs
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   701
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   702
        comboVideoCodecs = new QComboBox(groupVideoRec);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   703
        groupVideoRec->layout()->addWidget(comboVideoCodecs, 4, 1, 1, 4);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   704
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   705
        // label for resolution
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   706
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   707
        QLabel *labelRes = new QLabel(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   708
        labelRes->setText(QLabel::tr("Resolution"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   709
        groupVideoRec->layout()->addWidget(labelRes, 5, 0);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   710
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   711
        // width
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   712
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   713
        widthEdit = new QLineEdit(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   714
        widthEdit->setValidator(new QIntValidator(this));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   715
        groupVideoRec->layout()->addWidget(widthEdit, 5, 1);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   716
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   717
        // x
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   718
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   719
        QLabel *labelX = new QLabel(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   720
        labelX->setText("X");
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   721
        groupVideoRec->layout()->addWidget(labelX, 5, 2);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   722
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   723
        // height
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   724
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   725
        heightEdit = new QLineEdit(groupVideoRec);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   726
        heightEdit->setValidator(new QIntValidator(groupVideoRec));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   727
        groupVideoRec->layout()->addWidget(heightEdit, 5, 3);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   728
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   729
        // checkbox 'use game resolution'
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   730
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   731
        checkUseGameRes = new QCheckBox(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   732
        checkUseGameRes->setText(QCheckBox::tr("Use game resolution"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   733
        groupVideoRec->layout()->addWidget(checkUseGameRes, 5, 4);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   734
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   735
        // label for framerate
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   736
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   737
        QLabel *labelFramerate = new QLabel(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   738
        labelFramerate->setText(QLabel::tr("Framerate"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   739
        groupVideoRec->layout()->addWidget(labelFramerate, 6, 0);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   740
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   741
        framerateBox = new QComboBox(groupVideoRec);
8192
81da6576b0c3 Make video recording options have fixed size and merge with spinbox->combobox change.
Mitchell Kember <mk12360@gmail.com>
parents: 8151
diff changeset
   742
        framerateBox->addItem("24 fps", 24);
81da6576b0c3 Make video recording options have fixed size and merge with spinbox->combobox change.
Mitchell Kember <mk12360@gmail.com>
parents: 8151
diff changeset
   743
        framerateBox->addItem("25 fps", 25);
81da6576b0c3 Make video recording options have fixed size and merge with spinbox->combobox change.
Mitchell Kember <mk12360@gmail.com>
parents: 8151
diff changeset
   744
        framerateBox->addItem("30 fps", 30);
81da6576b0c3 Make video recording options have fixed size and merge with spinbox->combobox change.
Mitchell Kember <mk12360@gmail.com>
parents: 8151
diff changeset
   745
        framerateBox->addItem("50 fps", 50);
81da6576b0c3 Make video recording options have fixed size and merge with spinbox->combobox change.
Mitchell Kember <mk12360@gmail.com>
parents: 8151
diff changeset
   746
        framerateBox->addItem("60 fps", 60);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   747
        groupVideoRec->layout()->addWidget(framerateBox, 6, 1);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   748
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   749
        // label for Bitrate
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   750
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   751
        QLabel *labelBitrate = new QLabel(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   752
        labelBitrate->setText(QLabel::tr("Bitrate (Kbps)"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   753
        groupVideoRec->layout()->addWidget(labelBitrate, 6, 2);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   754
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   755
        // bitrate
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   756
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   757
        bitrateBox = new QSpinBox(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   758
        bitrateBox->setRange(100, 5000);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   759
        bitrateBox->setSingleStep(100);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   760
        groupVideoRec->layout()->addWidget(bitrateBox, 6, 3);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   761
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   762
        // button 'set default options'
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   763
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   764
        btnDefaults = new QPushButton(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   765
        btnDefaults->setText(QPushButton::tr("Set default options"));
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   766
        btnDefaults->setWhatsThis(QPushButton::tr("Restore default coding parameters"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   767
        groupVideoRec->layout()->addWidget(btnDefaults, 7, 0, 1, 5);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   768
    }
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   769
#endif
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   770
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   771
    previousQuality = this->SLQuality->value();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   772
    previousResolutionIndex = this->CBResolution->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   773
    previousFullscreenValue = this->CBFullscreen->isChecked();
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   774
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   775
    setFullscreen(CBFullscreen->isChecked());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   776
    setVolume(SLVolume->value());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   777
8343
aa4ea3cade3c Added Support for variable windowed resolution.
vitiv <nikita.utiu@gmail.com>
parents: 8284
diff changeset
   778
    // mutually exclude window and fullscreen resolution
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
   779
    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
   780
}
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
   781
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
   782
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
   783
{
6525
6c97379c584b [GCI] backz task: unify the back button functionality, avoid using the save button
m4tx
parents: 6218
diff changeset
   784
    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
   785
}
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
   786
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
   787
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
   788
{
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   789
#ifdef VIDEOREC
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   790
    connect(checkUseGameRes, SIGNAL(stateChanged(int)), this, SLOT(changeUseGameRes(int)));
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   791
    connect(checkRecordAudio, SIGNAL(stateChanged(int)), this, SLOT(changeRecordAudio(int)));
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   792
    connect(comboAVFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAVFormat(int)));
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   793
    connect(btnDefaults, SIGNAL(clicked()), this, SLOT(setDefaultOptions()));
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   794
#endif
8386
2aaa2995a32e - Fix another ton of bugs and misbehavior
unc0rr
parents: 8384
diff changeset
   795
    //connect(this, SIGNAL(pageEnter()), this, SLOT(setTeamOptionsEnabled()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   796
    connect(SLVolume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   797
    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
   798
    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
   799
    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
   800
    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
   801
    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
   802
    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
   803
}
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
   804
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   805
void PageOptions::setVolume(int volume)
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   806
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   807
    lblVolumeLevel->setText(QString("%1\%").arg(volume));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   808
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   809
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   810
void PageOptions::setupTabPage(QWidget * tabpage, QVBoxLayout ** leftColumn, QVBoxLayout ** rightColumn)
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   811
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   812
    QHBoxLayout * twoColumns = new QHBoxLayout(tabpage);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   813
    twoColumns->setSpacing(0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   814
    *leftColumn = new QVBoxLayout();
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   815
    *rightColumn = new QVBoxLayout();
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   816
    (*leftColumn)->setSpacing(OPTION_BOX_SPACING);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   817
    (*rightColumn)->setSpacing(OPTION_BOX_SPACING);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   818
    twoColumns->addStretch(4);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   819
    twoColumns->addLayout(*leftColumn, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   820
    twoColumns->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   821
    twoColumns->addLayout(*rightColumn, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   822
    twoColumns->addStretch(4);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   823
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   824
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   825
PageOptions::PageOptions(QWidget* parent) : AbstractPage(parent), config(0)
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
   826
{
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
   827
    initPage();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   828
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   829
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   830
void PageOptions::forceFullscreen(int index)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   831
{
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   832
    bool forced = (index == 7 || index == 8 || index == 9);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   833
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   834
    if (index != 0)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   835
    {
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   836
        this->SLQuality->setValue(this->SLQuality->maximum());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   837
        this->SLQuality->setEnabled(false);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   838
        this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   839
        setFullscreen(forced ? true : previousFullscreenValue);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   840
        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
   841
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   842
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   843
    {
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   844
        this->SLQuality->setEnabled(true);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   845
        this->SLQuality->setValue(previousQuality);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   846
        this->CBFullscreen->setChecked(previousFullscreenValue);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   847
        setFullscreen(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
   848
        this->CBResolution->setCurrentIndex(previousResolutionIndex);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   849
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   850
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   851
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   852
void PageOptions::setQuality(int value)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   853
{
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
   854
    Q_UNUSED(value);
6217
ef53ba841791 - Remove some old unused code
unc0rr
parents: 6060
diff changeset
   855
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   856
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   857
    if (index == 0)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   858
        previousQuality = this->SLQuality->value();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   859
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   860
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   861
void PageOptions::setFullscreen(int state)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   862
{
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
   863
    Q_UNUSED(state);
8352
ab7f22530ae0 Changed resolution labels on options page.
vitiv <nikita.utiu@gmail.com>
parents: 8350
diff changeset
   864
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   865
    lblFullScreenRes->setVisible(state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   866
    CBResolution->setVisible(state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   867
    lblWinScreenRes->setVisible(!state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   868
    winResContainer->setVisible(!state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   869
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   870
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   871
    if (index != 7 && index != 8 && index != 9)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   872
        previousFullscreenValue = this->CBFullscreen->isChecked();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   873
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   874
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   875
void PageOptions::setResolution(int state)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   876
{
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
   877
    Q_UNUSED(state);
6217
ef53ba841791 - Remove some old unused code
unc0rr
parents: 6060
diff changeset
   878
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   879
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   880
    if (index != 7 && index != 8 && index != 9)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   881
        previousResolutionIndex = this->CBResolution->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   882
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   883
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   884
void PageOptions::trimNetNick()
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   885
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   886
    editNetNick->setText(editNetNick->text().trimmed());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   887
}
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   888
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   889
void PageOptions::savePwdChanged(int state) {
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   890
    if (state == 0) {
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   891
        editNetPassword->setEnabled(false);
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   892
        editNetPassword->setText("");
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   893
    } else
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   894
        editNetPassword->setEnabled(true);
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   895
}
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   896
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   897
void PageOptions::requestEditSelectedTeam()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   898
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   899
    emit editTeamRequested(CBTeamName->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   900
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   901
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   902
void PageOptions::requestDeleteSelectedTeam()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   903
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   904
    emit deleteTeamRequested(CBTeamName->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   905
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   906
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   907
void PageOptions::setTeamOptionsEnabled(bool enabled)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   908
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   909
    BtnNewTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   910
    BtnEditTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   911
    BtnDeleteTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   912
    CBTeamName->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   913
    LblNoEditTeam->setVisible(!enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   914
}
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   915
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   916
void PageOptions::colorButtonClicked(int i)
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   917
{
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   918
    if(i < 0 || i >= m_colorButtons.size())
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   919
        return;
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   920
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   921
    QPalette p = m_colorButtons[i]->palette();
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   922
    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
   923
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   924
    if(c.isValid())
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   925
    {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   926
        DataManager::instance().colorsModel()->item(i)->setData(c);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   927
        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
   928
    }
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   929
}
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   930
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   931
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
   932
{
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   933
    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
   934
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   935
    QStandardItemModel * model = DataManager::instance().colorsModel();
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   936
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   937
    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
   938
}
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   939
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   940
void PageOptions::onProxyTypeChanged()
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   941
{
7703
78d2ac987f41 Make sheepluva happy
unc0rr
parents: 7702
diff changeset
   942
    bool b = cbProxyType->currentIndex() != NoProxy && cbProxyType->currentIndex() != SystemProxy ;
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   943
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   944
    sbProxyPort->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   945
    leProxy->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   946
    leProxyLogin->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   947
    leProxyPassword->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   948
}
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   949
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   950
// Video Recording
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   951
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   952
void PageOptions::setConfig(GameUIConfig * config)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   953
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   954
    this->config = config;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   955
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   956
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   957
// user changed file format, we need to update list of codecs
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   958
void PageOptions::changeAVFormat(int index)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   959
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   960
    // remember selected codecs
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   961
    QString prevVCodec = videoCodec();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   962
    QString prevACodec = audioCodec();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   963
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   964
    // clear lists of codecs
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   965
    comboVideoCodecs->clear();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   966
    comboAudioCodecs->clear();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   967
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   968
    // get list of codecs for specified format
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   969
    LibavInteraction::instance().fillCodecs(comboAVFormats->itemData(index).toString(), comboVideoCodecs, comboAudioCodecs);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   970
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   971
    // disable audio if there is no audio codec
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   972
    if (comboAudioCodecs->count() == 0)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   973
    {
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   974
        checkRecordAudio->setChecked(false);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   975
        checkRecordAudio->setEnabled(false);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   976
    }
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   977
    else
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   978
        checkRecordAudio->setEnabled(true);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   979
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   980
    // restore selected codecs if possible
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   981
    int iVCodec = comboVideoCodecs->findData(prevVCodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   982
    if (iVCodec != -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   983
        comboVideoCodecs->setCurrentIndex(iVCodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   984
    int iACodec = comboAudioCodecs->findData(prevACodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   985
    if (iACodec != -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   986
        comboAudioCodecs->setCurrentIndex(iACodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   987
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   988
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   989
// user switched checkbox 'use game resolution'
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   990
void PageOptions::changeUseGameRes(int state)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   991
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   992
    if (state && config)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   993
    {
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   994
        // set resolution to game resolution
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   995
        QRect resolution = config->vid_Resolution();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   996
        widthEdit->setText(QString::number(resolution.width()));
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   997
        heightEdit->setText(QString::number(resolution.height()));
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   998
    }
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   999
    widthEdit->setEnabled(!state);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1000
    heightEdit->setEnabled(!state);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1001
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1002
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1003
// user switched checkbox 'record audio'
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1004
void PageOptions::changeRecordAudio(int state)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1005
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1006
    comboAudioCodecs->setEnabled(!!state);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1007
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1008
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1009
void PageOptions::setDefaultCodecs()
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1010
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1011
    // VLC should be able to handle any of these configurations
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1012
    // Quicktime X only opens the first one
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1013
    // Windows Media Player TODO
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1014
    if (tryCodecs("mp4", "libx264", "aac"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1015
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1016
    if (tryCodecs("mp4", "libx264", "libfaac"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1017
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1018
    if (tryCodecs("mp4", "libx264", "libmp3lame"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1019
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1020
    if (tryCodecs("mp4", "libx264", "mp2"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1021
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1022
    if (tryCodecs("avi", "libxvid", "libmp3lame"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1023
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1024
    if (tryCodecs("avi", "libxvid", "ac3_fixed"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1025
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1026
    if (tryCodecs("avi", "libxvid", "mp2"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1027
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1028
    if (tryCodecs("avi", "mpeg4", "libmp3lame"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1029
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1030
    if (tryCodecs("avi", "mpeg4", "ac3_fixed"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1031
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1032
    if (tryCodecs("avi", "mpeg4", "mp2"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1033
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1034
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1035
    // this shouldn't happen, just in case
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1036
    if (tryCodecs("ogg", "libtheora", "libvorbis"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1037
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1038
    tryCodecs("ogg", "libtheora", "flac");
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1039
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1040
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1041
void PageOptions::setDefaultOptions()
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1042
{
8192
81da6576b0c3 Make video recording options have fixed size and merge with spinbox->combobox change.
Mitchell Kember <mk12360@gmail.com>
parents: 8151
diff changeset
  1043
    framerateBox->setCurrentIndex(2);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1044
    bitrateBox->setValue(1000);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1045
    checkRecordAudio->setChecked(true);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1046
    checkUseGameRes->setChecked(true);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1047
    setDefaultCodecs();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1048
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1049
8284
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1050
void PageOptions::checkForUpdates()
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1051
{
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1052
    AutoUpdater *updater = NULL;
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1053
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1054
#ifdef __APPLE__
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1055
#ifdef SPARKLE_ENABLED
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1056
    updater = new SparkleAutoUpdater();
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1057
#endif
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1058
#endif
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1059
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1060
    if (updater)
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1061
    {
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1062
        updater->checkForUpdatesNow();
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1063
        delete updater;
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1064
    }
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1065
}
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1066
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1067
bool PageOptions::tryCodecs(const QString & format, const QString & vcodec, const QString & acodec)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1068
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1069
    // first we should change format
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1070
    int iFormat = comboAVFormats->findData(format);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1071
    if (iFormat == -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1072
        return false;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1073
    comboAVFormats->setCurrentIndex(iFormat);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1074
    // format was changed, so lists of codecs were automatically updated to codecs supported by this format
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1075
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1076
    // try to find video codec
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1077
    int iVCodec = comboVideoCodecs->findData(vcodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1078
    if (iVCodec == -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1079
        return false;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1080
    comboVideoCodecs->setCurrentIndex(iVCodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1081
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1082
    // try to find audio codec
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1083
    int iACodec = comboAudioCodecs->findData(acodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1084
    if (iACodec == -1 && checkRecordAudio->isChecked())
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1085
        return false;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1086
    if (iACodec != -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1087
        comboAudioCodecs->setCurrentIndex(iACodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1088
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1089
    return true;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1090
}
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1091
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1092
// When the current tab is switched
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1093
void PageOptions::tabIndexChanged(int index)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1094
{
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1095
    if (index == binderTab) // Switched to bind tab
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1096
    {
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1097
        binder->resetInterface();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1098
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1099
        if (!config) return;
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1100
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1101
        QStandardItemModel * binds = DataManager::instance().bindsModel();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1102
        for(int i = 0; i < BINDS_NUMBER; i++)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1103
        {
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1104
            QString value = config->bind(i);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1105
            QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, value, 1, Qt::MatchExactly);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1106
            if(mdl.size() == 1) binder->setBindIndex(i, mdl[0].row());
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1107
        }
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1108
    }
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1109
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1110
    currentTab = index;
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1111
}
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1112
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1113
// When a key bind combobox is changed
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1114
void PageOptions::bindUpdated(int bindID)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1115
{
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1116
    int bindIndex = binder->bindIndex(bindID);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
  1117
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1118
    if (bindIndex == 0) bindIndex = resetBindToDefault(bindID);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1119
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1120
    // Save bind
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1121
    QStandardItemModel * binds = DataManager::instance().bindsModel();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1122
    QString strbind = binds->index(binder->bindIndex(bindID), 0).data(Qt::UserRole + 1).toString();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1123
    config->setBind(bindID, strbind);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1124
}
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1125
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1126
// Changes a key bind (bindID) to its default value. This updates the bind's combo-box in the UI.
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1127
// Returns: The bind model index of the default.
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1128
int PageOptions::resetBindToDefault(int bindID)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1129
{
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1130
    QStandardItemModel * binds = DataManager::instance().bindsModel();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1131
    QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, cbinds[bindID].strbind, 1, Qt::MatchExactly);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1132
    if(mdl.size() == 1) binder->setBindIndex(bindID, mdl[0].row());
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1133
    return mdl[0].row();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1134
}
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1135
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1136
// Called when "reset all binds" button is pressed
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1137
void PageOptions::resetAllBinds()
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1138
{
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1139
    for (int i = 0; i < BINDS_NUMBER; i++)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1140
    {
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1141
        resetBindToDefault(i);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1142
        bindUpdated(i);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1143
    }
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1144
}