QTfrontend/ui/page/pagenetgame.cpp
author alfadur
Wed, 22 May 2019 22:42:20 +0300
changeset 15030 dc4a12a84c92
parent 13703 9b73f079e811
permissions -rw-r--r--
remove RangeContains in favor of standard contains
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
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10108
diff changeset
     3
 * Copyright (c) 2004-2015 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
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 9998
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
5078
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>
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
    25
#include <QSettings>
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    26
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5126
diff changeset
    27
#include "pagenetgame.h"
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    28
#include "gamecfgwidget.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    29
#include "teamselect.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    30
#include "chatwidget.h"
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    31
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
    32
const int cutoffHeight = 688; /* Don't make this number below 605, or else it'll
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
    33
                                 let the GameCFGWidget shrink too much before switching to tabbed mode. */
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
    34
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
    35
QLayout * PageNetGame::bodyLayoutDefinition()
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    36
{
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
    37
    QGridLayout * pageLayout = new QGridLayout();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    38
    pageLayout->setSizeConstraint(QLayout::SetMinimumSize);
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    39
    pageLayout->setColumnStretch(0, 1);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    40
    pageLayout->setColumnStretch(1, 1);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    41
    pageLayout->setRowStretch(0, 0);
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
    42
    pageLayout->setRowStretch(1, 0);
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    43
    pageLayout->setRowStretch(2, 1);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    44
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    45
    // Room config
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    46
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    47
    QHBoxLayout * roomConfigLayout = new QHBoxLayout();
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    48
    pageLayout->addLayout(roomConfigLayout, 0, 0, 1, 2);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    49
    roomConfigLayout->setSpacing(0);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    50
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    51
    leRoomName = new HistoryLineEdit(this, 10);
11817
92b3b0fcb41f Add more What's This? texts throughout the frontend
Wuzzy <almikes@aol.com>
parents: 11816
diff changeset
    52
    leRoomName->setWhatsThis(tr("Room name"));
12850
b63ec501490b At the very least we should match the gameserver length which seems to be 40, not 60
nemo
parents: 11824
diff changeset
    53
    leRoomName->setMaxLength(40);
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    54
    leRoomName->setMinimumWidth(400);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    55
    leRoomName->setMaximumWidth(600);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    56
    leRoomName->setFixedHeight(30);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    57
    leRoomName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
8488
e72f3398a28b Removed in-lineedit labels such as "search:" and "room name:" due to size issues with localization and platform differences.
dag10
parents: 8453
diff changeset
    58
    leRoomName->setStyleSheet("border-right: 0; padding-left: 4px; border-top-right-radius: 0px; border-bottom-right-radius: 0px;");
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    59
    roomConfigLayout->addWidget(leRoomName, 100);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    60
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    61
    BtnUpdate = new QPushButton();
11817
92b3b0fcb41f Add more What's This? texts throughout the frontend
Wuzzy <almikes@aol.com>
parents: 11816
diff changeset
    62
    BtnUpdate->setWhatsThis(tr("Update the room name"));
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    63
    BtnUpdate->setEnabled(false);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    64
    BtnUpdate->setText(tr("Update"));
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    65
    BtnUpdate->setFixedHeight(leRoomName->height() - 0);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    66
    BtnUpdate->setStyleSheet("border-top-left-radius: 0px; border-bottom-left-radius: 0px; padding: auto 4px;");
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    67
    roomConfigLayout->addWidget(BtnUpdate, 0);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    68
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    69
    lblRoomNameReadOnly = new QLabel();
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    70
    lblRoomNameReadOnly->setMinimumWidth(400);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    71
    lblRoomNameReadOnly->setMaximumWidth(600);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    72
    lblRoomNameReadOnly->setFixedHeight(30);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    73
    lblRoomNameReadOnly->setObjectName("labelLikeLineEdit");
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    74
    lblRoomNameReadOnly->setStyleSheet("font: 12px;");
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    75
    lblRoomNameReadOnly->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    76
    lblRoomNameReadOnly->setVisible(false);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    77
    roomConfigLayout->addWidget(lblRoomNameReadOnly, 100);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    78
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    79
    roomConfigLayout->addSpacing(10);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    80
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    81
    BtnMaster = new QPushButton();
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    82
    BtnMaster->setText(tr("Room controls"));
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    83
    BtnMaster->setFixedHeight(leRoomName->height() - 0);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    84
    BtnMaster->setStyleSheet("QPushButton { padding: auto 4px; } QPushButton:pressed { background-color: #ffcc00; border-color: #ffcc00; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; color: #11084A; }");
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    85
    roomConfigLayout->addWidget(BtnMaster, 0);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    86
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    87
    roomConfigLayout->addStretch(1);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    88
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    89
    // Game config
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    90
11762
6874644a2d00 in non-local games, don't include DLC-themes/maps/missions during random selection. thanks to unC0Rr for helping me realize that I was stupid in a different way than I thought :P
sheepluva
parents: 11046
diff changeset
    91
    pGameCFG = new GameCFGWidget(this, true);
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    92
    pageLayout->addWidget(pGameCFG, 1, 0);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    93
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
    94
    // Teams
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    95
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    96
    pNetTeamsWidget = new TeamSelWidget(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    97
    pNetTeamsWidget->setAcceptOuter(true);
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
    98
    pNetTeamsWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
    99
    pageLayout->addWidget(pNetTeamsWidget, 1, 1);
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   100
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   101
    // Chat
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8430
diff changeset
   102
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   103
    chatWidget = new HWChatWidget(this, true);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   104
    chatWidget->setShowFollow(false); // don't show follow in nicks' context menus
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   105
    chatWidget->setIgnoreListKick(true); // kick ignored players automatically
8430
5a5c34a75e1a Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
dag10
parents: 8424
diff changeset
   106
    chatWidget->setMinimumHeight(50);
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   107
    chatWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   108
    pageLayout->addWidget(chatWidget, 2, 0, 1, 2);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   109
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
   110
    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
   111
}
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   112
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   113
QLayout * PageNetGame::footerLayoutLeftDefinition()
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   114
{
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   115
    QHBoxLayout * bottomLeftLayout = new QHBoxLayout();
11824
7642955690bc Tweak sizes and icons of most footer buttons of frontend
Wuzzy <almikes@aol.com>
parents: 11823
diff changeset
   116
    bottomLeftLayout->setContentsMargins(0,0,0,0);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8430
diff changeset
   117
11823
b421923c2577 Neatly align all the bottom buttons on the same height
Wuzzy <almikes@aol.com>
parents: 11817
diff changeset
   118
    btnSetup = addButton(":/res/Settings.png", bottomLeftLayout, 0, true, Qt::AlignBottom);
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   119
    btnSetup->setWhatsThis(tr("Edit game preferences"));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   120
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   121
    return bottomLeftLayout;
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   122
}
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   123
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
   124
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
   125
{
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
   126
    QHBoxLayout * bottomLayout = new QHBoxLayout;
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   127
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   128
    // Ready button
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   129
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   130
    BtnGo = new QPushButton(this);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   131
    BtnGo->setIconSize(QSize(25, 34));
11817
92b3b0fcb41f Add more What's This? texts throughout the frontend
Wuzzy <almikes@aol.com>
parents: 11816
diff changeset
   132
    BtnGo->setWhatsThis(tr("Turn on the lightbulb to show the other players when you're ready to fight"));
11814
f412d539284e Add various “What's This?” texts to multiplayer, net and team editor frontend pages
Wuzzy <almikes@aol.com>
parents: 11762
diff changeset
   133
    setReadyStatus(false);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   134
    BtnGo->setMinimumWidth(50);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   135
    BtnGo->setMinimumHeight(50);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   136
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
   137
    bottomLayout->addStretch();
11824
7642955690bc Tweak sizes and icons of most footer buttons of frontend
Wuzzy <almikes@aol.com>
parents: 11823
diff changeset
   138
    bottomLayout->addWidget(BtnGo, 0, Qt::AlignBottom);
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
   139
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   140
    // Start button
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
   141
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   142
    const QIcon& lp = QIcon(":/res/Start.png");
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   143
    QSize sz = lp.actualSize(QSize(65535, 65535));
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   144
    BtnStart = new QPushButton();
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   145
    BtnStart->setText(tr("Start"));
13703
9b73f079e811 Properly scale Start button size in pagenetgame just like in pagemultiplayer
Wuzzy <Wuzzy2@mail.ru>
parents: 13694
diff changeset
   146
    BtnStart->setStyleSheet("padding: 5px 10px");
11817
92b3b0fcb41f Add more What's This? texts throughout the frontend
Wuzzy <almikes@aol.com>
parents: 11816
diff changeset
   147
    BtnStart->setWhatsThis(tr("Start fighting (requires at least 2 teams)"));
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   148
    BtnStart->setIcon(lp);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   149
    BtnStart->setFixedHeight(50);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   150
    BtnStart->setIconSize(sz);
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents: 8179
diff changeset
   151
    BtnStart->setFlat(true);
13703
9b73f079e811 Properly scale Start button size in pagenetgame just like in pagemultiplayer
Wuzzy <Wuzzy2@mail.ru>
parents: 13694
diff changeset
   152
    BtnStart->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
11824
7642955690bc Tweak sizes and icons of most footer buttons of frontend
Wuzzy <almikes@aol.com>
parents: 11823
diff changeset
   153
    bottomLayout->addWidget(BtnStart, 0, Qt::AlignBottom);
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
   154
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
   155
    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
   156
}
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
   157
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
   158
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
   159
{
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
   160
    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
   161
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
   162
    connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick()));
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   163
    connect(leRoomName, SIGNAL(returnPressed()), this, SLOT(onUpdateClick()));
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   164
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   165
    connect(leRoomName, SIGNAL(textChanged(const QString &)), this, SLOT(onRoomNameEdited()));
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
   166
}
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
   167
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   168
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
   169
{
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
   170
    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
   171
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   172
    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
   173
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   174
    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
   175
    restrictJoins->setCheckable(true);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   176
    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
   177
    restrictTeamAdds->setCheckable(true);
8559
29e420194558 Support 'registered only' room flag in frontend
unc0rr
parents: 8488
diff changeset
   178
    restrictUnregistered = new QAction(QAction::tr("Restrict Unregistered Players Join"), menu);
29e420194558 Support 'registered only' room flag in frontend
unc0rr
parents: 8488
diff changeset
   179
    restrictUnregistered->setCheckable(true);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   180
    menu->addAction(restrictJoins);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   181
    menu->addAction(restrictTeamAdds);
8559
29e420194558 Support 'registered only' room flag in frontend
unc0rr
parents: 8488
diff changeset
   182
    menu->addAction(restrictUnregistered);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   183
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   184
    BtnMaster->setMenu(menu);
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   185
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   186
    if (height() < cutoffHeight)
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   187
        pGameCFG->setTabbed(true);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   188
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   189
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   190
void PageNetGame::resizeEvent(QResizeEvent * event)
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   191
{
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   192
    int oldHeight = event->oldSize().height();
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   193
    int newHeight = event->size().height();
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   194
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   195
    if (newHeight < cutoffHeight && oldHeight >= cutoffHeight)
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   196
    {
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   197
        pGameCFG->setTabbed(true);
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   198
    }
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   199
    else if (newHeight >= cutoffHeight && oldHeight < cutoffHeight)
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   200
    {
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   201
        pGameCFG->setTabbed(false);
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   202
    }
8424
225ede46e3dc On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents: 8415
diff changeset
   203
}
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
   204
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
   205
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
   206
{
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   207
    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
   208
}
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
   209
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
   210
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
   211
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
   212
{
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   213
    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
   214
}
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
   215
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
   216
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
   217
{
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   218
    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
   219
}
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
   220
13694
27e5e311c7a3 Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents: 12850
diff changeset
   221
void PageNetGame::cleanupFakeNetTeams()
27e5e311c7a3 Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents: 12850
diff changeset
   222
{
27e5e311c7a3 Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents: 12850
diff changeset
   223
    pNetTeamsWidget->cleanupFakeNetTeams();
27e5e311c7a3 Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents: 12850
diff changeset
   224
}
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
   225
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   226
void PageNetGame::setReadyStatus(bool isReady)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   227
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   228
    if(isReady)
11814
f412d539284e Add various “What's This?” texts to multiplayer, net and team editor frontend pages
Wuzzy <almikes@aol.com>
parents: 11762
diff changeset
   229
    {
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   230
        BtnGo->setIcon(QIcon(":/res/lightbulb_on.png"));
11814
f412d539284e Add various “What's This?” texts to multiplayer, net and team editor frontend pages
Wuzzy <almikes@aol.com>
parents: 11762
diff changeset
   231
    }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   232
    else
11814
f412d539284e Add various “What's This?” texts to multiplayer, net and team editor frontend pages
Wuzzy <almikes@aol.com>
parents: 11762
diff changeset
   233
    {
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   234
        BtnGo->setIcon(QIcon(":/res/lightbulb_off.png"));
11814
f412d539284e Add various “What's This?” texts to multiplayer, net and team editor frontend pages
Wuzzy <almikes@aol.com>
parents: 11762
diff changeset
   235
    }
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   236
}
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   237
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   238
void PageNetGame::onRoomNameEdited()
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   239
{
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   240
    BtnUpdate->setEnabled(true);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   241
}
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   242
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   243
void PageNetGame::onUpdateClick()
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   244
{
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
   245
    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
   246
    {
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   247
        m_gameSettings->setValue("frontend/lastroomname", 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
   248
        leRoomName->rememberCurrentText();
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   249
        BtnUpdate->setEnabled(false);
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   250
        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
   251
    }
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   252
    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
   253
    {
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
   254
        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
   255
        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
   256
        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
   257
        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
   258
        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
   259
        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
   260
        roomMsg.exec();
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   261
        leRoomName->setFocus();
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
   262
    }
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
   263
}
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
   264
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
   265
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
   266
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
   267
{
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
   268
    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
   269
    leRoomName->rememberCurrentText();
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   270
    lblRoomNameReadOnly->setText(roomName);
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   271
    BtnUpdate->setEnabled(false);
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   272
}
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   273
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   274
void PageNetGame::setMasterMode(bool isMaster)
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   275
{
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   276
    BtnMaster->setVisible(isMaster);
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   277
    BtnStart->setVisible(isMaster);
5126
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   278
    BtnUpdate->setVisible(isMaster);
50803f3403a5 Frontend: room rename
claymore
parents: 5078
diff changeset
   279
    leRoomName->setVisible(isMaster);
8415
02acf6b92f52 Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents: 8382
diff changeset
   280
    lblRoomNameReadOnly->setVisible(!isMaster);
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   281
    pGameCFG->setMaster(isMaster);
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   282
    repaint();
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
   283
}
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
   284
6227
ce60b734fff1 update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents: 6200
diff changeset
   285
void PageNetGame::setUser(const QString & nickname)
ce60b734fff1 update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents: 6200
diff changeset
   286
{
13694
27e5e311c7a3 Fix critical failure to cleanup teams list after rejoining game after a force-quit. Fixes bug 597
Wuzzy <Wuzzy2@mail.ru>
parents: 12850
diff changeset
   287
    pNetTeamsWidget->setUser(nickname);
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7853
diff changeset
   288
    chatWidget->setUser(nickname);
6227
ce60b734fff1 update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents: 6200
diff changeset
   289
}
8453
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   290
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   291
void PageNetGame::setSettings(QSettings *settings)
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   292
{
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   293
    m_gameSettings = settings;
06541556df53 Reorganized layout and appearance of rooms list page.
dag10
parents: 8434
diff changeset
   294
}