QTfrontend/pagesingleplayer.cpp
author Zorg <zorgiepoo@gmail.com>
Wed, 08 Jun 2011 03:36:54 -0400
changeset 5229 148d581b17ab
parent 5204 e1a5f4d5d86a
child 5543 5e597b725316
permissions -rw-r--r--
Attempt to fix issue #125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.
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"));
2d2422772832 Forgot to add this too..
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    49
    //BtnCampaignPage->setVisible(false);
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
}