QTfrontend/ui/page/pagenetgame.cpp
author dag10
Mon, 14 Jan 2013 11:19:59 +0100
changeset 8377 869f80966a77
parent 8179 a1ffcb559f99
child 8382 67e257b98422
permissions -rw-r--r--
GCI2012: Improve Game Configuration Widget - Refactored mapmodel+datamanager to have two separate map models for static and mission maps, and then three static MapInfos in MapModel for the three special maps (random, maze, drawn). - Created theme selector dialog. - Created seed view/edit dialog. - Enlarged start icon on pagemultiplayer and pagenetgame, and added Start.png. - Moved "Settings" button on pagemultiplayer and pagenetgame from middle of page to page footer. - Added "load drawing" button to mapcontainer widget. - Map preview is no longer the randomize button; The randomize functionality is now in a button of its own. - Map preview no longer grays out (isn't disabled) when in slave mode. - Seed is now viewable and copyable when in slave mode -- but not editable. - You should now use the property master (isMaster() and setMaster()) on gamecfgwidget and mapcontainer instead of the enabled property. This is because some widgets (e.g. "view/edit seed" button and map preview) shouldn't be disabled, when all other widgets should be. - Added mission map descriptions w/ locale support in INI format in mapname/desc.txt if applicable. Use '|' for line break.
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
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6929
diff changeset
     3
 * Copyright (c) 2004-2012 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
 */
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>
6171
8627698134b6 fix layout of net page
sheepluva
parents: 6165
diff changeset
    20
#include <QHBoxLayout>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    21
#include <QPushButton>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    22
#include <QAction>
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    23
#include <QMenu>
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
    24
#include <QMessageBox>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    25
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5126
diff changeset
    26
#include "pagenetgame.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    27
#include "gamecfgwidget.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    28
#include "teamselect.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    29
#include "chatwidget.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
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
    31
QLayout * PageNetGame::bodyLayoutDefinition()
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    32
{
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
    33
    QGridLayout * pageLayout = new QGridLayout();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    34
    pageLayout->setSizeConstraint(QLayout::SetMinimumSize);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    35
    //pageLayout->setSpacing(1);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    36
    pageLayout->setColumnStretch(0, 50);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    37
    pageLayout->setColumnStretch(1, 50);
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
    // chatwidget
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
    40
    chatWidget = new HWChatWidget(this, true);
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
    41
    chatWidget->setShowFollow(false); // don't show follow in nicks' context menus
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
    42
    chatWidget->setIgnoreListKick(true); // kick ignored players automatically
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    43
    pageLayout->addWidget(chatWidget, 1, 0, 1, 2);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    44
    pageLayout->setRowStretch(0, 0);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    45
    pageLayout->setRowStretch(1, 0);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    46
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    47
    pGameCFG = new GameCFGWidget(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    48
    pageLayout->addWidget(pGameCFG, 0, 0);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    49
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    50
    pNetTeamsWidget = new TeamSelWidget(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    51
    pNetTeamsWidget->setAcceptOuter(true);
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    52
    pNetTeamsWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    53
    pageLayout->addWidget(pNetTeamsWidget, 0, 1, 1, 1);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    54
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
    55
    return pageLayout;
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
    56
}
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    57
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    58
QLayout * PageNetGame::footerLayoutLeftDefinition()
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    59
{
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    60
    QHBoxLayout * bottomLeftLayout = new QHBoxLayout();
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    61
    
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    62
    btnSetup = addButton(":/res/Settings.png", bottomLeftLayout, 0, true);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    63
    btnSetup->setWhatsThis(tr("Edit game preferences"));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    64
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    65
    return bottomLeftLayout;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    66
}
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    67
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
QLayout * PageNetGame::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
    69
{
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
    70
    QHBoxLayout * bottomLayout = new QHBoxLayout;
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    71
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
    72
    leRoomName = new HistoryLineEdit(this,10);
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
    73
    leRoomName->setMaxLength(60);
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
    74
    leRoomName->setMinimumWidth(200);
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
    75
    leRoomName->setMaximumWidth(400);
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
    76
6539
3222bb0612ca GCI task: idea
kragniz
parents: 6227
diff changeset
    77
    //Button to signify whether the player is ready to start playing
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    78
    BtnGo = new QPushButton(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    79
    BtnGo->setToolTip(QPushButton::tr("Ready"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    80
    BtnGo->setIcon(QIcon(":/res/lightbulb_off.png"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    81
    BtnGo->setIconSize(QSize(25, 34));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    82
    BtnGo->setMinimumWidth(50);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    83
    BtnGo->setMinimumHeight(50);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    84
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
    85
    bottomLayout->addWidget(leRoomName);
7823
46f115569045 rollback of r08642c7da4a3b5e05be51a8b45995e799bbc4bbf ("add DLC button to net game room")
sheepluva
parents: 7794
diff changeset
    86
    BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1);
6173
6cb88fec7a79 fix netgame layout issues, I think all layout issues caused by page refactoring are fixed now, if you find any more let me know
sheepluva
parents: 6171
diff changeset
    87
6cb88fec7a79 fix netgame layout issues, I think all layout issues caused by page refactoring are fixed now, if you find any more let me know
sheepluva
parents: 6171
diff changeset
    88
    bottomLayout->addStretch();
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
    89
    bottomLayout->addWidget(BtnGo);
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
    90
7823
46f115569045 rollback of r08642c7da4a3b5e05be51a8b45995e799bbc4bbf ("add DLC button to net game room")
sheepluva
parents: 7794
diff changeset
    91
    BtnMaster = addButton(tr("Control"), bottomLayout, 3);
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
    92
    bottomLayout->insertStretch(3, 100);
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
    93
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    94
    const QIcon& lp = QIcon(":/res/Start.png");
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    95
    QSize sz = lp.actualSize(QSize(65535, 65535));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    96
    BtnStart = new QPushButton();
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    97
    BtnStart->setText(tr("Start"));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    98
    BtnStart->setMinimumWidth(sz.width() + 60);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
    99
    BtnStart->setIcon(lp);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   100
    BtnStart->setFixedHeight(50);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   101
    BtnStart->setIconSize(sz);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   102
    BtnStart->setFlat(true);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   103
    BtnStart->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   104
    bottomLayout->addWidget(BtnStart);
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
   105
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
   106
    return bottomLayout;
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
   107
}
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
   108
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
   109
void PageNetGame::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
   110
{
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
   111
    connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
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
   112
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
   113
    connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick()));
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
   114
}
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
   115
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   116
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent)
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
   117
{
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
   118
    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
   119
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   120
    QMenu * menu = new QMenu(BtnMaster);
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
   121
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   122
    restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   123
    restrictJoins->setCheckable(true);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   124
    restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   125
    restrictTeamAdds->setCheckable(true);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   126
    //menu->addAction(startGame);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   127
    menu->addAction(restrictJoins);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   128
    menu->addAction(restrictTeamAdds);
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
    BtnMaster->setMenu(menu);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   131
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   132
6180
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   133
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   134
void PageNetGame::displayError(const QString & message)
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   135
{
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   136
    chatWidget->displayError(message);
6180
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   137
}
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   138
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   139
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   140
void PageNetGame::displayNotice(const QString & message)
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   141
{
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   142
    chatWidget->displayNotice(message);
6180
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   143
}
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   144
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   145
void PageNetGame::displayWarning(const QString & message)
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   146
{
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   147
    chatWidget->displayWarning(message);
6180
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   148
}
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   149
0992fc5a4ad9 some changes to the css... display:none; works now (e.g. you can use it for user join/leave messages that are not your friends)
sheepluva
parents: 6173
diff changeset
   150
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   151
void PageNetGame::setReadyStatus(bool isReady)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   152
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   153
    if(isReady)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   154
        BtnGo->setIcon(QIcon(":/res/lightbulb_on.png"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   155
    else
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   156
        BtnGo->setIcon(QIcon(":/res/lightbulb_off.png"));
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   157
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   158
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   159
void PageNetGame::onUpdateClick()
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   160
{
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   161
    if (!leRoomName->text().trimmed().isEmpty())
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   162
    {
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   163
        emit askForUpdateRoomName(leRoomName->text());
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   164
        leRoomName->rememberCurrentText();
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   165
    }
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   166
    else
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   167
    {
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   168
        leRoomName->clear();
7794
ab7b94c03bc9 QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents: 7720
diff changeset
   169
        QMessageBox roomMsg(this);
ab7b94c03bc9 QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents: 7720
diff changeset
   170
        roomMsg.setIcon(QMessageBox::Warning);
ab7b94c03bc9 QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents: 7720
diff changeset
   171
        roomMsg.setWindowTitle(QMessageBox::tr("Netgame - Error"));
ab7b94c03bc9 QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents: 7720
diff changeset
   172
        roomMsg.setText(QMessageBox::tr("Please enter room name"));
ab7b94c03bc9 QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents: 7720
diff changeset
   173
        roomMsg.setWindowModality(Qt::WindowModal);
ab7b94c03bc9 QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents: 7720
diff changeset
   174
        roomMsg.exec();
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   175
    }
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   176
}
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   177
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   178
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   179
void PageNetGame::setRoomName(const QString & roomName)
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   180
{
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   181
    leRoomName->setText(roomName);
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   182
    leRoomName->rememberCurrentText();
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   183
}
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   184
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   185
void PageNetGame::setMasterMode(bool isMaster)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   186
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   187
    BtnMaster->setVisible(isMaster);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   188
    BtnStart->setVisible(isMaster);
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   189
    BtnUpdate->setVisible(isMaster);
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   190
    leRoomName->setVisible(isMaster);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   191
}
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6060
diff changeset
   192
6227
ce60b734fff1 update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents: 6200
diff changeset
   193
void PageNetGame::setUser(const QString & nickname)
ce60b734fff1 update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents: 6200
diff changeset
   194
{
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   195
    chatWidget->setUser(nickname);
6227
ce60b734fff1 update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents: 6200
diff changeset
   196
}