author | unc0rr |
Wed, 13 Feb 2013 23:00:57 +0400 | |
changeset 8504 | 9ff55b527d1b |
parent 8488 | e72f3398a28b |
child 8637 | bf63104605fe |
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 |
6952 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
4 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
8 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
13 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
17 |
*/ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
18 |
|
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> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
31 |
|
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
32 |
#include <QSortFilterProxyModel> |
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
33 |
|
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
|
34 |
#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
|
35 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
36 |
#include "ammoSchemeModel.h" |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
37 |
#include "hwconsts.h" |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
38 |
#include "chatwidget.h" |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
39 |
#include "roomnameprompt.h" |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
40 |
#include "lineeditcursor.h" |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
41 |
#include "pageroomslist.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
42 |
|
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
|
43 |
QLayout * PageRoomsList::bodyLayoutDefinition() |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
44 |
{ |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
45 |
QVBoxLayout * pageLayout = new QVBoxLayout(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
46 |
pageLayout->setSpacing(0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
47 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
48 |
QGridLayout * topLayout = new QGridLayout(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
49 |
topLayout->setSpacing(0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
50 |
pageLayout->addLayout(topLayout, 0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
51 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
52 |
// 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
|
53 |
QLabel * lblDesc = new QLabel(tr("Search for a room:")); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
54 |
lblDesc->setObjectName("lblDesc"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
55 |
lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
56 |
lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
57 |
lblDesc->setFixedHeight(24); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
58 |
lblDesc->setMinimumWidth(0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
59 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
60 |
// Search text box |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
61 |
QWidget * searchContainer = new QWidget(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
62 |
searchContainer->setFixedHeight(24); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
63 |
searchContainer->setObjectName("searchContainer"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
64 |
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
|
65 |
searchContainer->setFixedWidth(200); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
66 |
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
|
67 |
searchText->setFixedWidth(200); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
68 |
searchText->setMaxLength(60); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
72 |
// Corner widget |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
73 |
QLabel * corner = new QLabel(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
74 |
corner->setPixmap(QPixmap(QString::fromUtf8(":/res/inverse-corner-bl.png"))); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
75 |
corner->setFixedSize(10, 10); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
76 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
77 |
const QIcon& lp = QIcon(":/res/new.png"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
78 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
79 |
BtnCreate = new QPushButton(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
80 |
BtnCreate->setText(tr("Create room")); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
81 |
BtnCreate->setIcon(lp); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
82 |
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
|
83 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
84 |
BtnJoin = new QPushButton(tr("Join room")); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
85 |
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
|
86 |
BtnJoin->setEnabled(false); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
87 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
88 |
// Add widgets to top layout |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
89 |
topLayout->addWidget(lblDesc, 1, 0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
90 |
topLayout->addWidget(searchContainer, 1, 1); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
91 |
topLayout->addWidget(corner, 1, 2, Qt::AlignBottom); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
92 |
topLayout->addWidget(BtnCreate, 0, 4, 2, 1); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
93 |
topLayout->addWidget(BtnJoin, 0, 5, 2, 1); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
94 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
95 |
// Top layout stretch |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
96 |
topLayout->setRowStretch(0, 1); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
97 |
topLayout->setRowStretch(1, 0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
98 |
topLayout->setColumnStretch(3, 1); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
99 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
100 |
// Room list |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
101 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
102 |
roomsList = new RoomTableView(this); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
103 |
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
104 |
roomsList->verticalHeader()->setVisible(false); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
105 |
roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
106 |
roomsList->setAlternatingRowColors(true); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
107 |
roomsList->setShowGrid(false); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
108 |
roomsList->setSelectionMode(QAbstractItemView::SingleSelection); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
109 |
roomsList->setStyleSheet("QTableView { border-top-left-radius: 0px; }"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
110 |
roomsList->setFocusPolicy(Qt::NoFocus); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
111 |
pageLayout->addWidget(roomsList, 200); |
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 |
// Room filters container |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
114 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
115 |
QWidget * filtersContainer = new QWidget(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
116 |
filtersContainer->setMaximumWidth(800); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
117 |
filtersContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
6009 | 118 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
119 |
pageLayout->addSpacing(7); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
120 |
pageLayout->addWidget(filtersContainer, 0, Qt::AlignHCenter); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
121 |
pageLayout->addSpacing(7); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
122 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
123 |
QHBoxLayout * filterLayout = new QHBoxLayout(filtersContainer); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
124 |
filterLayout->setSpacing(0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
125 |
filterLayout->setMargin(0); |
6009 | 126 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
127 |
const int filterSpacing = 20; |
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 |
// State button |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6009
diff
changeset
|
130 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
131 |
QPushButton * btnState = new QPushButton(tr("Room state")); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
132 |
btnState->setStyleSheet("QPushButton { padding: 2px 4px; } QPushButton:pressed { background-color: #ffcc00; border-color: #ffcc00; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; color: #11084A; }"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
133 |
btnState->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
134 |
filterLayout->addWidget(btnState); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
135 |
filterLayout->addSpacing(filterSpacing); |
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 |
// State menu |
6009 | 138 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
139 |
QMenu * stateMenu = new QMenu(btnState); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
140 |
showGamesInLobby = new QAction(QAction::tr("Show games in lobby"), stateMenu); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
141 |
showGamesInLobby->setCheckable(true); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
142 |
showGamesInLobby->setChecked(true); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
143 |
showGamesInProgress = new QAction(QAction::tr("Show games in-progress"), stateMenu); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
144 |
showGamesInProgress->setCheckable(true); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
145 |
showGamesInProgress->setChecked(true); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
146 |
stateMenu->addAction(showGamesInLobby); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
147 |
stateMenu->addAction(showGamesInProgress); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
148 |
btnState->setMenu(stateMenu); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
149 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
150 |
// Rules dropdown |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
151 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
152 |
CBRules = new QComboBox(this); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
153 |
CBRules->setStyleSheet("QComboBox { border-top-left-radius: 0px; border-bottom-left-radius: 0px; border-left-width: 2px; }"); |
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 |
QLabel * ruleLabel = new QLabel(tr("Rules:"), this); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
156 |
ruleLabel->setFixedHeight(CBRules->height()); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
157 |
ruleLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
158 |
ruleLabel->setStyleSheet("border: solid; border-width: 3px; border-right-width: 0px; border-color: #ffcc00; border-top-left-radius: 10px; border-bottom-left-radius: 10px; background-color: rgba(13, 5, 68, 70%);"); |
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
|
159 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
160 |
filterLayout->addWidget(ruleLabel); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
161 |
filterLayout->addWidget(CBRules); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
162 |
filterLayout->addSpacing(filterSpacing); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
163 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
164 |
// Weapons dropdown |
6009 | 165 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
166 |
CBWeapons = new QComboBox(this); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
167 |
CBWeapons->setStyleSheet("QComboBox { border-top-left-radius: 0px; border-bottom-left-radius: 0px; border-left-width: 2px; }"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
168 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
169 |
QLabel * weaponLabel = new QLabel(tr("Weapons:"), this); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
170 |
weaponLabel->setFixedHeight(CBWeapons->height()); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
171 |
weaponLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
172 |
weaponLabel->setStyleSheet("border: solid; border-width: 3px; border-right-width: 0px; border-color: #ffcc00; border-top-left-radius: 10px; border-bottom-left-radius: 10px; background-color: rgba(13, 5, 68, 70%);"); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6009
diff
changeset
|
173 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
174 |
filterLayout->addWidget(weaponLabel); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
175 |
filterLayout->addWidget(CBWeapons); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
176 |
filterLayout->addSpacing(filterSpacing); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
177 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
178 |
// Clear filters button |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
179 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
180 |
BtnClear = addButton(tr("Clear filters"), filterLayout, 0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
181 |
weaponLabel->setFixedHeight(CBWeapons->height()); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
182 |
BtnClear->setStyleSheet("padding: 4px;"); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
183 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
184 |
// Lobby chat |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
185 |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
186 |
chatWidget = new HWChatWidget(this, false); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
187 |
pageLayout->addWidget(chatWidget, 350); |
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
|
188 |
|
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
|
189 |
CBRules->addItem(QComboBox::tr("Any")); |
6009 | 190 |
|
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
|
191 |
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
|
192 |
} |
6009 | 193 |
|
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
|
194 |
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
|
195 |
{ |
6172 | 196 |
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
|
197 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
198 |
BtnAdmin = addButton(tr("Admin features"), bottomLayout, 0); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
199 |
BtnAdmin->setStyleSheet("padding: 4px auto;"); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
200 |
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
|
201 |
|
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
|
202 |
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
|
203 |
} |
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
|
204 |
|
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
|
205 |
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
|
206 |
{ |
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
|
207 |
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
|
208 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
209 |
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
|
210 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
211 |
connect(BtnClear, SIGNAL(clicked()), this, SLOT(onClearClick())); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
212 |
connect(searchText, SIGNAL(moveUp()), this, SLOT(moveSelectionUp())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
213 |
connect(searchText, SIGNAL(moveDown()), this, SLOT(moveSelectionDown())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
214 |
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
|
215 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
216 |
connect(roomsList, SIGNAL(clicked (const QModelIndex &)), searchText, SLOT(setFocus())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
217 |
connect(showGamesInLobby, SIGNAL(triggered()), this, SLOT(onFilterChanged())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
218 |
connect(showGamesInProgress, SIGNAL(triggered()), this, SLOT(onFilterChanged())); |
6995 | 219 |
connect(CBRules, SIGNAL(currentIndexChanged (int)), this, SLOT(onFilterChanged())); |
220 |
connect(CBWeapons, SIGNAL(currentIndexChanged (int)), this, SLOT(onFilterChanged())); |
|
221 |
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
|
222 |
connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection); |
6995 | 223 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
224 |
// Set focus on search box |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
225 |
connect(this, SIGNAL(pageEnter()), searchText, SLOT(setFocus())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
226 |
|
6996 | 227 |
// sorting |
6995 | 228 |
connect(roomsList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), |
229 |
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
|
230 |
} |
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
|
231 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
232 |
void PageRoomsList::moveSelectionUp() |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
233 |
{ |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
234 |
roomsList->setCurrentIndex(roomsList->moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier)); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
235 |
} |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
236 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
237 |
void PageRoomsList::moveSelectionDown() |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
238 |
{ |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
239 |
roomsList->setCurrentIndex(roomsList->moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier)); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
240 |
} |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
241 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
242 |
void PageRoomsList::roomSelectionChanged(const QModelIndex & current, const QModelIndex & previous) |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
243 |
{ |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
244 |
BtnJoin->setEnabled(current.isValid()); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
245 |
} |
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
|
246 |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
247 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
248 |
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
|
249 |
{ |
6995 | 250 |
roomsModel = NULL; |
251 |
stateFilteredModel = NULL; |
|
252 |
schemeFilteredModel = NULL; |
|
253 |
weaponsFilteredModel = NULL; |
|
254 |
||
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
|
255 |
initPage(); |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6009
diff
changeset
|
256 |
|
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
|
257 |
// not the most elegant solution but it works |
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
|
258 |
ammoSchemeModel = new AmmoSchemeModel(this, NULL); |
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
|
259 |
for (int i = 0; i < ammoSchemeModel->predefSchemesNames.count(); i++) |
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
|
260 |
CBRules->addItem(ammoSchemeModel->predefSchemesNames.at(i).toAscii().constData()); |
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
|
261 |
|
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
|
262 |
CBWeapons->addItem(QComboBox::tr("Any")); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
263 |
for (int i = 0; i < cDefaultAmmos.count(); i++) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
264 |
{ |
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
|
265 |
QPair<QString,QString> ammo = cDefaultAmmos.at(i); |
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
|
266 |
CBWeapons->addItem(ammo.first.toAscii().constData()); |
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
|
267 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
268 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
269 |
|
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
|
270 |
|
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
|
271 |
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
|
272 |
{ |
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
|
273 |
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
|
274 |
} |
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
|
275 |
|
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
|
276 |
|
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
|
277 |
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
|
278 |
{ |
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
|
279 |
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
|
280 |
} |
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
|
281 |
|
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
|
282 |
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
|
283 |
{ |
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
|
284 |
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
|
285 |
} |
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
|
286 |
|
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
|
287 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
288 |
void PageRoomsList::setAdmin(bool flag) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
289 |
{ |
5283 | 290 |
BtnAdmin->setVisible(flag); |
5078
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 |
|
6732
c906dc78091f
Start switching to rooms list model. To be continued.
unc0rr
parents:
6700
diff
changeset
|
293 |
/* |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
294 |
void PageRoomsList::setRoomsList(const QStringList & list) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
295 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
296 |
QBrush red(QColor(255, 0, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
297 |
QBrush orange(QColor(127, 127, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
298 |
QBrush yellow(QColor(255, 255, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
299 |
QBrush green(QColor(0, 255, 0)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
300 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
301 |
listFromServer = list; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
302 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
303 |
QString selection = ""; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
304 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
305 |
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
|
306 |
selection = item->text(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
307 |
|
5283 | 308 |
roomsList->clear(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
309 |
roomsList->setColumnCount(7); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
310 |
roomsList->setHorizontalHeaderLabels( |
6732
c906dc78091f
Start switching to rooms list model. To be continued.
unc0rr
parents:
6700
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 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
314 |
// set minimum sizes |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
315 |
// roomsList->horizontalHeader()->resizeSection(0, 200); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
316 |
// roomsList->horizontalHeader()->resizeSection(1, 50); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
317 |
// roomsList->horizontalHeader()->resizeSection(2, 50); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
318 |
// roomsList->horizontalHeader()->resizeSection(3, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
319 |
// roomsList->horizontalHeader()->resizeSection(4, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
320 |
// roomsList->horizontalHeader()->resizeSection(5, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
321 |
// roomsList->horizontalHeader()->resizeSection(6, 100); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
322 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
323 |
// set resize modes |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
324 |
// roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
325 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
326 |
bool gameCanBeJoined = true; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
327 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
328 |
if (list.size() % 8) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
329 |
return; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
330 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
331 |
roomsList->setRowCount(list.size() / 8); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
332 |
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
|
333 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
334 |
// if we are joining a game |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
335 |
// 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
|
336 |
if (gameInLobby) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
337 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
338 |
if (gameInLobbyName == list[i + 1]) |
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 |
gameCanBeJoined = list[i].compare("True"); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
341 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
342 |
} |
6616
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 |
// check filter settings |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
345 |
#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
|
346 |
|
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
347 |
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
|
348 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
349 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
350 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
351 |
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
|
352 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
353 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
354 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
355 |
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
|
356 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
357 |
NO_FILTER_MATCH; |
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 |
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
|
360 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
361 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
362 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
363 |
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
|
364 |
if (!found) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
365 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
366 |
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
|
367 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
368 |
QString compString = list[i + a]; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
369 |
if (a == 5 && compString == "+rnd+") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
370 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
371 |
compString = "Random Map"; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
372 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
373 |
else if (a == 5 && compString == "+maze+") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
374 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
375 |
compString = "Random Maze"; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
376 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
377 |
else if (a == 5 && compString == "+drawn+") |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
378 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
379 |
compString = "Drawn Map"; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
380 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
381 |
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
|
382 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
383 |
found = true; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
384 |
break; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
385 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
386 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
387 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
388 |
if (!searchText->text().isEmpty() && !found) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
389 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
390 |
NO_FILTER_MATCH; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
391 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
392 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
393 |
QTableWidgetItem * item; |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
394 |
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
|
395 |
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
|
396 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
397 |
// 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
|
398 |
if(list[i].compare("True")) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
399 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
400 |
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
|
401 |
item->setToolTip(tr("Waiting...")); |
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
402 |
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
|
403 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
404 |
else |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
405 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
406 |
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
|
407 |
item->setToolTip(tr("In progress...")); |
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
408 |
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
|
409 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
410 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
411 |
roomsList->setItem(r, 0, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
412 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
413 |
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
|
414 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
415 |
item->setTextAlignment(Qt::AlignCenter); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
416 |
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
|
417 |
roomsList->setItem(r, 1, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
418 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
419 |
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
|
420 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
421 |
item->setTextAlignment(Qt::AlignCenter); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
422 |
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
|
423 |
//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
|
424 |
//if(list[i + 3].toInt() >= cMaxTeams) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
425 |
// item->setForeground(red); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
426 |
roomsList->setItem(r, 2, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
427 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
428 |
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
|
429 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
430 |
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
|
431 |
roomsList->setItem(r, 3, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
432 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
433 |
if(list[i + 5] == "+rnd+") |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
434 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
435 |
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
|
436 |
// 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
|
437 |
// item->setIcon(QIcon(":/res/mapRandom.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
438 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
439 |
else if (list[i+5] == "+maze+") |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
440 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
441 |
item = new QTableWidgetItem(tr("Random Maze")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
442 |
// 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
|
443 |
// item->setIcon(QIcon(":/res/mapMaze.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
444 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
445 |
else |
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 |
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
|
448 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
449 |
// 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
|
450 |
// not perfect but a start |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
451 |
if(!mapList->contains(list[i + 5])) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
452 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
453 |
item->setForeground(red); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
454 |
item->setIcon(QIcon(":/res/mapMissing.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
455 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
456 |
else |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
457 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
458 |
// todo: mission icon? |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
459 |
// 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
|
460 |
// item->setIcon(QIcon(":/res/mapCustom.png")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
461 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
462 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
463 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
464 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
465 |
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
|
466 |
roomsList->setItem(r, 4, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
467 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
468 |
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
|
469 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
470 |
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
|
471 |
roomsList->setItem(r, 5, item); |
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 |
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
|
474 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
475 |
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
|
476 |
roomsList->setItem(r, 6, item); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
477 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
478 |
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
|
479 |
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
|
480 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
481 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
482 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
483 |
roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
484 |
roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
485 |
roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
486 |
roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
487 |
roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
488 |
roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
489 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
490 |
// 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
|
491 |
if (gameInLobby) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
492 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
493 |
gameInLobby = false; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
494 |
if (gameCanBeJoined) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
495 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
496 |
emit askForJoinRoom(gameInLobbyName); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
497 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
498 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
499 |
{ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
500 |
emit askJoinConfirmation(gameInLobbyName); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
501 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
502 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
503 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
504 |
// roomsList->resizeColumnsToContents(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
505 |
} |
6732
c906dc78091f
Start switching to rooms list model. To be continued.
unc0rr
parents:
6700
diff
changeset
|
506 |
*/ |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
507 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
508 |
void PageRoomsList::onCreateClick() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
509 |
{ |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
510 |
RoomNamePrompt prompt(parentWidget()->parentWidget(), m_gameSettings->value("frontend/lastroomname", QString()).toString()); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
511 |
connect(&prompt, SIGNAL(roomNameChosen(const QString &)), this, SLOT(onRoomNameChosen(const QString &))); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
512 |
prompt.exec(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
513 |
} |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
514 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
515 |
void PageRoomsList::onRoomNameChosen(const QString & roomName) |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
516 |
{ |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
517 |
if (!roomName.trimmed().isEmpty()) |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
518 |
{ |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
519 |
m_gameSettings->setValue("frontend/lastroomname", roomName); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
520 |
emit askForCreateRoom(roomName); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
521 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
522 |
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
|
523 |
{ |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
524 |
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
|
525 |
} |
5078
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 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
528 |
void PageRoomsList::onJoinClick() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
529 |
{ |
6736 | 530 |
QModelIndexList mdl = roomsList->selectionModel()->selectedRows(); |
531 |
||
532 |
if(mdl.size() != 1) |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
533 |
{ |
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
|
534 |
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
|
535 |
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
|
536 |
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
|
537 |
roomNameMsg.setText(QMessageBox::tr("Please select room from the list")); |
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 |
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
|
539 |
roomNameMsg.exec(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
540 |
return; |
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 |
|
6736 | 543 |
bool gameInLobby = roomsList->model()->index(mdl[0].row(), 0).data().toString().compare("True"); |
544 |
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
|
545 |
|
6736 | 546 |
if (!gameInLobby) |
547 |
emit askJoinConfirmation(roomName); |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6227
diff
changeset
|
548 |
else |
6736 | 549 |
emit askForJoinRoom(roomName); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
550 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
551 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
552 |
void PageRoomsList::onRefreshClick() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
553 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
554 |
emit askForRoomList(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
555 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
556 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
557 |
void PageRoomsList::onClearClick() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
558 |
{ |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
559 |
showGamesInLobby->setChecked(true); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
560 |
showGamesInProgress->setChecked(true); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
561 |
CBRules->setCurrentIndex(0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
562 |
CBWeapons->setCurrentIndex(0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
563 |
searchText->clear(); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
564 |
searchText->setFocus(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
565 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
566 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
567 |
void PageRoomsList::onJoinConfirmation(const QString & room) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
568 |
{ |
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
|
569 |
|
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
|
570 |
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
|
571 |
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
|
572 |
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
|
573 |
reallyJoinMsg.setText(QMessageBox::tr("The game you are trying to join has started.\nDo you still want to join the room?")); |
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
|
574 |
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
|
575 |
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
|
576 |
|
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
|
577 |
if (reallyJoinMsg.exec() == QMessageBox::Ok) |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
578 |
{ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
579 |
emit askForJoinRoom(room); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
580 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
581 |
} |
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
|
582 |
|
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
|
583 |
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
|
584 |
{ |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
585 |
setDefautDescription(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
|
586 |
} |
6227
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
587 |
|
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
588 |
void PageRoomsList::setUser(const QString & nickname) |
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
589 |
{ |
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
590 |
chatWidget->setUser(nickname); |
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6180
diff
changeset
|
591 |
} |
6735 | 592 |
|
6995 | 593 |
void PageRoomsList::setModel(RoomsListModel * model) |
6735 | 594 |
{ |
6996 | 595 |
// filter chain: |
596 |
// model -> stateFilteredModel -> schemeFilteredModel -> |
|
597 |
// -> weaponsFilteredModel -> roomsModel (search filter+sorting) |
|
598 |
||
6995 | 599 |
if (roomsModel == NULL) |
600 |
{ |
|
601 |
roomsModel = new QSortFilterProxyModel(this); |
|
602 |
roomsModel->setDynamicSortFilter(true); |
|
603 |
roomsModel->setSortCaseSensitivity(Qt::CaseInsensitive); |
|
604 |
roomsModel->sort(RoomsListModel::StateColumn, Qt::AscendingOrder); |
|
605 |
||
606 |
stateFilteredModel = new QSortFilterProxyModel(this); |
|
607 |
schemeFilteredModel = new QSortFilterProxyModel(this); |
|
608 |
weaponsFilteredModel = new QSortFilterProxyModel(this); |
|
609 |
||
610 |
stateFilteredModel->setDynamicSortFilter(true); |
|
611 |
schemeFilteredModel->setDynamicSortFilter(true); |
|
612 |
weaponsFilteredModel->setDynamicSortFilter(true); |
|
613 |
||
614 |
roomsModel->setFilterKeyColumn(-1); // search in all columns |
|
615 |
stateFilteredModel->setFilterKeyColumn(RoomsListModel::StateColumn); |
|
616 |
schemeFilteredModel->setFilterKeyColumn(RoomsListModel::SchemeColumn); |
|
617 |
weaponsFilteredModel->setFilterKeyColumn(RoomsListModel::WeaponsColumn); |
|
618 |
||
619 |
roomsModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
|
620 |
schemeFilteredModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
|
621 |
weaponsFilteredModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
|
622 |
||
623 |
schemeFilteredModel->setSourceModel(stateFilteredModel); |
|
624 |
weaponsFilteredModel->setSourceModel(schemeFilteredModel); |
|
6996 | 625 |
roomsModel->setSourceModel(weaponsFilteredModel); |
6995 | 626 |
|
6996 | 627 |
// let the table view display the last model in the filter chain |
628 |
roomsList->setModel(roomsModel); |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
629 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
630 |
// When the data changes |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
631 |
connect(roomsModel, SIGNAL(layoutChanged()), roomsList, SLOT(repaint())); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
632 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
633 |
// When a selection changes |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
634 |
connect(roomsList->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(roomSelectionChanged(const QModelIndex &, const QModelIndex &))); |
6995 | 635 |
} |
636 |
||
6996 | 637 |
stateFilteredModel->setSourceModel(model); |
6735 | 638 |
|
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
|
639 |
roomsList->hideColumn(RoomsListModel::StateColumn); |
6736 | 640 |
|
6735 | 641 |
QHeaderView * h = roomsList->horizontalHeader(); |
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
642 |
|
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
643 |
h->setSortIndicatorShown(true); |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
644 |
h->setSortIndicator(RoomsListModel::StateColumn, Qt::AscendingOrder); |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
645 |
h->setResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch); |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
646 |
|
6996 | 647 |
if (!restoreHeaderState()) |
648 |
{ |
|
649 |
h->resizeSection(RoomsListModel::PlayerCountColumn, 32); |
|
650 |
h->resizeSection(RoomsListModel::TeamCountColumn, 32); |
|
651 |
h->resizeSection(RoomsListModel::OwnerColumn, 100); |
|
652 |
h->resizeSection(RoomsListModel::MapColumn, 100); |
|
653 |
h->resizeSection(RoomsListModel::SchemeColumn, 100); |
|
654 |
h->resizeSection(RoomsListModel::WeaponsColumn, 100); |
|
655 |
} |
|
656 |
||
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
657 |
|
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
658 |
// save header state on change |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
659 |
connect(roomsList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
660 |
this, SLOT(saveHeaderState())); |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
661 |
connect(roomsList->horizontalHeader(), SIGNAL(sectionResized(int, int, int)), |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
662 |
this, SLOT(saveHeaderState())); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
663 |
|
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
664 |
roomsList->repaint(); |
6995 | 665 |
} |
6977 | 666 |
|
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
667 |
|
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
668 |
void PageRoomsList::onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order) |
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
669 |
{ |
6995 | 670 |
if (roomsModel == NULL) |
671 |
return; |
|
672 |
||
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
673 |
if (logicalIndex == 0) |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
674 |
{ |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
675 |
roomsModel->sort(0, Qt::AscendingOrder); |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
676 |
return; |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
677 |
} |
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
678 |
|
6989
4c35e9cf6057
make column sorting three-state: asc -> dsc -> off/default (= by room state)
sheepluva
parents:
6988
diff
changeset
|
679 |
// 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
|
680 |
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
|
681 |
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
|
682 |
RoomsListModel::StateColumn, Qt::AscendingOrder); |
6989
4c35e9cf6057
make column sorting three-state: asc -> dsc -> off/default (= by room state)
sheepluva
parents:
6988
diff
changeset
|
683 |
else |
4c35e9cf6057
make column sorting three-state: asc -> dsc -> off/default (= by room state)
sheepluva
parents:
6988
diff
changeset
|
684 |
roomsModel->sort(logicalIndex, order); |
6987
e34415c77342
allow custom sorting of roomslist (by clicking on header sections)
sheepluva
parents:
6977
diff
changeset
|
685 |
} |
6995 | 686 |
|
687 |
||
688 |
void PageRoomsList::onFilterChanged() |
|
689 |
{ |
|
690 |
if (roomsModel == NULL) |
|
691 |
return; |
|
692 |
||
693 |
roomsModel->setFilterWildcard(QString("*%1*").arg(searchText->text())); |
|
694 |
||
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
695 |
bool stateLobby = showGamesInLobby->isChecked(); |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
696 |
bool stateProgress = showGamesInProgress->isChecked(); |
6995 | 697 |
|
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
698 |
if (stateLobby && stateProgress) |
6995 | 699 |
stateFilteredModel->setFilterWildcard("*"); // "any" |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
700 |
else if (stateLobby != stateProgress) |
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
701 |
stateFilteredModel->setFilterFixedString(QString(stateProgress)); |
6995 | 702 |
else |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8179
diff
changeset
|
703 |
stateFilteredModel->setFilterFixedString(QString("none")); // Basically, none. |
6995 | 704 |
|
705 |
if (CBRules->currentIndex() == 0) |
|
706 |
schemeFilteredModel->setFilterWildcard("*"); // "any" |
|
707 |
else |
|
708 |
schemeFilteredModel->setFilterWildcard( |
|
709 |
QString("*%1*").arg(CBRules->currentText())); |
|
710 |
||
711 |
if (CBWeapons->currentIndex() == 0) |
|
712 |
weaponsFilteredModel->setFilterWildcard("*"); // "any" |
|
713 |
else |
|
714 |
weaponsFilteredModel->setFilterWildcard( |
|
715 |
QString("*%1*").arg(CBWeapons->currentText())); |
|
716 |
} |
|
6996 | 717 |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
718 |
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
|
719 |
{ |
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
720 |
m_gameSettings = settings; |
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
721 |
} |
6996 | 722 |
|
723 |
bool PageRoomsList::restoreHeaderState() |
|
724 |
{ |
|
7003
e118ee168577
tweak how the header customization is stored in the settings file
sheepluva
parents:
6996
diff
changeset
|
725 |
if (!m_gameSettings->contains("frontend/roomslist_header")) |
6996 | 726 |
return false; |
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
727 |
return roomsList->horizontalHeader()->restoreState(QByteArray::fromBase64( |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
7794
diff
changeset
|
728 |
(m_gameSettings->value("frontend/roomslist_header").toByteArray()))); |
6996 | 729 |
} |
730 |
||
731 |
void PageRoomsList::saveHeaderState() |
|
732 |
{ |
|
7003
e118ee168577
tweak how the header customization is stored in the settings file
sheepluva
parents:
6996
diff
changeset
|
733 |
m_gameSettings->setValue("frontend/roomslist_header", |
7011
f6f09a0954ea
small tweaks/fixes to room list header saving and restore...
sheepluva
parents:
7003
diff
changeset
|
734 |
QString(roomsList->horizontalHeader()->saveState().toBase64())); |
6996 | 735 |
} |