author | unc0rr |
Tue, 04 Jun 2013 00:15:03 +0400 | |
changeset 9100 | 3f5e0280db4d |
parent 9080 | 9b42757d7e71 |
child 9123 | 19c57656460f |
permissions | -rw-r--r-- |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
1 |
/* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
9080 | 3 |
* Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
4 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
8 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
13 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
17 |
*/ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6586
diff
changeset
|
18 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
19 |
#include <QGridLayout> |
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:
5763
diff
changeset
|
20 |
#include <QHBoxLayout> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
21 |
#include <QPushButton> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
22 |
#include <QLabel> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
23 |
#include <QTime> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
24 |
|
5204 | 25 |
#include "pagemain.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
26 |
#include "hwconsts.h" |
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
27 |
#include "hwform.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
28 |
|
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:
5763
diff
changeset
|
29 |
QLayout * PageMain::bodyLayoutDefinition() |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
30 |
{ |
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:
5763
diff
changeset
|
31 |
QGridLayout * pageLayout = new QGridLayout(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
32 |
//pageLayout->setColumnStretch(0, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
33 |
//pageLayout->setColumnStretch(1, 2); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
34 |
//pageLayout->setColumnStretch(2, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
35 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
36 |
//QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
37 |
//pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
38 |
pageLayout->setRowStretch(0, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
39 |
pageLayout->setRowStretch(1, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
40 |
pageLayout->setRowStretch(2, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
41 |
pageLayout->setRowStretch(3, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
42 |
pageLayout->setRowStretch(4, 1); |
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:
5763
diff
changeset
|
43 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
44 |
BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
6478 | 45 |
BtnSinglePlayer->setWhatsThis(tr("Play a game on a single computer")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
46 |
pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
47 |
|
8318 | 48 |
//BtnNet = addButton(":/res/NetworkPlay.png", (QBoxLayout*)netLayout, 1, true); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
49 |
BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
6478 | 50 |
BtnNet->setWhatsThis(tr("Play a game across a network")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
51 |
pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
8434 | 52 |
|
8318 | 53 |
originalNetworkIcon = BtnNet->icon(); |
54 |
disabledNetworkIcon = QIcon(":/res/NetworkPlayDisabled.png"); |
|
55 |
||
56 |
//QWidget *netLayoutWidget = new QWidget(); |
|
57 |
QVBoxLayout *netLayout = new QVBoxLayout(BtnNet); |
|
58 |
//pageLayout->addWidget(netLayoutWidget, 2, 2, 1, 2); |
|
59 |
//netLayoutWidget->setStyleSheet("background: green;"); |
|
60 |
//netLayoutWidget->setFixedSize(314, 260); |
|
61 |
netLayout->setSpacing(20); |
|
62 |
netLayout->setAlignment(Qt::AlignHCenter); |
|
63 |
||
8693
ab42f868b1c3
*sigh* hopefully there aren't any more of these. add missing tr() to button text
nemo
parents:
8676
diff
changeset
|
64 |
BtnNetLocal = addButton(tr("Play local network game"), (QBoxLayout*)netLayout, 0, false); |
8318 | 65 |
BtnNetLocal->setWhatsThis(tr("Play a game across a local area network")); |
66 |
BtnNetLocal->setFixedSize(BtnNet->width() - 50, 60); |
|
67 |
BtnNetLocal->setVisible(false); |
|
68 |
||
8693
ab42f868b1c3
*sigh* hopefully there aren't any more of these. add missing tr() to button text
nemo
parents:
8676
diff
changeset
|
69 |
BtnNetOfficial = addButton(tr("Play official network game"), (QBoxLayout*)netLayout, 0, false); |
8318 | 70 |
BtnNetOfficial->setWhatsThis(tr("Play a game on an official server")); |
71 |
BtnNetOfficial->setFixedSize(BtnNet->width() - 50, 60); |
|
72 |
BtnNetOfficial->setVisible(false); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
73 |
|
6169 | 74 |
// button order matters for overlapping (what's on top and what isn't) |
75 |
BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
76 |
BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
|
6478 | 77 |
BtnInfo->setWhatsThis(tr("Read about who is behind the Hedgewars Project")); |
6169 | 78 |
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
79 |
||
8676 | 80 |
BtnFeedback = addButton(tr("Feedback"), pageLayout, 4, 0, 1, 4, false); |
8622
2045bdf1b11b
Resolves issue 528. Fixed platform-specific order of buttons on seed prompt and new room prompt. Fixed height of back button on all pages -- now aligns to bottom. On pagemain, feedback and dlc buttons no longer fixed size.
dag10
parents:
8435
diff
changeset
|
81 |
BtnFeedback->setStyleSheet("padding: 5px 10px"); |
6759 | 82 |
BtnFeedback->setWhatsThis(tr("Leave a feedback here reporting issues, suggesting features or just saying how you like Hedgewars")); |
6582 | 83 |
pageLayout->setAlignment(BtnFeedback, Qt::AlignHCenter); |
84 |
||
85 |
BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 5, 0, 1, 4, false); |
|
8622
2045bdf1b11b
Resolves issue 528. Fixed platform-specific order of buttons on seed prompt and new room prompt. Fixed height of back button on all pages -- now aligns to bottom. On pagemain, feedback and dlc buttons no longer fixed size.
dag10
parents:
8435
diff
changeset
|
86 |
BtnDataDownload->setStyleSheet("padding: 5px 10px"); |
6478 | 87 |
BtnDataDownload->setWhatsThis(tr("Access the user created content downloadable from our website")); |
5763
d7a887c7e2d0
Add a crappy button to encourage artists to make another one. Restore Info page.
nemo
parents:
5646
diff
changeset
|
88 |
pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter); |
d7a887c7e2d0
Add a crappy button to encourage artists to make another one. Restore Info page.
nemo
parents:
5646
diff
changeset
|
89 |
|
6583 | 90 |
// disable exit button sound |
91 |
btnBack->isSoundEnabled = false; |
|
92 |
||
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:
5763
diff
changeset
|
93 |
return pageLayout; |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
5763
diff
changeset
|
94 |
} |
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:
5763
diff
changeset
|
95 |
|
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:
5763
diff
changeset
|
96 |
QLayout * PageMain::footerLayoutDefinition() |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
5763
diff
changeset
|
97 |
{ |
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:
5763
diff
changeset
|
98 |
QHBoxLayout * bottomLayout = new QHBoxLayout(); |
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:
5763
diff
changeset
|
99 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
100 |
mainNote = new QLabel(this); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
101 |
mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
102 |
mainNote->setWordWrap(true); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6586
diff
changeset
|
103 |
|
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:
5763
diff
changeset
|
104 |
bottomLayout->addWidget(mainNote, 0); |
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:
5763
diff
changeset
|
105 |
bottomLayout->setStretch(0,1); |
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:
5763
diff
changeset
|
106 |
|
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
107 |
btnBack->setWhatsThis(tr("Exit game")); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
6952
diff
changeset
|
108 |
|
7617 | 109 |
#ifdef VIDEOREC |
7643
97b98bcfd056
Differentiate videos from demos - navigating between them was too confusing. BTW, why is this on the front page, instead of next to the demos button?
nemo
parents:
7620
diff
changeset
|
110 |
BtnVideos = addButton(":/res/Videos.png", bottomLayout, 1, true); |
7620 | 111 |
BtnVideos->setWhatsThis(tr("Manage videos recorded from game")); |
7617 | 112 |
#endif |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
6952
diff
changeset
|
113 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
6952
diff
changeset
|
114 |
BtnSetup = addButton(":/res/Settings.png", bottomLayout, 2, true); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
115 |
BtnSetup->setWhatsThis(tr("Edit game preferences")); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
6952
diff
changeset
|
116 |
|
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:
5763
diff
changeset
|
117 |
return bottomLayout; |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
5763
diff
changeset
|
118 |
} |
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:
5763
diff
changeset
|
119 |
|
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:
5763
diff
changeset
|
120 |
void PageMain::connectSignals() |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
5763
diff
changeset
|
121 |
{ |
8435 | 122 |
connect(BtnNet, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice())); |
8977 | 123 |
//connect(BtnNetLocal, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice())); |
124 |
//connect(BtnNetOfficial, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice())); |
|
8435 | 125 |
// TODO: add signal-forwarding required by (currently missing) encapsulation |
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:
5763
diff
changeset
|
126 |
} |
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:
5763
diff
changeset
|
127 |
|
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:
5763
diff
changeset
|
128 |
PageMain::PageMain(QWidget* parent) : AbstractPage(parent) |
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:
5763
diff
changeset
|
129 |
{ |
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:
5763
diff
changeset
|
130 |
initPage(); |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
5763
diff
changeset
|
131 |
|
8635 | 132 |
if(frontendEffects) |
133 |
setAttribute(Qt::WA_NoSystemBackground, true); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
134 |
mainNote->setOpenExternalLinks(true); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
135 |
|
8635 | 136 |
#ifdef DEBUG |
8729 | 137 |
setDefaultDescription(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game, while some features might be broken or incomplete!")); |
8635 | 138 |
#else |
8729 | 139 |
setDefaultDescription(QLabel::tr("Tip: ") + randomTip()); |
8635 | 140 |
#endif |
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:
5763
diff
changeset
|
141 |
|
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:
5763
diff
changeset
|
142 |
} |
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:
5763
diff
changeset
|
143 |
|
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:
5763
diff
changeset
|
144 |
QString PageMain::randomTip() const |
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:
5763
diff
changeset
|
145 |
{ |
8361 | 146 |
#ifdef _WIN32 |
147 |
int platform = 1; |
|
148 |
#elif defined __APPLE__ |
|
149 |
int platform = 2; |
|
150 |
#else |
|
151 |
int platform = 3; |
|
152 |
#endif |
|
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:
5763
diff
changeset
|
153 |
QStringList Tips; |
8361 | 154 |
QFile file(":/res/xml/tips.xml"); |
155 |
file.open(QIODevice::ReadOnly); |
|
156 |
QTextStream in(&file); |
|
157 |
QString line = in.readLine(); |
|
158 |
int tip_platform = 0; |
|
159 |
while (!line.isNull()) { |
|
160 |
if(line.contains("<windows-only>", Qt::CaseSensitive)) |
|
161 |
tip_platform = 1; |
|
162 |
if(line.contains("<mac-only>", Qt::CaseSensitive)) |
|
163 |
tip_platform = 2; |
|
164 |
if(line.contains("<linux-only>", Qt::CaseSensitive)) |
|
165 |
tip_platform = 3; |
|
8434 | 166 |
if(line.contains("</windows-only>", Qt::CaseSensitive) || |
167 |
line.contains("</mac-only>", Qt::CaseSensitive) || |
|
8361 | 168 |
line.contains("</linux-only>", Qt::CaseSensitive)) { |
169 |
tip_platform = 0; |
|
170 |
} |
|
171 |
QStringList split_string = line.split(QRegExp("</?tip>")); |
|
172 |
if((tip_platform == platform || tip_platform == 0) && split_string.size() != 1) |
|
173 |
Tips << tr(split_string[1].toLatin1().data(), "Tips"); |
|
174 |
line = in.readLine(); |
|
175 |
} |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6586
diff
changeset
|
176 |
// The following tip will require links to app store entries first. |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6586
diff
changeset
|
177 |
//Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg(""); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6586
diff
changeset
|
178 |
// the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866 |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
179 |
|
8361 | 180 |
file.close(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6586
diff
changeset
|
181 |
return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]; |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
182 |
} |
8318 | 183 |
|
184 |
void PageMain::toggleNetworkChoice() |
|
185 |
{ |
|
186 |
bool visible = BtnNetLocal->isVisible(); |
|
187 |
BtnNetLocal->setVisible(!visible); |
|
188 |
BtnNetOfficial->setVisible(!visible); |
|
189 |
if (visible) BtnNet->setIcon(originalNetworkIcon); |
|
190 |
else BtnNet->setIcon(disabledNetworkIcon); |
|
191 |
} |
|
8982 | 192 |
|
193 |
void PageMain::resetNetworkChoice() |
|
194 |
{ |
|
195 |
BtnNetLocal->setVisible(false); |
|
196 |
BtnNetOfficial->setVisible(false); |
|
197 |
BtnNet->setIcon(originalNetworkIcon); |
|
198 |
} |