40 pageLayout->setRowStretch(2, 0); |
40 pageLayout->setRowStretch(2, 0); |
41 pageLayout->setRowStretch(3, 1); |
41 pageLayout->setRowStretch(3, 1); |
42 pageLayout->setRowStretch(4, 1); |
42 pageLayout->setRowStretch(4, 1); |
43 |
43 |
44 BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
44 BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
45 BtnSinglePlayer->setToolTip(tr("Local Game")); |
|
46 BtnSinglePlayer->setWhatsThis(tr("Play a game on a single computer")); |
45 BtnSinglePlayer->setWhatsThis(tr("Play a game on a single computer")); |
47 pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
46 pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
48 |
47 |
49 //BtnNet = addButton(":/res/NetworkPlay.png", (QBoxLayout*)netLayout, 1, true); |
48 //BtnNet = addButton(":/res/NetworkPlay.png", (QBoxLayout*)netLayout, 1, true); |
50 BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
49 BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
51 BtnNet->setToolTip(tr("Network Game")); |
|
52 BtnNet->setWhatsThis(tr("Play a game across a network")); |
50 BtnNet->setWhatsThis(tr("Play a game across a network")); |
53 pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
51 pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
54 connect(BtnNet, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice())); |
|
55 |
52 |
56 originalNetworkIcon = BtnNet->icon(); |
53 originalNetworkIcon = BtnNet->icon(); |
57 disabledNetworkIcon = QIcon(":/res/NetworkPlayDisabled.png"); |
54 disabledNetworkIcon = QIcon(":/res/NetworkPlayDisabled.png"); |
58 |
55 |
59 //QWidget *netLayoutWidget = new QWidget(); |
56 //QWidget *netLayoutWidget = new QWidget(); |
63 //netLayoutWidget->setFixedSize(314, 260); |
60 //netLayoutWidget->setFixedSize(314, 260); |
64 netLayout->setSpacing(20); |
61 netLayout->setSpacing(20); |
65 netLayout->setAlignment(Qt::AlignHCenter); |
62 netLayout->setAlignment(Qt::AlignHCenter); |
66 |
63 |
67 BtnNetLocal = addButton("Play local network game", (QBoxLayout*)netLayout, 0, false); |
64 BtnNetLocal = addButton("Play local network game", (QBoxLayout*)netLayout, 0, false); |
68 BtnNetLocal->setToolTip(tr("Play a local network game")); |
|
69 BtnNetLocal->setWhatsThis(tr("Play a game across a local area network")); |
65 BtnNetLocal->setWhatsThis(tr("Play a game across a local area network")); |
70 BtnNetLocal->setFixedSize(BtnNet->width() - 50, 60); |
66 BtnNetLocal->setFixedSize(BtnNet->width() - 50, 60); |
71 BtnNetLocal->setVisible(false); |
67 BtnNetLocal->setVisible(false); |
72 |
68 |
73 BtnNetOfficial = addButton("Play official network game", (QBoxLayout*)netLayout, 0, false); |
69 BtnNetOfficial = addButton("Play official network game", (QBoxLayout*)netLayout, 0, false); |
74 BtnNetOfficial->setToolTip(tr("Play a network game")); |
|
75 BtnNetOfficial->setWhatsThis(tr("Play a game on an official server")); |
70 BtnNetOfficial->setWhatsThis(tr("Play a game on an official server")); |
76 BtnNetOfficial->setFixedSize(BtnNet->width() - 50, 60); |
71 BtnNetOfficial->setFixedSize(BtnNet->width() - 50, 60); |
77 BtnNetOfficial->setVisible(false); |
72 BtnNetOfficial->setVisible(false); |
78 |
73 |
79 // button order matters for overlapping (what's on top and what isn't) |
74 // button order matters for overlapping (what's on top and what isn't) |
80 BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
75 BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
81 BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
76 BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
82 //BtnInfo->setToolTip(tr("Credits")); //tooltip looks horrible with transparent background buttons |
|
83 BtnInfo->setWhatsThis(tr("Read about who is behind the Hedgewars Project")); |
77 BtnInfo->setWhatsThis(tr("Read about who is behind the Hedgewars Project")); |
84 pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
78 pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
85 |
79 |
86 BtnFeedback = addButton("Feedback", pageLayout, 4, 0, 1, 4, false); |
80 BtnFeedback = addButton("Feedback", pageLayout, 4, 0, 1, 4, false); |
87 BtnFeedback->setFixedSize(86, 27); |
81 BtnFeedback->setFixedSize(86, 27); |
88 BtnFeedback->setWhatsThis(tr("Leave a feedback here reporting issues, suggesting features or just saying how you like Hedgewars")); |
82 BtnFeedback->setWhatsThis(tr("Leave a feedback here reporting issues, suggesting features or just saying how you like Hedgewars")); |
89 pageLayout->setAlignment(BtnFeedback, Qt::AlignHCenter); |
83 pageLayout->setAlignment(BtnFeedback, Qt::AlignHCenter); |
90 |
84 |
91 BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 5, 0, 1, 4, false); |
85 BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 5, 0, 1, 4, false); |
92 BtnDataDownload->setFixedSize(176, 27); |
86 BtnDataDownload->setFixedSize(176, 27); |
93 //BtnDataDownload->setToolTip(tr(Downloadable Content")); |
|
94 BtnDataDownload->setWhatsThis(tr("Access the user created content downloadable from our website")); |
87 BtnDataDownload->setWhatsThis(tr("Access the user created content downloadable from our website")); |
95 pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter); |
88 pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter); |
96 |
89 |
97 // disable exit button sound |
90 // disable exit button sound |
98 btnBack->isSoundEnabled = false; |
91 btnBack->isSoundEnabled = false; |
147 |
141 |
148 } |
142 } |
149 |
143 |
150 QString PageMain::randomTip() const |
144 QString PageMain::randomTip() const |
151 { |
145 { |
|
146 #ifdef _WIN32 |
|
147 int platform = 1; |
|
148 #elif defined __APPLE__ |
|
149 int platform = 2; |
|
150 #else |
|
151 int platform = 3; |
|
152 #endif |
152 QStringList Tips; |
153 QStringList Tips; |
153 Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips"); |
154 QFile file(":/res/xml/tips.xml"); |
154 Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips"); |
155 file.open(QIODevice::ReadOnly); |
155 Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips"); |
156 QTextStream in(&file); |
156 Tips << tr("Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips"); |
157 QString line = in.readLine(); |
157 Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips"); |
158 int tip_platform = 0; |
158 Tips << tr("You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.", "Tips"); |
159 while (!line.isNull()) { |
159 Tips << tr("By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.", "Tips"); |
160 if(line.contains("<windows-only>", Qt::CaseSensitive)) |
160 Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you've got problems, ask on our forums but please don't expect 24/7 support!", "Tips"); |
161 tip_platform = 1; |
161 Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!", "Tips"); |
162 if(line.contains("<mac-only>", Qt::CaseSensitive)) |
162 Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!", "Tips"); |
163 tip_platform = 2; |
163 Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If someone sold you the game, you should try get a refund!", "Tips"); |
164 if(line.contains("<linux-only>", Qt::CaseSensitive)) |
164 Tips << tr("From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.", "Tips"); |
165 tip_platform = 3; |
165 Tips << tr("Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!", "Tips"); |
166 if(line.contains("</windows-only>", Qt::CaseSensitive) || |
166 Tips << tr("Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.", "Tips"); |
167 line.contains("</mac-only>", Qt::CaseSensitive) || |
167 Tips << tr("Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.", "Tips"); |
168 line.contains("</linux-only>", Qt::CaseSensitive)) { |
168 Tips << tr("Connect one or more gamepads before starting the game to be able to assign their controls to your teams.", "Tips"); |
169 tip_platform = 0; |
169 Tips << tr("Create an account on %1 to keep others from using your most favourite nickname while playing on the official server.", "Tips").arg("<a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a>"); |
170 } |
170 Tips << tr("While playing you should give yourself a short break at least once an hour.", "Tips"); |
171 QStringList split_string = line.split(QRegExp("</?tip>")); |
171 Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.", "Tips"); |
172 if((tip_platform == platform || tip_platform == 0) && split_string.size() != 1) |
172 Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to update the associated drivers.", "Tips"); |
173 Tips << tr(split_string[1].toLatin1().data(), "Tips"); |
173 Tips << tr("We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!", "Tips"); |
174 line = in.readLine(); |
174 Tips << tr("Especially while playing online be polite and always remember there might be some minors playing with or against you as well!", "Tips"); |
175 } |
175 Tips << tr("Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!", "Tips"); |
|
176 Tips << tr("The Windows version of Hedgewars supports Xfire. Make sure to add Hedgewars to its game list so your friends can see you playing.", "Tips"); |
|
177 Tips << tr("You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!", "Tips"); |
|
178 Tips << tr("Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.", "Tips"); |
|
179 Tips << tr("No hedgehogs were harmed in making this game.", "Tips"); |
|
180 Tips << tr("There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.", "Tips"); |
|
181 Tips << tr("Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.", "Tips"); |
|
182 Tips << tr("Some weapons require special strategies or just lots of training, so don't give up on a particular tool if you miss an enemy once.", "Tips"); |
|
183 Tips << tr("Most weapons won't work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.", "Tips"); |
|
184 Tips << tr("The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.", "Tips"); |
|
185 Tips << tr("The Piano Strike is the most damaging air strike. You'll lose the hedgehog performing it, so there's a huge downside as well.", "Tips"); |
|
186 Tips << tr("The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power.", "Tips"); |
|
187 Tips << tr("Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.", "Tips"); |
|
188 Tips << tr("The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.", "Tips"); |
|
189 Tips << tr("If you're stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.", "Tips"); |
|
190 Tips << tr("The Cake's maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.", "Tips"); |
|
191 Tips << tr("The Flame Thrower is a weapon but it can be used for tunnel digging as well.", "Tips"); |
|
192 Tips << tr("Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms.", "Tips"); |
|
193 Tips << tr("Want to know who's behind the game? Click on the Hedgewars logo in the main menu to see the credits.", "Tips"); |
|
194 Tips << tr("Like Hedgewars? Become a fan on %1 or follow us on %2!", "Tips").arg("<a href=\"http://www.facebook.com/Hedgewars\">Facebook</a>").arg("<a href=\"http://twitter.com/hedgewars\">Twitter</a>"); |
|
195 Tips << tr("Feel free to draw your own graves, hats, flags or even maps and themes! But note that you'll have to share them somewhere to use them online.", "Tips"); |
|
196 Tips << tr("Really want to wear a specific hat? Donate to us and receive an exclusive hat of your choice!", "Tips"); |
|
197 // The following tip will require links to app store entries first. |
176 // The following tip will require links to app store entries first. |
198 //Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg(""); |
177 //Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg(""); |
199 // the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866 |
178 // the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866 |
200 Tips << tr("Keep your video card drivers up to date to avoid issues playing the game.", "Tips"); |
|
201 Tips << tr("You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.", "Tips"); |
|
202 #ifdef _WIN32 |
|
203 Tips << tr("You can find your Hedgewars configuration files under \"My Documents\\Hedgewars\". Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
|
204 #elif defined __APPLE__ |
|
205 Tips << tr("You can find your Hedgewars configuration files under \"Library/Application Support/Hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
|
206 #else |
|
207 Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
|
208 #endif |
|
209 |
179 |
|
180 file.close(); |
210 return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]; |
181 return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]; |
211 } |
182 } |
212 |
183 |
213 void PageMain::toggleNetworkChoice() |
184 void PageMain::toggleNetworkChoice() |
214 { |
185 { |