QTfrontend/ui/page/pagesingleplayer.cpp
author dag10
Sun, 13 Jan 2013 10:46:01 +0400
changeset 8374 3a1708759c4f
parent 7201 dc17ffdf0702
child 8382 67e257b98422
permissions -rw-r--r--
Hat selection reworked
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     1
/*
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6700
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     4
 *
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     8
 *
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    13
 *
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    17
 */
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    18
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    19
#include <QGridLayout>
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    20
#include <QPushButton>
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    21
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5082
diff changeset
    22
#include "pagesingleplayer.h"
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    23
#include "gamecfgwidget.h"
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    24
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: 6009
diff changeset
    25
QLayout * PageSinglePlayer::bodyLayoutDefinition()
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    26
{
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: 6009
diff changeset
    27
    QVBoxLayout * vLayout = new QVBoxLayout();
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: 6009
diff changeset
    28
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    29
    QHBoxLayout * topLine = new QHBoxLayout();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
    QHBoxLayout * middleLine = new QHBoxLayout();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    31
    vLayout->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    32
    vLayout->addLayout(topLine);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    33
    vLayout->addSpacing(30);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    34
    vLayout->addLayout(middleLine);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    35
    vLayout->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    36
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    37
    topLine->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    38
    BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true);
6699
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    39
    BtnSimpleGamePage->setToolTip(tr("Simple Game"));
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    40
    BtnSimpleGamePage->setWhatsThis(tr("Play a quick game against the computer with random settings"));
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    41
    topLine->addSpacing(60);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    42
    BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true);
6699
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    43
    BtnMultiplayer->setToolTip(tr("Multiplayer"));
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    44
    BtnMultiplayer->setWhatsThis(tr("Play a hotseat game against your friends, or AI teams"));
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    45
    topLine->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    46
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    47
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    48
    BtnCampaignPage = addButton(":/res/Campaign.png", middleLine, 0, true);
6699
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    49
    BtnCampaignPage->setToolTip(tr("Campaign Mode"));
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    50
    BtnCampaignPage->setWhatsThis(tr("Campaign Mode"));
7201
dc17ffdf0702 The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents: 6952
diff changeset
    51
    BtnCampaignPage->setVisible(true);
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    52
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    53
    BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 1, true);
6699
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    54
    BtnTrainPage->setToolTip(tr("Training Mode"));
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    55
    BtnTrainPage->setWhatsThis(tr("Practice your skills in a range of training missions"));
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    56
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: 6009
diff changeset
    57
    return vLayout;
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: 6009
diff changeset
    58
}
6009
14f6fc9869f2 code cleanup/etc
sheepluva
parents: 5543
diff changeset
    59
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: 6009
diff changeset
    60
QLayout * PageSinglePlayer::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: 6009
diff changeset
    61
{
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: 6009
diff changeset
    62
    QHBoxLayout * bottomLine = new QHBoxLayout();
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    63
    bottomLine->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    64
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    65
    BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true);
6699
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    66
    BtnDemos->setToolTip(tr("Demos"));
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    67
    BtnDemos->setWhatsThis(tr("Watch recorded demos"));
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: 6009
diff changeset
    68
    BtnLoad = addButton(":/res/Load.png", bottomLine, 2, true);
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: 6009
diff changeset
    69
    BtnLoad->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
6699
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    70
    BtnLoad->setToolTip(tr("Load"));
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6131
diff changeset
    71
    BtnLoad->setWhatsThis(tr("Load a previously saved game"));
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: 6009
diff changeset
    72
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: 6009
diff changeset
    73
    bottomLine->setStretch(1,0);
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: 6009
diff changeset
    74
    bottomLine->setStretch(2,0);
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: 6009
diff changeset
    75
    bottomLine->setAlignment(BtnDemos, Qt::AlignRight | Qt::AlignBottom);
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: 6009
diff changeset
    76
    bottomLine->setAlignment(BtnLoad, Qt::AlignRight | Qt::AlignBottom);
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: 6009
diff changeset
    77
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: 6009
diff changeset
    78
    return bottomLine;
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    79
}
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: 6009
diff changeset
    80
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: 6009
diff changeset
    81
void PageSinglePlayer::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: 6009
diff changeset
    82
{
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: 6009
diff changeset
    83
    //TODO
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: 6009
diff changeset
    84
}
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: 6009
diff changeset
    85
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: 6009
diff changeset
    86
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent)
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6009
diff changeset
    87
{
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: 6009
diff changeset
    88
    initPage();
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: 6009
diff changeset
    89
}