QTfrontend/ui/page/pageoptions.cpp
author Wuzzy <Wuzzy2@mail.ru>
Mon, 06 May 2019 23:03:16 +0200
changeset 14898 66b510a8b81c
parent 14857 56293aa24e81
child 14904 4d5df8d35a95
permissions -rw-r--r--
Pas2C: Fix path concatenation in uVideoRec
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
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10108
diff changeset
     3
 * Copyright (c) 2004-2015 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
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 10017
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
5078
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>
12246
0b5aa545e058 Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents: 12245
diff changeset
    35
#include <QMessageBox>
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    36
#include <QStandardItemModel>
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    37
#include <QDebug>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    38
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5078
diff changeset
    39
#include "pageoptions.h"
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
    40
#include "gameuiconfig.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    41
#include "hwconsts.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    42
#include "fpsedit.h"
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    43
#include "DataManager.h"
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
    44
#include "LibavInteraction.h"
8284
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    45
#include "AutoUpdater.h"
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    46
#include "HWApplication.h"
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    47
#include "keybinder.h"
8284
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    48
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    49
#ifdef __APPLE__
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    50
#ifdef SPARKLE_ENABLED
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    51
#include "SparkleAutoUpdater.h"
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    52
#endif
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
    53
#endif
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    54
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    55
const int OPTION_BOX_SPACING = 10;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    56
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    57
OptionGroupBox::OptionGroupBox(const QString & iconName,
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    58
                               const QString & title,
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    59
                               QWidget * parent) : IconedGroupBox(parent)
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    60
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    61
    setIcon(QIcon(iconName));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    62
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    63
    setTitle(title);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    64
    setMinimumWidth(300);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    65
    m_layout = new QGridLayout(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    66
    m_layout->setColumnStretch(0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    67
    m_layout->setColumnStretch(1, 1);
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
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    70
QGridLayout * OptionGroupBox::layout()
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    71
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    72
    return m_layout;
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
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    75
void OptionGroupBox::addDivider()
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    76
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    77
    QFrame * hr = new QFrame(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    78
    hr->setFrameStyle(QFrame::HLine);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    79
    hr->setLineWidth(3);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    80
    hr->setFixedHeight(10);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    81
    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
    82
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    83
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
    84
// 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
    85
QLayout * PageOptions::bodyLayoutDefinition()
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    86
{
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    87
    QVBoxLayout * pageLayout = new QVBoxLayout();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    88
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    89
    QTabWidget * tabs = new QTabWidget(this);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
    90
    pageLayout->addWidget(tabs);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    91
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    92
    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
    93
    connect(binder, SIGNAL(bindUpdate(int)), this, SLOT(bindUpdated(int)));
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
    94
    connect(binder, SIGNAL(resetAllBinds()), this, SLOT(resetAllBinds()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    95
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    96
    QWidget * pageGame = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    97
    tabs->addTab(pageGame, tr("Game"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    98
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
    99
    QWidget * pageGraphics = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   100
    tabs->addTab(pageGraphics, tr("Graphics"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   101
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   102
    QWidget * pageAudio = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   103
    tabs->addTab(pageAudio, tr("Audio"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   104
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
   105
    binderTab = tabs->addTab(binder, tr("Controls"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   106
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   107
#ifdef VIDEOREC
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   108
    QWidget * pageVideoRec = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   109
    tabs->addTab(pageVideoRec, tr("Video Recording"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   110
#endif
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   111
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   112
    QWidget * pageNetwork = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   113
    tabs->addTab(pageNetwork, tr("Network"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   114
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   115
    QWidget * pageAdvanced = new QWidget(this);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   116
    tabs->addTab(pageAdvanced, tr("Advanced"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   117
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
   118
    connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged(int)));
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
   119
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   120
    QPixmap pmNew(":/res/new.png");
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   121
    QPixmap pmEdit(":/res/edit.png");
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   122
    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
   123
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   124
    { // game page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   125
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   126
        setupTabPage(pageGame, &leftColumn, &rightColumn);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   127
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   128
        { // group: Teams
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   129
            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
   130
            groupTeams->setMinimumWidth(400);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   131
            rightColumn->addWidget(groupTeams);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   132
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   133
            groupTeams->layout()->setColumnStretch(0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   134
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   135
            CBTeamName = new QComboBox(groupTeams);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   136
            CBTeamName->setMaxVisibleItems(50);
13232
26c739440bef Some padding tweaks in options and team editor pages. Fixes insane width of context menu of hog name line edit
Wuzzy <Wuzzy2@mail.ru>
parents: 13207
diff changeset
   137
            CBTeamName->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   138
            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
   139
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   140
            BtnNewTeam = new QPushButton(groupTeams);
8382
67e257b98422 GCI2012: No More Hovering
dag10
parents: 8359
diff changeset
   141
            BtnNewTeam->setWhatsThis(tr("New team"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   142
            BtnNewTeam->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   143
            BtnNewTeam->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   144
            BtnNewTeam->setMaximumWidth(pmNew.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   145
            BtnNewTeam->setStyleSheet("padding: 0px;");
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   146
            connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   147
            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
   148
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   149
            BtnEditTeam = new QPushButton(groupTeams);
8382
67e257b98422 GCI2012: No More Hovering
dag10
parents: 8359
diff changeset
   150
            BtnEditTeam->setWhatsThis(tr("Edit team"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   151
            BtnEditTeam->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   152
            BtnEditTeam->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   153
            BtnEditTeam->setMaximumWidth(pmEdit.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   154
            BtnEditTeam->setStyleSheet("padding: 0px;");
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   155
            connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   156
            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
   157
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   158
            BtnDeleteTeam = new QPushButton(groupTeams);
8382
67e257b98422 GCI2012: No More Hovering
dag10
parents: 8359
diff changeset
   159
            BtnDeleteTeam->setWhatsThis(tr("Delete team"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   160
            BtnDeleteTeam->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   161
            BtnDeleteTeam->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   162
            BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   163
            BtnDeleteTeam->setStyleSheet("padding: 0px;");
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   164
            connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   165
            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
   166
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   167
            LblNoEditTeam = new QLabel(groupTeams);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   168
            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
   169
            LblNoEditTeam->setWordWrap(true);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   170
            LblNoEditTeam->setVisible(false);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   171
            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
   172
        }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   173
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   174
        { // group: schemes
12486
37bcd4ef9242 Change game scheme icon in options menu
Wuzzy <almikes@aol.com>
parents: 12485
diff changeset
   175
            OptionGroupBox * groupSchemes = new OptionGroupBox(":/res/schemeicon.png", tr("Schemes"), this);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   176
            leftColumn->addWidget(groupSchemes);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   177
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   178
            groupSchemes->layout()->setColumnStretch(0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   179
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   180
            SchemesName = new QComboBox(groupSchemes);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   181
            SchemesName->setMaxVisibleItems(50);
13232
26c739440bef Some padding tweaks in options and team editor pages. Fixes insane width of context menu of hog name line edit
Wuzzy <Wuzzy2@mail.ru>
parents: 13207
diff changeset
   182
            SchemesName->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   183
            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
   184
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   185
            SchemeNew = new QPushButton(groupSchemes);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   186
            SchemeNew->setWhatsThis(tr("New scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   187
            SchemeNew->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   188
            SchemeNew->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   189
            SchemeNew->setMaximumWidth(pmNew.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   190
            SchemeNew->setStyleSheet("padding: 0px;");
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   191
            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
   192
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   193
            SchemeEdit = new QPushButton(groupSchemes);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   194
            SchemeEdit->setWhatsThis(tr("Edit scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   195
            SchemeEdit->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   196
            SchemeEdit->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   197
            SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   198
            SchemeEdit->setStyleSheet("padding: 0px;");
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   199
            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
   200
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   201
            SchemeDelete = new QPushButton(groupSchemes);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   202
            SchemeDelete->setWhatsThis(tr("Delete scheme"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   203
            SchemeDelete->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   204
            SchemeDelete->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   205
            SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   206
            SchemeDelete->setStyleSheet("padding: 0px;");
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   207
            groupSchemes->layout()->addWidget(SchemeDelete, 0, 3);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   208
        }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   209
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   210
        { // group: weapons
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   211
            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
   212
            leftColumn->addWidget(groupWeapons);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   213
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   214
            groupWeapons->layout()->setColumnStretch(0, 1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   215
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   216
            WeaponsName = new QComboBox(groupWeapons);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   217
            WeaponsName->setMaxVisibleItems(50);
13232
26c739440bef Some padding tweaks in options and team editor pages. Fixes insane width of context menu of hog name line edit
Wuzzy <Wuzzy2@mail.ru>
parents: 13207
diff changeset
   218
            WeaponsName->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   219
            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
   220
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   221
            WeaponNew = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   222
            WeaponNew->setWhatsThis(tr("New weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   223
            WeaponNew->setIconSize(pmNew.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   224
            WeaponNew->setIcon(pmNew);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   225
            WeaponNew->setMaximumWidth(pmNew.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   226
            WeaponNew->setStyleSheet("padding: 0px;");
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   227
            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
   228
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   229
            WeaponEdit = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   230
            WeaponEdit->setWhatsThis(tr("Edit weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   231
            WeaponEdit->setIconSize(pmEdit.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   232
            WeaponEdit->setIcon(pmEdit);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   233
            WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   234
            WeaponEdit->setStyleSheet("padding: 0px;");
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   235
            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
   236
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   237
            WeaponDelete = new QPushButton(groupWeapons);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   238
            WeaponDelete->setWhatsThis(tr("Delete weapon set"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   239
            WeaponDelete->setIconSize(pmDelete.size());
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   240
            WeaponDelete->setIcon(pmDelete);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   241
            WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
14556
1c623169a44d Frontend: Increase padding of small push buttons
Wuzzy <Wuzzy2@mail.ru>
parents: 14284
diff changeset
   242
            WeaponDelete->setStyleSheet("padding: 0px;");
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   243
            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
   244
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   245
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   246
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   247
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   248
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   249
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   250
    { // graphics page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   251
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   252
        setupTabPage(pageGraphics, &leftColumn, &rightColumn);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   253
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   254
        { // group: game
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   255
            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
   256
            leftColumn->addWidget(groupGame);
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
            groupGame->layout()->setColumnStretch(0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   259
            groupGame->layout()->setColumnStretch(1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   260
            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
   261
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   262
            // Fullscreen
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   263
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   264
            CBFullscreen = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   265
            groupGame->layout()->addWidget(CBFullscreen, 0, 0, 1, 2);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   266
            CBFullscreen->setText(QLabel::tr("Fullscreen"));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   267
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   268
            // Fullscreen resolution
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   269
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   270
            lblFullScreenRes = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   271
            lblFullScreenRes->setText(QLabel::tr("Fullscreen Resolution"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   272
            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
   273
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   274
            CBResolution = new QComboBox(groupGame);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   275
            CBResolution->setMaxVisibleItems(50);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   276
            CBResolution->setFixedWidth(200);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   277
            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
   278
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   279
            // Windowed resolution
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   280
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   281
            lblWinScreenRes = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   282
            lblWinScreenRes->setText(QLabel::tr("Windowed Resolution"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   283
            groupGame->layout()->addWidget(lblWinScreenRes, 2, 0);
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
            winResContainer = new QWidget();
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   286
            QHBoxLayout * winResLayout = new QHBoxLayout(winResContainer);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   287
            winResLayout->setSpacing(0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   288
            groupGame->layout()->addWidget(winResContainer, 2, 1);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   289
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   290
            QLabel *winLabelX = new QLabel(groupGame);
12637
888032b2fda4 Make multipy sign in QTfrondend translatable and update hedgewars_en.ts
Wuzzy <almikes@aol.com>
parents: 12486
diff changeset
   291
            //: Multiplication sign, to be used between two numbers. Note the “x” is only a dummy character, we recommend to use “×” if your language permits it
888032b2fda4 Make multipy sign in QTfrondend translatable and update hedgewars_en.ts
Wuzzy <almikes@aol.com>
parents: 12486
diff changeset
   292
            winLabelX->setText(tr("x"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   293
            winLabelX->setFixedWidth(40);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   294
            winLabelX->setAlignment(Qt::AlignCenter);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   295
8902
a94c074fd483 fix for issue 599: "Change graphics size settings to use qspinbox"? somebody ask unC0Rr if that's what he wanted :p
sheepluva
parents: 8434
diff changeset
   296
            // TODO: less random max. also:
a94c074fd483 fix for issue 599: "Change graphics size settings to use qspinbox"? somebody ask unC0Rr if that's what he wanted :p
sheepluva
parents: 8434
diff changeset
   297
            // make some min/max-consts, shared with engine?
a94c074fd483 fix for issue 599: "Change graphics size settings to use qspinbox"? somebody ask unC0Rr if that's what he wanted :p
sheepluva
parents: 8434
diff changeset
   298
            windowWidthEdit = new QSpinBox(groupGame);
a94c074fd483 fix for issue 599: "Change graphics size settings to use qspinbox"? somebody ask unC0Rr if that's what he wanted :p
sheepluva
parents: 8434
diff changeset
   299
            windowWidthEdit->setRange(640, 102400);
9249
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   300
            windowWidthEdit->setFixedSize(60, CBResolution->height());
8902
a94c074fd483 fix for issue 599: "Change graphics size settings to use qspinbox"? somebody ask unC0Rr if that's what he wanted :p
sheepluva
parents: 8434
diff changeset
   301
            windowHeightEdit = new QSpinBox(groupGame);
a94c074fd483 fix for issue 599: "Change graphics size settings to use qspinbox"? somebody ask unC0Rr if that's what he wanted :p
sheepluva
parents: 8434
diff changeset
   302
            windowHeightEdit->setRange(480, 102400);
9249
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   303
            windowHeightEdit->setFixedSize(60, CBResolution->height());
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   304
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   305
            winResLayout->addWidget(windowWidthEdit, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   306
            winResLayout->addWidget(winLabelX, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   307
            winResLayout->addWidget(windowHeightEdit, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   308
            winResLayout->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   309
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   310
            // Quality
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   311
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   312
            QLabel * lblQuality = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   313
            lblQuality->setText(QLabel::tr("Quality"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   314
            lblQuality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   315
            groupGame->layout()->addWidget(lblQuality, 3, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   316
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   317
            SLQuality = new QSlider(Qt::Horizontal, groupGame);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   318
            SLQuality->setTickPosition(QSlider::TicksBelow);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   319
            SLQuality->setMaximum(5);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   320
            SLQuality->setMinimum(0);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   321
            SLQuality->setFixedWidth(150);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   322
            groupGame->layout()->addWidget(SLQuality, 3, 1, Qt::AlignLeft);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   323
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   324
            // Zoom
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   325
            QLabel * lblZoom = new QLabel(groupGame);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   326
            lblZoom->setText(QLabel::tr("Zoom (%)"));
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   327
            lblZoom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   328
            groupGame->layout()->addWidget(lblZoom, 4, 0);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   329
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   330
            SLZoom = new QSpinBox(groupGame);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   331
            SLZoom->setSingleStep(5);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   332
            SLZoom->setMaximum(150);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   333
            SLZoom->setMinimum(50);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   334
            groupGame->layout()->addWidget(SLZoom, 4, 1, Qt::AlignLeft);
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   335
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   336
            // Stereo spacing
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   337
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   338
            QLabel * lblStereo = new QLabel(groupGame);
12245
88b31fdc760b Add a few WhatsThis texts in frontend, rename “Stereo rendering” to “Stereoscopy”
Wuzzy <almikes@aol.com>
parents: 12244
diff changeset
   339
            lblStereo->setText(QLabel::tr("Stereoscopy"));
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   340
            groupGame->layout()->addWidget(lblStereo, 5, 0);
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   341
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   342
            CBStereoMode = new QComboBox(groupGame);
12245
88b31fdc760b Add a few WhatsThis texts in frontend, rename “Stereo rendering” to “Stereoscopy”
Wuzzy <almikes@aol.com>
parents: 12244
diff changeset
   343
            CBStereoMode->setWhatsThis(QComboBox::tr("Stereoscopy creates an illusion of depth when you wear 3D glasses."));
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   344
            CBStereoMode->setMaxVisibleItems(50);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   345
            CBStereoMode->addItem(QComboBox::tr("Disabled"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   346
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   347
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   348
            CBStereoMode->addItem(QComboBox::tr("Red/Blue"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   349
            CBStereoMode->addItem(QComboBox::tr("Blue/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   350
            CBStereoMode->addItem(QComboBox::tr("Red/Green"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   351
            CBStereoMode->addItem(QComboBox::tr("Green/Red"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   352
            CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   353
            CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   354
            CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   355
            CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   356
            CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale"));
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   357
            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
   358
            CBStereoMode->addItem(QComboBox::tr("Side-by-side"));
9a7024b2a4d3 Removed wiggle 3D mode, reorder the list of 3D modes.
martin_bede
parents: 8356
diff changeset
   359
            CBStereoMode->addItem(QComboBox::tr("Top-Bottom"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   360
            CBStereoMode->setFixedWidth(CBResolution->width());
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   361
            groupGame->layout()->addWidget(CBStereoMode, 5, 1);
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
            // Divider
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   364
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   365
            groupGame->addDivider(); // row 6
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   366
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   367
            // FPS limit
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   368
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   369
            QHBoxLayout * fpsLayout = new QHBoxLayout();
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   370
            groupGame->layout()->addLayout(fpsLayout, 7, 0, 1, 2);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   371
            QLabel * maxfps = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   372
            maxfps->setText(QLabel::tr("FPS limit"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   373
            fpsLayout->addWidget(maxfps);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   374
            fpsLayout->addSpacing(30);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   375
            fpsedit = new FPSEdit(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   376
            fpsLayout->addWidget(fpsedit);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   377
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   378
            // Show FPS
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   379
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   380
            CBShowFPS = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   381
            CBShowFPS->setText(QCheckBox::tr("Show FPS"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   382
            fpsLayout->addWidget(CBShowFPS);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   383
            fpsLayout->addStretch(1);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   384
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   385
            // Divider
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   386
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   387
            groupGame->addDivider(); // row 8
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   388
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   389
            // Alternative damage show
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   390
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   391
            CBAltDamage = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   392
            CBAltDamage->setText(QCheckBox::tr("Alternative damage show"));
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   393
            groupGame->layout()->addWidget(CBAltDamage, 9, 0, 1, 2);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   394
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   395
            // Show ammo menu tooltips
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   396
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   397
            WeaponTooltip = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   398
            WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   399
            groupGame->layout()->addWidget(WeaponTooltip, 10, 0, 1, 2);
9249
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   400
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   401
            groupGame->addDivider();
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   402
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   403
            lblTags = new QLabel(groupGame);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   404
            lblTags->setText(QLabel::tr("Displayed tags above hogs and translucent tags"));
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   405
            groupGame->layout()->addWidget(lblTags, 12, 0, 1, 2);
9249
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   406
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   407
            tagsContainer = new QWidget();
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   408
            QHBoxLayout * tagsLayout = new QHBoxLayout(tagsContainer);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   409
            tagsLayout->setSpacing(0);
14682
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14556
diff changeset
   410
            groupGame->layout()->addWidget(tagsContainer, 13, 0, 1, 2);
9249
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   411
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   412
            CBTeamTag = new QCheckBox(groupGame);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   413
            CBTeamTag->setText(QCheckBox::tr("Team"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   414
            CBTeamTag->setWhatsThis(QCheckBox::tr("Enable team tags by default"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   415
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   416
            CBHogTag = new QCheckBox(groupGame);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   417
            CBHogTag->setText(QCheckBox::tr("Hog"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   418
            CBHogTag->setWhatsThis(QCheckBox::tr("Enable hedgehog tags by default"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   419
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   420
            CBHealthTag = new QCheckBox(groupGame);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   421
            CBHealthTag->setText(QCheckBox::tr("Health"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   422
            CBHealthTag->setWhatsThis(QCheckBox::tr("Enable health tags by default"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   423
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   424
            CBTagOpacity = new QCheckBox(groupGame);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   425
            CBTagOpacity->setText(QCheckBox::tr("Translucent"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   426
            CBTagOpacity->setWhatsThis(QCheckBox::tr("Enable translucent tags by default"));
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   427
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   428
            tagsLayout->addWidget(CBTeamTag, 0);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   429
            tagsLayout->addWidget(CBHogTag, 0);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   430
            tagsLayout->addWidget(CBHealthTag, 0);
7b8c82785145 Configuration for tag display default
nemo
parents: 9080
diff changeset
   431
            tagsLayout->addWidget(CBTagOpacity, 0);
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 9998
diff changeset
   432
            tagsLayout->addStretch(1);
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
   433
        }
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   434
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   435
        { // group: frontend
12483
3ed556dad4ec Change icon for frontend group box in options menu
Wuzzy <almikes@aol.com>
parents: 12264
diff changeset
   436
            OptionGroupBox * groupFrontend = new OptionGroupBox(":/res/frontendicon.png", tr("Frontend"), this);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   437
            rightColumn->addWidget(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   438
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   439
            // Fullscreen
7678
8aabba680598 Polish settings page a bit
unc0rr
parents: 7630
diff changeset
   440
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   441
            CBFrontendFullscreen = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   442
            CBFrontendFullscreen->setText(QCheckBox::tr("Fullscreen"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   443
            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
   444
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   445
            // Visual effects
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   446
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   447
            CBFrontendEffects = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   448
            CBFrontendEffects->setText(QCheckBox::tr("Visual effects"));
12245
88b31fdc760b Add a few WhatsThis texts in frontend, rename “Stereo rendering” to “Stereoscopy”
Wuzzy <almikes@aol.com>
parents: 12244
diff changeset
   449
            CBFrontendEffects->setWhatsThis(QCheckBox::tr("Enable visual effects such as animated menu transitions and falling stars"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   450
            groupFrontend->layout()->addWidget(CBFrontendEffects, 1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   451
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   452
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   453
        { // group: colors
12256
caff1a3a7456 Use palette icon for user color settings group box
Wuzzy <almikes@aol.com>
parents: 12246
diff changeset
   454
            OptionGroupBox * groupColors = new OptionGroupBox(":/res/Palette.png", tr("Custom colors"), this);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   455
            rightColumn->addWidget(groupColors);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   456
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   457
            groupColors->layout()->setColumnStretch(0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   458
            groupColors->layout()->setColumnStretch(1, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   459
            groupColors->layout()->setColumnStretch(2, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   460
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   461
            // Color buttons
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   462
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   463
            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
   464
            QStandardItemModel * model = DataManager::instance().colorsModel();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   465
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   466
            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
   467
            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
   468
            {
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   469
                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
   470
                btn->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   471
                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
   472
                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
   473
                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
   474
                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
   475
                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
   476
            }
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   477
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   478
            connect(mapper, SIGNAL(mapped(int)), this, SLOT(colorButtonClicked(int)));
7680
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   479
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   480
            // Reset default colors
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   481
7680
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   482
            QPushButton * btn = new QPushButton(this);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   483
            groupColors->layout()->addWidget(btn, (model->rowCount() - 1) / 3 + 1, 0, 1, 3);
7680
46a91cbed8db - Some improvements to tr() calls
unc0rr
parents: 7678
diff changeset
   484
            btn->setText(tr("Reset to default colors"));
7681
26978d581070 Reset to default colors button
unc0rr
parents: 7680
diff changeset
   485
            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
   486
        }
7153
f0d055645ab2 minor tweaks for options page; should improve readability at small window size... a bit...
sheepluva
parents: 6952
diff changeset
   487
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   488
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   489
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   490
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   491
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   492
    { // audio page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   493
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   494
        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
   495
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   496
        { // group: game
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   497
            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
   498
            leftColumn->addWidget(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   499
            groupGame->layout()->setColumnStretch(1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   500
            groupGame->layout()->setColumnStretch(2, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   501
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   502
            // Initial sound volume
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
            QLabel * vol = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   505
            vol->setText(QLabel::tr("Initial sound volume"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   506
            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
   507
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   508
            SLVolume = new QSlider(Qt::Horizontal, groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   509
            SLVolume->setTickPosition(QSlider::TicksBelow);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   510
            SLVolume->setMaximum(100);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   511
            SLVolume->setMinimum(0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   512
            SLVolume->setFixedWidth(150);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   513
            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
   514
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   515
            lblVolumeLevel = new QLabel(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   516
            lblVolumeLevel->setFixedWidth(40);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   517
            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
   518
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   519
            // 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
   520
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   521
            CBSound = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   522
            CBSound->setText(QCheckBox::tr("Sound"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   523
            CBSound->setWhatsThis(QCheckBox::tr("In-game sound effects"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   524
            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
   525
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   526
            // 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
   527
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   528
            CBMusic = new QCheckBox(groupGame);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   529
            CBMusic->setText(QCheckBox::tr("Music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   530
            CBMusic->setWhatsThis(QCheckBox::tr("In-game music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   531
            groupGame->layout()->addWidget(CBMusic, 1, 2, 1, 2, Qt::AlignLeft);
13633
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 13232
diff changeset
   532
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 13232
diff changeset
   533
            // Dampen
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 13232
diff changeset
   534
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 13232
diff changeset
   535
            CBDampenAudio = new QCheckBox(groupGame);
13681
05fde8e30041 Add a few translator comments for frontend strings
Wuzzy <Wuzzy2@mail.ru>
parents: 13633
diff changeset
   536
            //: Checkbox text. If checked, the in-game audio volume is reduced (=dampened) when the game window loses its focus
13633
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 13232
diff changeset
   537
            CBDampenAudio->setText(QCheckBox::tr("Dampen when losing focus"));
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 13232
diff changeset
   538
            CBDampenAudio->setWhatsThis(QCheckBox::tr("Reduce the game audio volume if the game window has lost its focus"));
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 13232
diff changeset
   539
            groupGame->layout()->addWidget(CBDampenAudio, 2, 1, 1, 3, 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
   540
        }
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
   541
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   542
        { // group: frontend
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   543
            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
   544
            rightColumn->addWidget(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   545
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   546
            CBFrontendSound = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   547
            CBFrontendSound->setText(QCheckBox::tr("Sound"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   548
            CBFrontendSound->setWhatsThis(QCheckBox::tr("Frontend sound effects"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   549
            groupFrontend->layout()->addWidget(CBFrontendSound, 0, 0);
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
            CBFrontendMusic = new QCheckBox(groupFrontend);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   552
            CBFrontendMusic->setText(QCheckBox::tr("Music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   553
            CBFrontendMusic->setWhatsThis(QCheckBox::tr("Frontend music"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   554
            groupFrontend->layout()->addWidget(CBFrontendMusic, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   555
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   556
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   557
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   558
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   559
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   560
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   561
    { // network page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   562
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   563
        setupTabPage(pageNetwork, &leftColumn, &rightColumn);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   564
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   565
        { // group: account
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   566
            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
   567
            leftColumn->addWidget(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   568
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   569
            // Label and field for net nick
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
            labelNN = new QLabel(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   572
            labelNN->setText(QLabel::tr("Nickname"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   573
            groupAccount->layout()->addWidget(labelNN, 0, 0);
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
            editNetNick = new QLineEdit(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   576
            editNetNick->setMaxLength(20);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   577
            editNetNick->setText(QLineEdit::tr("anonymous"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   578
            groupAccount->layout()->addWidget(editNetNick, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   579
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   580
            // Checkbox and field for password
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   581
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   582
            CBSavePassword = new QCheckBox(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   583
            CBSavePassword->setText(QCheckBox::tr("Save password"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   584
            groupAccount->layout()->addWidget(CBSavePassword, 1, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   585
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   586
            editNetPassword = new QLineEdit(groupAccount);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   587
            editNetPassword->setEchoMode(QLineEdit::Password);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   588
            groupAccount->layout()->addWidget(editNetPassword, 1, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   589
        }
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
        { // group: proxy
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   592
            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
   593
            rightColumn->addWidget(groupProxy);
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
            // Labels
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   596
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   597
            QStringList sl;
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   598
            sl << tr("Proxy host")
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   599
               << tr("Proxy port")
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   600
               << tr("Proxy login")
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   601
               << tr("Proxy password");
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   602
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   603
            for(int i = 0; i < sl.size(); ++i)
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   604
            {
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   605
                QLabel * l = new QLabel(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   606
                l->setText(sl[i]);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   607
                groupProxy->layout()->addWidget(l, i + 1, 0);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   608
            }
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   609
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   610
            // Proxy type
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
            cbProxyType = new QComboBox(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   613
            cbProxyType->addItems(QStringList()
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   614
                                  << tr("No proxy")
7702
c8906c3a2aeb Allow using system proxy settings
unc0rr
parents: 7701
diff changeset
   615
                                  << tr("System proxy settings")
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   616
                                  << tr("Socks5 proxy")
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   617
                                  << tr("HTTP proxy"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   618
            groupProxy->layout()->addWidget(cbProxyType, 0, 0, 1, 2);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   619
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   620
            // Proxy
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   621
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   622
            leProxy = new QLineEdit(groupProxy);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   623
            groupProxy->layout()->addWidget(leProxy, 1, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   624
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   625
            // Proxy
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
            sbProxyPort = new QSpinBox(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   628
            sbProxyPort->setMaximum(65535);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   629
            groupProxy->layout()->addWidget(sbProxyPort, 2, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   630
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   631
            leProxyLogin = new QLineEdit(groupProxy);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   632
            groupProxy->layout()->addWidget(leProxyLogin, 3, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   633
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   634
            leProxyPassword = new QLineEdit(groupProxy);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   635
            leProxyPassword->setEchoMode(QLineEdit::Password);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   636
            groupProxy->layout()->addWidget(leProxyPassword, 4, 1);
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   637
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   638
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   639
            connect(cbProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged()));
7701
2b9017ffc72f - Small fix
unc0rr
parents: 7700
diff changeset
   640
            onProxyTypeChanged();
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   641
        }
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
   642
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   643
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   644
        rightColumn->addStretch(1);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   645
    }
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   646
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   647
    { // advanced page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   648
        QVBoxLayout * leftColumn, * rightColumn;
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   649
        setupTabPage(pageAdvanced, &leftColumn, &rightColumn);
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
        { // group: miscellaneous
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   652
            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
   653
            leftColumn->addWidget(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   654
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   655
            // Language
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
            QLabel *labelLanguage = new QLabel(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   658
            labelLanguage->setText(QLabel::tr("Locale"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   659
            groupMisc->layout()->addWidget(labelLanguage, 0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   660
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   661
            CBLanguage = new QComboBox(groupMisc);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   662
            CBLanguage->setMaxVisibleItems(50);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   663
            groupMisc->layout()->addWidget(CBLanguage, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   664
            QStringList locs = DataManager::instance().entryList("Locale", QDir::Files, QStringList("hedgewars_*.qm"));
12165
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   665
            QStringList langnames;
9048
c58a9829e1cc Store suffix of .qm files instead of locale name
unc0rr
parents: 8924
diff changeset
   666
            CBLanguage->addItem(QComboBox::tr("(System default)"), QString());
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   667
            for(int i = 0; i < locs.count(); i++)
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   668
            {
9048
c58a9829e1cc Store suffix of .qm files instead of locale name
unc0rr
parents: 8924
diff changeset
   669
                QString lname = locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1");
12165
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   670
                QLocale loc = QLocale(lname);
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   671
                QString entryName;
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   672
                // If local identifier has underscore, it means the country has been specified
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   673
                if(lname.contains("_"))
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   674
                {
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   675
                    // Append country name for disambiguation
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   676
                    // FIXME: These brackets are hardcoded and can't be translated. Luckily, these are rarely used and work with most languages anyway
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   677
                    entryName = loc.nativeLanguageName() + " (" + loc.nativeCountryName() + ")";
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   678
                }
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   679
                else
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   680
                {
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   681
                    // Usually, we just print the language name
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   682
                    entryName = loc.nativeLanguageName();
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   683
                }
12185
7df59356471e Fix name Scottish Gaelic being incorrectly displayed in language dropdown
Wuzzy <almikes@aol.com>
parents: 12165
diff changeset
   684
                // Fallback code, if language name is empty for some reason. This should normally not happen
12165
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   685
                if(entryName.isEmpty())
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   686
                {
13199
290815bbd4e1 Remove old Qt4 workaround for missing language name of Scottish Gaelic
Wuzzy <Wuzzy2@mail.ru>
parents: 13198
diff changeset
   687
                    // Show error and the locale identifier
14284
20b08e59730d Add a few translator comments to some not-so-obvious strings
Wuzzy <Wuzzy2@mail.ru>
parents: 13681
diff changeset
   688
                    //: In the case of an error, this is shown in the language selection for a language with unknown name. %1 = language code
13199
290815bbd4e1 Remove old Qt4 workaround for missing language name of Scottish Gaelic
Wuzzy <Wuzzy2@mail.ru>
parents: 13198
diff changeset
   689
                    entryName = tr("MISSING LANGUAGE NAME [%1]").arg(lname);
12165
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   690
                }
1c3670021559 Display native language names in language combo box instead of always English
Wuzzy <almikes@aol.com>
parents: 11679
diff changeset
   691
                CBLanguage->addItem(entryName, lname);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   692
            }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   693
8880
71ed64b18540 reintroduce the notice for restarting frontend after changing language
koda
parents: 8434
diff changeset
   694
            QLabel *restartNoticeLabel = new QLabel(groupMisc);
71ed64b18540 reintroduce the notice for restarting frontend after changing language
koda
parents: 8434
diff changeset
   695
            restartNoticeLabel->setText(QLabel::tr("This setting will be effective at next restart."));
71ed64b18540 reintroduce the notice for restarting frontend after changing language
koda
parents: 8434
diff changeset
   696
            groupMisc->layout()->addWidget(restartNoticeLabel, 1, 1);
71ed64b18540 reintroduce the notice for restarting frontend after changing language
koda
parents: 8434
diff changeset
   697
71ed64b18540 reintroduce the notice for restarting frontend after changing language
koda
parents: 8434
diff changeset
   698
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   699
            // Divider
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   700
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   701
            groupMisc->addDivider(); // row 1
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   702
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   703
            // Append date and time to record file name
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   704
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   705
            CBNameWithDate = new QCheckBox(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   706
            CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
12264
be68823c2852 Fix broken "whats this" help in misc options tab
Wuzzy <almikes@aol.com>
parents: 12256
diff changeset
   707
            CBNameWithDate->setWhatsThis(QCheckBox::tr("If enabled, Hedgewars adds the date and time in the form \"YYYY-MM-DD_hh-mm\" for automatically created demos."));
8880
71ed64b18540 reintroduce the notice for restarting frontend after changing language
koda
parents: 8434
diff changeset
   708
            groupMisc->layout()->addWidget(CBNameWithDate, 3, 0, 1, 2);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   709
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   710
            // Associate file extensions
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   711
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   712
            BtnAssociateFiles = new QPushButton(groupMisc);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   713
            BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   714
            BtnAssociateFiles->setVisible(!custom_data && !custom_config);
8880
71ed64b18540 reintroduce the notice for restarting frontend after changing language
koda
parents: 8434
diff changeset
   715
            groupMisc->layout()->addWidget(BtnAssociateFiles, 4, 0, 1, 2);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   716
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   717
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   718
#ifdef __APPLE__
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   719
#ifdef SPARKLE_ENABLED
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   720
        { // group: updates
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   721
            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
   722
            rightColumn->addWidget(groupUpdates);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   723
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   724
            // Check for updates at startup
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   725
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   726
            CBAutoUpdate = new QCheckBox(groupUpdates);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   727
            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
   728
            groupUpdates->layout()->addWidget(CBAutoUpdate, 0, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   729
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   730
            // Check for updates now
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   731
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   732
            btnUpdateNow = new QPushButton(groupUpdates);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   733
            connect(btnUpdateNow, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   734
            btnUpdateNow->setWhatsThis(tr("Check for updates"));
12485
f29a1c645cf1 Make string “Check now” in Apple build translatable
Wuzzy <almikes@aol.com>
parents: 12483
diff changeset
   735
            btnUpdateNow->setText(tr("Check now"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   736
            btnUpdateNow->setFixedSize(130, 30);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   737
            groupUpdates->layout()->addWidget(btnUpdateNow, 0, 1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   738
        }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   739
#endif
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   740
#endif
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   741
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   742
        leftColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   743
        rightColumn->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   744
    }
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   745
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   746
#ifdef VIDEOREC
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   747
    { // video recording page
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   748
        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
   749
        groupVideoRec->setMinimumWidth(500);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   750
        groupVideoRec->setMaximumWidth(650);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   751
        QHBoxLayout * layoutVideoRec = new QHBoxLayout(pageVideoRec);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   752
        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
   753
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   754
        // label for format
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   755
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   756
        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
   757
        labelFormat->setText(QLabel::tr("Format"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   758
        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
   759
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   760
        // list of supported formats
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   761
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   762
        comboAVFormats = new QComboBox(groupVideoRec);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   763
        comboAVFormats->setMaxVisibleItems(50);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   764
        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
   765
        LibavInteraction::instance().fillFormats(comboAVFormats);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   766
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   767
        // separator
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   768
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   769
        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
   770
        hr->setFrameStyle(QFrame::HLine);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   771
        hr->setLineWidth(3);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   772
        hr->setFixedHeight(10);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   773
        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
   774
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   775
        // label for audio codec
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   776
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   777
        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
   778
        labelACodec->setText(QLabel::tr("Audio codec"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   779
        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
   780
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   781
        // list of supported audio codecs
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   782
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   783
        comboAudioCodecs = new QComboBox(groupVideoRec);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   784
        comboAudioCodecs->setMaxVisibleItems(50);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   785
        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
   786
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   787
        // checkbox 'record audio'
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   788
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   789
        checkRecordAudio = new QCheckBox(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   790
        checkRecordAudio->setText(QCheckBox::tr("Record audio"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   791
        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
   792
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   793
        // separator
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   794
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   795
        hr = new QFrame(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   796
        hr->setFrameStyle(QFrame::HLine);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   797
        hr->setLineWidth(3);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   798
        hr->setFixedHeight(10);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   799
        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
   800
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   801
        // label for video codec
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   802
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   803
        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
   804
        labelVCodec->setText(QLabel::tr("Video codec"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   805
        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
   806
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   807
        // list of supported video codecs
8387
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
        comboVideoCodecs = new QComboBox(groupVideoRec);
11679
d59b6f289e30 Increase size of many drop-down lists
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   810
        comboVideoCodecs->setMaxVisibleItems(50);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   811
        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
   812
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   813
        // label for resolution
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   814
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   815
        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
   816
        labelRes->setText(QLabel::tr("Resolution"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   817
        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
   818
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   819
        // width
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   820
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   821
        widthEdit = new QLineEdit(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   822
        widthEdit->setValidator(new QIntValidator(this));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   823
        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
   824
12637
888032b2fda4 Make multipy sign in QTfrondend translatable and update hedgewars_en.ts
Wuzzy <almikes@aol.com>
parents: 12486
diff changeset
   825
        // multiplication sign
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   826
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   827
        QLabel *labelX = new QLabel(groupVideoRec);
12637
888032b2fda4 Make multipy sign in QTfrondend translatable and update hedgewars_en.ts
Wuzzy <almikes@aol.com>
parents: 12486
diff changeset
   828
        labelX->setText(tr("x"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   829
        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
   830
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   831
        // height
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   832
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   833
        heightEdit = new QLineEdit(groupVideoRec);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   834
        heightEdit->setValidator(new QIntValidator(groupVideoRec));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   835
        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
   836
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   837
        // checkbox 'use game resolution'
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   838
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   839
        checkUseGameRes = new QCheckBox(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   840
        checkUseGameRes->setText(QCheckBox::tr("Use game resolution"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   841
        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
   842
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   843
        // label for framerate
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   844
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   845
        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
   846
        labelFramerate->setText(QLabel::tr("Framerate"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   847
        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
   848
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   849
        framerateBox = new QComboBox(groupVideoRec);
12242
76fa467b6833 Make framerate drop-down list translatable
Wuzzy <almikes@aol.com>
parents: 12185
diff changeset
   850
        framerateBox->addItem(QComboBox::tr("24 FPS"), 24);
76fa467b6833 Make framerate drop-down list translatable
Wuzzy <almikes@aol.com>
parents: 12185
diff changeset
   851
        framerateBox->addItem(QComboBox::tr("25 FPS"), 25);
76fa467b6833 Make framerate drop-down list translatable
Wuzzy <almikes@aol.com>
parents: 12185
diff changeset
   852
        framerateBox->addItem(QComboBox::tr("30 FPS"), 30);
76fa467b6833 Make framerate drop-down list translatable
Wuzzy <almikes@aol.com>
parents: 12185
diff changeset
   853
        framerateBox->addItem(QComboBox::tr("50 FPS"), 50);
76fa467b6833 Make framerate drop-down list translatable
Wuzzy <almikes@aol.com>
parents: 12185
diff changeset
   854
        framerateBox->addItem(QComboBox::tr("60 FPS"), 60);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   855
        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
   856
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   857
        // label for Bitrate
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   858
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   859
        QLabel *labelBitrate = new QLabel(groupVideoRec);
12244
8db93a3a29dc Use standard units and abbreviations in frontend
Wuzzy <almikes@aol.com>
parents: 12242
diff changeset
   860
        //: “Kibit/s” is the symbol for 1024 bits per second
8db93a3a29dc Use standard units and abbreviations in frontend
Wuzzy <almikes@aol.com>
parents: 12242
diff changeset
   861
        labelBitrate->setText(QLabel::tr("Bitrate (Kibit/s)"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   862
        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
   863
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   864
        // bitrate
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   865
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   866
        bitrateBox = new QSpinBox(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   867
        bitrateBox->setRange(100, 5000);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   868
        bitrateBox->setSingleStep(100);
12244
8db93a3a29dc Use standard units and abbreviations in frontend
Wuzzy <almikes@aol.com>
parents: 12242
diff changeset
   869
        bitrateBox->setWhatsThis(QSpinBox::tr("Specify the bitrate of recorded videos as a multiple of 1024 bits per second"));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   870
        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
   871
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   872
        // button 'set default options'
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   873
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   874
        btnDefaults = new QPushButton(groupVideoRec);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   875
        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
   876
        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
   877
        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
   878
    }
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   879
#endif
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   880
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   881
    previousQuality = this->SLQuality->value();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   882
    previousResolutionIndex = this->CBResolution->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   883
    previousFullscreenValue = this->CBFullscreen->isChecked();
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   884
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   885
    setFullscreen(CBFullscreen->isChecked());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   886
    setVolume(SLVolume->value());
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   887
8343
aa4ea3cade3c Added Support for variable windowed resolution.
vitiv <nikita.utiu@gmail.com>
parents: 8284
diff changeset
   888
    // 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
   889
    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
   890
}
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
   891
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
   892
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
   893
{
6525
6c97379c584b [GCI] backz task: unify the back button functionality, avoid using the save button
m4tx
parents: 6218
diff changeset
   894
    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
   895
}
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
   896
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
   897
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
   898
{
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   899
#ifdef VIDEOREC
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   900
    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
   901
    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
   902
    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
   903
    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
   904
#endif
8386
2aaa2995a32e - Fix another ton of bugs and misbehavior
unc0rr
parents: 8384
diff changeset
   905
    //connect(this, SIGNAL(pageEnter()), this, SLOT(setTeamOptionsEnabled()));
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   906
    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
   907
    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
   908
    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
   909
    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
   910
    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
   911
    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
   912
    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
   913
}
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
   914
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   915
void PageOptions::setVolume(int volume)
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   916
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   917
    lblVolumeLevel->setText(QString("%1\%").arg(volume));
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   918
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   919
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   920
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
   921
{
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   922
    QHBoxLayout * twoColumns = new QHBoxLayout(tabpage);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   923
    twoColumns->setSpacing(0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   924
    *leftColumn = new QVBoxLayout();
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   925
    *rightColumn = new QVBoxLayout();
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   926
    (*leftColumn)->setSpacing(OPTION_BOX_SPACING);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   927
    (*rightColumn)->setSpacing(OPTION_BOX_SPACING);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   928
    twoColumns->addStretch(4);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   929
    twoColumns->addLayout(*leftColumn, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   930
    twoColumns->addStretch(1);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   931
    twoColumns->addLayout(*rightColumn, 0);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   932
    twoColumns->addStretch(4);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   933
}
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   934
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
   935
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
   936
{
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
   937
    initPage();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   938
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   939
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   940
void PageOptions::forceFullscreen(int index)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   941
{
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   942
    bool forced = (index == 7 || index == 8 || index == 9);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
   943
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   944
    if (index != 0)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   945
    {
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   946
        this->SLQuality->setValue(this->SLQuality->maximum());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   947
        this->SLQuality->setEnabled(false);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   948
        this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   949
        setFullscreen(forced ? true : previousFullscreenValue);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   950
        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
   951
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   952
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6575
diff changeset
   953
    {
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   954
        this->SLQuality->setEnabled(true);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   955
        this->SLQuality->setValue(previousQuality);
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   956
        this->CBFullscreen->setChecked(previousFullscreenValue);
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   957
        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
   958
        this->CBResolution->setCurrentIndex(previousResolutionIndex);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   959
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   960
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   961
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   962
void PageOptions::setQuality(int value)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   963
{
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
   964
    Q_UNUSED(value);
6217
ef53ba841791 - Remove some old unused code
unc0rr
parents: 6060
diff changeset
   965
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   966
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   967
    if (index == 0)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   968
        previousQuality = this->SLQuality->value();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   969
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   970
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   971
void PageOptions::setFullscreen(int state)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   972
{
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
   973
    Q_UNUSED(state);
8352
ab7f22530ae0 Changed resolution labels on options page.
vitiv <nikita.utiu@gmail.com>
parents: 8350
diff changeset
   974
8387
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   975
    lblFullScreenRes->setVisible(state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   976
    CBResolution->setVisible(state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   977
    lblWinScreenRes->setVisible(!state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   978
    winResContainer->setVisible(!state);
f9d1191476ce Organized options into more relavant tabs.
dag10 <gottlieb.drew@gmail.com>
parents: 8386
diff changeset
   979
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   980
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   981
    if (index != 7 && index != 8 && index != 9)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   982
        previousFullscreenValue = this->CBFullscreen->isChecked();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   983
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   984
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   985
void PageOptions::setResolution(int state)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   986
{
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
   987
    Q_UNUSED(state);
6217
ef53ba841791 - Remove some old unused code
unc0rr
parents: 6060
diff changeset
   988
5878
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   989
    int index = this->CBStereoMode->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   990
    if (index != 7 && index != 8 && index != 9)
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   991
        previousResolutionIndex = this->CBResolution->currentIndex();
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   992
}
404ca990793a I.Fight.For.The.Users
koda
parents: 5877
diff changeset
   993
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   994
void PageOptions::trimNetNick()
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   995
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   996
    editNetNick->setText(editNetNick->text().trimmed());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   997
}
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
   998
6911
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
   999
void PageOptions::savePwdChanged(int state) {
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
  1000
    if (state == 0) {
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
  1001
        editNetPassword->setEnabled(false);
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
  1002
        editNetPassword->setText("");
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
  1003
    } else
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
  1004
        editNetPassword->setEnabled(true);
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
  1005
}
1cda333286e0 added savepassword checkbox to options page, which now reloads values at every acces
koda
parents: 6700
diff changeset
  1006
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1007
void PageOptions::requestEditSelectedTeam()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1008
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1009
    emit editTeamRequested(CBTeamName->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1010
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1011
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1012
void PageOptions::requestDeleteSelectedTeam()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1013
{
12246
0b5aa545e058 Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents: 12245
diff changeset
  1014
    if(CBTeamName->count() > 1)
0b5aa545e058 Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents: 12245
diff changeset
  1015
        emit deleteTeamRequested(CBTeamName->currentText());
0b5aa545e058 Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents: 12245
diff changeset
  1016
    else
0b5aa545e058 Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents: 12245
diff changeset
  1017
        QMessageBox::warning(this, tr("Can't delete last team"), tr("You can't delete the last team!"));
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1018
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1019
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1020
void PageOptions::setTeamOptionsEnabled(bool enabled)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1021
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1022
    BtnNewTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1023
    BtnEditTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1024
    BtnDeleteTeam->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1025
    CBTeamName->setVisible(enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1026
    LblNoEditTeam->setVisible(!enabled);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 6009
diff changeset
  1027
}
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1028
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1029
void PageOptions::colorButtonClicked(int i)
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1030
{
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1031
    if(i < 0 || i >= m_colorButtons.size())
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1032
        return;
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1033
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1034
    QPalette p = m_colorButtons[i]->palette();
13207
2fe85d497e0f Backed out changeset 3a110dcb6e87 (Qt color chooser)
Wuzzy <Wuzzy2@mail.ru>
parents: 13199
diff changeset
  1035
    QColor c = QColorDialog::getColor(p.color(QPalette::Button));
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1036
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1037
    if(c.isValid())
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1038
    {
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1039
        DataManager::instance().colorsModel()->item(i)->setData(c);
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1040
        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
  1041
    }
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1042
}
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1043
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1044
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
  1045
{
7630
13fa53bb3134 Move some options to the second page so first page doesn't look ugly on low resolution
unc0rr
parents: 7541
diff changeset
  1046
    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
  1047
7541
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1048
    QStandardItemModel * model = DataManager::instance().colorsModel();
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1049
e51b11349637 Allow customization of colors in ui, store custom colors in config
unc0rr
parents: 7153
diff changeset
  1050
    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
  1051
}
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1052
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1053
void PageOptions::onProxyTypeChanged()
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1054
{
7703
78d2ac987f41 Make sheepluva happy
unc0rr
parents: 7702
diff changeset
  1055
    bool b = cbProxyType->currentIndex() != NoProxy && cbProxyType->currentIndex() != SystemProxy ;
7700
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1056
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1057
    sbProxyPort->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1058
    leProxy->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1059
    leProxyLogin->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1060
    leProxyPassword->setEnabled(b);
fc44e4e33d1c Support for proxies (not tested)
unc0rr
parents: 7681
diff changeset
  1061
}
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1062
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1063
// Video Recording
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1064
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1065
void PageOptions::setConfig(GameUIConfig * config)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1066
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1067
    this->config = config;
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
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1070
// 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
  1071
void PageOptions::changeAVFormat(int index)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1072
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1073
    // remember selected codecs
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1074
    QString prevVCodec = videoCodec();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1075
    QString prevACodec = audioCodec();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1076
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1077
    // clear lists of codecs
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1078
    comboVideoCodecs->clear();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1079
    comboAudioCodecs->clear();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1080
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1081
    // 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
  1082
    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
  1083
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1084
    // 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
  1085
    if (comboAudioCodecs->count() == 0)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1086
    {
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1087
        checkRecordAudio->setChecked(false);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1088
        checkRecordAudio->setEnabled(false);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1089
    }
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1090
    else
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1091
        checkRecordAudio->setEnabled(true);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1092
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1093
    // restore selected codecs if possible
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1094
    int iVCodec = comboVideoCodecs->findData(prevVCodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1095
    if (iVCodec != -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1096
        comboVideoCodecs->setCurrentIndex(iVCodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1097
    int iACodec = comboAudioCodecs->findData(prevACodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1098
    if (iACodec != -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1099
        comboAudioCodecs->setCurrentIndex(iACodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1100
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1101
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1102
// 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
  1103
void PageOptions::changeUseGameRes(int state)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1104
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1105
    if (state && config)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1106
    {
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1107
        // set resolution to game resolution
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1108
        QRect resolution = config->vid_Resolution();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1109
        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
  1110
        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
  1111
    }
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1112
    widthEdit->setEnabled(!state);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1113
    heightEdit->setEnabled(!state);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1114
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1115
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1116
// user switched checkbox 'record audio'
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1117
void PageOptions::changeRecordAudio(int state)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1118
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1119
    comboAudioCodecs->setEnabled(!!state);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1120
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1121
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1122
void PageOptions::setDefaultCodecs()
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1123
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1124
    // 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
  1125
    // 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
  1126
    // Windows Media Player TODO
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1127
    if (tryCodecs("mp4", "libx264", "aac"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1128
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1129
    if (tryCodecs("mp4", "libx264", "libfaac"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1130
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1131
    if (tryCodecs("mp4", "libx264", "libmp3lame"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1132
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1133
    if (tryCodecs("mp4", "libx264", "mp2"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1134
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1135
    if (tryCodecs("avi", "libxvid", "libmp3lame"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1136
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1137
    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
  1138
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1139
    if (tryCodecs("avi", "libxvid", "mp2"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1140
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1141
    if (tryCodecs("avi", "mpeg4", "libmp3lame"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1142
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1143
    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
  1144
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1145
    if (tryCodecs("avi", "mpeg4", "mp2"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1146
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1147
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1148
    // 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
  1149
    if (tryCodecs("ogg", "libtheora", "libvorbis"))
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1150
        return;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1151
    tryCodecs("ogg", "libtheora", "flac");
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1152
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1153
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1154
void PageOptions::setDefaultOptions()
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1155
{
8192
81da6576b0c3 Make video recording options have fixed size and merge with spinbox->combobox change.
Mitchell Kember <mk12360@gmail.com>
parents: 8151
diff changeset
  1156
    framerateBox->setCurrentIndex(2);
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1157
    bitrateBox->setValue(1000);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1158
    checkRecordAudio->setChecked(true);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1159
    checkUseGameRes->setChecked(true);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1160
    setDefaultCodecs();
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1161
}
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1162
8284
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1163
void PageOptions::checkForUpdates()
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1164
{
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1165
    AutoUpdater *updater = NULL;
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1166
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1167
#ifdef __APPLE__
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1168
#ifdef SPARKLE_ENABLED
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1169
    updater = new SparkleAutoUpdater();
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1170
#endif
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1171
#endif
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1172
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1173
    if (updater)
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1174
    {
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1175
        updater->checkForUpdatesNow();
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1176
        delete updater;
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1177
    }
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1178
}
a874d00df4a4 GCI2012: Autoupdate Button in Settings
Drew Gottlieb
parents: 8229
diff changeset
  1179
8151
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1180
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
  1181
{
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1182
    // first we should change format
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1183
    int iFormat = comboAVFormats->findData(format);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1184
    if (iFormat == -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1185
        return false;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1186
    comboAVFormats->setCurrentIndex(iFormat);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1187
    // 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
  1188
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1189
    // try to find video codec
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1190
    int iVCodec = comboVideoCodecs->findData(vcodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1191
    if (iVCodec == -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1192
        return false;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1193
    comboVideoCodecs->setCurrentIndex(iVCodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1194
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1195
    // try to find audio codec
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1196
    int iACodec = comboAudioCodecs->findData(acodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1197
    if (iACodec == -1 && checkRecordAudio->isChecked())
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1198
        return false;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1199
    if (iACodec != -1)
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1200
        comboAudioCodecs->setCurrentIndex(iACodec);
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1201
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1202
    return true;
25b95d6224fc Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents: 8098
diff changeset
  1203
}
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1204
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1205
// When the current tab is switched
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1206
void PageOptions::tabIndexChanged(int index)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1207
{
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1208
    if (index == binderTab) // Switched to bind tab
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1209
    {
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1210
        binder->resetInterface();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1211
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1212
        if (!config) return;
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1213
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1214
        QStandardItemModel * binds = DataManager::instance().bindsModel();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1215
        for(int i = 0; i < BINDS_NUMBER; i++)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1216
        {
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1217
            QString value = config->bind(i);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1218
            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
  1219
            if(mdl.size() == 1) binder->setBindIndex(i, mdl[0].row());
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1220
        }
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1221
    }
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1222
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1223
    currentTab = index;
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1224
}
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1225
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1226
// When a key bind combobox is changed
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1227
void PageOptions::bindUpdated(int bindID)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1228
{
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1229
    int bindIndex = binder->bindIndex(bindID);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8387
diff changeset
  1230
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1231
    if (bindIndex == 0) bindIndex = resetBindToDefault(bindID);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1232
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1233
    // Save bind
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1234
    QStandardItemModel * binds = DataManager::instance().bindsModel();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1235
    QString strbind = binds->index(binder->bindIndex(bindID), 0).data(Qt::UserRole + 1).toString();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1236
    config->setBind(bindID, strbind);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1237
}
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1238
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1239
// 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
  1240
// Returns: The bind model index of the default.
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1241
int PageOptions::resetBindToDefault(int bindID)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1242
{
14857
56293aa24e81 Fix crash when pressing key bind reset button in settings
Wuzzy <Wuzzy2@mail.ru>
parents: 14682
diff changeset
  1243
    if (QString(cbinds[bindID].action) == QString("!MULTI"))
56293aa24e81 Fix crash when pressing key bind reset button in settings
Wuzzy <Wuzzy2@mail.ru>
parents: 14682
diff changeset
  1244
        return -1;
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1245
    QStandardItemModel * binds = DataManager::instance().bindsModel();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1246
    QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, cbinds[bindID].strbind, 1, Qt::MatchExactly);
14857
56293aa24e81 Fix crash when pressing key bind reset button in settings
Wuzzy <Wuzzy2@mail.ru>
parents: 14682
diff changeset
  1247
    if(mdl.size() == 1)
56293aa24e81 Fix crash when pressing key bind reset button in settings
Wuzzy <Wuzzy2@mail.ru>
parents: 14682
diff changeset
  1248
        binder->setBindIndex(bindID, mdl[0].row());
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1249
    return mdl[0].row();
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1250
}
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1251
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1252
// Called when "reset all binds" button is pressed
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1253
void PageOptions::resetAllBinds()
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1254
{
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1255
    for (int i = 0; i < BINDS_NUMBER; i++)
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1256
    {
14857
56293aa24e81 Fix crash when pressing key bind reset button in settings
Wuzzy <Wuzzy2@mail.ru>
parents: 14682
diff changeset
  1257
        int ret = resetBindToDefault(i);
56293aa24e81 Fix crash when pressing key bind reset button in settings
Wuzzy <Wuzzy2@mail.ru>
parents: 14682
diff changeset
  1258
        if(ret != -1)
56293aa24e81 Fix crash when pressing key bind reset button in settings
Wuzzy <Wuzzy2@mail.ru>
parents: 14682
diff changeset
  1259
            bindUpdated(i);
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1260
    }
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8284
diff changeset
  1261
}