QTfrontend/pagesingleplayer.cpp
author Xeli
Fri, 16 Sep 2011 20:39:14 +0200
branchhedgeroid
changeset 5938 c186c454779d
parent 5543 5e597b725316
child 5997 a9495e0bd418
child 6009 14f6fc9869f2
permissions -rw-r--r--
isOnCurrentHog and isOnCrosshair now look at the distance relative to the screen rather than world coords, this means that zooming out doesn't make it harder to touch the hog or crosshair
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
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com>
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
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    25
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent)
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    26
{
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    27
    QVBoxLayout * vLayout = new QVBoxLayout(this);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    28
    QHBoxLayout * topLine = new QHBoxLayout();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    29
    QHBoxLayout * middleLine = new QHBoxLayout();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
    QHBoxLayout * bottomLine = 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
    vLayout->addLayout(bottomLine);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    37
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    38
    topLine->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    39
    BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    40
    BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)"));
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);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    43
    BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)"));
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    44
    topLine->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    45
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
    BtnCampaignPage = addButton(":/res/Campaign.png", middleLine, 0, true);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    48
    BtnCampaignPage->setToolTip(tr("Campaign Mode (...). IN DEVELOPMENT"));
5543
5e597b725316 disable campaign button, structure and change sudden death music to hell.ogg
Henek
parents: 5204
diff changeset
    49
    BtnCampaignPage->setVisible(false);
5082
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    50
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    51
    BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 1, true);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    52
    BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT"));
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    53
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    54
    BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    55
    bottomLine->addStretch();
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    56
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    57
    BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    58
    BtnDemos->setToolTip(tr("Demos (Watch recorded demos)"));
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    59
    BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true);
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    60
    BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    61
    BtnLoad->setToolTip(tr("Load (Load a previously saved game)"));
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    62
    BtnBack->setFixedHeight(BtnLoad->height());
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    63
    BtnBack->setStyleSheet("QPushButton{margin-top: 31px;}");
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    64
}