author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 12 Oct 2020 01:01:28 +0200 | |
changeset 15769 | ed3c5c15dcbd |
parent 14857 | b9437746bffb |
child 15900 | fc3cb23fd26f |
permissions | -rw-r--r-- |
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 | 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:
9999
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 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
19 |
#include <QVBoxLayout> |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
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 <QGridLayout> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
22 |
#include <QPushButton> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
23 |
#include <QComboBox> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
24 |
#include <QLabel> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
25 |
#include <QLineEdit> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
26 |
#include <QMessageBox> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
27 |
#include <QHeaderView> |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
28 |
#include <QGroupBox> |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
29 |
#include <QMenu> |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
30 |
#include <QDebug> |
9031 | 31 |
#include <QSplitter> |
13198
ceae8e01af98
Fix frontend from messing with legacy schemes.ini, just read it, never write
Wuzzy <Wuzzy2@mail.ru>
parents:
13197
diff
changeset
|
32 |
#include <QSettings> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
33 |
|
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
34 |
#include <QSortFilterProxyModel> |
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
35 |
|
6993
47830cf50574
room list: replace magic table column indexes with enum. makes future changes to the room list format way easier.
sheepluva
parents:
6991
diff
changeset
|
36 |
#include "roomslistmodel.h" |
47830cf50574
room list: replace magic table column indexes with enum. makes future changes to the room list format way easier.
sheepluva
parents:
6991
diff
changeset
|
37 |
|
13197
0bc5f618ca7c
Rename the misleadingly-named AmmoSchemeModel to GameSchemeModel
Wuzzy <Wuzzy2@mail.ru>
parents:
12897
diff
changeset
|
38 |
#include "gameSchemeModel.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
39 |
#include "hwconsts.h" |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
40 |
#include "chatwidget.h" |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
41 |
#include "roomnameprompt.h" |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
42 |
#include "lineeditcursor.h" |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
43 |
#include "pageroomslist.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
44 |
|
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
45 |
void RoomTableView::moveDown() |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
46 |
{ |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
47 |
setCurrentIndex(moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier)); |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
48 |
} |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
49 |
|
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
50 |
void RoomTableView::moveUp() |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
51 |
{ |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
52 |
setCurrentIndex(moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier)); |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
53 |
} |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
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 |
QLayout * PageRoomsList::bodyLayoutDefinition() |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
56 |
{ |
9999 | 57 |
// TODO move stylesheet stuff into css/qt.css |
58 |
||
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
59 |
QVBoxLayout * pageLayout = new QVBoxLayout(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
60 |
pageLayout->setSpacing(0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
61 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
62 |
QGridLayout * topLayout = new QGridLayout(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
63 |
topLayout->setSpacing(0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
64 |
pageLayout->addLayout(topLayout, 0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
65 |
|
9997 | 66 |
// State button |
67 |
||
68 |
QPushButton * btnState = new QPushButton(tr("Room state")); |
|
9999 | 69 |
btnState->setStyleSheet("QPushButton { background-color: #F6CB1C; border-color: #F6CB1C; color: #130F2A; padding: 1px 3px 3px 3px; margin: 0px; border-bottom: none; border-radius: 0px; border-top-left-radius: 10px; } QPushButton:hover { background-color: #FFEB3C; border-color: #F6CB1C; color: #000000 } QPushButton:pressed { background-color: #FFEB3C; border-color: #F6CB1C; color: #000000; }"); |
9997 | 70 |
btnState->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); |
71 |
||
72 |
// State menu |
|
73 |
||
74 |
QMenu * stateMenu = new QMenu(btnState); |
|
75 |
showGamesInLobby = new QAction(QAction::tr("Show games in lobby"), stateMenu); |
|
76 |
showGamesInLobby->setCheckable(true); |
|
77 |
showGamesInLobby->setChecked(true); |
|
78 |
showGamesInProgress = new QAction(QAction::tr("Show games in-progress"), stateMenu); |
|
79 |
showGamesInProgress->setCheckable(true); |
|
80 |
showGamesInProgress->setChecked(true); |
|
10743
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
81 |
showPassword = new QAction(QAction::tr("Show password protected"), stateMenu); |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
82 |
showPassword->setCheckable(true); |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
83 |
showPassword->setChecked(true); |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
84 |
showJoinRestricted = new QAction(QAction::tr("Show join restricted"), stateMenu); |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
85 |
showJoinRestricted->setCheckable(true); |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
86 |
showJoinRestricted->setChecked(true); |
9997 | 87 |
stateMenu->addAction(showGamesInLobby); |
88 |
stateMenu->addAction(showGamesInProgress); |
|
10803
df39aa3f6d4d
merge 0.9.21, hopefully without screwing anything up due to this having been left for a while + parallel commits that occurred...
nemo
parents:
10750
diff
changeset
|
89 |
stateMenu->addAction(showPassword); |
df39aa3f6d4d
merge 0.9.21, hopefully without screwing anything up due to this having been left for a while + parallel commits that occurred...
nemo
parents:
10750
diff
changeset
|
90 |
stateMenu->addAction(showJoinRestricted); |
9997 | 91 |
btnState->setMenu(stateMenu); |
92 |
||
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
93 |
// Help/prompt message at top |
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
|
94 |
QLabel * lblDesc = new QLabel(tr("Search for a room:")); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
95 |
lblDesc->setObjectName("lblDesc"); |
9999 | 96 |
lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; padding: 5px 10px 3px 6px;}"); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
97 |
lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
98 |
lblDesc->setFixedHeight(24); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
99 |
lblDesc->setMinimumWidth(0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
100 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
101 |
// Search text box |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
102 |
QWidget * searchContainer = new QWidget(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
103 |
searchContainer->setFixedHeight(24); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
104 |
searchContainer->setObjectName("searchContainer"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
105 |
searchContainer->setStyleSheet("#searchContainer { background: #F6CB1C; border-top-right-radius: 10px; padding: 3px; }"); |
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
|
106 |
searchContainer->setFixedWidth(200); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
107 |
searchText = new LineEditCursor(searchContainer); |
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
|
108 |
searchText->setFixedWidth(200); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
109 |
searchText->setMaxLength(60); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
110 |
searchText->setFixedHeight(22); |
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
|
111 |
searchText->setStyleSheet("LineEditCursor { border-width: 0px; border-radius: 6px; margin-top: 3px; margin-right: 3px; padding-left: 4px; padding-bottom: 2px; background-color: rgb(23, 11, 54); } LineEditCursor:hover, LineEditCursor:focus { background-color: rgb(13, 5, 68); }"); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
112 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
113 |
// Corner widget |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
114 |
QLabel * corner = new QLabel(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
115 |
corner->setPixmap(QPixmap(QString::fromUtf8(":/res/inverse-corner-bl.png"))); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
116 |
corner->setFixedSize(10, 10); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
117 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
118 |
const QIcon& lp = QIcon(":/res/new.png"); |
8637 | 119 |
//QSize sz = lp.actualSize(QSize(65535, 65535)); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
120 |
BtnCreate = new QPushButton(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
121 |
BtnCreate->setText(tr("Create room")); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
122 |
BtnCreate->setIcon(lp); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
123 |
BtnCreate->setStyleSheet("padding: 4px 8px; margin-bottom: 6px;"); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
124 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
125 |
BtnJoin = new QPushButton(tr("Join room")); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
126 |
BtnJoin->setStyleSheet("padding: 4px 8px; margin-bottom: 6px; margin-left: 6px;"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
127 |
BtnJoin->setEnabled(false); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
128 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
129 |
// Add widgets to top layout |
9997 | 130 |
topLayout->addWidget(btnState, 1, 0); |
131 |
topLayout->addWidget(lblDesc, 1, 1); |
|
132 |
topLayout->addWidget(searchContainer, 1, 2); |
|
133 |
topLayout->addWidget(corner, 1, 3, Qt::AlignBottom); |
|
134 |
topLayout->addWidget(BtnCreate, 0, 5, 2, 1); |
|
135 |
topLayout->addWidget(BtnJoin, 0, 6, 2, 1); |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
136 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
137 |
// Top layout stretch |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
138 |
topLayout->setRowStretch(0, 1); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
139 |
topLayout->setRowStretch(1, 0); |
9997 | 140 |
topLayout->setColumnStretch(4, 1); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
141 |
|
9031 | 142 |
// Rooms list and chat with splitter |
143 |
m_splitter = new QSplitter(); |
|
144 |
m_splitter->setChildrenCollapsible(false); |
|
145 |
pageLayout->addWidget(m_splitter, 100); |
|
146 |
||
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
147 |
// Room list |
9031 | 148 |
QWidget * roomsListWidget = new QWidget(this); |
149 |
m_splitter->setOrientation(Qt::Vertical); |
|
150 |
m_splitter->addWidget(roomsListWidget); |
|
151 |
||
152 |
QVBoxLayout * roomsLayout = new QVBoxLayout(roomsListWidget); |
|
153 |
roomsLayout->setMargin(0); |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
154 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
155 |
roomsList = new RoomTableView(this); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
156 |
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
157 |
roomsList->verticalHeader()->setVisible(false); |
12897
fc47fc4af6bd
Finish porting. Seems to work, but no thorough testing has been performed
unc0rr
parents:
12236
diff
changeset
|
158 |
roomsList->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); |
13325 | 159 |
roomsList->horizontalHeader()->stretchLastSection(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
160 |
roomsList->setAlternatingRowColors(true); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
161 |
roomsList->setShowGrid(false); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
162 |
roomsList->setSelectionMode(QAbstractItemView::SingleSelection); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
163 |
roomsList->setStyleSheet("QTableView { border-top-left-radius: 0px; }"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
164 |
roomsList->setFocusPolicy(Qt::NoFocus); |
9031 | 165 |
roomsLayout->addWidget(roomsList, 200); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
166 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
167 |
// Lobby chat |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
168 |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
169 |
chatWidget = new HWChatWidget(this, false); |
9031 | 170 |
m_splitter->addWidget(chatWidget); |
6146
c7c2dd71ced4
server lobby: don't stretch buttons right of the roomlist - instead let the roomlist use all the available space
sheepluva
parents:
6060
diff
changeset
|
171 |
|
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
|
172 |
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
|
173 |
} |
6009 | 174 |
|
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
|
175 |
QLayout * PageRoomsList::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
|
176 |
{ |
6172 | 177 |
QHBoxLayout * bottomLayout = new QHBoxLayout(); |
5259
926958e3e87b
display player count below and with label, just because it's funny to mess with unC0Rr's code and make him cry :P
sheepluva
parents:
5204
diff
changeset
|
178 |
|
11819
7642955690bc
Tweak sizes and icons of most footer buttons of frontend
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
179 |
BtnAdmin = addButton(tr("Admin features"), bottomLayout, 0, false, Qt::AlignBottom); |
7642955690bc
Tweak sizes and icons of most footer buttons of frontend
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
180 |
BtnAdmin->setMinimumSize(180, 50); |
12236
a0ed4caa6d35
Apply minimal padding to all text buttons in frontend
Wuzzy <almikes@aol.com>
parents:
11819
diff
changeset
|
181 |
BtnAdmin->setStyleSheet("padding: 5px 10px"); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
182 |
BtnAdmin->setWhatsThis(tr("Open server administration page")); |
5259
926958e3e87b
display player count below and with label, just because it's funny to mess with unC0Rr's code and make him cry :P
sheepluva
parents:
5204
diff
changeset
|
183 |
|
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
|
184 |
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
|
185 |
} |
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
|
186 |
|
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
|
187 |
void PageRoomsList::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
|
188 |
{ |
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
|
189 |
connect(chatWidget, SIGNAL(nickCountUpdate(const int)), this, SLOT(updateNickCounter(const int))); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
190 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
191 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
192 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
193 |
connect(searchText, SIGNAL(moveUp()), this, SLOT(moveSelectionUp())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
194 |
connect(searchText, SIGNAL(moveDown()), this, SLOT(moveSelectionDown())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
195 |
connect(searchText, SIGNAL(returnPressed()), this, SLOT(onJoinClick())); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
196 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
197 |
connect(roomsList, SIGNAL(clicked (const QModelIndex &)), searchText, SLOT(setFocus())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
198 |
connect(showGamesInLobby, SIGNAL(triggered()), this, SLOT(onFilterChanged())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
199 |
connect(showGamesInProgress, SIGNAL(triggered()), this, SLOT(onFilterChanged())); |
10743
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
200 |
connect(showPassword, SIGNAL(triggered()), this, SLOT(onFilterChanged())); |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
201 |
connect(showJoinRestricted, SIGNAL(triggered()), this, SLOT(onFilterChanged())); |
6995 | 202 |
connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onFilterChanged())); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
203 |
connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection); |
6995 | 204 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
205 |
// Set focus on search box |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
206 |
connect(this, SIGNAL(pageEnter()), searchText, SLOT(setFocus())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
207 |
|
6996 | 208 |
// sorting |
6995 | 209 |
connect(roomsList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), |
210 |
this, SLOT(onSortIndicatorChanged(int, Qt::SortOrder))); |
|
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
|
211 |
} |
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
|
212 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
213 |
void PageRoomsList::moveSelectionUp() |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
214 |
{ |
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
215 |
roomsList->moveUp(); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
216 |
} |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
217 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
218 |
void PageRoomsList::moveSelectionDown() |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
219 |
{ |
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8729
diff
changeset
|
220 |
roomsList->moveDown(); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
221 |
} |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
222 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
223 |
void PageRoomsList::roomSelectionChanged(const QModelIndex & current, const QModelIndex & previous) |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
224 |
{ |
9031 | 225 |
Q_UNUSED(previous); |
226 |
||
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
227 |
BtnJoin->setEnabled(current.isValid()); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
228 |
} |
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
|
229 |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
230 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
231 |
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
|
232 |
{ |
6995 | 233 |
roomsModel = NULL; |
234 |
stateFilteredModel = NULL; |
|
235 |
||
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
|
236 |
initPage(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
237 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
238 |
|
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:
6172
diff
changeset
|
239 |
|
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:
6172
diff
changeset
|
240 |
void PageRoomsList::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:
6172
diff
changeset
|
241 |
{ |
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:
6172
diff
changeset
|
242 |
chatWidget->displayError(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:
6172
diff
changeset
|
243 |
} |
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:
6172
diff
changeset
|
244 |
|
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:
6172
diff
changeset
|
245 |
|
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:
6172
diff
changeset
|
246 |
void PageRoomsList::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:
6172
diff
changeset
|
247 |
{ |
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:
6172
diff
changeset
|
248 |
chatWidget->displayNotice(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:
6172
diff
changeset
|
249 |
} |
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:
6172
diff
changeset
|
250 |
|
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:
6172
diff
changeset
|
251 |
void PageRoomsList::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:
6172
diff
changeset
|
252 |
{ |
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:
6172
diff
changeset
|
253 |
chatWidget->displayWarning(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:
6172
diff
changeset
|
254 |
} |
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:
6172
diff
changeset
|
255 |
|
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:
6172
diff
changeset
|
256 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
257 |
void PageRoomsList::setAdmin(bool flag) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
258 |
{ |
5283 | 259 |
BtnAdmin->setVisible(flag); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
260 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
261 |
|
6732
c906dc78091f
Start switching to rooms list model. To be continued.
unc0rr
parents:
6700
diff
changeset
|
262 |
/* |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
263 |
void PageRoomsList::setRoomsList(const QStringList & list) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
264 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
265 |
QBrush red(QColor(255, 0, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
266 |
QBrush orange(QColor(127, 127, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
267 |
QBrush yellow(QColor(255, 255, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
268 |
QBrush green(QColor(0, 255, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
269 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
270 |
listFromServer = list; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
271 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
272 |
QString selection = ""; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
273 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
274 |
if(QTableWidgetItem *item = roomsList->item(roomsList->currentRow(), 0)) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
275 |
selection = item->text(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
276 |
|
5283 | 277 |
roomsList->clear(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
278 |
roomsList->setColumnCount(7); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
279 |
roomsList->setHorizontalHeaderLabels( |
6732
c906dc78091f
Start switching to rooms list model. To be continued.
unc0rr
parents:
6700
diff
changeset
|
280 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
281 |
); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
282 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
283 |
// set minimum sizes |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
284 |
// roomsList->horizontalHeader()->resizeSection(0, 200); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
285 |
// roomsList->horizontalHeader()->resizeSection(1, 50); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
286 |
// roomsList->horizontalHeader()->resizeSection(2, 50); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
287 |
// roomsList->horizontalHeader()->resizeSection(3, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
288 |
// roomsList->horizontalHeader()->resizeSection(4, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
289 |
// roomsList->horizontalHeader()->resizeSection(5, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
290 |
// roomsList->horizontalHeader()->resizeSection(6, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
291 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
292 |
// set resize modes |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
293 |
// roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
294 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
295 |
bool gameCanBeJoined = true; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
296 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
297 |
if (list.size() % 8) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
298 |
return; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
299 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
300 |
roomsList->setRowCount(list.size() / 8); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
301 |
for(int i = 0, r = 0; i < list.size(); i += 8, r++) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
302 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
303 |
// if we are joining a game |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
304 |
// TODO: Should NOT be done here |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
305 |
if (gameInLobby) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
306 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
307 |
if (gameInLobbyName == list[i + 1]) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
308 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
309 |
gameCanBeJoined = list[i].compare("True"); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
310 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
311 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
312 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
313 |
// check filter settings |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
314 |
#define NO_FILTER_MATCH roomsList->setRowCount(roomsList->rowCount() - 1); --r; continue |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
315 |
|
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
316 |
if (list[i].compare("True") && CBState->currentIndex() == 2) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
317 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
318 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
319 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
320 |
if (list[i].compare("False") && CBState->currentIndex() == 1) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
321 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
322 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
323 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
324 |
if (CBRules->currentIndex() != 0 && list[i + 6].compare(CBRules->currentText())) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
325 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
326 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
327 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
328 |
if (CBWeapons->currentIndex() != 0 && list[i + 7].compare(CBWeapons->currentText())) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
329 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
330 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
331 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
332 |
bool found = list[i + 1].contains(searchText->text(), Qt::CaseInsensitive); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
333 |
if (!found) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
334 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
335 |
for (int a = 4; a <= 7; ++a) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
336 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
337 |
QString compString = list[i + a]; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
338 |
if (a == 5 && compString == "+rnd+") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
339 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
340 |
compString = "Random Map"; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
341 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
342 |
else if (a == 5 && compString == "+maze+") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
343 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
344 |
compString = "Random Maze"; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
345 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
346 |
else if (a == 5 && compString == "+drawn+") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
347 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
348 |
compString = "Drawn Map"; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
349 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
350 |
if (compString.contains(searchText->text(), Qt::CaseInsensitive)) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
351 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
352 |
found = true; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
353 |
break; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
354 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
355 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
356 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
357 |
if (!searchText->text().isEmpty() && !found) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
358 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
359 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
360 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
361 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
362 |
QTableWidgetItem * item; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
363 |
item = new QTableWidgetItem(list[i + 1]); // room name |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
364 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
365 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
366 |
// pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
367 |
if(list[i].compare("True")) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
368 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
369 |
item->setIcon(QIcon(":/res/iconTime.png"));// game is in lobby |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
370 |
item->setToolTip(tr("Waiting...")); |
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
371 |
item->setWhatsThis(tr("This game is in lobby: you may join and start playing once the game starts.")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
372 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
373 |
else |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
374 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
375 |
item->setIcon(QIcon(":/res/iconDamage.png"));// game has started |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
376 |
item->setToolTip(tr("In progress...")); |
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
377 |
item->setWhatsThis(tr("This game is in progress: you may join and spectate now but you'll have to wait for the game to end to start playing.")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
378 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
379 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
380 |
roomsList->setItem(r, 0, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
381 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
382 |
item = new QTableWidgetItem(list[i + 2]); // number of clients |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
383 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
384 |
item->setTextAlignment(Qt::AlignCenter); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
385 |
item->setWhatsThis(tr("There are %1 clients connected to this room.", "", list[i + 2].toInt()).arg(list[i + 2])); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
386 |
roomsList->setItem(r, 1, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
387 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
388 |
item = new QTableWidgetItem(list[i + 3]); // number of teams |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
389 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
390 |
item->setTextAlignment(Qt::AlignCenter); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
391 |
item->setWhatsThis(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3])); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
392 |
//Should we highlight "full" games? Might get misinterpreted |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
393 |
//if(list[i + 3].toInt() >= cMaxTeams) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
394 |
// item->setForeground(red); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
395 |
roomsList->setItem(r, 2, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
396 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
397 |
item = new QTableWidgetItem(list[i + 4].left(15)); // name of host |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
398 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
399 |
item->setWhatsThis(tr("%1 is the host. He may adjust settings and start the game.").arg(list[i + 4])); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
400 |
roomsList->setItem(r, 3, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
401 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
402 |
if(list[i + 5] == "+rnd+") |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
403 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
404 |
item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
405 |
// FIXME - need real icons. Disabling until then |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
406 |
// item->setIcon(QIcon(":/res/mapRandom.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
407 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
408 |
else if (list[i+5] == "+maze+") |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
409 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
410 |
item = new QTableWidgetItem(tr("Random Maze")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
411 |
// FIXME - need real icons. Disabling until then |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
412 |
// item->setIcon(QIcon(":/res/mapMaze.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
413 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
414 |
else |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
415 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
416 |
item = new QTableWidgetItem(list[i + 5]); // selected map |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
417 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
418 |
// check to see if we've got this map |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
419 |
// not perfect but a start |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
420 |
if(!mapList->contains(list[i + 5])) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
421 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
422 |
item->setForeground(red); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
423 |
item->setIcon(QIcon(":/res/mapMissing.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
424 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
425 |
else |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
426 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
427 |
// todo: mission icon? |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
428 |
// FIXME - need real icons. Disabling until then |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
429 |
// item->setIcon(QIcon(":/res/mapCustom.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
430 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
431 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
432 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
433 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
434 |
item->setWhatsThis(tr("Games may be played on precreated or randomized maps.")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
435 |
roomsList->setItem(r, 4, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
436 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
437 |
item = new QTableWidgetItem(list[i + 6].left(24)); // selected game scheme |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
438 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
439 |
item->setWhatsThis(tr("The Game Scheme defines general options and preferences like Round Time, Sudden Death or Vampirism.")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
440 |
roomsList->setItem(r, 5, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
441 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
442 |
item = new QTableWidgetItem(list[i + 7].left(24)); // selected weapon scheme |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
443 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
444 |
item->setWhatsThis(tr("The Weapon Scheme defines available weapons and their ammunition count.")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
445 |
roomsList->setItem(r, 6, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
446 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
447 |
if(!list[i + 1].compare(selection) && !selection.isEmpty()) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
448 |
roomsList->selectionModel()->setCurrentIndex(roomsList->model()->index(r, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
449 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
450 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
451 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
452 |
roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
453 |
roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
454 |
roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
455 |
roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
456 |
roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
457 |
roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
458 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
459 |
// TODO: Should NOT be done here |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
460 |
if (gameInLobby) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
461 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
462 |
gameInLobby = false; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
463 |
if (gameCanBeJoined) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
464 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
465 |
emit askForJoinRoom(gameInLobbyName); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
466 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
467 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
468 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
469 |
emit askJoinConfirmation(gameInLobbyName); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
470 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
471 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
472 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
473 |
// roomsList->resizeColumnsToContents(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
474 |
} |
6732
c906dc78091f
Start switching to rooms list model. To be continued.
unc0rr
parents:
6700
diff
changeset
|
475 |
*/ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
476 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
477 |
void PageRoomsList::onCreateClick() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
478 |
{ |
9541
312bb4384f33
- Frontend finally learns how to create passworded room
unc0rr
parents:
9080
diff
changeset
|
479 |
RoomNamePrompt prompt(this, m_gameSettings->value("frontend/lastroomname", QString()).toString()); |
312bb4384f33
- Frontend finally learns how to create passworded room
unc0rr
parents:
9080
diff
changeset
|
480 |
if(prompt.exec()) |
312bb4384f33
- Frontend finally learns how to create passworded room
unc0rr
parents:
9080
diff
changeset
|
481 |
onRoomNameChosen(prompt.getRoomName(), prompt.getPassword()); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
482 |
} |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
483 |
|
9541
312bb4384f33
- Frontend finally learns how to create passworded room
unc0rr
parents:
9080
diff
changeset
|
484 |
void PageRoomsList::onRoomNameChosen(const QString & roomName, const QString & password) |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
485 |
{ |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
486 |
if (!roomName.trimmed().isEmpty()) |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
487 |
{ |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
488 |
m_gameSettings->setValue("frontend/lastroomname", roomName); |
9541
312bb4384f33
- Frontend finally learns how to create passworded room
unc0rr
parents:
9080
diff
changeset
|
489 |
emit askForCreateRoom(roomName, password); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
490 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
491 |
else |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
492 |
{ |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
493 |
onCreateClick(); |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
494 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
495 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
496 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
497 |
void PageRoomsList::onJoinClick() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
498 |
{ |
6736 | 499 |
QModelIndexList mdl = roomsList->selectionModel()->selectedRows(); |
500 |
||
501 |
if(mdl.size() != 1) |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
502 |
{ |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
503 |
QMessageBox roomNameMsg(this); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
504 |
roomNameMsg.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:
7769
diff
changeset
|
505 |
roomNameMsg.setWindowTitle(QMessageBox::tr("Room Name - Error")); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
506 |
roomNameMsg.setText(QMessageBox::tr("Please select room from the list")); |
14857
b9437746bffb
Frontend: Force plain text mode for many message windows
Wuzzy <Wuzzy2@mail.ru>
parents:
13325
diff
changeset
|
507 |
roomNameMsg.setTextFormat(Qt::PlainText); |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
508 |
roomNameMsg.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:
7769
diff
changeset
|
509 |
roomNameMsg.exec(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
510 |
return; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
511 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
512 |
|
6736 | 513 |
bool gameInLobby = roomsList->model()->index(mdl[0].row(), 0).data().toString().compare("True"); |
514 |
QString roomName = roomsList->model()->index(mdl[0].row(), 1).data().toString(); |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
515 |
|
6736 | 516 |
if (!gameInLobby) |
517 |
emit askJoinConfirmation(roomName); |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
518 |
else |
9549 | 519 |
emit askForJoinRoom(roomName, QString()); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
520 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
521 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
522 |
void PageRoomsList::onRefreshClick() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
523 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
524 |
emit askForRoomList(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
525 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
526 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
527 |
void PageRoomsList::onJoinConfirmation(const QString & room) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
528 |
{ |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
529 |
|
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
530 |
QMessageBox reallyJoinMsg(this); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
531 |
reallyJoinMsg.setIcon(QMessageBox::Question); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
532 |
reallyJoinMsg.setWindowTitle(QMessageBox::tr("Room Name - Are you sure?")); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
533 |
reallyJoinMsg.setText(QMessageBox::tr("The game you are trying to join has started.\nDo you still want to join the room?")); |
14857
b9437746bffb
Frontend: Force plain text mode for many message windows
Wuzzy <Wuzzy2@mail.ru>
parents:
13325
diff
changeset
|
534 |
reallyJoinMsg.setTextFormat(Qt::PlainText); |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
535 |
reallyJoinMsg.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:
7769
diff
changeset
|
536 |
reallyJoinMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
537 |
|
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7769
diff
changeset
|
538 |
if (reallyJoinMsg.exec() == QMessageBox::Ok) |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
539 |
{ |
9549 | 540 |
emit askForJoinRoom(room, QString()); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
541 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
542 |
} |
5259
926958e3e87b
display player count below and with label, just because it's funny to mess with unC0Rr's code and make him cry :P
sheepluva
parents:
5204
diff
changeset
|
543 |
|
926958e3e87b
display player count below and with label, just because it's funny to mess with unC0Rr's code and make him cry :P
sheepluva
parents:
5204
diff
changeset
|
544 |
void PageRoomsList::updateNickCounter(int cnt) |
926958e3e87b
display player count below and with label, just because it's funny to mess with unC0Rr's code and make him cry :P
sheepluva
parents:
5204
diff
changeset
|
545 |
{ |
8729 | 546 |
setDefaultDescription(tr("%1 players online", 0, cnt).arg(cnt)); |
5259
926958e3e87b
display player count below and with label, just because it's funny to mess with unC0Rr's code and make him cry :P
sheepluva
parents:
5204
diff
changeset
|
547 |
} |
6227
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
548 |
|
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
549 |
void PageRoomsList::setUser(const QString & nickname) |
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
550 |
{ |
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
551 |
chatWidget->setUser(nickname); |
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
552 |
} |
6735 | 553 |
|
6995 | 554 |
void PageRoomsList::setModel(RoomsListModel * model) |
6735 | 555 |
{ |
6996 | 556 |
// filter chain: |
557 |
// model -> stateFilteredModel -> schemeFilteredModel -> |
|
558 |
// -> weaponsFilteredModel -> roomsModel (search filter+sorting) |
|
559 |
||
6995 | 560 |
if (roomsModel == NULL) |
561 |
{ |
|
562 |
roomsModel = new QSortFilterProxyModel(this); |
|
563 |
roomsModel->setDynamicSortFilter(true); |
|
564 |
roomsModel->setSortCaseSensitivity(Qt::CaseInsensitive); |
|
565 |
roomsModel->sort(RoomsListModel::StateColumn, Qt::AscendingOrder); |
|
566 |
||
567 |
stateFilteredModel = new QSortFilterProxyModel(this); |
|
568 |
||
569 |
stateFilteredModel->setDynamicSortFilter(true); |
|
570 |
||
571 |
roomsModel->setFilterKeyColumn(-1); // search in all columns |
|
572 |
stateFilteredModel->setFilterKeyColumn(RoomsListModel::StateColumn); |
|
573 |
||
574 |
roomsModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
|
575 |
||
9702 | 576 |
roomsModel->setSourceModel(stateFilteredModel); |
6995 | 577 |
|
6996 | 578 |
// let the table view display the last model in the filter chain |
579 |
roomsList->setModel(roomsModel); |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
580 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
581 |
// When the data changes |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
582 |
connect(roomsModel, SIGNAL(layoutChanged()), roomsList, SLOT(repaint())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
583 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
584 |
// When a selection changes |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
585 |
connect(roomsList->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(roomSelectionChanged(const QModelIndex &, const QModelIndex &))); |
6995 | 586 |
} |
587 |
||
6996 | 588 |
stateFilteredModel->setSourceModel(model); |
6735 | 589 |
|
590 |
QHeaderView * h = roomsList->horizontalHeader(); |
|
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
591 |
|
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
592 |
h->setSortIndicatorShown(true); |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
593 |
h->setSortIndicator(RoomsListModel::StateColumn, Qt::AscendingOrder); |
12897
fc47fc4af6bd
Finish porting. Seems to work, but no thorough testing has been performed
unc0rr
parents:
12236
diff
changeset
|
594 |
h->setSectionResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch); |
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
595 |
|
13201
25502e6b3e08
While the intent was good, saving column width/sort was unfortunately not handling the addition of new columns and old configs were losing columns. If this is restored, it should have some check on column with invalidation of config.
nemo
parents:
13198
diff
changeset
|
596 |
h->resizeSection(RoomsListModel::PlayerCountColumn, 32); |
25502e6b3e08
While the intent was good, saving column width/sort was unfortunately not handling the addition of new columns and old configs were losing columns. If this is restored, it should have some check on column with invalidation of config.
nemo
parents:
13198
diff
changeset
|
597 |
h->resizeSection(RoomsListModel::TeamCountColumn, 32); |
25502e6b3e08
While the intent was good, saving column width/sort was unfortunately not handling the addition of new columns and old configs were losing columns. If this is restored, it should have some check on column with invalidation of config.
nemo
parents:
13198
diff
changeset
|
598 |
h->resizeSection(RoomsListModel::OwnerColumn, 100); |
25502e6b3e08
While the intent was good, saving column width/sort was unfortunately not handling the addition of new columns and old configs were losing columns. If this is restored, it should have some check on column with invalidation of config.
nemo
parents:
13198
diff
changeset
|
599 |
h->resizeSection(RoomsListModel::MapColumn, 100); |
25502e6b3e08
While the intent was good, saving column width/sort was unfortunately not handling the addition of new columns and old configs were losing columns. If this is restored, it should have some check on column with invalidation of config.
nemo
parents:
13198
diff
changeset
|
600 |
h->resizeSection(RoomsListModel::SchemeColumn, 100); |
25502e6b3e08
While the intent was good, saving column width/sort was unfortunately not handling the addition of new columns and old configs were losing columns. If this is restored, it should have some check on column with invalidation of config.
nemo
parents:
13198
diff
changeset
|
601 |
h->resizeSection(RoomsListModel::WeaponsColumn, 100); |
6996 | 602 |
|
9702 | 603 |
// hide column used for filtering |
604 |
roomsList->hideColumn(RoomsListModel::StateColumn); |
|
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
605 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
606 |
roomsList->repaint(); |
6995 | 607 |
} |
6977 | 608 |
|
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
609 |
|
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
610 |
void PageRoomsList::onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order) |
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
611 |
{ |
6995 | 612 |
if (roomsModel == NULL) |
613 |
return; |
|
614 |
||
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
615 |
if (logicalIndex == 0) |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
616 |
{ |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
617 |
roomsModel->sort(0, Qt::AscendingOrder); |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
618 |
return; |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
619 |
} |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
620 |
|
6989
4c35e9cf6057
make column sorting three-state: asc -> dsc -> off/default (= by room state)
sheepluva
parents:
6988
diff
changeset
|
621 |
// three state sorting: asc -> dsc -> default (by room state) |
4c35e9cf6057
make column sorting three-state: asc -> dsc -> off/default (= by room state)
sheepluva
parents:
6988
diff
changeset
|
622 |
if ((order == Qt::AscendingOrder) && (logicalIndex == roomsModel->sortColumn())) |
6993
47830cf50574
room list: replace magic table column indexes with enum. makes future changes to the room list format way easier.
sheepluva
parents:
6991
diff
changeset
|
623 |
roomsList->horizontalHeader()->setSortIndicator( |
47830cf50574
room list: replace magic table column indexes with enum. makes future changes to the room list format way easier.
sheepluva
parents:
6991
diff
changeset
|
624 |
RoomsListModel::StateColumn, Qt::AscendingOrder); |
6989
4c35e9cf6057
make column sorting three-state: asc -> dsc -> off/default (= by room state)
sheepluva
parents:
6988
diff
changeset
|
625 |
else |
4c35e9cf6057
make column sorting three-state: asc -> dsc -> off/default (= by room state)
sheepluva
parents:
6988
diff
changeset
|
626 |
roomsModel->sort(logicalIndex, order); |
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
627 |
} |
6995 | 628 |
|
629 |
||
630 |
void PageRoomsList::onFilterChanged() |
|
631 |
{ |
|
632 |
if (roomsModel == NULL) |
|
633 |
return; |
|
634 |
||
9702 | 635 |
roomsModel->setFilterFixedString(searchText->text()); |
6995 | 636 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
637 |
bool stateLobby = showGamesInLobby->isChecked(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
638 |
bool stateProgress = showGamesInProgress->isChecked(); |
10743
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
639 |
bool statePassword = showPassword->isChecked(); |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
640 |
bool stateJoinRestricted = showJoinRestricted->isChecked(); |
6995 | 641 |
|
10743
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
642 |
QString filter; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
643 |
if (!stateLobby && !stateProgress) |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
644 |
filter = "O_o"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
645 |
else if (stateLobby && stateProgress && statePassword && stateJoinRestricted) |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
646 |
filter = ""; |
6995 | 647 |
else |
10743
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
648 |
{ |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
649 |
QString exclude = "[^"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
650 |
if (!stateProgress) exclude += "g"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
651 |
if (!statePassword) exclude += "p"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
652 |
if (!stateJoinRestricted) exclude += "j"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
653 |
exclude += "]*"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
654 |
if (stateProgress && statePassword && stateJoinRestricted) exclude = ".*"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
655 |
filter = "^" + exclude; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
656 |
if (!stateLobby) filter += "g" + exclude; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
657 |
filter += "$"; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
658 |
} |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
659 |
//qDebug() << filter; |
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
660 |
|
1d16c5414fee
Intent is to allow filtering by arbitrary flag combinations. This isn't actually working yet. No idea why. It seems it should. Tired though, so will look at it tomorrow.
nemo
parents:
10108
diff
changeset
|
661 |
stateFilteredModel->setFilterRegExp(filter); |
6995 | 662 |
} |
6996 | 663 |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
664 |
void PageRoomsList::setSettings(QSettings *settings) |
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
665 |
{ |
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
666 |
m_gameSettings = settings; |
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
667 |
} |