QTfrontend/pageeditteam.cpp
author unc0rr
Mon, 26 Sep 2011 21:45:33 +0400
changeset 6040 a740069c21e3
parent 6024 d38da7c19e43
child 6042 8b5345758f62
permissions -rw-r--r--
- Add unique id to replay file name - INSERT instead of UPDATE for stats
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
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     4
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     8
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    13
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    17
 */
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    18
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    19
#include <QGridLayout>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    20
#include <QPushButton>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    21
#include <QComboBox>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    22
#include <QLabel>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    23
#include <QLineEdit>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    24
#include <QTabWidget>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    25
#include <QGroupBox>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    26
#include <QToolBox>
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    27
#include <QMessageBox>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    28
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5078
diff changeset
    29
#include "pageeditteam.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
#include "sdlkeys.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    31
#include "SquareLabel.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    32
#include "hats.h"
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
    33
#include "HWApplication.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    34
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    35
PageEditTeam::PageEditTeam(QWidget* parent, SDLInteraction * sdli) :
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    36
  AbstractPage(parent)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    37
{
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    38
    m_playerHash = "0000000000000000000000000000000000000000";
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    39
    mySdli = sdli;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    40
    QGridLayout * pageLayout = new QGridLayout(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    41
    QTabWidget * tbw = new QTabWidget(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    42
    QWidget * page1 = new QWidget(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    43
    QWidget * page2 = new QWidget(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    44
    tbw->addTab(page1, tr("General"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    45
    tbw->addTab(page2, tr("Advanced"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    46
    pageLayout->addWidget(tbw, 0, 0, 1, 3);
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    47
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    48
    BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    49
    BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    50
    connect(BtnTeamSave, SIGNAL(clicked()), this, SLOT(saveTeam()));
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    51
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    52
    BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    53
    BtnTeamDiscard->setFixedHeight(BtnTeamSave->height());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    54
    BtnTeamDiscard->setStyleSheet("QPushButton{margin-top: 31px;}");
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    55
    connect(BtnTeamDiscard, SIGNAL(clicked()), this, SIGNAL(goBack()));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    56
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    57
    QHBoxLayout * page1Layout = new QHBoxLayout(page1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    58
    page1Layout->setAlignment(Qt::AlignTop);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    59
    QGridLayout * page2Layout = new QGridLayout(page2);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    60
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    61
// ====== Page 1 ======
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    62
    QVBoxLayout * vbox1 = new QVBoxLayout();
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    63
    QVBoxLayout * vbox2 = new QVBoxLayout();
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    64
    page1Layout->addLayout(vbox1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    65
    page1Layout->addLayout(vbox2);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    66
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    67
    GBoxHedgehogs = new QGroupBox(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    68
    GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    69
    GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    70
    QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    71
5907
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    72
    signalMapper1 = new QSignalMapper(this);
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    73
    signalMapper2 = new QSignalMapper(this);
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    74
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    75
    connect(signalMapper1, SIGNAL(mapped(int)), this, SLOT(fixHHname(int)));
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    76
    connect(signalMapper2, SIGNAL(mapped(int)), this, SLOT(setRandomName(int)));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    77
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    78
    HatsModel * hatsModel = new HatsModel(GBoxHedgehogs);
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
    79
    for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    80
    {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    81
        HHHats[i] = new QComboBox(GBoxHedgehogs);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    82
        HHHats[i]->setModel(hatsModel);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    83
        HHHats[i]->setIconSize(QSize(32, 37));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    84
        //HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    85
        //HHHats[i]->setModelColumn(1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    86
        //HHHats[i]->setMinimumWidth(132);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    87
        GBHLayout->addWidget(HHHats[i], i, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    88
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    89
        HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    90
        HHNameEdit[i]->setMaxLength(64);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    91
        HHNameEdit[i]->setMinimumWidth(120);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    92
        GBHLayout->addWidget(HHNameEdit[i], i, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    93
5907
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    94
        connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map()));
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    95
            signalMapper1->setMapping(HHNameEdit[i], i);
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    96
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    97
        randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    98
5907
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
    99
        connect(randButton[i], SIGNAL(clicked()), signalMapper2, SLOT(map()));
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   100
            signalMapper2->setMapping(randButton[i], i);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   101
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   102
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   103
    randTeamButton = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, false);
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   104
    connect(randTeamButton, SIGNAL(clicked()), this, SLOT(setRandomNames()));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   105
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   106
    vbox1->addWidget(GBoxHedgehogs);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   107
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   108
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   109
    GBoxTeam = new QGroupBox(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   110
    GBoxTeam->setTitle(QGroupBox::tr("Team Settings"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   111
    GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   112
    QGridLayout * GBTLayout = new QGridLayout(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   113
    QLabel * tmpLabel = new QLabel(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   114
    tmpLabel->setText(QLabel::tr("Name"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   115
    GBTLayout->addWidget(tmpLabel, 0, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   116
    tmpLabel = new QLabel(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   117
    tmpLabel->setText(QLabel::tr("Type"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   118
    GBTLayout->addWidget(tmpLabel, 1, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   119
    tmpLabel = new QLabel(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   120
    tmpLabel->setText(QLabel::tr("Grave"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   121
    GBTLayout->addWidget(tmpLabel, 2, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   122
    tmpLabel = new QLabel(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   123
    tmpLabel->setText(QLabel::tr("Flag"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   124
    GBTLayout->addWidget(tmpLabel, 3, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   125
    tmpLabel = new QLabel(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   126
    tmpLabel->setText(QLabel::tr("Voice"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   127
    GBTLayout->addWidget(tmpLabel, 4, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   128
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   129
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   130
    TeamNameEdit = new QLineEdit(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   131
    TeamNameEdit->setMaxLength(64);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   132
    GBTLayout->addWidget(TeamNameEdit, 0, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   133
    vbox2->addWidget(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   134
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   135
    CBTeamLvl = new QComboBox(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   136
    CBTeamLvl->setIconSize(QSize(48, 48));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   137
    CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   138
    for(int i = 5; i > 0; i--)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   139
        CBTeamLvl->addItem(
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   140
                QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   141
                QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   142
                );
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   143
    GBTLayout->addWidget(CBTeamLvl, 1, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   144
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   145
    CBGrave = new QComboBox(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   146
    CBGrave->setMaxCount(65535);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   147
    CBGrave->setIconSize(QSize(32, 32));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   148
    GBTLayout->addWidget(CBGrave, 2, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   149
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   150
    CBFlag = new QComboBox(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   151
    CBFlag->setMaxCount(65535);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   152
    CBFlag->setIconSize(QSize(22, 15));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   153
    GBTLayout->addWidget(CBFlag, 3, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   154
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   155
    {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   156
        QHBoxLayout * hbox = new QHBoxLayout();
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   157
        CBVoicepack = new QComboBox(GBoxTeam);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   158
        {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   159
            QDir tmpdir;
5308
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   160
            QStringList list;
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   161
            tmpdir.cd(cfgdir->absolutePath());
5308
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   162
            if (tmpdir.cd("Data/Sounds/voices")) 
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   163
            {
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   164
                list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   165
                CBVoicepack->addItems(list);
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   166
            }
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   167
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   168
            tmpdir.cd(datadir->absolutePath());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   169
            tmpdir.cd("Sounds/voices");
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   170
            QStringList tmplist = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   171
            QStringList tmplist2;
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   172
            for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it)
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   173
                if (!list.contains(*it,Qt::CaseInsensitive)) tmplist2.append(*it);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   174
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   175
            CBVoicepack->addItems(tmplist2);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   176
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   177
        hbox->addWidget(CBVoicepack, 100);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   178
        BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   179
        hbox->setStretchFactor(BtnTestSound, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   180
        connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound()));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   181
        GBTLayout->addLayout(hbox, 4, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   182
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   183
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   184
    GBoxFort = new QGroupBox(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   185
    GBoxFort->setTitle(QGroupBox::tr("Fort"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   186
    QGridLayout * GBFLayout = new QGridLayout(GBoxFort);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   187
    CBFort = new QComboBox(GBoxFort);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   188
    CBFort->setMaxCount(65535);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   189
    GBFLayout->addWidget(CBFort, 0, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   190
    FortPreview = new SquareLabel(GBoxFort);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   191
    FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   192
    FortPreview->setMinimumSize(128, 128);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   193
    FortPreview->setPixmap(QPixmap());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   194
    // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   195
    //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   196
    GBFLayout->addWidget(FortPreview, 1, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   197
    vbox2->addWidget(GBoxFort);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   198
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   199
    QDir tmpdir;
5308
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   200
    QStringList userforts;
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   201
    tmpdir.cd(cfgdir->absolutePath());
5308
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   202
    if (tmpdir.cd("Data/Forts"))
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   203
    {
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   204
        tmpdir.setFilter(QDir::Files);
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   205
        userforts = tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1");
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   206
        CBFort->addItems(userforts);
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   207
    }
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   208
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   209
    tmpdir.cd("../Graphics/Graves");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   210
    QStringList userlist = tmpdir.entryList(QStringList("*.png"));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   211
    for (QStringList::Iterator it = userlist.begin(); it != userlist.end(); ++it )
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   212
    {
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   213
        QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Graves/" + *it);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   214
        QIcon icon(pix.copy(0, 0, 32, 32));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   215
        CBGrave->addItem(icon, QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1"));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   216
    }
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   217
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   218
    tmpdir.cd(datadir->absolutePath());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   219
    tmpdir.cd("Forts");
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   220
    tmpdir.setFilter(QDir::Files);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   221
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   222
    QStringList tmplist = tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   223
    QStringList dataforts;
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   224
    for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it)
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   225
        if (!userforts.contains(*it,Qt::CaseInsensitive)) dataforts.append(*it);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   226
5308
c57a8878eebe fixing some different issues with edit team page and the new dual data setup
Henek
parents: 5252
diff changeset
   227
    CBFort->addItems(dataforts);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   228
    connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &)));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   229
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   230
    tmpdir.cd("../Graphics/Graves");
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   231
    QStringList datalist = tmpdir.entryList(QStringList("*.png"));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   232
    for (QStringList::Iterator it = datalist.begin(); it != datalist.end(); ++it )
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   233
    {
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   234
        if (userlist.contains(*it,Qt::CaseInsensitive)) continue;
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   235
        QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   236
        QIcon icon(pix.copy(0, 0, 32, 32));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   237
        CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   238
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   239
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   240
    // add the default flag
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   241
    CBFlag->addItem(QIcon(QPixmap(datadir->absolutePath() + "/Graphics/Flags/hedgewars.png").copy(0, 0, 22, 15)), "Hedgewars", "hedgewars");
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   242
    CBFlag->insertSeparator(CBFlag->count());
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   243
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   244
    tmpdir.cd(cfgdir->absolutePath());
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   245
    tmpdir.cd("Data/Graphics/Flags");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   246
    userlist = tmpdir.entryList(QStringList("*.png"));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   247
    
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   248
    // add all country flags
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   249
    for (QStringList::Iterator it = userlist.begin(); it != userlist.end(); ++it )
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   250
    {
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   251
        QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Flags/" + *it);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   252
        QIcon icon(pix.copy(0, 0, 22, 15));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   253
        if(it->compare("cpu.png") && it->compare("hedgewars.png") && (it->indexOf("cm_") == -1)) // skip cpu and hedgewars flags as well as all community flags
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   254
        {
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   255
            QString flag = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   256
            CBFlag->addItem(icon, QString(flag).replace("_", " "), flag);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   257
        }
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   258
    }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   259
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   260
    CBFlag->insertSeparator(CBFlag->count());
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   261
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   262
    // add all community flags
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   263
    for (QStringList::Iterator it = userlist.begin(); it != userlist.end(); ++it )
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   264
    {
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   265
        QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Flags/" + *it);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   266
        QIcon icon(pix.copy(0, 0, 22, 15));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   267
        if(it->indexOf("cm_") > -1) // skip non community flags this time
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   268
        {
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   269
            QString flag = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   270
            CBFlag->addItem(icon, QString(flag).replace("cm_", QComboBox::tr("Community") + ": "), flag);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   271
        }
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   272
    }
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   273
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   274
    CBFlag->insertSeparator(CBFlag->count());
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   275
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   276
    tmpdir.cd(datadir->absolutePath());
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   277
    tmpdir.cd("Graphics/Flags");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   278
    datalist = tmpdir.entryList(QStringList("*.png"));
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   279
    
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   280
    // add all country flags
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   281
    for (QStringList::Iterator it = datalist.begin(); it != datalist.end(); ++it )
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   282
    {
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   283
        if (userlist.contains(*it,Qt::CaseInsensitive)) continue;
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   284
        QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   285
        QIcon icon(pix.copy(0, 0, 22, 15));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   286
        if(it->compare("cpu.png") && it->compare("hedgewars.png") && (it->indexOf("cm_") == -1)) // skip cpu and hedgewars flags as well as all community flags
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   287
        {
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   288
            QString flag = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1");
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   289
            CBFlag->addItem(icon, QString(flag).replace("_", " "), flag);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   290
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   291
    }
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   292
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   293
    CBFlag->insertSeparator(CBFlag->count());
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   294
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   295
    // add all community flags
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   296
    for (QStringList::Iterator it = datalist.begin(); it != datalist.end(); ++it )
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   297
    {
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   298
        if (userlist.contains(*it,Qt::CaseInsensitive)) continue;
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   299
        QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   300
        QIcon icon(pix.copy(0, 0, 22, 15));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   301
        if(it->indexOf("cm_") > -1) // skip non community flags this time
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   302
        {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   303
            QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   304
            CBFlag->addItem(icon, QString(flag).replace("cm_", QComboBox::tr("Community") + ": "), flag);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   305
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   306
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   307
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   308
    vbox1->addStretch();
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   309
    vbox2->addStretch();
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   310
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   311
// ====== Page 2 ======
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   312
    GBoxBinds = new QGroupBox(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   313
    GBoxBinds->setTitle(QGroupBox::tr("Key binds"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   314
    QGridLayout * GBBLayout = new QGridLayout(GBoxBinds);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   315
    BindsBox = new QToolBox(GBoxBinds);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   316
    BindsBox->setLineWidth(0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   317
    GBBLayout->addWidget(BindsBox);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   318
    page2Layout->addWidget(GBoxBinds, 0, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   319
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   320
    quint16 i = 0;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   321
    quint16 num = 0;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   322
    QWidget * curW = NULL;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   323
    QGridLayout * pagelayout = NULL;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   324
    QLabel* l = NULL;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   325
    while (i < BINDS_NUMBER) {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   326
        if(cbinds[i].category != NULL)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   327
        {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   328
            if(curW != NULL)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   329
            {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   330
                l = new QLabel(curW);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   331
                l->setText("");
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   332
                pagelayout->addWidget(l, num++, 0, 1, 2);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   333
            }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   334
            curW = new QWidget(this);
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   335
            BindsBox->addItem(curW, HWApplication::translate("binds (categories)", cbinds[i].category));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   336
            pagelayout = new QGridLayout(curW);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   337
            num = 0;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   338
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   339
        if(cbinds[i].description != NULL)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   340
        {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   341
            l = new QLabel(curW);
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   342
            l->setText((num > 0 ? QString("\n") : QString("")) + HWApplication::translate("binds (descriptions)", cbinds[i].description));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   343
            pagelayout->addWidget(l, num++, 0, 1, 2);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   344
        }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   345
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   346
        l = new QLabel(curW);
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   347
        l->setText(HWApplication::translate("binds", cbinds[i].name));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   348
        l->setAlignment(Qt::AlignRight);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   349
        pagelayout->addWidget(l, num, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   350
        CBBind[i] = new QComboBox(curW);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   351
        for(int j = 0; sdlkeys[j][1][0] != '\0'; j++)
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   352
            CBBind[i]->addItem(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   353
        pagelayout->addWidget(CBBind[i++], num++, 1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   354
    }
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   355
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   356
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   357
5907
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   358
void PageEditTeam::fixHHname(int idx)
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   359
{
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   360
    HHNameEdit[idx]->setText(HHNameEdit[idx]->text().trimmed());
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   361
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   362
    if (HHNameEdit[idx]->text().isEmpty())
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   363
        HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1));
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   364
}
64ccc6be0ec5 team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents: 5886
diff changeset
   365
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   366
void PageEditTeam::CBFort_activated(const QString & fortname)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   367
{
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   368
    QFile tmp;
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   369
    tmp.setFileName(cfgdir->absolutePath() + "/Data/Forts/" + fortname + "L.png");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   370
    if (!tmp.exists()) tmp.setFileName(datadir->absolutePath() + "/Forts/" + fortname + "L.png");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   371
    QPixmap pix(QFileInfo(tmp).absoluteFilePath());
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   372
    FortPreview->setPixmap(pix);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   373
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   374
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   375
void PageEditTeam::testSound()
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   376
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   377
    Mix_Chunk *sound;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   378
    QDir tmpdir;
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   379
    mySdli->SDLMusicInit();
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   380
    
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   381
    tmpdir.cd(cfgdir->absolutePath());
5886
a4a620f68b22 fix voice preview
nemo
parents: 5549
diff changeset
   382
    if (!tmpdir.cd("Data/Sounds/voices/"+CBVoicepack->currentText()))
a4a620f68b22 fix voice preview
nemo
parents: 5549
diff changeset
   383
    {
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   384
        tmpdir.cd(datadir->absolutePath());
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   385
        tmpdir.cd("Sounds/voices");
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   386
        tmpdir.cd(CBVoicepack->currentText());
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   387
    }
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5204
diff changeset
   388
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   389
    QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   390
    if (list.size()) {
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   391
        sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   392
        Mix_PlayChannel(-1, sound, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   393
    }
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   394
}
6024
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   395
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   396
void PageEditTeam::createTeam(const QString & name, const QString & playerHash)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   397
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   398
    m_playerHash = playerHash;
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   399
    HWTeam newTeam(name);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   400
    loadTeam(newTeam);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   401
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   402
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   403
void PageEditTeam::editTeam(const QString & name, const QString & playerHash)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   404
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   405
    m_playerHash = playerHash;
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   406
    HWTeam team(name);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   407
    team.loadFromFile();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   408
    loadTeam(team);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   409
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   410
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   411
void PageEditTeam::deleteTeam(const QString & name)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   412
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   413
    QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel, this);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   414
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   415
    if (reallyDelete.exec() == QMessageBox::Ok)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   416
        HWTeam(name).deleteFile();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   417
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   418
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   419
void PageEditTeam::setRandomNames()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   420
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   421
    HWTeam team = data();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   422
    HWNamegen::teamRandomNames(team, true);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   423
    loadTeam(team);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   424
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   425
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   426
void PageEditTeam::setRandomName(int hh_index)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   427
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   428
    HWTeam team = data();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   429
    HWNamegen::teamRandomName(team,hh_index);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   430
    loadTeam(team);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   431
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   432
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   433
void PageEditTeam::loadTeam(const HWTeam & team)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   434
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   435
    TeamNameEdit->setText(team.name());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   436
    CBTeamLvl->setCurrentIndex(team.difficulty());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   437
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   438
    for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   439
    {
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   440
        HWHog hh = team.hedgehog(i);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   441
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   442
        HHNameEdit[i]->setText(hh.Name);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   443
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   444
        if (hh.Hat.startsWith("Reserved"))
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   445
            hh.Hat = hh.Hat.remove(0,40);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   446
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   447
        HHHats[i]->setCurrentIndex(HHHats[i]->findData(hh.Hat, Qt::DisplayRole));
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   448
    }
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   449
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   450
    CBGrave->setCurrentIndex(CBGrave->findText(team.grave()));
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   451
    CBFlag->setCurrentIndex(CBFlag->findData(team.flag()));
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   452
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   453
    CBFort->setCurrentIndex(CBFort->findText(team.fort()));
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   454
    CBVoicepack->setCurrentIndex(CBVoicepack->findText(team.voicepack()));
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   455
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   456
    for(int i = 0; i < BINDS_NUMBER; i++)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   457
    {
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   458
        CBBind[i]->setCurrentIndex(CBBind[i]->findData(team.keyBind(i)));
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   459
    }
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   460
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   461
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   462
HWTeam PageEditTeam::data()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   463
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   464
    HWTeam team(TeamNameEdit->text());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   465
    team.setDifficulty(CBTeamLvl->currentIndex());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   466
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   467
    for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   468
    {
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   469
        HWHog hh;
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   470
        hh.Name = HHNameEdit[i]->text();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   471
        hh.Hat = HHHats[i]->currentText();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   472
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   473
        if (hh.Hat.startsWith("Reserved"))
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   474
            hh.Hat = "Reserved"+m_playerHash+hh.Hat.remove(0,9);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   475
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   476
        team.setHedgehog(i,hh);
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   477
    }
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   478
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   479
    team.setGrave(CBGrave->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   480
    team.setFort(CBFort->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   481
    team.setVoicepack(CBVoicepack->currentText());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   482
    team.setFlag(CBFlag->itemData(CBFlag->currentIndex()).toString());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   483
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   484
    for(int i = 0; i < BINDS_NUMBER; i++)
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   485
    {
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   486
        team.bindKey(i,CBBind[i]->itemData(CBBind[i]->currentIndex()).toString());
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   487
    }
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   488
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   489
    return team;
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   490
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   491
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   492
void PageEditTeam::saveTeam()
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   493
{
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   494
    data().saveToFile();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   495
    emit teamEdited();
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   496
}
d38da7c19e43 some more cleanups and refactoring.
sheepluva
parents: 5907
diff changeset
   497