author | Wuzzy <almikes@aol.com> |
Thu, 27 Apr 2017 01:46:28 +0200 | |
changeset 12349 | 7535da917696 |
parent 12305 | d3a52e51efd4 |
child 12633 | a791a08062d6 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10017
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
184 | 17 |
*/ |
18 |
||
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
19 |
#include <QDir> |
184 | 20 |
#include <QFile> |
21 |
#include <QTextStream> |
|
407 | 22 |
#include <QMessageBox> |
502
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
23 |
#include <QPushButton> |
8415
02acf6b92f52
Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents:
8407
diff
changeset
|
24 |
#include <QSpinBox> |
502
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
25 |
#include <QListWidget> |
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
26 |
#include <QStackedLayout> |
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
27 |
#include <QLineEdit> |
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
28 |
#include <QLabel> |
636 | 29 |
#include <QRadioButton> |
654 | 30 |
#include <QSpinBox> |
674 | 31 |
#include <QCloseEvent> |
1235 | 32 |
#include <QCheckBox> |
1377 | 33 |
#include <QTextBrowser> |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
34 |
#include <QAction> |
1418 | 35 |
#include <QTimer> |
1419 | 36 |
#include <QScrollBar> |
1885 | 37 |
#include <QDataWidgetMapper> |
1887 | 38 |
#include <QTableView> |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2845
diff
changeset
|
39 |
#include <QCryptographicHash> |
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
40 |
#include <QSignalMapper> |
4759 | 41 |
#include <QShortcut> |
5651
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
42 |
#include <QDesktopServices> |
8328 | 43 |
#include <QDesktopWidget> |
44 |
#include <QApplication> |
|
5734 | 45 |
#include <QInputDialog> |
6428 | 46 |
#include <QPropertyAnimation> |
6604
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
47 |
#include <QSettings> |
8891
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
48 |
#include <QSortFilterProxyModel> |
11863 | 49 |
#include <QIcon> |
50 |
#include <QImage> |
|
6604
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
51 |
|
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
52 |
#if (QT_VERSION >= 0x040600) |
6428 | 53 |
#include <QGraphicsEffect> |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
54 |
#include <QParallelAnimationGroup> |
6604
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
55 |
#endif |
184 | 56 |
|
57 |
#include "hwform.h" |
|
58 |
#include "game.h" |
|
59 |
#include "team.h" |
|
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
60 |
#include "campaign.h" |
184 | 61 |
#include "teamselect.h" |
681 | 62 |
#include "selectWeapon.h" |
184 | 63 |
#include "gameuiconfig.h" |
5204 | 64 |
#include "pageinfo.h" |
65 |
#include "pagetraining.h" |
|
66 |
#include "pagesingleplayer.h" |
|
67 |
#include "pageselectweapon.h" |
|
68 |
#include "pageadmin.h" |
|
69 |
#include "pagecampaign.h" |
|
70 |
#include "pagescheme.h" |
|
71 |
#include "pagenetgame.h" |
|
72 |
#include "pageroomslist.h" |
|
73 |
#include "pageconnecting.h" |
|
74 |
#include "pageoptions.h" |
|
75 |
#include "pageeditteam.h" |
|
76 |
#include "pagemultiplayer.h" |
|
77 |
#include "pagenet.h" |
|
78 |
#include "pagemain.h" |
|
79 |
#include "pagenetserver.h" |
|
80 |
#include "pagedrawmap.h" |
|
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
81 |
#include "pagegamestats.h" |
5567
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5255
diff
changeset
|
82 |
#include "pageplayrecord.h" |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5255
diff
changeset
|
83 |
#include "pagedata.h" |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
84 |
#include "pagevideos.h" |
184 | 85 |
#include "hwconsts.h" |
314 | 86 |
#include "newnetclient.h" |
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
328
diff
changeset
|
87 |
#include "gamecfgwidget.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
625
diff
changeset
|
88 |
#include "netserverslist.h" |
634 | 89 |
#include "netudpserver.h" |
461 | 90 |
#include "chatwidget.h" |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
91 |
#include "input_ip.h" |
6910
ea058558c68b
add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
6907
diff
changeset
|
92 |
#include "input_password.h" |
1885 | 93 |
#include "ammoSchemeModel.h" |
2012 | 94 |
#include "bgwidget.h" |
4520
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
95 |
#include "drawmapwidget.h" |
6477 | 96 |
#include "mouseoverfilter.h" |
6732
c906dc78091f
Start switching to rooms list model. To be continued.
unc0rr
parents:
6720
diff
changeset
|
97 |
#include "roomslistmodel.h" |
7180 | 98 |
#include "recorder.h" |
7723 | 99 |
#include "playerslistmodel.h" |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
100 |
#include "feedbackdialog.h" |
184 | 101 |
|
8383 | 102 |
#include "MessageDialog.h" |
6930 | 103 |
#include "DataManager.h" |
8284 | 104 |
#include "AutoUpdater.h" |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6151
diff
changeset
|
105 |
|
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9100
diff
changeset
|
106 |
#ifdef Q_OS_WIN |
11803 | 107 |
#ifndef WINVER |
8328 | 108 |
#define WINVER 0x0500 |
11803 | 109 |
#endif |
8328 | 110 |
#include <windows.h> |
111 |
#else |
|
112 |
#include <unistd.h> |
|
113 |
#include <sys/types.h> |
|
114 |
#endif |
|
115 |
||
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9100
diff
changeset
|
116 |
#ifdef Q_OS_MAC |
8328 | 117 |
#include <sys/sysctl.h> |
118 |
#endif |
|
119 |
||
2400
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
120 |
#ifdef __APPLE__ |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
121 |
#include "M3Panel.h" |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
122 |
#ifdef SPARKLE_ENABLED |
2261 | 123 |
#include "SparkleAutoUpdater.h" |
124 |
#endif |
|
2400
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
125 |
#endif |
2261 | 126 |
|
6561 | 127 |
|
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2080
diff
changeset
|
128 |
// I started handing this down to each place it touches, but it was getting ridiculous |
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2080
diff
changeset
|
129 |
// and this one flag does not warrant a static class |
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2080
diff
changeset
|
130 |
bool frontendEffects = true; |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2845
diff
changeset
|
131 |
QString playerHash; |
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2080
diff
changeset
|
132 |
|
11950
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
133 |
QIcon finishedIcon; |
11978
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
134 |
QIcon notFinishedIcon; |
6572 | 135 |
GameUIConfig* HWForm::config = NULL; |
136 |
||
5849 | 137 |
HWForm::HWForm(QWidget *parent, QString styleSheet) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
138 |
: QMainWindow(parent) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
139 |
, game(0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
140 |
, pnetserver(0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
141 |
, pRegisterServer(0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
142 |
, editedTeam(0) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
143 |
, hwnet(0) |
184 | 144 |
{ |
6166 | 145 |
// set music track |
8049 | 146 |
SDLInteraction::instance().setMusicTrack("/Music/main_theme.ogg"); |
6166 | 147 |
|
5849 | 148 |
this->setStyleSheet(styleSheet); |
11863 | 149 |
|
150 |
||
151 |
QIcon * hwIcon = new QIcon(); |
|
152 |
hwIcon->addFile(":/res/hh_small.png"); |
|
153 |
//hwIcon->addFile(":/res/hh25x25.png"); |
|
154 |
// crop-workaround for the fact that hh25x25.png is actually 25x35 |
|
155 |
QPixmap pm(":/res/hh25x25.png"); |
|
156 |
hwIcon->addPixmap(pm.copy(0,(pm.height()-25)/2,25,25)); |
|
157 |
hwIcon->addFile(":/res/teamicon.png"); |
|
158 |
hwIcon->addFile(":/res/teamicon2.png"); |
|
159 |
||
160 |
this->setWindowIcon(*hwIcon); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
161 |
ui.setupUi(this); |
8424
225ede46e3dc
On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible.
dag10
parents:
8416
diff
changeset
|
162 |
setMinimumSize(760, 580); |
4592
b1fe47b11b99
disable fix for issue 24 in order to fix issue 123, as suggested by koda
sheepluva
parents:
4576
diff
changeset
|
163 |
//setFocusPolicy(Qt::StrongFocus); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
164 |
CustomizePalettes(); |
3697 | 165 |
|
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6160
diff
changeset
|
166 |
ui.pageOptions->CBResolution->addItems(SDLInteraction::instance().getResolutions()); |
1225
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
167 |
|
8918
512753ea4b1b
Switch to 'settings.ini'. Copies old ini file if necessary on startup.
unc0rr
parents:
8901
diff
changeset
|
168 |
config = new GameUIConfig(this, DataManager::instance().settingsFileName()); |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
169 |
frontendEffects = config->value("frontend/effects", true).toBool(); |
9057
903f50e85144
Default to random guest username in all places net/nick is fetched. Fixes issue #588
nemo
parents:
9033
diff
changeset
|
170 |
playerHash = QString(QCryptographicHash::hash(config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString().toUtf8(), QCryptographicHash::Md5).toHex()); |
2377 | 171 |
|
11978
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
172 |
// Icons for finished missions |
11950
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
173 |
finishedIcon.addFile(":/res/missionFinished.png", QSize(), QIcon::Normal, QIcon::On); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
174 |
finishedIcon.addFile(":/res/missionFinishedSelected.png", QSize(), QIcon::Selected, QIcon::On); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
175 |
|
11978
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
176 |
// A transparent icon, used to nicely align the unfinished missions with the finished ones |
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
177 |
QPixmap emptySpace = QPixmap(15, 15); |
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
178 |
emptySpace.fill(QColor(0, 0, 0, 0)); |
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
179 |
notFinishedIcon = QIcon(emptySpace); |
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
180 |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
181 |
ui.pageRoomsList->setSettings(config); |
8453
06541556df53
Reorganized layout and appearance of rooms list page.
dag10
parents:
8451
diff
changeset
|
182 |
ui.pageNetGame->setSettings(config); |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
183 |
ui.pageNetGame->chatWidget->setSettings(config); |
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
184 |
ui.pageRoomsList->chatWidget->setSettings(config); |
8346 | 185 |
ui.pageOptions->setConfig(config); |
8151
25b95d6224fc
Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents:
8140
diff
changeset
|
186 |
#ifdef VIDEOREC |
8196
ed5001115265
Fixed crash that occured after recording a video (pagevideos' config wasn't set).
Mitchell Kember <mk12360@gmail.com>
parents:
8183
diff
changeset
|
187 |
ui.pageVideos->init(config); |
8151
25b95d6224fc
Google Code-in: Move video preferences in settings tab
Mitchell Kember <mk12360@gmail.com>
parents:
8140
diff
changeset
|
188 |
#endif |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
189 |
|
10971 | 190 |
#if defined(__APPLE__) && defined(SPARKLE_ENABLED) |
8284 | 191 |
if (config->isAutoUpdateEnabled()) |
192 |
{ |
|
9393 | 193 |
AutoUpdater* updater = NULL; |
194 |
||
8284 | 195 |
updater = new SparkleAutoUpdater(); |
196 |
if (updater) |
|
197 |
{ |
|
198 |
updater->checkForUpdates(); |
|
199 |
delete updater; |
|
200 |
} |
|
201 |
} |
|
8287
e2a5dece221f
Fix non-osx build broken in ra874d00df4a4. Dudes... :(
unc0rr
parents:
8284
diff
changeset
|
202 |
#endif |
8284 | 203 |
|
2400
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
204 |
#ifdef __APPLE__ |
3937 | 205 |
panel = new M3Panel; |
5087
d3af455a868e
cmd+m should minimize the app as per apple human guidelines
koda
parents:
5061
diff
changeset
|
206 |
|
d3af455a868e
cmd+m should minimize the app as per apple human guidelines
koda
parents:
5061
diff
changeset
|
207 |
QShortcut *hideFrontend = new QShortcut(QKeySequence("Ctrl+M"), this); |
d3af455a868e
cmd+m should minimize the app as per apple human guidelines
koda
parents:
5061
diff
changeset
|
208 |
connect (hideFrontend, SIGNAL(activated()), this, SLOT(showMinimized())); |
4759 | 209 |
#else |
210 |
// ctrl+q closes frontend for consistency |
|
6960
822f8269e13f
map, theme & style selection won't be lost on data updata now (except the selected map/theme/style is deleted ofc). enabling F5 key to reload data :>
sheepluva
parents:
6952
diff
changeset
|
211 |
QShortcut * closeFrontend = new QShortcut(QKeySequence("Ctrl+Q"), this); |
4759 | 212 |
connect (closeFrontend, SIGNAL(activated()), this, SLOT(close())); |
7824 | 213 |
//QShortcut * updateData = new QShortcut(QKeySequence("F5"), this); |
214 |
//connect (updateData, SIGNAL(activated()), &DataManager::instance(), SLOT(reload())); |
|
2261 | 215 |
#endif |
2377 | 216 |
|
9219 | 217 |
previousCampaignName = ""; |
218 |
previousTeamName = ""; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
219 |
UpdateTeamsLists(); |
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
220 |
InitCampaignPage(); |
3760 | 221 |
UpdateCampaignPage(0); |
11950
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
222 |
UpdateCampaignPageTeam(0); |
9286
c89b992ff5fe
fixed bug about starting campaign page with not descriptions/images and with wrong description/image mathcing
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9284
diff
changeset
|
223 |
UpdateCampaignPageMission(0); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
224 |
UpdateWeapons(); |
184 | 225 |
|
6009 | 226 |
// connect all goBack signals |
227 |
int nPages = ui.Pages->count(); |
|
228 |
||
229 |
for (int i = 0; i < nPages; i++) |
|
230 |
connect(ui.Pages->widget(i), SIGNAL(goBack()), this, SLOT(GoBack())); |
|
231 |
||
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
232 |
pageSwitchMapper = new QSignalMapper(this); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
233 |
connect(pageSwitchMapper, SIGNAL(mapped(int)), this, SLOT(GoToPage(int))); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
234 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
235 |
connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
236 |
onFrontendFullscreen(config->isFrontendFullscreen()); |
1162 | 237 |
|
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
238 |
connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
239 |
pageSwitchMapper->setMapping(ui.pageMain->BtnSinglePlayer, ID_PAGE_SINGLEPLAYER); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
240 |
|
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
241 |
connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
242 |
pageSwitchMapper->setMapping(ui.pageMain->BtnSetup, ID_PAGE_SETUP); |
6561 | 243 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
244 |
connect(ui.pageMain->BtnFeedback, SIGNAL(clicked()), this, SLOT(showFeedbackDialog())); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
245 |
|
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
246 |
connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
5763
d7a887c7e2d0
Add a crappy button to encourage artists to make another one. Restore Info page.
nemo
parents:
5746
diff
changeset
|
247 |
pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_INFO); |
d7a887c7e2d0
Add a crappy button to encourage artists to make another one. Restore Info page.
nemo
parents:
5746
diff
changeset
|
248 |
|
d7a887c7e2d0
Add a crappy button to encourage artists to make another one. Restore Info page.
nemo
parents:
5746
diff
changeset
|
249 |
connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
d7a887c7e2d0
Add a crappy button to encourage artists to make another one. Restore Info page.
nemo
parents:
5746
diff
changeset
|
250 |
pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD); |
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
251 |
|
7015 | 252 |
|
7617 | 253 |
#ifdef VIDEOREC |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
254 |
connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
255 |
pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS); |
7617 | 256 |
#endif |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
257 |
|
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:
6036
diff
changeset
|
258 |
//connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); |
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:
6036
diff
changeset
|
259 |
//connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); |
184 | 260 |
|
7553 | 261 |
connect(ui.pageEditTeam, SIGNAL(goBack()), this, SLOT(AfterTeamEdit())); |
1840 | 262 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
263 |
connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
264 |
connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
265 |
ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool))); |
4410
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
266 |
connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup())); |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
267 |
connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int))); |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
268 |
connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int))); |
4511 | 269 |
connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map())); |
270 |
pageSwitchMapper->setMapping(ui.pageMultiplayer->gameCFG, ID_PAGE_DRAWMAP); |
|
184 | 271 |
|
6009 | 272 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
273 |
connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
274 |
connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo())); |
184 | 275 |
|
6024 | 276 |
connect(ui.pageOptions, SIGNAL(newTeamRequested()), this, SLOT(NewTeam())); |
277 |
connect(ui.pageOptions, SIGNAL(editTeamRequested(const QString&)), this, SLOT(EditTeam(const QString&))); |
|
278 |
connect(ui.pageOptions, SIGNAL(deleteTeamRequested(const QString&)), this, SLOT(DeleteTeam(const QString&))); |
|
6525
6c97379c584b
[GCI] backz task: unify the back button functionality, avoid using the save button
m4tx
parents:
6477
diff
changeset
|
279 |
connect(ui.pageOptions, SIGNAL(goBack()), config, SLOT(SaveOptions())); |
3932 | 280 |
connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles())); |
695 | 281 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
282 |
connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon())); |
4410
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
283 |
connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon())); |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
284 |
connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet())); |
4410
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
285 |
connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme())); |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
286 |
connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme())); |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
287 |
connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme())); |
6574 | 288 |
connect(ui.pageOptions->CBFrontendEffects, SIGNAL(toggled(bool)), this, SLOT(onFrontendEffects(bool)) ); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
289 |
connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons())); |
184 | 290 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
291 |
connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect())); |
4518 | 292 |
connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
293 |
pageSwitchMapper->setMapping(ui.pageNet->BtnNetSvrStart, ID_PAGE_NETSERVER); |
|
294 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
295 |
connect(ui.pageNet, SIGNAL(connectClicked(const QString &, quint16)), this, SLOT(NetConnectServer(const QString &, quint16))); |
2377 | 296 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
297 |
connect(ui.pageNetServer->BtnStart, SIGNAL(clicked()), this, SLOT(NetStartServer())); |
184 | 298 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
299 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
300 |
ui.pageNetGame->BtnStart, SLOT(setEnabled(bool))); |
4410
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
301 |
connect(ui.pageNetGame, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup())); |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
302 |
connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int))); |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
303 |
connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int))); |
4511 | 304 |
connect(ui.pageNetGame->pGameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map())); |
305 |
pageSwitchMapper->setMapping(ui.pageNetGame->pGameCFG, ID_PAGE_DRAWMAP); |
|
184 | 306 |
|
4518 | 307 |
connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
308 |
pageSwitchMapper->setMapping(ui.pageRoomsList->BtnAdmin, ID_PAGE_ADMIN); |
|
187 | 309 |
|
5651
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
310 |
connect(ui.pageInfo->BtnSnapshots, SIGNAL(clicked()), this, SLOT(OpenSnapshotFolder())); |
1312 | 311 |
|
5734 | 312 |
connect(ui.pageGameStats, SIGNAL(saveDemoRequested()), this, SLOT(saveDemoWithCustomName())); |
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
313 |
connect(ui.pageGameStats, SIGNAL(restartGameRequested()), this, SLOT(restartGame())); |
306 | 314 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
315 |
connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame())); |
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
316 |
connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
317 |
pageSwitchMapper->setMapping(ui.pageSinglePlayer->BtnTrainPage, ID_PAGE_TRAINING); |
4518 | 318 |
|
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
319 |
connect(ui.pageSinglePlayer->BtnCampaignPage, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
320 |
pageSwitchMapper->setMapping(ui.pageSinglePlayer->BtnCampaignPage, ID_PAGE_CAMPAIGN); |
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
321 |
|
4518 | 322 |
connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
323 |
pageSwitchMapper->setMapping(ui.pageSinglePlayer->BtnMultiplayer, ID_PAGE_MULTIPLAYER); |
|
324 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
325 |
connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
326 |
connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos())); |
311 | 327 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11959
diff
changeset
|
328 |
connect(ui.pageTraining, SIGNAL(startMission(const QString&, const QString&)), this, SLOT(startTraining(const QString&, const QString&))); |
587 | 329 |
|
3760 | 330 |
connect(ui.pageCampaign->BtnStartCampaign, SIGNAL(clicked()), this, SLOT(StartCampaign())); |
9324
98368198a75d
added slot for starting campaign by clicking the image and some events in moon mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9308
diff
changeset
|
331 |
connect(ui.pageCampaign->btnPreview, SIGNAL(clicked()), this, SLOT(StartCampaign())); |
3760 | 332 |
connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int))); |
11950
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
333 |
connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPageTeam(int))); |
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
334 |
connect(ui.pageCampaign->CBCampaign, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int))); |
9182
f92e205bc167
issue 562, image and description for the campaign page
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9163
diff
changeset
|
335 |
connect(ui.pageCampaign->CBMission, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPageMission(int))); |
600 | 336 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
337 |
connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
338 |
ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
339 |
connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
340 |
this, SLOT(UpdateWeapons())); // executed second |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
341 |
//connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()), |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
342 |
// this, SLOT(GoBack())); // executed third |
718 | 343 |
|
1887 | 344 |
|
8318 | 345 |
connect(ui.pageMain->BtnNetLocal, SIGNAL(clicked()), this, SLOT(GoToNet())); |
346 |
connect(ui.pageMain->BtnNetOfficial, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer())); |
|
1950 | 347 |
|
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
348 |
connect(ui.pageVideos, SIGNAL(goBack()), config, SLOT(SaveVideosOptions())); |
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
349 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
350 |
ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini"); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
351 |
ui.pageScheme->setModel(ammoSchemeModel); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
352 |
ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel); |
4410
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
353 |
ui.pageOptions->SchemesName->setModel(ammoSchemeModel); |
1885 | 354 |
|
6574 | 355 |
wBackground = new BGWidget(this); |
356 |
wBackground->setFixedSize(this->width(), this->height()); |
|
357 |
wBackground->lower(); |
|
358 |
wBackground->init(); |
|
359 |
wBackground->enabled = config->isFrontendEffects(); |
|
360 |
wBackground->startAnimation(); |
|
2012 | 361 |
|
6477 | 362 |
//Install all eventFilters : |
363 |
||
364 |
MouseOverFilter *filter = new MouseOverFilter(); |
|
365 |
filter->setUi(&ui); |
|
366 |
||
367 |
QList<QWidget *> widgets; |
|
368 |
||
369 |
for (int i=0; i < ui.Pages->count(); i++) |
|
370 |
{ |
|
371 |
widgets = ui.Pages->widget(i)->findChildren<QWidget *>(); |
|
372 |
||
373 |
for (int i=0; i < widgets.size(); i++) |
|
374 |
{ |
|
375 |
widgets.at(i)->installEventFilter(filter); |
|
376 |
} |
|
377 |
} |
|
378 |
||
8569 | 379 |
ui.Pages->setCurrentIndex(ID_PAGE_INFO); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
380 |
PagesStack.push(ID_PAGE_MAIN); |
8384 | 381 |
((AbstractPage*)ui.Pages->widget(ID_PAGE_MAIN))->triggerPageEnter(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
382 |
GoBack(); |
184 | 383 |
} |
384 |
||
1162 | 385 |
void HWForm::onFrontendFullscreen(bool value) |
386 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
387 |
if (value) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
388 |
setWindowState(windowState() | Qt::WindowFullScreen); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
389 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
390 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
391 |
setWindowState(windowState() & static_cast<int>(!Qt::WindowFullScreen)); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
392 |
} |
1162 | 393 |
} |
394 |
||
6574 | 395 |
void HWForm::onFrontendEffects(bool value) |
396 |
{ |
|
397 |
wBackground->enabled = value; |
|
398 |
if (value) |
|
399 |
wBackground->startAnimation(); |
|
400 |
else |
|
401 |
wBackground->stopAnimation(); |
|
402 |
} |
|
403 |
||
4592
b1fe47b11b99
disable fix for issue 24 in order to fix issue 123, as suggested by koda
sheepluva
parents:
4576
diff
changeset
|
404 |
/* |
3937 | 405 |
void HWForm::keyReleaseEvent(QKeyEvent *event) |
406 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
407 |
if (event->key() == Qt::Key_Escape) |
3937 | 408 |
this->GoBack(); |
409 |
} |
|
4592
b1fe47b11b99
disable fix for issue 24 in order to fix issue 123, as suggested by koda
sheepluva
parents:
4576
diff
changeset
|
410 |
*/ |
3937 | 411 |
|
1419 | 412 |
void HWForm::CustomizePalettes() |
413 |
{ |
|
12220
a7c08e4748ff
Use the same link color consistently in frontend
Wuzzy <almikes@aol.com>
parents:
12217
diff
changeset
|
414 |
// Scroll bar widget palette |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
415 |
QList<QScrollBar *> allSBars = findChildren<QScrollBar *>(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
416 |
QPalette pal = palette(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
417 |
pal.setColor(QPalette::WindowText, QColor(0xff, 0xcc, 0x00)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
418 |
pal.setColor(QPalette::Button, QColor(0x00, 0x35, 0x1d)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
419 |
pal.setColor(QPalette::Base, QColor(0x00, 0x35, 0x1d)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
420 |
pal.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); |
1419 | 421 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
422 |
for (int i = 0; i < allSBars.size(); ++i) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
423 |
allSBars.at(i)->setPalette(pal); |
12220
a7c08e4748ff
Use the same link color consistently in frontend
Wuzzy <almikes@aol.com>
parents:
12217
diff
changeset
|
424 |
|
a7c08e4748ff
Use the same link color consistently in frontend
Wuzzy <almikes@aol.com>
parents:
12217
diff
changeset
|
425 |
// Set default hyperlink color |
a7c08e4748ff
Use the same link color consistently in frontend
Wuzzy <almikes@aol.com>
parents:
12217
diff
changeset
|
426 |
QPalette appPal = qApp->palette(); |
a7c08e4748ff
Use the same link color consistently in frontend
Wuzzy <almikes@aol.com>
parents:
12217
diff
changeset
|
427 |
appPal.setColor(QPalette::Link, QColor(0xff, 0xff, 0x6e)); |
a7c08e4748ff
Use the same link color consistently in frontend
Wuzzy <almikes@aol.com>
parents:
12217
diff
changeset
|
428 |
qApp->setPalette(appPal); |
1419 | 429 |
} |
430 |
||
695 | 431 |
void HWForm::UpdateWeapons() |
432 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
433 |
QVector<QComboBox*> combos; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
434 |
combos.push_back(ui.pageOptions->WeaponsName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
435 |
combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
436 |
combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName); |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
437 |
combos.push_back(ui.pageSelectWeapon->selectWeaponSet); |
696 | 438 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
439 |
QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames(); |
1517 | 440 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
441 |
for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
442 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
443 |
(*it)->clear(); |
1517 | 444 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
445 |
for(int i = 0; i < names.size(); ++i) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
446 |
(*it)->addItem(names[i], ui.pageSelectWeapon->pWeapons->getWeaponsString(names[i])); |
2377 | 447 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
448 |
int pos = (*it)->findText("Default"); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
449 |
if (pos != -1) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
450 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
451 |
(*it)->setCurrentIndex(pos); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
452 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
453 |
} |
695 | 454 |
} |
455 |
||
8140 | 456 |
void HWForm::UpdateTeamsLists() |
245 | 457 |
{ |
8140 | 458 |
QStringList teamslist = config->GetTeamsList(); |
245 | 459 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
460 |
if(teamslist.empty()) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
461 |
{ |
9057
903f50e85144
Default to random guest username in all places net/nick is fetched. Fixes issue #588
nemo
parents:
9033
diff
changeset
|
462 |
QString currentNickName = config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString().toUtf8(); |
8136 | 463 |
QString teamName; |
8140 | 464 |
|
12241
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
465 |
// Default team |
8140 | 466 |
if (currentNickName.isEmpty()) |
8136 | 467 |
{ |
12241
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
468 |
teamName = tr("Team 1"); |
8136 | 469 |
} |
470 |
else |
|
471 |
{ |
|
472 |
teamName = tr("%1's Team").arg(currentNickName); |
|
473 |
} |
|
8140 | 474 |
|
8136 | 475 |
HWTeam defaultTeam(teamName); |
12296
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
476 |
// Randomize fort and grave for greater variety by default. |
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
477 |
// But we exclude DLC graves and forts to not have desyncing teams by default |
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
478 |
// TODO: Remove DLC filtering when it isn't neccessary anymore |
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
479 |
HWNamegen::teamRandomGrave(defaultTeam, false); |
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
480 |
HWNamegen::teamRandomFort(defaultTeam, false); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
6009
diff
changeset
|
481 |
defaultTeam.saveToFile(); |
8136 | 482 |
teamslist.push_back(teamName); |
12241
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
483 |
|
12242
09010333c947
Randomize forts and graves in new teams
Wuzzy <almikes@aol.com>
parents:
12241
diff
changeset
|
484 |
// Add 3 additional teams to allow local multiplayer instantly |
12241
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
485 |
for(int i=2; i<=4; i++) |
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
486 |
{ |
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
487 |
teamName = tr("Team %1").arg(i); |
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
488 |
HWTeam numberTeam(teamName); |
12296
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
489 |
HWNamegen::teamRandomGrave(numberTeam, false); |
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
490 |
HWNamegen::teamRandomFort(numberTeam, false); |
12241
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
491 |
numberTeam.saveToFile(); |
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
492 |
teamslist.push_back(teamName); |
0b5aa545e058
Add 4 teams on first start of Hedgewars
Wuzzy <almikes@aol.com>
parents:
12220
diff
changeset
|
493 |
} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
494 |
} |
245 | 495 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
496 |
ui.pageOptions->CBTeamName->clear(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
497 |
ui.pageOptions->CBTeamName->addItems(teamslist); |
3760 | 498 |
ui.pageCampaign->CBTeam->clear(); |
11959
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
499 |
/* Only show human teams in campaign page */ |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
500 |
for(int i=0; i<teamslist.length(); i++) |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
501 |
{ |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
502 |
HWTeam testTeam = HWTeam(teamslist[i]); |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
503 |
testTeam.loadFromFile(); |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
504 |
if(testTeam.difficulty() == 0) |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
505 |
{ |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
506 |
ui.pageCampaign->CBTeam->addItem(teamslist[i]); |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
507 |
} |
3c15903256a7
Don't show AI-controlled teams in campaigns page
Wuzzy <almikes@aol.com>
parents:
11958
diff
changeset
|
508 |
} |
245 | 509 |
} |
510 |
||
694 | 511 |
void HWForm::GoToSelectNewWeapon() |
512 |
{ |
|
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
513 |
ui.pageSelectWeapon->pWeapons->newWeaponsName(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
514 |
GoToPage(ID_PAGE_SELECTWEAPON); |
694 | 515 |
} |
516 |
||
600 | 517 |
void HWForm::GoToSelectWeapon() |
518 |
{ |
|
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
519 |
ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
520 |
GoToPage(ID_PAGE_SELECTWEAPON); |
600 | 521 |
} |
522 |
||
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
523 |
void HWForm::GoToSelectWeaponSet(int index) |
2009 | 524 |
{ |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
525 |
ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(index); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
526 |
GoToPage(ID_PAGE_SELECTWEAPON); |
2009 | 527 |
} |
528 |
||
579 | 529 |
void HWForm::GoToSaves() |
530 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
531 |
ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Save); |
579 | 532 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
533 |
GoToPage(ID_PAGE_DEMOS); |
579 | 534 |
} |
535 |
||
184 | 536 |
void HWForm::GoToDemos() |
537 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
538 |
ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Demo); |
579 | 539 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
540 |
GoToPage(ID_PAGE_DEMOS); |
184 | 541 |
} |
542 |
||
543 |
void HWForm::GoToNet() |
|
544 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
545 |
ui.pageNet->updateServersList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
625
diff
changeset
|
546 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
547 |
GoToPage(ID_PAGE_NET); |
184 | 548 |
} |
549 |
||
4410
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
550 |
void HWForm::GoToScheme(int index) |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
551 |
{ |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
552 |
ui.pageScheme->selectScheme->setCurrentIndex(index); |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
553 |
GoToPage(ID_PAGE_SCHEME); |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
554 |
} |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
555 |
|
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
556 |
void HWForm::GoToNewScheme() |
1885 | 557 |
{ |
4410
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
558 |
ui.pageScheme->newRow(); |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
559 |
GoToPage(ID_PAGE_SCHEME); |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
560 |
} |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
561 |
|
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
562 |
void HWForm::GoToEditScheme() |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
563 |
{ |
f9e38ce1e813
a Henek-koda production: nicer game config screen, fixed scheme-weapon lock, added scheme editing to config page and some minor stuff
Henek
parents:
4392
diff
changeset
|
564 |
ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
565 |
GoToPage(ID_PAGE_SCHEME); |
1885 | 566 |
} |
567 |
||
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7347
diff
changeset
|
568 |
void HWForm::GoToVideos() |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7347
diff
changeset
|
569 |
{ |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7347
diff
changeset
|
570 |
GoToPage(ID_PAGE_VIDEOS); |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7347
diff
changeset
|
571 |
} |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7347
diff
changeset
|
572 |
|
8353 | 573 |
//TODO: maybe find a better place for this? |
574 |
QString HWForm::stringifyPageId(quint32 id) |
|
575 |
{ |
|
576 |
QString pageName; |
|
577 |
switch (id) |
|
578 |
{ |
|
579 |
case ID_PAGE_SETUP_TEAM : pageName = "PAGE_SETUP_TEAM"; break; |
|
580 |
case ID_PAGE_SETUP : pageName = "PAGE_SETUP"; break; |
|
581 |
case ID_PAGE_MULTIPLAYER : pageName = "PAGE_MULTIPLAYER"; break; |
|
582 |
case ID_PAGE_DEMOS : pageName = "PAGE_DEMOS"; break; |
|
583 |
case ID_PAGE_NET : pageName = "PAGE_NET"; break; |
|
584 |
case ID_PAGE_NETGAME : pageName = "PAGE_NETGAME"; break; |
|
585 |
case ID_PAGE_INFO : pageName = "PAGE_INFO"; break; |
|
586 |
case ID_PAGE_MAIN : pageName = "PAGE_MAIN"; break; |
|
587 |
case ID_PAGE_GAMESTATS : pageName = "PAGE_GAMESTATS"; break; |
|
588 |
case ID_PAGE_SINGLEPLAYER : pageName = "PAGE_SINGLEPLAYER"; break; |
|
589 |
case ID_PAGE_TRAINING : pageName = "PAGE_TRAINING"; break; |
|
590 |
case ID_PAGE_SELECTWEAPON : pageName = "PAGE_SELECTWEAPON"; break; |
|
591 |
case ID_PAGE_NETSERVER : pageName = "PAGE_NETSERVER"; break; |
|
592 |
case ID_PAGE_INGAME : pageName = "PAGE_INGAME"; break; |
|
593 |
case ID_PAGE_ROOMSLIST : pageName = "PAGE_ROOMSLIST"; break; |
|
594 |
case ID_PAGE_CONNECTING : pageName = "PAGE_CONNECTING"; break; |
|
595 |
case ID_PAGE_SCHEME : pageName = "PAGE_SCHEME"; break; |
|
596 |
case ID_PAGE_ADMIN : pageName = "PAGE_ADMIN"; break; |
|
597 |
case ID_PAGE_CAMPAIGN : pageName = "PAGE_CAMPAIGN"; break; |
|
598 |
case ID_PAGE_DRAWMAP : pageName = "PAGE_DRAWMAP"; break; |
|
599 |
case ID_PAGE_DATADOWNLOAD : pageName = "PAGE_DATADOWNLOAD"; break; |
|
600 |
case ID_PAGE_VIDEOS : pageName = "PAGE_VIDEOS"; break; |
|
601 |
case MAX_PAGE : pageName = "MAX_PAGE"; break; |
|
602 |
default : pageName = "UNKNOWN_PAGE"; break; |
|
603 |
} |
|
604 |
return pageName; |
|
605 |
} |
|
606 |
||
496 | 607 |
void HWForm::OnPageShown(quint8 id, quint8 lastid) |
311 | 608 |
{ |
9235 | 609 |
#ifdef QT_DEBUG |
8353 | 610 |
qDebug("Leaving %s, entering %s", qPrintable(stringifyPageId(lastid)), qPrintable(stringifyPageId(id))); |
9235 | 611 |
#endif |
8977 | 612 |
if (lastid == ID_PAGE_MAIN) |
613 |
{ |
|
8982 | 614 |
ui.pageMain->resetNetworkChoice(); |
8977 | 615 |
} |
8353 | 616 |
|
8384 | 617 |
// pageEnter and pageLeave events |
8434 | 618 |
((AbstractPage*)ui.Pages->widget(lastid))->triggerPageLeave(); |
8384 | 619 |
((AbstractPage*)ui.Pages->widget(id))->triggerPageEnter(); |
620 |
||
5999
dad168522e3b
display a message when network is down or server is not reachable, nemo also made the page refresh at display time
koda
parents:
5907
diff
changeset
|
621 |
if (id == ID_PAGE_DATADOWNLOAD) |
dad168522e3b
display a message when network is down or server is not reachable, nemo also made the page refresh at display time
koda
parents:
5907
diff
changeset
|
622 |
{ |
dad168522e3b
display a message when network is down or server is not reachable, nemo also made the page refresh at display time
koda
parents:
5907
diff
changeset
|
623 |
ui.pageDataDownload->fetchList(); |
dad168522e3b
display a message when network is down or server is not reachable, nemo also made the page refresh at display time
koda
parents:
5907
diff
changeset
|
624 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
625 |
if (id == ID_PAGE_DRAWMAP) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
626 |
{ |
4520
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
627 |
DrawMapScene * scene; |
4535 | 628 |
if(lastid == ID_PAGE_MULTIPLAYER) |
4520
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
629 |
scene = ui.pageMultiplayer->gameCFG->pMapContainer->getDrawMapScene(); |
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
630 |
else |
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
631 |
scene = ui.pageNetGame->pGameCFG->pMapContainer->getDrawMapScene(); |
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
632 |
|
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
633 |
ui.pageDrawMap->drawMapWidget->setScene(scene); |
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
634 |
} |
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
635 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
636 |
if (lastid == ID_PAGE_DRAWMAP) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
637 |
{ |
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
638 |
if (id == ID_PAGE_MULTIPLAYER) |
4525 | 639 |
ui.pageMultiplayer->gameCFG->pMapContainer->mapDrawingFinished(); |
4520
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
640 |
else |
4525 | 641 |
ui.pageNetGame->pGameCFG->pMapContainer->mapDrawingFinished(); |
4520
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
642 |
} |
e7882bd1a894
Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents:
4518
diff
changeset
|
643 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
644 |
if (id == ID_PAGE_ROOMSLIST) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
645 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
646 |
if (hwnet && game && game->gameState == gsStarted) // abnormal exit - kick or room destruction - send kills. |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
647 |
{ |
6190
1db2486e45f4
potential fix for issue #217 (SigSegV while in game room in KillAllTeams - team list change?)
sheepluva
parents:
6180
diff
changeset
|
648 |
game->netSuspend = true; |
6211
ee9465c0ea82
move (prematurely) finishing game by removing all teams into engine since that's where it should happen
sheepluva
parents:
6205
diff
changeset
|
649 |
ui.pageRoomsList->displayWarning(tr("Game aborted")); |
ee9465c0ea82
move (prematurely) finishing game by removing all teams into engine since that's where it should happen
sheepluva
parents:
6205
diff
changeset
|
650 |
game->abort(); |
6190
1db2486e45f4
potential fix for issue #217 (SigSegV while in game room in KillAllTeams - team list change?)
sheepluva
parents:
6180
diff
changeset
|
651 |
} |
1db2486e45f4
potential fix for issue #217 (SigSegV while in game room in KillAllTeams - team list change?)
sheepluva
parents:
6180
diff
changeset
|
652 |
} |
1db2486e45f4
potential fix for issue #217 (SigSegV while in game room in KillAllTeams - team list change?)
sheepluva
parents:
6180
diff
changeset
|
653 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
654 |
if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
655 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
656 |
QStringList tmNames = config->GetTeamsList(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
657 |
TeamSelWidget* curTeamSelWidget; |
6024 | 658 |
ui.pageOptions->setTeamOptionsEnabled(false); |
2377 | 659 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
660 |
if (id == ID_PAGE_MULTIPLAYER) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
661 |
{ |
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
662 |
curTeamSelWidget = ui.pageMultiplayer->teamsSelect; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
663 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
664 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
665 |
{ |
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
666 |
curTeamSelWidget = ui.pageNetGame->pNetTeamsWidget; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
667 |
} |
2377 | 668 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
669 |
QList<HWTeam> teamsList; |
9393 | 670 |
for (QStringList::iterator it = tmNames.begin(); it != tmNames.end(); ++it) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
671 |
{ |
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
672 |
HWTeam team(*it); |
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
6009
diff
changeset
|
673 |
team.loadFromFile(); |
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
674 |
teamsList.push_back(team); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
675 |
} |
2377 | 676 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
677 |
if (lastid == ID_PAGE_SETUP || lastid == ID_PAGE_DRAWMAP) // _TEAM |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
678 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
679 |
if (editedTeam) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
680 |
{ |
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
681 |
curTeamSelWidget->addTeam(*editedTeam); |
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
682 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
683 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
684 |
else if (lastid != ID_PAGE_GAMESTATS |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
685 |
&& lastid != ID_PAGE_INGAME |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
686 |
&& lastid != ID_PAGE_SCHEME |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
687 |
&& lastid != ID_PAGE_SELECTWEAPON) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
688 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
689 |
curTeamSelWidget->resetPlayingTeams(teamsList); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
690 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
691 |
} |
2845 | 692 |
|
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
693 |
if (id == ID_PAGE_GAMESTATS) |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
694 |
{ |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
695 |
switch(lastGameType) { |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
696 |
case gtLocal: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
697 |
case gtQLocal: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
698 |
case gtTraining: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
699 |
case gtCampaign: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
700 |
ui.pageGameStats->restartBtnVisible(true); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
701 |
break; |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
702 |
default: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
703 |
ui.pageGameStats->restartBtnVisible(false); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
704 |
break; |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
705 |
} |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
706 |
} |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
707 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
708 |
if (id == ID_PAGE_MAIN) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
709 |
{ |
6024 | 710 |
ui.pageOptions->setTeamOptionsEnabled(true); |
3159 | 711 |
} |
311 | 712 |
} |
713 |
||
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
714 |
void HWForm::GoToPage(int id) |
289 | 715 |
{ |
9393 | 716 |
//bool stopAnim = false; |
6428 | 717 |
|
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
718 |
int lastid = ui.Pages->currentIndex(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
719 |
PagesStack.push(ui.Pages->currentIndex()); |
6428 | 720 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
721 |
OnPageShown(id, lastid); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
722 |
ui.Pages->setCurrentIndex(id); |
6428 | 723 |
|
7004 | 724 |
|
725 |
/* if (id == ID_PAGE_DRAWMAP || id == ID_PAGE_GAMESTATS) |
|
6428 | 726 |
stopAnim = true; |
8098 | 727 |
This were disabled due to broken flake animations. I believe the more general problems w/ opacity that forced its disable makes blocking these |
728 |
unnecessary. |
|
7004 | 729 |
*/ |
6428 | 730 |
|
8384 | 731 |
|
6604
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
732 |
#if (QT_VERSION >= 0x040600) |
9393 | 733 |
//if (!stopAnim) |
6428 | 734 |
{ |
735 |
/**Start animation :**/ |
|
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
736 |
int coeff = 1; |
6630
f8bbfa9a1a36
Disable opacity across the board. It is screwed up in OSX and apparently also Linux. Bad artifacts and overall performance.
nemo
parents:
6616
diff
changeset
|
737 |
#ifdef false |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
738 |
coeff = 2; |
6428 | 739 |
QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id)); |
740 |
ui.Pages->widget(id)->setGraphicsEffect(effectNew); |
|
741 |
||
742 |
QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(lastid)); |
|
743 |
ui.Pages->widget(lastid)->setGraphicsEffect(effectLast); |
|
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
744 |
#endif |
6574 | 745 |
// no effects, means 0 effect duration :D |
746 |
int duration = config->isFrontendEffects() ? 500 : 0; |
|
6428 | 747 |
|
748 |
//New page animation |
|
749 |
animationNewSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos"); |
|
6574 | 750 |
animationNewSlide->setDuration(duration); |
7004 | 751 |
animationNewSlide->setStartValue(QPoint(width()/coeff, 0)); |
6428 | 752 |
animationNewSlide->setEndValue(QPoint(0, 0)); |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
753 |
animationNewSlide->setEasingCurve(QEasingCurve::OutExpo); |
6428 | 754 |
|
6630
f8bbfa9a1a36
Disable opacity across the board. It is screwed up in OSX and apparently also Linux. Bad artifacts and overall performance.
nemo
parents:
6616
diff
changeset
|
755 |
#ifdef false |
6428 | 756 |
animationNewOpacity = new QPropertyAnimation(effectNew, "opacity"); |
6574 | 757 |
animationNewOpacity->setDuration(duration); |
6428 | 758 |
animationNewOpacity->setStartValue(0.01); |
759 |
animationNewOpacity->setEndValue(1); |
|
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
760 |
animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo); |
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
761 |
#endif |
6428 | 762 |
|
763 |
//Last page animation |
|
764 |
ui.Pages->widget(lastid)->setHidden(false); |
|
765 |
||
766 |
animationOldSlide = new QPropertyAnimation(ui.Pages->widget(lastid), "pos"); |
|
6574 | 767 |
animationOldSlide->setDuration(duration); |
6428 | 768 |
animationOldSlide->setStartValue(QPoint(0, 0)); |
7004 | 769 |
animationOldSlide->setEndValue(QPoint(-width()/coeff, 0)); |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
770 |
animationOldSlide->setEasingCurve(QEasingCurve::OutExpo); |
6428 | 771 |
|
6630
f8bbfa9a1a36
Disable opacity across the board. It is screwed up in OSX and apparently also Linux. Bad artifacts and overall performance.
nemo
parents:
6616
diff
changeset
|
772 |
#ifdef false |
6428 | 773 |
animationOldOpacity = new QPropertyAnimation(effectLast, "opacity"); |
6574 | 774 |
animationOldOpacity->setDuration(duration); |
6428 | 775 |
animationOldOpacity->setStartValue(1); |
776 |
animationOldOpacity->setEndValue(0.01); |
|
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
777 |
animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo); |
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
778 |
#endif |
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
779 |
|
7860
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
780 |
// let's hide the old slide after its animation has finished |
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
781 |
connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide())); |
7826
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
782 |
|
7860
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
783 |
// start animations |
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
784 |
animationOldSlide->start(QAbstractAnimation::DeleteWhenStopped); |
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
785 |
animationNewSlide->start(QAbstractAnimation::DeleteWhenStopped); |
6428 | 786 |
|
8098 | 787 |
/* this is for the situation when the animation below is interrupted by a new animation. For some reason, finished is not being fired */ |
788 |
for(int i=0;i<MAX_PAGE;i++) if (i!=id && i!=lastid) ui.Pages->widget(i)->hide(); |
|
6428 | 789 |
} |
6604
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
790 |
#endif |
289 | 791 |
} |
792 |
||
793 |
void HWForm::GoBack() |
|
794 |
{ |
|
6428 | 795 |
bool stopAnim = false; |
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:
6036
diff
changeset
|
796 |
int curid = ui.Pages->currentIndex(); |
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:
6036
diff
changeset
|
797 |
if (curid == ID_PAGE_MAIN) |
6428 | 798 |
{ |
8384 | 799 |
((AbstractPage*)ui.Pages->widget(ID_PAGE_MAIN))->triggerPageLeave(); |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7347
diff
changeset
|
800 |
if (!ui.pageVideos->tryQuit(this)) |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7347
diff
changeset
|
801 |
return; |
6428 | 802 |
stopAnim = true; |
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:
6036
diff
changeset
|
803 |
exit(); |
6428 | 804 |
} |
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:
6036
diff
changeset
|
805 |
|
4509
816a0bff5019
Use QSignalMapper instead of GoToPage*() functions (not all calls converted yet)
unc0rr
parents:
4433
diff
changeset
|
806 |
int id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
807 |
ui.Pages->setCurrentIndex(id); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
808 |
OnPageShown(id, curid); |
2377 | 809 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
810 |
if (id == ID_PAGE_CONNECTING) |
6428 | 811 |
{ |
812 |
stopAnim = true; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
813 |
GoBack(); |
6428 | 814 |
} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
815 |
if (id == ID_PAGE_NETSERVER) |
6428 | 816 |
{ |
817 |
stopAnim = true; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
818 |
GoBack(); |
6428 | 819 |
} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
820 |
if ((!hwnet) && (id == ID_PAGE_ROOMSLIST)) |
6428 | 821 |
{ |
822 |
stopAnim = true; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
823 |
GoBack(); |
6428 | 824 |
} |
7004 | 825 |
/*if (curid == ID_PAGE_DRAWMAP) |
826 |
stopAnim = true; */ |
|
2377 | 827 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
828 |
if ((!hwnet) || (!hwnet->isInRoom())) |
9393 | 829 |
if (id == ID_PAGE_NETGAME) |
6428 | 830 |
{ |
831 |
stopAnim = true; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
832 |
GoBack(); |
6428 | 833 |
} |
1672
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
834 |
|
5147 | 835 |
if (curid == ID_PAGE_ROOMSLIST || curid == ID_PAGE_CONNECTING) NetDisconnect(); |
6030
2577028cba07
fix typo that sneaked in by pressing ctrl+z one time too much I guess :D
sheepluva
parents:
6026
diff
changeset
|
836 |
if (curid == ID_PAGE_NETGAME && hwnet && hwnet->isInRoom()) hwnet->partRoom(); |
4432 | 837 |
// need to work on this, can cause invalid state for admin quit trying to prevent bad state message on kick |
838 |
//if (curid == ID_PAGE_NETGAME && (!game || game->gameState != gsStarted)) hwnet->partRoom(); |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
839 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
840 |
if (curid == ID_PAGE_SCHEME) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
841 |
ammoSchemeModel->Save(); |
6428 | 842 |
|
6604
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
843 |
#if (QT_VERSION >= 0x040600) |
6428 | 844 |
/**Start animation :**/ |
6574 | 845 |
if (curid != 0 && !stopAnim) |
6428 | 846 |
{ |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
847 |
int coeff = 1; |
6630
f8bbfa9a1a36
Disable opacity across the board. It is screwed up in OSX and apparently also Linux. Bad artifacts and overall performance.
nemo
parents:
6616
diff
changeset
|
848 |
#ifdef false |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
849 |
coeff = 2; |
6428 | 850 |
QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id)); |
851 |
effectNew->setOpacity(1); |
|
852 |
ui.Pages->widget(id)->setGraphicsEffect(effectNew); |
|
853 |
||
854 |
QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(curid)); |
|
855 |
ui.Pages->widget(curid)->setGraphicsEffect(effectLast); |
|
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
856 |
#endif |
6574 | 857 |
// no effects, means 0 effect duration :D |
858 |
int duration = config->isFrontendEffects() ? 500 : 0; |
|
6428 | 859 |
|
860 |
//Last page animation |
|
861 |
animationOldSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos"); |
|
6574 | 862 |
animationOldSlide->setDuration(duration); |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
863 |
animationOldSlide->setStartValue(QPoint(-width()/coeff, 0)); |
6428 | 864 |
animationOldSlide->setEndValue(QPoint(0, 0)); |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
865 |
animationOldSlide->setEasingCurve(QEasingCurve::OutExpo); |
6428 | 866 |
|
6630
f8bbfa9a1a36
Disable opacity across the board. It is screwed up in OSX and apparently also Linux. Bad artifacts and overall performance.
nemo
parents:
6616
diff
changeset
|
867 |
#ifdef false |
6428 | 868 |
animationOldOpacity = new QPropertyAnimation(effectLast, "opacity"); |
6574 | 869 |
animationOldOpacity->setDuration(duration); |
6428 | 870 |
animationOldOpacity->setStartValue(1); |
871 |
animationOldOpacity->setEndValue(0.01); |
|
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
872 |
animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo); |
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
873 |
#endif |
6428 | 874 |
//New page animation |
875 |
ui.Pages->widget(curid)->setHidden(false); |
|
876 |
||
877 |
animationNewSlide = new QPropertyAnimation(ui.Pages->widget(curid), "pos"); |
|
6574 | 878 |
animationNewSlide->setDuration(duration); |
6428 | 879 |
animationNewSlide->setStartValue(QPoint(0, 0)); |
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
880 |
animationNewSlide->setEndValue(QPoint(width()/coeff, 0)); |
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
881 |
animationNewSlide->setEasingCurve(QEasingCurve::OutExpo); |
6428 | 882 |
|
6630
f8bbfa9a1a36
Disable opacity across the board. It is screwed up in OSX and apparently also Linux. Bad artifacts and overall performance.
nemo
parents:
6616
diff
changeset
|
883 |
#ifdef false |
6428 | 884 |
animationNewOpacity = new QPropertyAnimation(effectNew, "opacity"); |
6574 | 885 |
animationNewOpacity->setDuration(duration); |
6428 | 886 |
animationNewOpacity->setStartValue(0.01); |
887 |
animationNewOpacity->setEndValue(1); |
|
6440
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
888 |
animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo); |
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
889 |
#endif |
1fa9dc94c93f
disable opacity effect for non-linux as it is working only there, fix a glitch that would print the page for a frame and then animate it from another position, change the animation curve to something a little more speedy
koda
parents:
6428
diff
changeset
|
890 |
|
7860
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
891 |
// let's hide the old slide after its animation has finished |
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
892 |
connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide())); |
6428 | 893 |
|
7860
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
894 |
// start animations |
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
895 |
animationOldSlide->start(QAbstractAnimation::DeleteWhenStopped); |
a90936219ffa
let animation objects delete themselves after they are not being used anymore
sheepluva
parents:
7842
diff
changeset
|
896 |
animationNewSlide->start(QAbstractAnimation::DeleteWhenStopped); |
6428 | 897 |
} |
6604
9cc612a24b43
this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents:
6574
diff
changeset
|
898 |
#endif |
7826
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
899 |
|
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
900 |
if (stopAnim) |
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
901 |
ui.Pages->widget(curid)->hide(); |
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
902 |
|
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
903 |
// TODO the whole pages shown and effects stuff should be moved |
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
904 |
// out of hwform.cpp and into a subclass of QStackedLayout |
9f529722d61e
fix for the root cause of issue 434 (previous pages being visible in the background)
sheepluva
parents:
7824
diff
changeset
|
905 |
|
184 | 906 |
} |
907 |
||
5651
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
908 |
void HWForm::OpenSnapshotFolder() |
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
909 |
{ |
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
910 |
QString path = QDir::toNativeSeparators(cfgdir->absolutePath() + "/Screenshots"); |
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
911 |
QDesktopServices::openUrl(QUrl("file:///" + path)); |
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
912 |
} |
a7de68f4f87f
allow accessing the snapshot folder from the about page in the frontend (button could use a nicer icon)
koda
parents:
5567
diff
changeset
|
913 |
|
530 | 914 |
void HWForm::btnExitPressed() |
915 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
916 |
eggTimer.start(); |
530 | 917 |
} |
918 |
||
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:
6036
diff
changeset
|
919 |
void HWForm::exit() |
530 | 920 |
{ |
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:
6036
diff
changeset
|
921 |
// if (eggTimer.elapsed() < 3000){ |
2400
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
922 |
#ifdef __APPLE__ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
923 |
panel->showInstallController(); |
2400
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
924 |
#endif |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
925 |
close(); |
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:
6036
diff
changeset
|
926 |
// TODO reactivate egg |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
927 |
/* } |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
928 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
929 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
930 |
QPushButton * btn = findChild<QPushButton *>("imageButt"); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
931 |
if (btn) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
932 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
933 |
btn->setIcon(QIcon(":/res/bonus.png")); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
934 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
935 |
} */ |
530 | 936 |
} |
937 |
||
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
938 |
void HWForm::IntermediateSetup() |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
939 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
940 |
quint8 id=ui.Pages->currentIndex(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
941 |
TeamSelWidget* curTeamSelWidget; |
2377 | 942 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
943 |
if(id == ID_PAGE_MULTIPLAYER) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
944 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
945 |
curTeamSelWidget = ui.pageMultiplayer->teamsSelect; |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
946 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
947 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
948 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
949 |
curTeamSelWidget = ui.pageNetGame->pNetTeamsWidget; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
950 |
} |
2377 | 951 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
952 |
QStringList tmnames; |
5772
c09c50efe8b5
Replace iterators with simple declarative foreach (not tested if it works)
unc0rr
parents:
5763
diff
changeset
|
953 |
|
5773 | 954 |
foreach(HWTeam team, curTeamSelWidget->getNotPlayingTeams()) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
955 |
tmnames += team.name(); |
5140
932307228d05
Change a few iterations over list to what is apparently a modification safe syntax, may fix issue #208 and #217 - needs testing of course.
nemo
parents:
5126
diff
changeset
|
956 |
|
3757 | 957 |
//UpdateTeamsLists(&tmnames); // FIXME: still need more work if teamname is updated while configuring |
958 |
UpdateTeamsLists(); |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
959 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
960 |
GoToPage(ID_PAGE_SETUP); |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
961 |
} |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
962 |
|
184 | 963 |
void HWForm::NewTeam() |
964 |
{ |
|
6024 | 965 |
ui.pageEditTeam->createTeam(QLineEdit::tr("unnamed"), playerHash); |
966 |
UpdateTeamsLists(); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
967 |
GoToPage(ID_PAGE_SETUP_TEAM); |
184 | 968 |
} |
969 |
||
6024 | 970 |
void HWForm::EditTeam(const QString & teamName) |
3159 | 971 |
{ |
6024 | 972 |
ui.pageEditTeam->editTeam(teamName, playerHash); |
973 |
GoToPage(ID_PAGE_SETUP_TEAM); |
|
3159 | 974 |
} |
975 |
||
6024 | 976 |
void HWForm::AfterTeamEdit() |
1840 | 977 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
978 |
UpdateTeamsLists(); |
7551 | 979 |
//GoBack(); |
184 | 980 |
} |
981 |
||
6024 | 982 |
|
983 |
void HWForm::DeleteTeam(const QString & teamName) |
|
184 | 984 |
{ |
8346 | 985 |
ui.pageEditTeam->deleteTeam(teamName); |
986 |
UpdateTeamsLists(); |
|
184 | 987 |
} |
988 |
||
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
989 |
void HWForm::DeleteScheme() |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
990 |
{ |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
991 |
ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex()); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
992 |
if (ui.pageOptions->SchemesName->currentIndex() < ammoSchemeModel->numberOfDefaultSchemes) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
993 |
{ |
8383 | 994 |
MessageDialog::ShowErrorMessage(QMessageBox::tr("Cannot delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()), this); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
995 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
996 |
else |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
997 |
{ |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
998 |
ui.pageScheme->deleteRow(); |
4576
d85062310790
fixed and enabled removing of game scheme from options page
Henek
parents:
4560
diff
changeset
|
999 |
ammoSchemeModel->Save(); |
4416
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1000 |
} |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1001 |
} |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1002 |
|
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1003 |
void HWForm::DeleteWeaponSet() |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1004 |
{ |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1005 |
ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex()); |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1006 |
ui.pageSelectWeapon->pWeapons->deleteWeaponsName(); |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1007 |
} |
29d2d1548387
adding a combobox to weapon editor as scheme editor, added a few notices for deleting and some buttons in this area.
Henek
parents:
4410
diff
changeset
|
1008 |
|
184 | 1009 |
void HWForm::SimpleGame() |
1010 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1011 |
CreateGame(0, 0, *cDefaultAmmoStore); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1012 |
game->StartQuick(); |
184 | 1013 |
} |
1014 |
||
1015 |
void HWForm::PlayDemo() |
|
1016 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1017 |
QListWidgetItem * curritem = ui.pagePlayDemo->DemosList->currentItem(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1018 |
if (!curritem) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1019 |
{ |
8383 | 1020 |
MessageDialog::ShowErrorMessage(QMessageBox::tr("Please select a record from the list"), this); |
5252 | 1021 |
return; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1022 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1023 |
CreateGame(0, 0, 0); |
5865 | 1024 |
game->PlayDemo(curritem->data(Qt::UserRole).toString(), ui.pagePlayDemo->isSave()); |
184 | 1025 |
} |
1026 |
||
5252 | 1027 |
void HWForm::PlayDemoQuick(const QString & demofilename) |
1028 |
{ |
|
5255
947025eeb5dc
under osx don't load a file in case a game is already running (also a little of code formatting)
koda
parents:
5252
diff
changeset
|
1029 |
GoToPage(ID_PAGE_MAIN); |
8709
191bd86f97a1
fix loading files on osx too, the cause was different than other systems
koda
parents:
8643
diff
changeset
|
1030 |
//GoBack() <- don't or you'll close the socket |
5252 | 1031 |
CreateGame(0, 0, 0); |
5865 | 1032 |
game->PlayDemo(demofilename, false); |
5252 | 1033 |
} |
1034 |
||
8716
e09633d10f16
hit hwplay://server:port and automatically join an unofficial server (on osx right now)
koda
parents:
8709
diff
changeset
|
1035 |
void HWForm::NetConnectQuick(const QString & host, quint16 port) |
e09633d10f16
hit hwplay://server:port and automatically join an unofficial server (on osx right now)
koda
parents:
8709
diff
changeset
|
1036 |
{ |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1037 |
GoToPage(ID_PAGE_MAIN); |
8716
e09633d10f16
hit hwplay://server:port and automatically join an unofficial server (on osx right now)
koda
parents:
8709
diff
changeset
|
1038 |
NetConnectServer(host, port); |
e09633d10f16
hit hwplay://server:port and automatically join an unofficial server (on osx right now)
koda
parents:
8709
diff
changeset
|
1039 |
} |
e09633d10f16
hit hwplay://server:port and automatically join an unofficial server (on osx right now)
koda
parents:
8709
diff
changeset
|
1040 |
|
666 | 1041 |
void HWForm::NetConnectServer(const QString & host, quint16 port) |
416 | 1042 |
{ |
8716
e09633d10f16
hit hwplay://server:port and automatically join an unofficial server (on osx right now)
koda
parents:
8709
diff
changeset
|
1043 |
qDebug("connecting to %s:%d", qPrintable(host), port); |
4870 | 1044 |
_NetConnect(host, port, ui.pageOptions->editNetNick->text().trimmed()); |
1395 | 1045 |
} |
1046 |
||
1047 |
void HWForm::NetConnectOfficialServer() |
|
1048 |
{ |
|
8803 | 1049 |
NetConnectServer(NETGAME_DEFAULT_SERVER, NETGAME_DEFAULT_PORT); |
416 | 1050 |
} |
1051 |
||
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1052 |
void HWForm::NetPassword(const QString & nick) |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1053 |
{ |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
1054 |
Q_UNUSED(nick); |
8181 | 1055 |
//Get hashes |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1056 |
QString hash = config->passwordHash(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1057 |
QString temphash = config->tempHash(); |
8181 | 1058 |
|
1059 |
//Check them |
|
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1060 |
|
8181 | 1061 |
if (temphash.isEmpty() && hash.isEmpty()) { //If the user enters a registered nick with no password, sends a bogus hash |
1062 |
hwnet->SendPasswordHash("THISISNOHASH"); |
|
1063 |
} |
|
1064 |
else if (temphash.isEmpty()) { //Send saved hash as default |
|
1065 |
hwnet->SendPasswordHash(hash); |
|
1066 |
} |
|
1067 |
else { //Send the hash |
|
1068 |
hwnet->SendPasswordHash(temphash); |
|
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1069 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1070 |
|
8181 | 1071 |
//Remove temporary hash from config |
8295
6ef114ea2298
fixed minor problem with saving hash
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8294
diff
changeset
|
1072 |
config->clearTempHash(); |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1073 |
} |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1074 |
|
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1075 |
void HWForm::NetNickRegistered(const QString & nick) |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1076 |
{ |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1077 |
//Get hashes |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1078 |
QString hash = config->passwordHash(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1079 |
QString temphash = config->tempHash(); |
8295
6ef114ea2298
fixed minor problem with saving hash
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8294
diff
changeset
|
1080 |
|
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1081 |
if (hash.isEmpty()) { |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1082 |
if (temphash.isEmpty()) { //If the user enters a registered nick with no password |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1083 |
QString suppliedpass; |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1084 |
while (suppliedpass.isEmpty()) { |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1085 |
QInputDialog nickRegedDialog(this); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1086 |
nickRegedDialog.setWindowModality(Qt::WindowModal); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1087 |
nickRegedDialog.setInputMode(QInputDialog::TextInput); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1088 |
nickRegedDialog.setWindowTitle(tr("Hedgewars - Nick registered")); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1089 |
nickRegedDialog.setLabelText(tr("This nick is registered, and you haven't specified a password.\n\nIf this nick isn't yours, please register your own nick at www.hedgewars.org\n\nPassword:")); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1090 |
nickRegedDialog.setTextEchoMode(QLineEdit::Password); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1091 |
nickRegedDialog.exec(); |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1092 |
|
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1093 |
suppliedpass = nickRegedDialog.textValue(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1094 |
|
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1095 |
if (nickRegedDialog.result() == QDialog::Rejected) { |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1096 |
config->clearPasswordHash(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1097 |
config->clearTempHash(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1098 |
GoBack(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1099 |
return; |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1100 |
} |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1101 |
temphash = QCryptographicHash::hash(suppliedpass.toUtf8(), QCryptographicHash::Md5).toHex(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1102 |
config->setTempHash(temphash); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1103 |
} |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1104 |
} |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1105 |
} |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1106 |
NetPassword(nick); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1107 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1108 |
|
8299
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1109 |
void HWForm::NetNickNotRegistered(const QString & nick) |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1110 |
{ |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
1111 |
Q_UNUSED(nick); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
1112 |
|
8299
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1113 |
QMessageBox noRegMsg(this); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1114 |
noRegMsg.setIcon(QMessageBox::Information); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1115 |
noRegMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Nick not registered")); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1116 |
noRegMsg.setWindowModality(Qt::WindowModal); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1117 |
noRegMsg.setText(tr("Your nickname is not registered.\nTo prevent someone else from using it,\nplease register it at www.hedgewars.org")); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1118 |
|
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1119 |
if (!config->passwordHash().isEmpty()) |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1120 |
{ |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1121 |
config->clearPasswordHash(); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1122 |
noRegMsg.setText(noRegMsg.text()+tr("\n\nYour password wasn't saved either.")); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1123 |
} |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1124 |
if (!config->tempHash().isEmpty()) |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1125 |
{ |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1126 |
config->clearTempHash(); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1127 |
} |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1128 |
noRegMsg.exec(); |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1129 |
} |
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1130 |
|
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1131 |
void HWForm::NetNickTaken(const QString & nick) |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1132 |
{ |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1133 |
bool ok = false; |
7795
ba32d3f9e567
set window modality also for custom dialogs, small text changes
koda
parents:
7794
diff
changeset
|
1134 |
QString newNick = QInputDialog::getText(this, tr("Nickname"), tr("Someone already uses your nickname %1 on the server.\nPlease pick another nickname:").arg(nick), QLineEdit::Normal, nick, &ok); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1135 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1136 |
if (!ok || newNick.isEmpty()) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1137 |
{ |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1138 |
//ForcedDisconnect(tr("No nickname supplied.")); |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1139 |
bool retry = RetryDialog(tr("Hedgewars - Empty nickname"), tr("No nickname supplied.")); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1140 |
GoBack(); |
9549 | 1141 |
if (retry && hwnet) { |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1142 |
if (hwnet->m_private_game) { |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1143 |
QStringList list = hwnet->getHost().split(":"); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1144 |
NetConnectServer(list.at(0), list.at(1).toShort()); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1145 |
} else |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1146 |
NetConnectOfficialServer(); |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1147 |
} |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1148 |
return; |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1149 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1150 |
|
9549 | 1151 |
if(hwnet) |
1152 |
hwnet->NewNick(newNick); |
|
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1153 |
config->setValue("net/nick", newNick); |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1154 |
config->updNetNick(); |
6227
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6225
diff
changeset
|
1155 |
|
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6225
diff
changeset
|
1156 |
ui.pageRoomsList->setUser(nick); |
ce60b734fff1
update name autocompletion after nick change (since own nick isn't suggested)
sheepluva
parents:
6225
diff
changeset
|
1157 |
ui.pageNetGame->setUser(nick); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1158 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1159 |
|
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1160 |
void HWForm::NetAuthFailed() |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1161 |
{ |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1162 |
// Set the password blank if case the user tries to join and enter his password again |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1163 |
config->clearTempHash(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1164 |
|
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1165 |
//Try to login again |
8296
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1166 |
bool retry = RetryDialog(tr("Hedgewars - Wrong password"), tr("You entered a wrong password.")); |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1167 |
GoBack(); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1168 |
|
8297
b236e3afed0d
Reverted password loading in PAGE_SETUP, changed the value of passwordlength to save, added clearing of hashes after a 'Wrong password' RetryDialog
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8296
diff
changeset
|
1169 |
config->clearPasswordHash(); |
b236e3afed0d
Reverted password loading in PAGE_SETUP, changed the value of passwordlength to save, added clearing of hashes after a 'Wrong password' RetryDialog
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8296
diff
changeset
|
1170 |
config->clearTempHash(); |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1171 |
if (retry) { |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1172 |
NetConnectOfficialServer(); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1173 |
} |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1174 |
} |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1175 |
|
9549 | 1176 |
void HWForm::askRoomPassword() |
1177 |
{ |
|
1178 |
QString password = QInputDialog::getText(this, tr("Room password"), tr("The room is protected with password.\nPlease, enter the password:")); |
|
1179 |
if(hwnet && !password.isEmpty()) |
|
1180 |
hwnet->roomPasswordEntered(password); |
|
1181 |
} |
|
1182 |
||
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1183 |
bool HWForm::RetryDialog(const QString & title, const QString & label) |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1184 |
{ |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1185 |
QMessageBox retryMsg(this); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1186 |
retryMsg.setIcon(QMessageBox::Warning); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1187 |
retryMsg.setWindowTitle(title); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1188 |
retryMsg.setText(label); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1189 |
retryMsg.setWindowModality(Qt::WindowModal); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1190 |
|
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1191 |
retryMsg.addButton(QMessageBox::Cancel); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1192 |
|
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1193 |
QPushButton *retryButton = retryMsg.addButton(QMessageBox::Ok); |
8296
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1194 |
retryButton->setText(tr("Try Again")); |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1195 |
retryButton->setFocus(); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1196 |
|
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1197 |
retryMsg.exec(); |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1198 |
|
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1199 |
if (retryMsg.clickedButton() == retryButton) { |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1200 |
return true; |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1201 |
} |
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1202 |
return false; |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1203 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1204 |
|
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1205 |
void HWForm::NetTeamAccepted(const QString & team) |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1206 |
{ |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1207 |
ui.pageNetGame->pNetTeamsWidget->changeTeamStatus(team); |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1208 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1209 |
|
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1210 |
void HWForm::NetError(const QString & errmsg) |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1211 |
{ |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1212 |
switch (ui.Pages->currentIndex()) |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1213 |
{ |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1214 |
case ID_PAGE_INGAME: |
8383 | 1215 |
MessageDialog::ShowErrorMessage(errmsg, this); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1216 |
// no break |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1217 |
case ID_PAGE_NETGAME: |
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:
6167
diff
changeset
|
1218 |
ui.pageNetGame->displayError(errmsg); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1219 |
break; |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1220 |
default: |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1221 |
ui.pageRoomsList->displayError(errmsg); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1222 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1223 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1224 |
|
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1225 |
void HWForm::NetWarning(const QString & wrnmsg) |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1226 |
{ |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1227 |
if (ui.Pages->currentIndex() == ID_PAGE_NETGAME || ui.Pages->currentIndex() == ID_PAGE_INGAME) |
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:
6167
diff
changeset
|
1228 |
ui.pageNetGame->displayWarning(wrnmsg); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1229 |
else |
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:
6167
diff
changeset
|
1230 |
ui.pageRoomsList->displayWarning(wrnmsg); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1231 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1232 |
|
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1233 |
void HWForm::_NetConnect(const QString & hostName, quint16 port, QString nick) |
184 | 1234 |
{ |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
1235 |
Q_UNUSED(nick); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
1236 |
|
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1237 |
if (hwnet) { |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1238 |
// destroy old connection |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1239 |
hwnet->Disconnect(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1240 |
delete hwnet; |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1241 |
hwnet = NULL; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1242 |
} |
2377 | 1243 |
|
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1244 |
hwnet = new HWNewNet(); |
637
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
1245 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1246 |
GoToPage(ID_PAGE_CONNECTING); |
1800 | 1247 |
|
8504
9ff55b527d1b
Ehm... probably this will improve situation with desyncs
unc0rr
parents:
8489
diff
changeset
|
1248 |
connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()), Qt::QueuedConnection); |
6697
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1249 |
connect(hwnet, SIGNAL(connected()), this, SLOT(NetConnected()), Qt::QueuedConnection); |
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1250 |
connect(hwnet, SIGNAL(Error(const QString&)), this, SLOT(NetError(const QString&)), Qt::QueuedConnection); |
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1251 |
connect(hwnet, SIGNAL(Warning(const QString&)), this, SLOT(NetWarning(const QString&)), Qt::QueuedConnection); |
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1252 |
connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()), Qt::QueuedConnection); |
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1253 |
connect(hwnet, SIGNAL(LeftRoom(const QString&)), this, SLOT(NetLeftRoom(const QString&)), Qt::QueuedConnection); |
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1254 |
connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)), Qt::QueuedConnection); |
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1255 |
connect(hwnet, SIGNAL(RemoveNetTeam(const HWTeam&)), this, SLOT(RemoveNetTeam(const HWTeam&)), Qt::QueuedConnection); |
8534
92da587691c9
Workaround queued signals problem in netclient instead. Should fix everything.
unc0rr
parents:
8529
diff
changeset
|
1256 |
connect(hwnet, SIGNAL(TeamAccepted(const QString&)), this, SLOT(NetTeamAccepted(const QString&)), Qt::QueuedConnection); |
8291
e4a0d980d1e2
Patched login dialog bugs, added retry dialogs
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8287
diff
changeset
|
1257 |
connect(hwnet, SIGNAL(NickRegistered(const QString&)), this, SLOT(NetNickRegistered(const QString&)), Qt::QueuedConnection); |
8299
ef2e284255cd
Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8297
diff
changeset
|
1258 |
connect(hwnet, SIGNAL(NickNotRegistered(const QString&)), this, SLOT(NetNickNotRegistered(const QString&)), Qt::QueuedConnection); |
6697
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1259 |
connect(hwnet, SIGNAL(NickTaken(const QString&)), this, SLOT(NetNickTaken(const QString&)), Qt::QueuedConnection); |
4a04c02bc8c3
Use queued signal-slot connections with HWNet class
unc0rr
parents:
6677
diff
changeset
|
1260 |
connect(hwnet, SIGNAL(AuthFailed()), this, SLOT(NetAuthFailed()), Qt::QueuedConnection); |
4392
95e27e12d0e9
Fix koda's esc key binding so leaving rooms works correctly with it
nemo
parents:
4232
diff
changeset
|
1261 |
//connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom())); |
9549 | 1262 |
connect(hwnet, SIGNAL(askForRoomPassword()), this, SLOT(askRoomPassword()), Qt::QueuedConnection); |
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
328
diff
changeset
|
1263 |
|
7723 | 1264 |
ui.pageRoomsList->chatWidget->setUsersModel(hwnet->lobbyPlayersModel()); |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1265 |
ui.pageNetGame->chatWidget->setUsersModel(hwnet->roomPlayersModel()); |
7723 | 1266 |
|
1874 | 1267 |
// rooms list page stuff |
6735 | 1268 |
ui.pageRoomsList->setModel(hwnet->roomsListModel()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1269 |
connect(hwnet, SIGNAL(adminAccess(bool)), |
6720
84261c3408a6
Make all signals from HWNet queued, this should fix issues with teams and chat widgets
unc0rr
parents:
6700
diff
changeset
|
1270 |
ui.pageRoomsList, SLOT(setAdmin(bool)), Qt::QueuedConnection); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1271 |
connect(hwnet, SIGNAL(adminAccess(bool)), |
6720
84261c3408a6
Make all signals from HWNet queued, this should fix issues with teams and chat widgets
unc0rr
parents:
6700
diff
changeset
|
1272 |
ui.pageRoomsList->chatWidget, SLOT(adminAccess(bool)), Qt::QueuedConnection); |
2377 | 1273 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1274 |
connect(hwnet, SIGNAL(serverMessage(const QString&)), |
6720
84261c3408a6
Make all signals from HWNet queued, this should fix issues with teams and chat widgets
unc0rr
parents:
6700
diff
changeset
|
1275 |
ui.pageRoomsList->chatWidget, SLOT(onServerMessage(const QString&)), Qt::QueuedConnection); |
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1577
diff
changeset
|
1276 |
|
9541
312bb4384f33
- Frontend finally learns how to create passworded room
unc0rr
parents:
9393
diff
changeset
|
1277 |
connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &, const QString &)), |
312bb4384f33
- Frontend finally learns how to create passworded room
unc0rr
parents:
9393
diff
changeset
|
1278 |
hwnet, SLOT(CreateRoom(const QString&, const QString &))); |
9549 | 1279 |
connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &, const QString &)), |
1280 |
hwnet, SLOT(JoinRoom(const QString&, const QString &))); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1281 |
// connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1282 |
// this, SLOT(NetGameMaster())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1283 |
// connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1284 |
// this, SLOT(NetGameSlave())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1285 |
connect(ui.pageRoomsList, SIGNAL(askForRoomList()), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1286 |
hwnet, SLOT(askRoomsList())); |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
1287 |
|
2345
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2261
diff
changeset
|
1288 |
// room status stuff |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1289 |
connect(hwnet, SIGNAL(roomMaster(bool)), |
8893
8f92e94d0b32
Don't set Default scheme/ammo when switching script if not room admin. Prevents game config desync.
unc0rr
parents:
8891
diff
changeset
|
1290 |
this, SLOT(NetGameChangeStatus(bool))); |
2345
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2261
diff
changeset
|
1291 |
|
1874 | 1292 |
// net page stuff |
8489
25cb6f4a1d1b
Implements protocol message JOINING on frontend, so client in a room always displays correct room name, even when room name changes. Fixes issue 522.
dag10
parents:
8453
diff
changeset
|
1293 |
connect(hwnet, SIGNAL(roomNameUpdated(const QString &)), |
8534
92da587691c9
Workaround queued signals problem in netclient instead. Should fix everything.
unc0rr
parents:
8529
diff
changeset
|
1294 |
ui.pageNetGame, SLOT(setRoomName(const QString &)), Qt::QueuedConnection); |
8759 | 1295 |
connect(hwnet, SIGNAL(roomChatAction(const QString&, const QString&)), |
1296 |
ui.pageNetGame->chatWidget, SLOT(onChatAction(const QString&, const QString&)), Qt::QueuedConnection); |
|
1297 |
connect(hwnet, SIGNAL(roomChatMessage(const QString&, const QString&)), |
|
1298 |
ui.pageNetGame->chatWidget, SLOT(onChatMessage(const QString&, const QString&)), Qt::QueuedConnection); |
|
7720 | 1299 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1300 |
connect(hwnet, SIGNAL(roomMaster(bool)), |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1301 |
ui.pageNetGame->chatWidget, SLOT(adminAccess(bool)), Qt::QueuedConnection); |
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1302 |
connect(ui.pageNetGame->chatWidget, SIGNAL(chatLine(const QString&)), |
8765
688062f1db59
fix/hack so that (own) messages sent in frontend are also visible in the game chat
sheepluva
parents:
8762
diff
changeset
|
1303 |
hwnet, SLOT(chatLineToNetWithEcho(const QString&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1304 |
connect(ui.pageNetGame->BtnGo, SIGNAL(clicked()), hwnet, SLOT(ToggleReady())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1305 |
connect(hwnet, SIGNAL(setMyReadyStatus(bool)), |
6720
84261c3408a6
Make all signals from HWNet queued, this should fix issues with teams and chat widgets
unc0rr
parents:
6700
diff
changeset
|
1306 |
ui.pageNetGame, SLOT(setReadyStatus(bool)), Qt::QueuedConnection); |
1577 | 1307 |
|
1874 | 1308 |
// chat widget actions |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1309 |
connect(ui.pageNetGame->chatWidget, SIGNAL(kick(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1310 |
hwnet, SLOT(kickPlayer(const QString&))); |
11865
047be82b6f67
fix for Bug 91 - Make DELEGATE action available in frontend
sheepluva
parents:
11863
diff
changeset
|
1311 |
connect(ui.pageNetGame->chatWidget, SIGNAL(delegate(const QString&)), |
047be82b6f67
fix for Bug 91 - Make DELEGATE action available in frontend
sheepluva
parents:
11863
diff
changeset
|
1312 |
hwnet, SLOT(delegateToPlayer(const QString&))); |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1313 |
connect(ui.pageNetGame->chatWidget, SIGNAL(ban(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1314 |
hwnet, SLOT(banPlayer(const QString&))); |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1315 |
connect(ui.pageNetGame->chatWidget, SIGNAL(info(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1316 |
hwnet, SLOT(infoPlayer(const QString&))); |
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1317 |
connect(ui.pageNetGame->chatWidget, SIGNAL(follow(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1318 |
hwnet, SLOT(followPlayer(const QString&))); |
8436
b89aacebb9db
- Also pass unknown cmds to the server when in room
unc0rr
parents:
8434
diff
changeset
|
1319 |
connect(ui.pageNetGame->chatWidget, SIGNAL(consoleCommand(const QString&)), |
b89aacebb9db
- Also pass unknown cmds to the server when in room
unc0rr
parents:
8434
diff
changeset
|
1320 |
hwnet, SLOT(consoleCommand(const QString&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1321 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(kick(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1322 |
hwnet, SLOT(kickPlayer(const QString&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1323 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(ban(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1324 |
hwnet, SLOT(banPlayer(const QString&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1325 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(info(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1326 |
hwnet, SLOT(infoPlayer(const QString&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1327 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(follow(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1328 |
hwnet, SLOT(followPlayer(const QString&))); |
8396 | 1329 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(consoleCommand(const QString&)), |
1330 |
hwnet, SLOT(consoleCommand(const QString&))); |
|
1566
6b63c75fdc68
Start work on lobby: add/remove nick from the list on join/quit
unc0rr
parents:
1531
diff
changeset
|
1331 |
|
8762 | 1332 |
// player info |
1333 |
connect(hwnet, SIGNAL(playerInfo(const QString&, const QString&, const QString&, const QString&)), |
|
1334 |
ui.pageRoomsList->chatWidget, SLOT(onPlayerInfo(const QString&, const QString&, const QString&, const QString&)), Qt::QueuedConnection); |
|
1335 |
connect(hwnet, SIGNAL(playerInfo(const QString&, const QString&, const QString&, const QString&)), |
|
1336 |
ui.pageNetGame->chatWidget, SLOT(onPlayerInfo(const QString&, const QString&, const QString&, const QString&)), Qt::QueuedConnection); |
|
1337 |
||
1874 | 1338 |
// chatting |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1339 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(chatLine(const QString&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1340 |
hwnet, SLOT(chatLineToLobby(const QString&))); |
8759 | 1341 |
connect(hwnet, SIGNAL(lobbyChatAction(const QString&,const QString&)), |
1342 |
ui.pageRoomsList->chatWidget, SLOT(onChatAction(const QString&,const QString&)), Qt::QueuedConnection); |
|
1343 |
connect(hwnet, SIGNAL(lobbyChatMessage(const QString&, const QString&)), |
|
1344 |
ui.pageRoomsList->chatWidget, SLOT(onChatMessage(const QString&, const QString&)), Qt::QueuedConnection); |
|
1568 | 1345 |
|
1874 | 1346 |
// nick list stuff |
8891
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1347 |
{ |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1348 |
QSortFilterProxyModel * playersSortFilterModel = qobject_cast<QSortFilterProxyModel *>(hwnet->lobbyPlayersModel()); |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1349 |
if(playersSortFilterModel) |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1350 |
{ |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1351 |
PlayersListModel * players = qobject_cast<PlayersListModel *>(playersSortFilterModel->sourceModel()); |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1352 |
connect(players, SIGNAL(nickAdded(const QString&, bool)), |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1353 |
ui.pageNetGame->chatWidget, SLOT(nickAdded(const QString&, bool))); |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1354 |
connect(players, SIGNAL(nickRemoved(const QString&)), |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1355 |
ui.pageNetGame->chatWidget, SLOT(nickRemoved(const QString&))); |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1356 |
connect(players, SIGNAL(nickAddedLobby(const QString&, bool)), |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1357 |
ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&, bool))); |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1358 |
connect(players, SIGNAL(nickRemovedLobby(const QString&)), |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1359 |
ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&))); |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1360 |
connect(players, SIGNAL(nickRemovedLobby(const QString&, const QString&)), |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1361 |
ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&, const QString&))); |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1362 |
} |
bf67b4d7d7b4
- Better fix to friends joins/quits highlighting problem
unc0rr
parents:
8887
diff
changeset
|
1363 |
} |
461 | 1364 |
|
1874 | 1365 |
// teams selecting stuff |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1366 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(hhogsNumChanged(const HWTeam&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1367 |
hwnet, SLOT(onHedgehogsNumChanged(const HWTeam&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1368 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamColorChanged(const HWTeam&)), |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1369 |
hwnet, SLOT(onTeamColorChanged(const HWTeam&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1370 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamWillPlay(HWTeam)), hwnet, SLOT(AddTeam(HWTeam))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1371 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(acceptRequested(HWTeam)), hwnet, SLOT(AddTeam(HWTeam))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1372 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamNotPlaying(const HWTeam&)), hwnet, SLOT(RemoveTeam(const HWTeam&))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1373 |
connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)), |
6720
84261c3408a6
Make all signals from HWNet queued, this should fix issues with teams and chat widgets
unc0rr
parents:
6700
diff
changeset
|
1374 |
ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)), Qt::QueuedConnection); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1375 |
connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)), |
6720
84261c3408a6
Make all signals from HWNet queued, this should fix issues with teams and chat widgets
unc0rr
parents:
6700
diff
changeset
|
1376 |
ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)), Qt::QueuedConnection); |
1874 | 1377 |
|
1924 | 1378 |
// admin stuff |
3283 | 1379 |
connect(hwnet, SIGNAL(serverMessageNew(const QString&)), ui.pageAdmin, SLOT(serverMessageNew(const QString &))); |
1380 |
connect(hwnet, SIGNAL(serverMessageOld(const QString&)), ui.pageAdmin, SLOT(serverMessageOld(const QString &))); |
|
1381 |
connect(hwnet, SIGNAL(latestProtocolVar(int)), ui.pageAdmin, SLOT(protocol(int))); |
|
8157 | 1382 |
connect(hwnet, SIGNAL(bansList(const QStringList &)), ui.pageAdmin, SLOT(setBansList(const QStringList &))); |
3283 | 1383 |
connect(ui.pageAdmin, SIGNAL(setServerMessageNew(const QString&)), hwnet, SLOT(setServerMessageNew(const QString &))); |
1384 |
connect(ui.pageAdmin, SIGNAL(setServerMessageOld(const QString&)), hwnet, SLOT(setServerMessageOld(const QString &))); |
|
1385 |
connect(ui.pageAdmin, SIGNAL(setProtocol(int)), hwnet, SLOT(setLatestProtocolVar(int))); |
|
1386 |
connect(ui.pageAdmin, SIGNAL(askServerVars()), hwnet, SLOT(askServerVars())); |
|
6009 | 1387 |
connect(ui.pageAdmin, SIGNAL(clearAccountsCache()), hwnet, SLOT(clearAccountsCache())); |
8157 | 1388 |
connect(ui.pageAdmin, SIGNAL(bansListRequest()), hwnet, SLOT(getBanList())); |
1389 |
connect(ui.pageAdmin, SIGNAL(removeBan(QString)), hwnet, SLOT(removeBan(QString))); |
|
1390 |
connect(ui.pageAdmin, SIGNAL(banIP(QString,QString,int)), hwnet, SLOT(banIP(QString,QString,int))); |
|
1391 |
connect(ui.pageAdmin, SIGNAL(banNick(QString,QString,int)), hwnet, SLOT(banNick(QString,QString,int))); |
|
1924 | 1392 |
|
1898
f0ab0c77946d
Send scheme data over net (but recieving part isn't implemented yet)
unc0rr
parents:
1897
diff
changeset
|
1393 |
// disconnect |
6036 | 1394 |
connect(hwnet, SIGNAL(disconnected(const QString&)), this, SLOT(ForcedDisconnect(const QString&)), Qt::QueuedConnection); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1395 |
|
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1396 |
// config stuff |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1397 |
connect(hwnet, SIGNAL(paramChanged(const QString &, const QStringList &)), ui.pageNetGame->pGameCFG, SLOT(setParam(const QString &, const QStringList &))); |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1398 |
connect(ui.pageNetGame->pGameCFG, SIGNAL(paramChanged(const QString &, const QStringList &)), hwnet, SLOT(onParamChanged(const QString &, const QStringList &))); |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1399 |
connect(hwnet, SIGNAL(configAsked()), ui.pageNetGame->pGameCFG, SLOT(fullNetConfig())); |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1400 |
|
9100 | 1401 |
// using proxy slot to prevent loss of game messages when they're sent to not yet connected slot of game object |
1402 |
connect(hwnet, SIGNAL(FromNet(const QByteArray &)), this, SLOT(FromNetProxySlot(const QByteArray &)), Qt::QueuedConnection); |
|
1403 |
||
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1404 |
//nick and pass stuff |
8986 | 1405 |
hwnet->m_private_game = !(hostName == NETGAME_DEFAULT_SERVER && port == NETGAME_DEFAULT_PORT); |
1406 |
if (hwnet->m_private_game == false && AskForNickAndPwd() != 0) |
|
1407 |
return; |
|
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1408 |
|
9057
903f50e85144
Default to random guest username in all places net/nick is fetched. Fixes issue #588
nemo
parents:
9033
diff
changeset
|
1409 |
QString nickname = config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString(); |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1410 |
ui.pageRoomsList->setUser(nickname); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1411 |
ui.pageNetGame->setUser(nickname); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1412 |
|
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1413 |
hwnet->Connect(hostName, port, nickname); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1414 |
} |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1415 |
|
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1416 |
int HWForm::AskForNickAndPwd(void) |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1417 |
{ |
8181 | 1418 |
//remove temppasswordhash just in case |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1419 |
config->clearTempHash(); |
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1420 |
|
8181 | 1421 |
//initialize |
8986 | 1422 |
QString hash; |
1423 |
QString temphash; |
|
1424 |
QString nickname; |
|
8181 | 1425 |
QString password; |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1426 |
|
8986 | 1427 |
do { |
9057
903f50e85144
Default to random guest username in all places net/nick is fetched. Fixes issue #588
nemo
parents:
9033
diff
changeset
|
1428 |
nickname = config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString(); |
8986 | 1429 |
hash = config->passwordHash(); |
1430 |
temphash = config->tempHash(); |
|
1431 |
||
1432 |
//if something from login is missing, start dialog loop |
|
1433 |
if (nickname.isEmpty() || hash.isEmpty()) { |
|
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1434 |
//open dialog |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1435 |
HWPasswordDialog * pwDialog = new HWPasswordDialog(this); |
8364
fbc9bcc6c39d
Added "New account" button when connectiong to the official server
vitiv <nikita.utiu@gmail.com>
parents:
8357
diff
changeset
|
1436 |
// make the "new account" button dialog open a browser with the registration page |
fbc9bcc6c39d
Added "New account" button when connectiong to the official server
vitiv <nikita.utiu@gmail.com>
parents:
8357
diff
changeset
|
1437 |
connect(pwDialog->pbNewAccount, SIGNAL(clicked()), this, SLOT(openRegistrationPage())); |
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1438 |
pwDialog->cbSave->setChecked(config->value("net/savepassword", true).toBool()); |
8181 | 1439 |
|
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1440 |
//if nickname is present, put it into the field |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1441 |
if (!nickname.isEmpty()) { |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1442 |
pwDialog->leNickname->setText(nickname); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1443 |
pwDialog->lePassword->setFocus(); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1444 |
} |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1445 |
|
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1446 |
//if dialog close, create an error message |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1447 |
if (pwDialog->exec() != QDialog::Accepted) { |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1448 |
delete pwDialog; |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1449 |
GoBack(); |
8986 | 1450 |
break; |
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1451 |
} |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1452 |
|
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1453 |
//set nick and pass from the dialog |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1454 |
nickname = pwDialog->leNickname->text(); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1455 |
password = pwDialog->lePassword->text(); |
8986 | 1456 |
bool save = pwDialog->cbSave->isChecked(); |
1457 |
//clean up |
|
1458 |
delete pwDialog; |
|
8181 | 1459 |
|
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1460 |
//check the nickname variable |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1461 |
if (nickname.isEmpty()) { |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1462 |
int retry = RetryDialog(tr("Hedgewars - Empty nickname"), tr("No nickname supplied.")); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1463 |
GoBack(); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1464 |
if (retry) { |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1465 |
if (hwnet->m_private_game) { |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1466 |
QStringList list = hwnet->getHost().split(":"); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1467 |
NetConnectServer(list.at(0), list.at(1).toShort()); |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1468 |
} else |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1469 |
NetConnectOfficialServer(); |
8986 | 1470 |
} |
1471 |
break; //loop restart |
|
1472 |
} else { |
|
1473 |
//update nickname if it's fine |
|
1474 |
config->setValue("net/nick", nickname); |
|
1475 |
config->updNetNick(); |
|
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1476 |
} |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1477 |
|
8986 | 1478 |
//check the password variable |
1479 |
if (password.isEmpty()) { |
|
1480 |
config->clearPasswordHash(); |
|
1481 |
break; |
|
1482 |
} else { |
|
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1483 |
//calculate temphash and set it into config |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1484 |
temphash = QCryptographicHash::hash(password.toUtf8(), QCryptographicHash::Md5).toHex(); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1485 |
config->setTempHash(temphash); |
8181 | 1486 |
|
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1487 |
//if user wants to save password |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1488 |
config->setValue("net/savepassword", save); |
8986 | 1489 |
if (save) { |
1490 |
// user wants to save password |
|
8407
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1491 |
ui.pageOptions->CBSavePassword->setChecked(true); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1492 |
config->setPasswordHash(temphash); |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1493 |
} |
686f2e716c97
Fixes password not actually saving when "save password" is checked in the HWPasswordDialog called by HWForm.
dag10 <gottlieb.drew@gmail.com>
parents:
8396
diff
changeset
|
1494 |
} |
8986 | 1495 |
} |
1496 |
} while (nickname.isEmpty() || (hash.isEmpty() && temphash.isEmpty())); //while a nickname, or both hashes are missing |
|
8294
0e5782b0dd54
Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8293
diff
changeset
|
1497 |
|
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1498 |
return 0; |
184 | 1499 |
} |
1500 |
||
314 | 1501 |
void HWForm::NetConnect() |
1502 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1503 |
HWHostPortDialog * hpd = new HWHostPortDialog(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1504 |
hpd->leHost->setText(*netHost); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1505 |
hpd->sbPort->setValue(netPort); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
1506 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1507 |
if (hpd->exec() == QDialog::Accepted) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1508 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1509 |
config->SaveOptions(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1510 |
delete netHost; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1511 |
netHost = new QString(hpd->leHost->text()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1512 |
netPort = hpd->sbPort->value(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1513 |
NetConnectServer(*netHost, netPort); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1514 |
} |
6907 | 1515 |
delete hpd; |
314 | 1516 |
} |
1517 |
||
1518 |
void HWForm::NetStartServer() |
|
1519 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1520 |
config->SaveOptions(); |
636 | 1521 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1522 |
pnetserver = new HWNetServer; |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
1523 |
if (!pnetserver->StartServer(ui.pageNetServer->sbPort->value())) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1524 |
{ |
8383 | 1525 |
MessageDialog::ShowErrorMessage(QMessageBox::tr("Unable to start server"), this); |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
1526 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1527 |
delete pnetserver; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1528 |
pnetserver = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1529 |
return; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1530 |
} |
672
08ed55ea1e2a
- Fix a bug when server fails to start, and then connecting to another server on the same host (strange, the fix won't work on my machine)
unc0rr
parents:
668
diff
changeset
|
1531 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1532 |
QTimer::singleShot(250, this, SLOT(AsyncNetServerStart())); |
672
08ed55ea1e2a
- Fix a bug when server fails to start, and then connecting to another server on the same host (strange, the fix won't work on my machine)
unc0rr
parents:
668
diff
changeset
|
1533 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1534 |
pRegisterServer = new HWNetUdpServer(0, |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1535 |
ui.pageNetServer->leServerDescr->text(), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1536 |
ui.pageNetServer->sbPort->value()); |
1418 | 1537 |
} |
1538 |
||
1539 |
void HWForm::AsyncNetServerStart() |
|
1540 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1541 |
NetConnectServer("localhost", pnetserver->getRunningPort()); |
314 | 1542 |
} |
1543 |
||
184 | 1544 |
void HWForm::NetDisconnect() |
1545 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1546 |
if(pnetserver) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1547 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1548 |
if (pRegisterServer) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1549 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1550 |
pRegisterServer->unregister(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1551 |
pRegisterServer = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1552 |
} |
659 | 1553 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1554 |
pnetserver->StopServer(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1555 |
delete pnetserver; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1556 |
pnetserver = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1557 |
} |
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
1558 |
|
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
1559 |
if(hwnet) |
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
1560 |
hwnet->Disconnect(); |
184 | 1561 |
} |
1562 |
||
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1563 |
void HWForm::ForcedDisconnect(const QString & reason) |
383 | 1564 |
{ |
8296
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1565 |
if (reason == "Reconnected too fast") { //TODO: this is a hack, which should be remade |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1566 |
bool retry = RetryDialog(tr("Hedgewars - Connection error"), tr("You reconnected too fast.\nPlease wait a few seconds and try again.")); |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1567 |
if (retry) { |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1568 |
if (hwnet->m_private_game) { |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1569 |
QStringList list = hwnet->getHost().split(":"); |
9063
5cab446e1341
Fix "try again" button in "reconnected to fast" dialog trying to connect to port 0
unc0rr
parents:
9057
diff
changeset
|
1570 |
NetConnectServer(list.at(0), list.at(1).toUInt()); |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1571 |
} else |
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1572 |
NetConnectOfficialServer(); |
8296
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1573 |
} |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1574 |
else { |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1575 |
while (ui.Pages->currentIndex() != ID_PAGE_NET |
8434 | 1576 |
&& ui.Pages->currentIndex() != ID_PAGE_MAIN) |
8296
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1577 |
{ |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1578 |
GoBack(); |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1579 |
} |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1580 |
} |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1581 |
return; |
455da122c0ad
Added a hack that activates a RetryDialog in case the user is banned for 'Reconnect too fast'. Set all string used in RetryDialog to be translated
Ondrej Skopek <skopekondrej@gmail.com>
parents:
8295
diff
changeset
|
1582 |
} |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
1583 |
if (pnetserver) |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
1584 |
return; // we have server - let it care of all things |
8720
5603527f9803
this should prevent the password prompt from appearing on local games (issue 548)
koda
parents:
8716
diff
changeset
|
1585 |
if (hwnet) { |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
1586 |
QString errorStr = QMessageBox::tr("Connection to server is lost") + (reason.isEmpty()?"":("\n\n" + HWNewNet::tr("Quit reason: ") + '"' + reason +'"')); |
8383 | 1587 |
MessageDialog::ShowErrorMessage(errorStr, this); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1588 |
} |
7842
d1c0e4341165
- Better fix than the one from rc7f5c3bd7f8c. Now just scrolling back till net/nettype/main page. Not tested aswell.
unc0rr
parents:
7826
diff
changeset
|
1589 |
|
d1c0e4341165
- Better fix than the one from rc7f5c3bd7f8c. Now just scrolling back till net/nettype/main page. Not tested aswell.
unc0rr
parents:
7826
diff
changeset
|
1590 |
while (ui.Pages->currentIndex() != ID_PAGE_NET |
d1c0e4341165
- Better fix than the one from rc7f5c3bd7f8c. Now just scrolling back till net/nettype/main page. Not tested aswell.
unc0rr
parents:
7826
diff
changeset
|
1591 |
&& ui.Pages->currentIndex() != ID_PAGE_MAIN) |
7803 | 1592 |
{ |
7842
d1c0e4341165
- Better fix than the one from rc7f5c3bd7f8c. Now just scrolling back till net/nettype/main page. Not tested aswell.
unc0rr
parents:
7826
diff
changeset
|
1593 |
GoBack(); |
7803 | 1594 |
} |
383 | 1595 |
} |
1596 |
||
1311 | 1597 |
void HWForm::NetConnected() |
1598 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1599 |
GoToPage(ID_PAGE_ROOMSLIST); |
1311 | 1600 |
} |
1601 |
||
184 | 1602 |
void HWForm::NetGameEnter() |
1603 |
{ |
|
8179
a1ffcb559f99
Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents:
8157
diff
changeset
|
1604 |
ui.pageNetGame->chatWidget->clear(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1605 |
GoToPage(ID_PAGE_NETGAME); |
184 | 1606 |
} |
1607 |
||
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
338
diff
changeset
|
1608 |
void HWForm::AddNetTeam(const HWTeam& team) |
184 | 1609 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1610 |
ui.pageNetGame->pNetTeamsWidget->addTeam(team); |
184 | 1611 |
} |
1612 |
||
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1613 |
void HWForm::RemoveNetTeam(const HWTeam& team) |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1614 |
{ |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1615 |
ui.pageNetGame->pNetTeamsWidget->removeNetTeam(team); |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1616 |
} |
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1617 |
|
184 | 1618 |
void HWForm::StartMPGame() |
1619 |
{ |
|
12217
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1620 |
int numHogs = ui.pageMultiplayer->teamsSelect->getNumHedgehogs(); |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1621 |
/* Don't allow to start game with >48 hogs. |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1622 |
TODO: Remove this as soon the engine supports more hogs. */ |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1623 |
if(numHogs > 48) |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1624 |
{ |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1625 |
MessageDialog::ShowErrorMessage(QMessageBox::tr("Sorry, Hedgewars can't be played with more than 48 hedgehogs. Please try again with fewer hedgehogs.\n\nCurrent number of hedgehogs: %1").arg(numHogs), this); |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1626 |
return; |
a6cd48b8ef61
Prevent frontend from starting game w/ >48 hogs
Wuzzy <almikes@aol.com>
parents:
11978
diff
changeset
|
1627 |
} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1628 |
QString ammo; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1629 |
ammo = ui.pageMultiplayer->gameCFG->WeaponsName->itemData( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1630 |
ui.pageMultiplayer->gameCFG->WeaponsName->currentIndex() |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1631 |
).toString(); |
696 | 1632 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1633 |
CreateGame(ui.pageMultiplayer->gameCFG, ui.pageMultiplayer->teamsSelect, ammo); |
306 | 1634 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1635 |
game->StartLocal(); |
184 | 1636 |
} |
306 | 1637 |
|
1638 |
void HWForm::GameStateChanged(GameState gameState) |
|
1639 |
{ |
|
4430
cacda05a053e
Try suppressing those annoying "incorrect state" messages without actually breaking net play. Alter prior checks on GoBack. NEEDS TESTING.
nemo
parents:
4429
diff
changeset
|
1640 |
quint8 id = ui.Pages->currentIndex(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1641 |
switch(gameState) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1642 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1643 |
case gsStarted: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1644 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1645 |
Music(false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1646 |
if (wBackground) wBackground->stopAnimation(); |
4428
2bc3d3475edf
Try to kill off all teams if the player returns to the lobby in mid-game. Also leave game room open for admins to kick/restrict joins etc. NEEDS TESTING PROBABLY BROKE SOMETHING OR OTHER
nemo
parents:
4416
diff
changeset
|
1647 |
if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoToPage(ID_PAGE_INGAME); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1648 |
ui.pageGameStats->clear(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1649 |
if (pRegisterServer) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1650 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1651 |
pRegisterServer->unregister(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1652 |
pRegisterServer = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1653 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1654 |
//setVisible(false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1655 |
setFocusPolicy(Qt::NoFocus); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1656 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1657 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1658 |
case gsFinished: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1659 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1660 |
//setVisible(true); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1661 |
setFocusPolicy(Qt::StrongFocus); |
4430
cacda05a053e
Try suppressing those annoying "incorrect state" messages without actually breaking net play. Alter prior checks on GoBack. NEEDS TESTING.
nemo
parents:
4429
diff
changeset
|
1662 |
if (id == ID_PAGE_INGAME) GoBack(); |
8226
67f07ff5b593
Removed redundant "enable"s on checkboxes and variable names.
Mitchell Kember <mk12360@gmail.com>
parents:
8205
diff
changeset
|
1663 |
Music(ui.pageOptions->CBFrontendMusic->isChecked()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1664 |
if (wBackground) wBackground->startAnimation(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1665 |
GoToPage(ID_PAGE_GAMESTATS); |
4908
99d6797b7ff4
Frontend sends ROUNDFINISHED with information about whether the round was played till end (will be needed for stats)
unc0rr
parents:
4902
diff
changeset
|
1666 |
if (hwnet && (!game || !game->netSuspend)) hwnet->gameFinished(true); |
4430
cacda05a053e
Try suppressing those annoying "incorrect state" messages without actually breaking net play. Alter prior checks on GoBack. NEEDS TESTING.
nemo
parents:
4429
diff
changeset
|
1667 |
if (game) game->netSuspend = false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1668 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1669 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1670 |
default: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1671 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1672 |
//setVisible(true); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1673 |
setFocusPolicy(Qt::StrongFocus); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1674 |
quint8 id = ui.Pages->currentIndex(); |
4428
2bc3d3475edf
Try to kill off all teams if the player returns to the lobby in mid-game. Also leave game room open for admins to kick/restrict joins etc. NEEDS TESTING PROBABLY BROKE SOMETHING OR OTHER
nemo
parents:
4416
diff
changeset
|
1675 |
if (id == ID_PAGE_INGAME || |
2bc3d3475edf
Try to kill off all teams if the player returns to the lobby in mid-game. Also leave game room open for admins to kick/restrict joins etc. NEEDS TESTING PROBABLY BROKE SOMETHING OR OTHER
nemo
parents:
4416
diff
changeset
|
1676 |
// was room chief and the game was aborted |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1677 |
(hwnet && hwnet->isRoomChief() && hwnet->isInRoom() && |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1678 |
(gameState == gsInterrupted || gameState == gsStopped || gameState == gsDestroyed || gameState == gsHalted))) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1679 |
{ |
4430
cacda05a053e
Try suppressing those annoying "incorrect state" messages without actually breaking net play. Alter prior checks on GoBack. NEEDS TESTING.
nemo
parents:
4429
diff
changeset
|
1680 |
if (id == ID_PAGE_INGAME) GoBack(); |
8226
67f07ff5b593
Removed redundant "enable"s on checkboxes and variable names.
Mitchell Kember <mk12360@gmail.com>
parents:
8205
diff
changeset
|
1681 |
Music(ui.pageOptions->CBFrontendMusic->isChecked()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1682 |
if (wBackground) wBackground->startAnimation(); |
4908
99d6797b7ff4
Frontend sends ROUNDFINISHED with information about whether the round was played till end (will be needed for stats)
unc0rr
parents:
4902
diff
changeset
|
1683 |
if (hwnet) hwnet->gameFinished(false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1684 |
} |
4845 | 1685 |
if (gameState == gsHalted) close(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1686 |
}; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1687 |
} |
307 | 1688 |
} |
1689 |
||
696 | 1690 |
void HWForm::CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo) |
306 | 1691 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1692 |
game = new HWGame(config, gamecfg, ammo, pTeamSelWidget); |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7207
diff
changeset
|
1693 |
connect(game, SIGNAL(CampStateChanged(int)), this, SLOT(UpdateCampaignPageProgress(int))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1694 |
connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1695 |
connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &))); |
10307
e13d3147f15b
do not get stuck on "in game..." page just because of game crash. output a message instead. could still need some tweaking, but a man gotta sleep. and sheep too...
sheepluva
parents:
10108
diff
changeset
|
1696 |
connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowFatalErrorMessage(const QString &)), Qt::QueuedConnection); |
7180 | 1697 |
connect(game, SIGNAL(HaveRecord(RecordType, const QByteArray &)), this, SLOT(GetRecord(RecordType, const QByteArray &))); |
5734 | 1698 |
m_lastDemo = QByteArray(); |
306 | 1699 |
} |
425 | 1700 |
|
7180 | 1701 |
void HWForm::GetRecord(RecordType type, const QByteArray & record) |
533 | 1702 |
{ |
7180 | 1703 |
if (type != rtNeither) |
1704 |
{ |
|
1705 |
QString filename; |
|
1706 |
QByteArray demo = record; |
|
1707 |
QString recordFileName = |
|
1708 |
config->appendDateTimeToRecordName() ? |
|
1709 |
QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm") : |
|
1710 |
"LastRound"; |
|
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1427
diff
changeset
|
1711 |
|
8613
82c649dfc7c3
split cVersionString into its three separate components (version, revision, hash) and apply the new values sensibly on the frontend (esp. title, info and feedback)
koda
parents:
8609
diff
changeset
|
1712 |
recordFileName += "_" + *cRevisionString + "-" + *cHashString; |
4902
45ec26ca9491
if on dev version append hg revision id to demos/saves' filenames
sheepluva
parents:
4897
diff
changeset
|
1713 |
|
7180 | 1714 |
if (type == rtDemo) |
1715 |
{ |
|
1716 |
demo.replace(QByteArray("\x02TL"), QByteArray("\x02TD")); |
|
1717 |
demo.replace(QByteArray("\x02TN"), QByteArray("\x02TD")); |
|
1718 |
demo.replace(QByteArray("\x02TS"), QByteArray("\x02TD")); |
|
1719 |
filename = cfgdir->absolutePath() + "/Demos/" + recordFileName + "." + *cProtoVer + ".hwd"; |
|
1720 |
m_lastDemo = demo; |
|
1721 |
} |
|
1722 |
else |
|
1723 |
{ |
|
1724 |
demo.replace(QByteArray("\x02TL"), QByteArray("\x02TS")); |
|
1725 |
demo.replace(QByteArray("\x02TN"), QByteArray("\x02TS")); |
|
1726 |
filename = cfgdir->absolutePath() + "/Saves/" + recordFileName + "." + *cProtoVer + ".hws"; |
|
1727 |
} |
|
1728 |
||
1729 |
QFile demofile(filename); |
|
1730 |
if (!demofile.open(QIODevice::WriteOnly)) |
|
8383 | 1731 |
MessageDialog::ShowErrorMessage(tr("Cannot save record to file %1").arg(filename), this); |
7180 | 1732 |
else |
1733 |
{ |
|
1734 |
demofile.write(demo); |
|
1735 |
demofile.close(); |
|
1736 |
} |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1737 |
} |
533 | 1738 |
|
7392
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7376
diff
changeset
|
1739 |
ui.pageVideos->startEncoding(record); |
533 | 1740 |
} |
587 | 1741 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11959
diff
changeset
|
1742 |
void HWForm::startTraining(const QString & scriptName, const QString & subFolder) |
587 | 1743 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1744 |
CreateGame(0, 0, 0); |
587 | 1745 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11959
diff
changeset
|
1746 |
game->StartTraining(scriptName, subFolder); |
3760 | 1747 |
} |
1748 |
||
1749 |
void HWForm::StartCampaign() |
|
1750 |
{ |
|
1751 |
CreateGame(0, 0, 0); |
|
11957 | 1752 |
QString camp = ui.pageCampaign->CBCampaign->itemData(ui.pageCampaign->CBCampaign->currentIndex()).toString(); |
9290
478aa681e702
this seems to work ok, but I have to clean up the code
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9288
diff
changeset
|
1753 |
QString miss = campaignMissionInfo[ui.pageCampaign->CBMission->currentIndex()].script; |
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1754 |
QString campTeam = ui.pageCampaign->CBTeam->currentText(); |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1755 |
game->StartCampaign(camp, miss, campTeam); |
587 | 1756 |
} |
660 | 1757 |
|
1758 |
void HWForm::CreateNetGame() |
|
1759 |
{ |
|
9100 | 1760 |
// go back in pages to prevent user from being stuck on certain pages |
1761 |
if(ui.Pages->currentIndex() == ID_PAGE_GAMESTATS || |
|
1762 |
ui.Pages->currentIndex() == ID_PAGE_INGAME) |
|
1763 |
GoBack(); |
|
1764 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1765 |
QString ammo; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1766 |
ammo = ui.pageNetGame->pGameCFG->WeaponsName->itemData( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1767 |
ui.pageNetGame->pGameCFG->WeaponsName->currentIndex() |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1768 |
).toString(); |
1517 | 1769 |
|
6225
505643d4c23d
disconnect when going back from lobby page (regression fix)
sheepluva
parents:
6223
diff
changeset
|
1770 |
CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo); |
660 | 1771 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1772 |
connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &))); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1773 |
connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &))); |
10392 | 1774 |
connect(game, SIGNAL(SendConsoleCommand(const QString&)), hwnet, SLOT(consoleCommand(const QString&))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1775 |
connect(game, SIGNAL(SendTeamMessage(const QString &)), hwnet, SLOT(SendTeamMessage(const QString &))); |
7916 | 1776 |
connect(hwnet, SIGNAL(chatStringFromNet(const QString &)), game, SLOT(FromNetChat(const QString &)), Qt::QueuedConnection); |
660 | 1777 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1778 |
game->StartNet(); |
660 | 1779 |
} |
674 | 1780 |
|
1781 |
void HWForm::closeEvent(QCloseEvent *event) |
|
1782 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1783 |
config->SaveOptions(); |
11852 | 1784 |
#ifdef VIDEOREC |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
1785 |
config->SaveVideosOptions(); |
8266
927da572bcdc
will fix this http://code.google.com/p/hedgewars/source/detail?r=9f0e79ab51f00f3b1e133ae70cdd63f6963439c0 and will allow hedgewars to build without video recording enabled, for the time being although i want to talk to koda or someone to understand what should be #ifdef'd and if i've done too much or too little.. but at least that will let it build
mk12
parents:
8226
diff
changeset
|
1786 |
#endif |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1787 |
event->accept(); |
674 | 1788 |
} |
1235 | 1789 |
|
1790 |
void HWForm::Music(bool checked) |
|
1791 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1792 |
if (checked) |
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6160
diff
changeset
|
1793 |
SDLInteraction::instance().startMusic(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1794 |
else |
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6160
diff
changeset
|
1795 |
SDLInteraction::instance().stopMusic(); |
1235 | 1796 |
} |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1797 |
|
2345
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2261
diff
changeset
|
1798 |
void HWForm::NetGameChangeStatus(bool isMaster) |
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2261
diff
changeset
|
1799 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1800 |
if (isMaster) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1801 |
NetGameMaster(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1802 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1803 |
NetGameSlave(); |
2345
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2261
diff
changeset
|
1804 |
} |
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2261
diff
changeset
|
1805 |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1806 |
void HWForm::NetGameMaster() |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1807 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1808 |
ui.pageNetGame->setMasterMode(true); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1809 |
ui.pageNetGame->restrictJoins->setChecked(false); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1810 |
ui.pageNetGame->restrictTeamAdds->setChecked(false); |
8559 | 1811 |
ui.pageNetGame->restrictUnregistered->setChecked(false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1812 |
ui.pageNetGame->pGameCFG->GameSchemes->setModel(ammoSchemeModel); |
8377 | 1813 |
ui.pageNetGame->pGameCFG->setMaster(true); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1814 |
ui.pageNetGame->pNetTeamsWidget->setInteractivity(true); |
2377 | 1815 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1816 |
if (hwnet) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1817 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1818 |
// disconnect connections first to ensure their inexistance and not to connect twice |
8416
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
1819 |
ui.pageNetGame->BtnStart->disconnect(this); |
5126 | 1820 |
ui.pageNetGame->BtnUpdate->disconnect(hwnet); |
8415
02acf6b92f52
Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents:
8407
diff
changeset
|
1821 |
ui.pageNetGame->leRoomName->disconnect(hwnet); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1822 |
ui.pageNetGame->restrictJoins->disconnect(hwnet); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1823 |
ui.pageNetGame->restrictTeamAdds->disconnect(hwnet); |
8559 | 1824 |
ui.pageNetGame->restrictUnregistered->disconnect(hwnet); |
7122
fa2d09868ac6
Fix reported in bug #327, comment #3 - untested but seems reasonable/safe.
nemo
parents:
7015
diff
changeset
|
1825 |
ui.pageNetGame->disconnect(hwnet, SLOT(updateRoomName(const QString&))); |
7710
fd5bcbd698a5
- Keep track of room name so correct name is displayed when you become room admin
unc0rr
parents:
7679
diff
changeset
|
1826 |
|
fd5bcbd698a5
- Keep track of room name so correct name is displayed when you become room admin
unc0rr
parents:
7679
diff
changeset
|
1827 |
ui.pageNetGame->setRoomName(hwnet->getRoom()); |
fd5bcbd698a5
- Keep track of room name so correct name is displayed when you become room admin
unc0rr
parents:
7679
diff
changeset
|
1828 |
|
8416
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
1829 |
connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), this, SLOT(startGame())); |
7122
fa2d09868ac6
Fix reported in bug #327, comment #3 - untested but seems reasonable/safe.
nemo
parents:
7015
diff
changeset
|
1830 |
connect(ui.pageNetGame, SIGNAL(askForUpdateRoomName(const QString &)), hwnet, SLOT(updateRoomName(const QString &))); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1831 |
connect(ui.pageNetGame->restrictJoins, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictJoins())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1832 |
connect(ui.pageNetGame->restrictTeamAdds, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictTeamAdds())); |
8559 | 1833 |
connect(ui.pageNetGame->restrictUnregistered, SIGNAL(triggered()), hwnet, SLOT(toggleRegisteredOnly())); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1834 |
connect(ui.pageNetGame->pGameCFG->GameSchemes->model(), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1835 |
SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1836 |
ui.pageNetGame->pGameCFG, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1837 |
SLOT(resendSchemeData()) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1838 |
); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1839 |
} |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1840 |
} |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1841 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1842 |
void HWForm::NetGameSlave() |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1843 |
{ |
8377 | 1844 |
ui.pageNetGame->pGameCFG->setMaster(false); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1845 |
ui.pageNetGame->pNetTeamsWidget->setInteractivity(false); |
2377 | 1846 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1847 |
if (hwnet) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1848 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1849 |
NetAmmoSchemeModel * netAmmo = new NetAmmoSchemeModel(hwnet); |
10721
9b789de8e5df
Workaround bug (each time losing room master status, even when joining mutliple rooms, new instance of NetAmmoSchemeModel created, receiving schemeConfig and modifying its 43rd member, thus the last model which accepts this signal has the string cut down several times, workaround creates copy of qstringlist to avoid modifying shared message instance. Proper fix would delete unneeded instances of NetAmmoSchemeModel, but who cares)
unc0rr
parents:
10392
diff
changeset
|
1850 |
connect(hwnet, SIGNAL(netSchemeConfig(QStringList)), netAmmo, SLOT(setNetSchemeConfig(QStringList))); |
8893
8f92e94d0b32
Don't set Default scheme/ammo when switching script if not room admin. Prevents game config desync.
unc0rr
parents:
8891
diff
changeset
|
1851 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1852 |
ui.pageNetGame->pGameCFG->GameSchemes->setModel(netAmmo); |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
1853 |
|
8415
02acf6b92f52
Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents:
8407
diff
changeset
|
1854 |
ui.pageNetGame->setRoomName(hwnet->getRoom()); |
02acf6b92f52
Moved room name edit box from footer to top of page. Also shows room name when in slave mode.
dag10
parents:
8407
diff
changeset
|
1855 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1856 |
ui.pageNetGame->pGameCFG->GameSchemes->view()->disconnect(hwnet); |
10801 | 1857 |
connect(hwnet, SIGNAL(netSchemeConfig(QStringList)), |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1858 |
this, SLOT(selectFirstNetScheme())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1859 |
} |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
1860 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1861 |
ui.pageNetGame->setMasterMode(false); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
1862 |
} |
1600 | 1863 |
|
9100 | 1864 |
void HWForm::FromNetProxySlot(const QByteArray & msg) |
1865 |
{ |
|
1866 |
if(game) |
|
1867 |
game->FromNet(msg); |
|
1868 |
||
1869 |
} |
|
1870 |
||
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
1871 |
void HWForm::selectFirstNetScheme() |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
1872 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1873 |
ui.pageNetGame->pGameCFG->GameSchemes->setCurrentIndex(0); |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
1874 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
1875 |
|
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1876 |
void HWForm::NetLeftRoom(const QString & reason) |
1600 | 1877 |
{ |
4433 | 1878 |
if (ui.Pages->currentIndex() == ID_PAGE_NETGAME || ui.Pages->currentIndex() == ID_PAGE_INGAME) |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1879 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1880 |
GoBack(); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1881 |
if (!reason.isEmpty()) |
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:
6167
diff
changeset
|
1882 |
ui.pageRoomsList->displayNotice(reason); |
5998
e8f44e9433f0
many many netclient/frondent changes (just the beginning though):
sheepluva
parents:
5907
diff
changeset
|
1883 |
} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1884 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1885 |
qWarning("Left room while not in room"); |
1600 | 1886 |
} |
2012 | 1887 |
|
1888 |
void HWForm::resizeEvent(QResizeEvent * event) |
|
1889 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1890 |
int w = event->size().width(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2874
diff
changeset
|
1891 |
int h = event->size().height(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1892 |
if (wBackground) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1893 |
{ |
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2080
diff
changeset
|
1894 |
wBackground->setFixedSize(w, h); |
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2080
diff
changeset
|
1895 |
wBackground->move(0, 0); |
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2080
diff
changeset
|
1896 |
} |
2012 | 1897 |
} |
3760 | 1898 |
|
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1899 |
void HWForm::InitCampaignPage() |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1900 |
{ |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1901 |
ui.pageCampaign->CBCampaign->clear(); |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1902 |
HWTeam team(ui.pageCampaign->CBTeam->currentText()); |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1903 |
|
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1904 |
QStringList entries = DataManager::instance().entryList( |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1905 |
"Missions/Campaign", |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1906 |
QDir::Dirs, |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1907 |
QStringList("[^\\.]*") |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1908 |
); |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1909 |
|
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1910 |
unsigned int n = entries.count(); |
11948
6da9bb4b3449
Show check marks for campaigns with Won=true
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
1911 |
|
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1912 |
for(unsigned int i = 0; i < n; i++) |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1913 |
{ |
12305 | 1914 |
const QString & campaignName = entries[i]; |
11948
6da9bb4b3449
Show check marks for campaigns with Won=true
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
1915 |
QString tName = team.name(); |
11957 | 1916 |
ui.pageCampaign->CBCampaign->addItem(getRealCampName(campaignName), campaignName); |
7201
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1917 |
} |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1918 |
} |
dc17ffdf0702
The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents:
7122
diff
changeset
|
1919 |
|
3760 | 1920 |
void HWForm::UpdateCampaignPage(int index) |
1921 |
{ |
|
4560
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4536
diff
changeset
|
1922 |
Q_UNUSED(index); |
3760 | 1923 |
HWTeam team(ui.pageCampaign->CBTeam->currentText()); |
11957 | 1924 |
QString campaignName = ui.pageCampaign->CBCampaign->itemData(ui.pageCampaign->CBCampaign->currentIndex()).toString(); |
10017 | 1925 |
QString tName = team.name(); |
1926 |
||
1927 |
campaignMissionInfo = getCampMissionList(campaignName,tName); |
|
1928 |
ui.pageCampaign->CBMission->clear(); |
|
1929 |
||
9292
187ce630dddc
y! code clean up :)
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9290
diff
changeset
|
1930 |
for(int i=0;i<campaignMissionInfo.size();i++) |
9182
f92e205bc167
issue 562, image and description for the campaign page
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9163
diff
changeset
|
1931 |
{ |
11958
de66192866d3
Make campaign mission names translatable
Wuzzy <almikes@aol.com>
parents:
11957
diff
changeset
|
1932 |
ui.pageCampaign->CBMission->addItem(QString(campaignMissionInfo[i].realName), QString(campaignMissionInfo[i].name)); |
11951
b05db9ca6e1c
Add support for storing and displaying success of campaign missions
Wuzzy <almikes@aol.com>
parents:
11950
diff
changeset
|
1933 |
if(isMissionWon(campaignName, i, tName)) |
b05db9ca6e1c
Add support for storing and displaying success of campaign missions
Wuzzy <almikes@aol.com>
parents:
11950
diff
changeset
|
1934 |
ui.pageCampaign->CBMission->setItemIcon(i, finishedIcon); |
b05db9ca6e1c
Add support for storing and displaying success of campaign missions
Wuzzy <almikes@aol.com>
parents:
11950
diff
changeset
|
1935 |
else |
11978
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
1936 |
ui.pageCampaign->CBMission->setItemIcon(i, notFinishedIcon); |
10017 | 1937 |
} |
9182
f92e205bc167
issue 562, image and description for the campaign page
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9163
diff
changeset
|
1938 |
} |
f92e205bc167
issue 562, image and description for the campaign page
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9163
diff
changeset
|
1939 |
|
11950
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1940 |
void HWForm::UpdateCampaignPageTeam(int index) |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1941 |
{ |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1942 |
Q_UNUSED(index); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1943 |
HWTeam team(ui.pageCampaign->CBTeam->currentText()); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1944 |
QString tName = team.name(); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1945 |
|
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1946 |
QStringList entries = DataManager::instance().entryList( |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1947 |
"Missions/Campaign", |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1948 |
QDir::Dirs, |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1949 |
QStringList("[^\\.]*") |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1950 |
); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1951 |
|
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1952 |
unsigned int n = entries.count(); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1953 |
|
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1954 |
for(unsigned int i = 0; i < n; i++) |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1955 |
{ |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1956 |
QString campaignName = QString(entries[i]).replace(QString(" "),QString("_")); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1957 |
if(isCampWon(campaignName, tName)) |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1958 |
ui.pageCampaign->CBCampaign->setItemIcon(i, finishedIcon); |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1959 |
else |
11978
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
1960 |
ui.pageCampaign->CBCampaign->setItemIcon(i, notFinishedIcon); |
11950
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1961 |
} |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1962 |
} |
3792a9f9fa9c
Update campaign victory status when changing selection
Wuzzy <almikes@aol.com>
parents:
11948
diff
changeset
|
1963 |
|
9219 | 1964 |
void HWForm::UpdateCampaignPageMission(int index) |
1965 |
{ |
|
9292
187ce630dddc
y! code clean up :)
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9290
diff
changeset
|
1966 |
// update thumbnail and description |
11957 | 1967 |
QString campaignName = ui.pageCampaign->CBCampaign->itemData(ui.pageCampaign->CBCampaign->currentIndex()).toString(); |
9182
f92e205bc167
issue 562, image and description for the campaign page
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9163
diff
changeset
|
1968 |
// when campaign changes the UpdateCampaignPageMission is triggered with wrong values |
f92e205bc167
issue 562, image and description for the campaign page
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9163
diff
changeset
|
1969 |
// this will cause segfault. This check prevents illegal memory reads |
9292
187ce630dddc
y! code clean up :)
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9290
diff
changeset
|
1970 |
if(index > -1 && index < campaignMissionInfo.count()) { |
9219 | 1971 |
ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>"); |
9290
478aa681e702
this seems to work ok, but I have to clean up the code
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9288
diff
changeset
|
1972 |
ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description); |
10017 | 1973 |
ui.pageCampaign->btnPreview->setIcon(QIcon(campaignMissionInfo[index].image)); |
9219 | 1974 |
} |
3760 | 1975 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
1976 |
|
7490
c422845b8d1f
Fixed a typo, frontend is now working properly
belphegorr <szabibibi@gmail.com>
parents:
7411
diff
changeset
|
1977 |
void HWForm::UpdateCampaignPageProgress(int index) |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7207
diff
changeset
|
1978 |
{ |
7679 | 1979 |
Q_UNUSED(index); |
1980 |
||
9641
b08c8bde57e3
fixes bug that doesn't display mission name in drop down list
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9482
diff
changeset
|
1981 |
QString missionTitle = ui.pageCampaign->CBMission->currentText(); |
7679 | 1982 |
UpdateCampaignPage(0); |
9641
b08c8bde57e3
fixes bug that doesn't display mission name in drop down list
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9482
diff
changeset
|
1983 |
for(int i=0;i<ui.pageCampaign->CBMission->count();i++) |
b08c8bde57e3
fixes bug that doesn't display mission name in drop down list
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9482
diff
changeset
|
1984 |
{ |
11958
de66192866d3
Make campaign mission names translatable
Wuzzy <almikes@aol.com>
parents:
11957
diff
changeset
|
1985 |
if (ui.pageCampaign->CBMission->itemData(i)==missionTitle) |
10017 | 1986 |
{ |
1987 |
ui.pageCampaign->CBMission->setCurrentIndex(i); |
|
1988 |
break; |
|
1989 |
} |
|
1990 |
} |
|
11955
d72a177dbaea
Update campaign drop-down list after campaign victory
Wuzzy <almikes@aol.com>
parents:
11951
diff
changeset
|
1991 |
int i = ui.pageCampaign->CBCampaign->currentIndex(); |
11957 | 1992 |
QString campaignName = ui.pageCampaign->CBCampaign->itemData(i).toString(); |
11955
d72a177dbaea
Update campaign drop-down list after campaign victory
Wuzzy <almikes@aol.com>
parents:
11951
diff
changeset
|
1993 |
HWTeam team(ui.pageCampaign->CBTeam->currentText()); |
d72a177dbaea
Update campaign drop-down list after campaign victory
Wuzzy <almikes@aol.com>
parents:
11951
diff
changeset
|
1994 |
QString tName = team.name(); |
d72a177dbaea
Update campaign drop-down list after campaign victory
Wuzzy <almikes@aol.com>
parents:
11951
diff
changeset
|
1995 |
if(isCampWon(campaignName, tName)) |
d72a177dbaea
Update campaign drop-down list after campaign victory
Wuzzy <almikes@aol.com>
parents:
11951
diff
changeset
|
1996 |
ui.pageCampaign->CBCampaign->setItemIcon(i, finishedIcon); |
d72a177dbaea
Update campaign drop-down list after campaign victory
Wuzzy <almikes@aol.com>
parents:
11951
diff
changeset
|
1997 |
else |
11978
4a2da00bbedc
Align drop-down text of unfinished campaign missions with finished icons
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
1998 |
ui.pageCampaign->CBCampaign->setItemIcon(i, notFinishedIcon); |
3760 | 1999 |
} |
3932 | 2000 |
|
5213
a86768368309
make the associate button use the user's settings for loading demos/saves
nemo
parents:
5205
diff
changeset
|
2001 |
// used for --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality] |
a86768368309
make the associate button use the user's settings for loading demos/saves
nemo
parents:
5205
diff
changeset
|
2002 |
QString HWForm::getDemoArguments() |
a86768368309
make the associate button use the user's settings for loading demos/saves
nemo
parents:
5205
diff
changeset
|
2003 |
{ |
8307 | 2004 |
|
8643 | 2005 |
QString prefix = "\"" + datadir->absolutePath() + "\""; |
2006 |
QString userPrefix = "\"" + cfgdir->absolutePath() + "\""; |
|
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9100
diff
changeset
|
2007 |
#ifdef Q_OS_WIN |
8307 | 2008 |
prefix = prefix.replace("/","\\"); |
2009 |
userPrefix = userPrefix.replace("/","\\"); |
|
8302
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2010 |
#endif |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2011 |
|
8354
c25bee85d6f8
Separated fullscreen and windowed hwengine resolution parameters.
vitiv <nikita.utiu@gmail.com>
parents:
8346
diff
changeset
|
2012 |
std::pair<QRect, QRect> resolutions = config->vid_ResolutionPair(); |
8307 | 2013 |
return QString("--prefix " + prefix |
2014 |
+ " --user-prefix " + userPrefix |
|
8354
c25bee85d6f8
Separated fullscreen and windowed hwengine resolution parameters.
vitiv <nikita.utiu@gmail.com>
parents:
8346
diff
changeset
|
2015 |
+ " --fullscreen-width " + QString::number(resolutions.first.width()) |
c25bee85d6f8
Separated fullscreen and windowed hwengine resolution parameters.
vitiv <nikita.utiu@gmail.com>
parents:
8346
diff
changeset
|
2016 |
+ " --fullscreen-height " + QString::number(resolutions.first.height()) |
c25bee85d6f8
Separated fullscreen and windowed hwengine resolution parameters.
vitiv <nikita.utiu@gmail.com>
parents:
8346
diff
changeset
|
2017 |
+ " --width " + QString::number(resolutions.second.width()) |
c25bee85d6f8
Separated fullscreen and windowed hwengine resolution parameters.
vitiv <nikita.utiu@gmail.com>
parents:
8346
diff
changeset
|
2018 |
+ " --height " + QString::number(resolutions.second.height()) |
8302
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2019 |
+ " --volume " + QString::number(config->volume()) |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2020 |
+ (config->isMusicEnabled() ? "" : " --nomusic") |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2021 |
+ (config->isSoundEnabled() ? "" : " --nosound") |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2022 |
+ " --locale " + config->language() + ".txt" |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2023 |
+ (config->vid_Fullscreen() ? " --fullscreen" : "") |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2024 |
+ (config->isShowFPSEnabled() ? " --showfps" : "") |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2025 |
+ (config->isAltDamageEnabled() ? " --altdmg" : "") |
a7934cd12469
improve engine cmd line parsing and its documentation
RowanD
parents:
8299
diff
changeset
|
2026 |
+ " --frame-interval " + QString::number(config->timerInterval()) |
9249 | 2027 |
+ " --raw-quality " + QString::number(config->translateQuality())) |
2028 |
+ (!config->Form->ui.pageOptions->CBTeamTag->isChecked() ? " --no-teamtag" : "") |
|
2029 |
+ (!config->Form->ui.pageOptions->CBHogTag->isChecked() ? " --no-hogtag" : "") |
|
2030 |
+ (!config->Form->ui.pageOptions->CBHealthTag->isChecked() ? " --no-healthtag" : "") |
|
2031 |
+ (config->Form->ui.pageOptions->CBTagOpacity->isChecked() ? " --translucent-tags" : ""); |
|
5213
a86768368309
make the associate button use the user's settings for loading demos/saves
nemo
parents:
5205
diff
changeset
|
2032 |
} |
a86768368309
make the associate button use the user's settings for loading demos/saves
nemo
parents:
5205
diff
changeset
|
2033 |
|
3932 | 2034 |
void HWForm::AssociateFiles() |
2035 |
{ |
|
4084
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2036 |
bool success = true; |
5222 | 2037 |
QString arguments = getDemoArguments(); |
4084
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2038 |
#ifdef _WIN32 |
3932 | 2039 |
QSettings registry_hkcr("HKEY_CLASSES_ROOT", QSettings::NativeFormat); |
8722
2dead6b84bca
this should supposedly add hwplay:// schemes to windows, after user presses file association
koda
parents:
8720
diff
changeset
|
2040 |
|
2dead6b84bca
this should supposedly add hwplay:// schemes to windows, after user presses file association
koda
parents:
8720
diff
changeset
|
2041 |
// file extension(s) |
3932 | 2042 |
registry_hkcr.setValue(".hwd/Default", "Hedgewars.Demo"); |
2043 |
registry_hkcr.setValue(".hws/Default", "Hedgewars.Save"); |
|
2044 |
registry_hkcr.setValue("Hedgewars.Demo/Default", tr("Hedgewars Demo File", "File Types")); |
|
2045 |
registry_hkcr.setValue("Hedgewars.Save/Default", tr("Hedgewars Save File", "File Types")); |
|
2046 |
registry_hkcr.setValue("Hedgewars.Demo/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwdfile.ico\",0"); |
|
2047 |
registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0"); |
|
8643 | 2048 |
registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1"); |
2049 |
registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1"); |
|
8722
2dead6b84bca
this should supposedly add hwplay:// schemes to windows, after user presses file association
koda
parents:
8720
diff
changeset
|
2050 |
|
2dead6b84bca
this should supposedly add hwplay:// schemes to windows, after user presses file association
koda
parents:
8720
diff
changeset
|
2051 |
// custom url scheme(s) |
8766
ce153d705fff
scheme association for linux (although it stops during connection)
koda
parents:
8722
diff
changeset
|
2052 |
registry_hkcr.setValue("hwplay/Default", "\"URL:Hedgewars ServerAccess Scheme\""); |
8722
2dead6b84bca
this should supposedly add hwplay:// schemes to windows, after user presses file association
koda
parents:
8720
diff
changeset
|
2053 |
registry_hkcr.setValue("hwplay/URL Protocol", ""); |
2dead6b84bca
this should supposedly add hwplay:// schemes to windows, after user presses file association
koda
parents:
8720
diff
changeset
|
2054 |
registry_hkcr.setValue("hwplay/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\",0"); |
2dead6b84bca
this should supposedly add hwplay:// schemes to windows, after user presses file association
koda
parents:
8720
diff
changeset
|
2055 |
registry_hkcr.setValue("hwplay/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\" %1"); |
4090 | 2056 |
#elif defined __APPLE__ |
5252 | 2057 |
// only useful when other apps have taken precedence over our file extensions and you want to reset it |
2058 |
system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hwd</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'"); |
|
2059 |
system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hws</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'"); |
|
2060 |
system("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -domain local -domain system -domain user"); |
|
4084
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2061 |
#else |
4091
f89b8d0afbe1
set as default type, add icon. going to assume the icon was installed already. should happen in most packaging out there.
nemo
parents:
4090
diff
changeset
|
2062 |
// this is a little silly due to all the system commands below anyway - just use mkdir -p ? Does have the advantage of the alert I guess |
4085 | 2063 |
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local"); |
2064 |
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share"); |
|
2065 |
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime"); |
|
4084
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2066 |
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime/packages"); |
4085 | 2067 |
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local"); |
2068 |
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share"); |
|
4084
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2069 |
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications"); |
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2070 |
if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0; |
8766
ce153d705fff
scheme association for linux (although it stops during connection)
koda
parents:
8722
diff
changeset
|
2071 |
if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0; |
4084
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2072 |
if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0; |
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2073 |
if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0; |
8766
ce153d705fff
scheme association for linux (although it stops during connection)
koda
parents:
8722
diff
changeset
|
2074 |
if (success) success = system("xdg-mime default hedgewars.desktop x-scheme-handler/hwplay")==0; |
4091
f89b8d0afbe1
set as default type, add icon. going to assume the icon was installed already. should happen in most packaging out there.
nemo
parents:
4090
diff
changeset
|
2075 |
if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0; |
f89b8d0afbe1
set as default type, add icon. going to assume the icon was installed already. should happen in most packaging out there.
nemo
parents:
4090
diff
changeset
|
2076 |
if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0; |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5222
diff
changeset
|
2077 |
// hack to add user's settings to hwengine. might be better at this point to read in the file, append it, and write it out to its new home. This assumes no spaces in the data dir path |
8639 | 2078 |
if (success) success = system(("sed -i 's|^\\(Exec=.*\\) \\(%f\\)|\\1 \\2 "+arguments+"|' "+QDir::home().absolutePath()+"/.local/share/applications/hwengine.desktop").toLocal8Bit().constData())==0; |
4084
0d0bf0533eee
Add opendesktop association of files for non-windows. NEEDS TESTING.
nemo
parents:
3940
diff
changeset
|
2079 |
#endif |
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2080 |
if (success) |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2081 |
{ |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2082 |
QMessageBox infoMsg(this); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2083 |
infoMsg.setIcon(QMessageBox::Information); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2084 |
infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success")); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2085 |
infoMsg.setText(QMessageBox::tr("All file associations have been set")); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2086 |
infoMsg.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:
7792
diff
changeset
|
2087 |
infoMsg.exec(); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2088 |
} |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7792
diff
changeset
|
2089 |
else |
8383 | 2090 |
MessageDialog::ShowErrorMessage(QMessageBox::tr("File association failed."), this); |
3932 | 2091 |
} |
3937 | 2092 |
|
8434 | 2093 |
void HWForm::openRegistrationPage() |
8364
fbc9bcc6c39d
Added "New account" button when connectiong to the official server
vitiv <nikita.utiu@gmail.com>
parents:
8357
diff
changeset
|
2094 |
{ |
11830 | 2095 |
QDesktopServices::openUrl(QUrl("https://www.hedgewars.org/user/register")); |
8434 | 2096 |
} |
8364
fbc9bcc6c39d
Added "New account" button when connectiong to the official server
vitiv <nikita.utiu@gmail.com>
parents:
8357
diff
changeset
|
2097 |
|
5734 | 2098 |
void HWForm::saveDemoWithCustomName() |
2099 |
{ |
|
2100 |
if(!m_lastDemo.isEmpty()) |
|
2101 |
{ |
|
2102 |
QString fileName; |
|
2103 |
bool ok = false; |
|
2104 |
do |
|
2105 |
{ |
|
2106 |
fileName = QInputDialog::getText(this, tr("Demo name"), tr("Demo name:")); |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
2107 |
|
5734 | 2108 |
if(!fileName.isEmpty()) |
2109 |
{ |
|
2110 |
QString filePath = cfgdir->absolutePath() + "/Demos/" + fileName + "." + *cProtoVer + ".hwd"; |
|
2111 |
QFile demofile(filePath); |
|
2112 |
ok = demofile.open(QIODevice::WriteOnly); |
|
2113 |
if (!ok) |
|
8383 | 2114 |
MessageDialog::ShowErrorMessage(tr("Cannot save record to file %1").arg(filePath), this); |
5734 | 2115 |
else |
2116 |
{ |
|
2117 |
ok = -1 != demofile.write(m_lastDemo); |
|
2118 |
demofile.close(); |
|
2119 |
} |
|
2120 |
} |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
2121 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6604
diff
changeset
|
2122 |
while(!fileName.isEmpty() && !ok); |
5734 | 2123 |
} |
5746
fbc52bb92cad
Use QTextBrowser instead of WebKit for downloadable contents page (currently only shows the page itself)
unc0rr
parents:
5734
diff
changeset
|
2124 |
} |
fbc52bb92cad
Use QTextBrowser instead of WebKit for downloadable contents page (currently only shows the page itself)
unc0rr
parents:
5734
diff
changeset
|
2125 |
|
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2126 |
void HWForm::restartGame() |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2127 |
{ |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2128 |
// get rid off old game stats page |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2129 |
if(ui.Pages->currentIndex() == ID_PAGE_GAMESTATS) |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2130 |
GoBack(); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2131 |
|
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2132 |
CreateGame(lastGameCfg, lastGameTeamSel, lastGameAmmo); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2133 |
|
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2134 |
switch(lastGameType) { |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2135 |
case gtTraining: |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11959
diff
changeset
|
2136 |
game->StartTraining(lastGameStartArgs.at(0).toString(), lastTrainingSubFolder); |
8901
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2137 |
break; |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2138 |
case gtQLocal: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2139 |
game->StartQuick(); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2140 |
break; |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2141 |
case gtCampaign: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2142 |
game->StartCampaign(lastGameStartArgs.at(0).toString(), lastGameStartArgs.at(1).toString(), lastGameStartArgs.at(2).toString()); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2143 |
break; |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2144 |
case gtLocal: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2145 |
game->StartLocal(); |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2146 |
break; |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2147 |
default: |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2148 |
break; |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2149 |
} |
505307b9735d
implementation of a restart-game button. location and appearance is not final :P
thunderstruck
parents:
8893
diff
changeset
|
2150 |
} |
6561 | 2151 |
|
10307
e13d3147f15b
do not get stuck on "in game..." page just because of game crash. output a message instead. could still need some tweaking, but a man gotta sleep. and sheep too...
sheepluva
parents:
10108
diff
changeset
|
2152 |
void HWForm::ShowFatalErrorMessage(const QString & msg) |
8383 | 2153 |
{ |
10307
e13d3147f15b
do not get stuck on "in game..." page just because of game crash. output a message instead. could still need some tweaking, but a man gotta sleep. and sheep too...
sheepluva
parents:
10108
diff
changeset
|
2154 |
MessageDialog::ShowFatalMessage(msg, this); |
8383 | 2155 |
} |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
2156 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
2157 |
void HWForm::showFeedbackDialog() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
2158 |
{ |
11830 | 2159 |
QNetworkRequest newRequest(QUrl("https://www.hedgewars.org")); |
8878 | 2160 |
|
2161 |
QNetworkAccessManager *manager = new QNetworkAccessManager(this); |
|
2162 |
QNetworkReply *reply = manager->get(newRequest); |
|
2163 |
connect(reply, SIGNAL(finished()), this, SLOT(showFeedbackDialogNetChecked())); |
|
2164 |
} |
|
2165 |
||
2166 |
void HWForm::showFeedbackDialogNetChecked() |
|
2167 |
{ |
|
2168 |
QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender()); |
|
2169 |
||
2170 |
if (reply && (reply->error() == QNetworkReply::NoError)) { |
|
2171 |
FeedbackDialog dialog(this); |
|
2172 |
dialog.exec(); |
|
2173 |
} else |
|
2174 |
MessageDialog::ShowErrorMessage(tr("This page requires an internet connection."), this); |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8384
diff
changeset
|
2175 |
} |
8416
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2176 |
|
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2177 |
void HWForm::startGame() |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2178 |
{ |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2179 |
QMessageBox questionMsg(this); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2180 |
questionMsg.setIcon(QMessageBox::Question); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2181 |
questionMsg.setWindowTitle(QMessageBox::tr("Not all players are ready")); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2182 |
questionMsg.setText(QMessageBox::tr("Are you sure you want to start this game?\nNot all players are ready.")); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2183 |
questionMsg.setWindowModality(Qt::WindowModal); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2184 |
questionMsg.addButton(QMessageBox::Yes); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2185 |
questionMsg.addButton(QMessageBox::Cancel); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2186 |
|
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2187 |
if (hwnet->allPlayersReady() || questionMsg.exec() == QMessageBox::Yes) |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2188 |
hwnet->startGame(); |
e691acd778f5
It is now possible to start a game even if not all players are "ready"; a confirmation prompt is shown. This commit updates the server.
dag10
parents:
8415
diff
changeset
|
2189 |
} |