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