QTfrontend/ui/page/pagemultiplayer.cpp
author unc0rr
Wed, 22 Jan 2014 23:06:50 +0400
changeset 10055 f738693be9be
parent 9998 736015b847e3
child 10108 c68cf030eded
permissions -rw-r--r--
More robust implementation of decompression
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
9998
736015b847e3 update copyright to 2014
sheepluva
parents: 9080
diff changeset
     3
 * Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     4
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     8
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    13
 *
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
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
 */
6170
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    18
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    19
/**
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    20
 * @file
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    21
 * @brief PageMultiplayer class implementation
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    22
 */
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    23
6171
8627698134b6 fix layout of net page
sheepluva
parents: 6170
diff changeset
    24
#include <QGridLayout>
6170
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    25
#include <QHBoxLayout>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    26
#include <QPushButton>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    27
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5078
diff changeset
    28
#include "pagemultiplayer.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    29
#include "gamecfgwidget.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
#include "teamselect.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    31
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
    32
QLayout * PageMultiplayer::bodyLayoutDefinition()
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    33
{
8886
5c521d1fdd63 Fixed map preview overlap on certain locales (Fixes issue 549).
dag10
parents: 8434
diff changeset
    34
    QHBoxLayout * pageLayout = new QHBoxLayout();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    35
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    36
    gameCFG = new GameCFGWidget(this);
8886
5c521d1fdd63 Fixed map preview overlap on certain locales (Fixes issue 549).
dag10
parents: 8434
diff changeset
    37
    pageLayout->addWidget(gameCFG, 3, Qt::AlignTop);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    38
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    39
    teamsSelect = new TeamSelWidget(this);
8886
5c521d1fdd63 Fixed map preview overlap on certain locales (Fixes issue 549).
dag10
parents: 8434
diff changeset
    40
    pageLayout->addWidget(teamsSelect, 2, Qt::AlignTop);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    41
6170
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    42
    return pageLayout;
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    43
}
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    44
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    45
QLayout * PageMultiplayer::footerLayoutLeftDefinition()
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    46
{
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    47
    QHBoxLayout * bottomLeftLayout = new QHBoxLayout();
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8377
diff changeset
    48
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    49
    btnSetup = addButton(":/res/Settings.png", bottomLeftLayout, 0, true);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    50
    btnSetup->setWhatsThis(tr("Edit game preferences"));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    51
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    52
    return bottomLeftLayout;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    53
}
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    54
6170
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    55
QLayout * PageMultiplayer::footerLayoutDefinition()
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    56
{
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    57
    QHBoxLayout * footerLayout = new QHBoxLayout();
6009
14f6fc9869f2 code cleanup/etc
sheepluva
parents: 5204
diff changeset
    58
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    59
    const QIcon& lp = QIcon(":/res/Start.png");
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    60
    QSize sz = lp.actualSize(QSize(65535, 65535));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    61
    BtnStartMPGame = new QPushButton();
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    62
    BtnStartMPGame->setText(tr("Start"));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    63
    BtnStartMPGame->setMinimumWidth(sz.width() + 60);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    64
    BtnStartMPGame->setIcon(lp);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    65
    BtnStartMPGame->setFixedHeight(50);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    66
    BtnStartMPGame->setIconSize(sz);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    67
    BtnStartMPGame->setFlat(true);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 6952
diff changeset
    68
    BtnStartMPGame->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
6170
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    69
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    70
    footerLayout->addStretch();
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    71
    footerLayout->addWidget(BtnStartMPGame);
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    72
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6060
diff changeset
    73
    return footerLayout;
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
    74
}
6009
14f6fc9869f2 code cleanup/etc
sheepluva
parents: 5204
diff changeset
    75
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
    76
void PageMultiplayer::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
    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
    PageMultiplayer::connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
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
PageMultiplayer::PageMultiplayer(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
    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
    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
    84
}