--- a/QTfrontend/pageinfo.cpp Wed Sep 28 04:21:24 2011 +0200
+++ b/QTfrontend/pageinfo.cpp Wed Sep 28 06:24:10 2011 +0200
@@ -30,9 +30,7 @@
pageLayout->setColumnStretch(1, 1);
pageLayout->setColumnStretch(2, 1);
- BtnSnapshots = addButton(":/res/Star.png", pageLayout, 1, 2, true);
-
- about = new About(this);
+ about = new About();
pageLayout->addWidget(about, 0, 0, 1, 3);
return pageLayout;
@@ -40,7 +38,10 @@
QLayout * PageInfo::footerLayoutDefinition()
{
- return NULL; // TODO: move screenshot button here
+ QGridLayout * bottomLayout = new QGridLayout();
+ BtnSnapshots = addButton(":/res/Star.png", bottomLayout, 1, 1, true);
+ bottomLayout->setAlignment(BtnSnapshots, Qt::AlignRight | Qt::AlignVCenter);
+ return bottomLayout;
}
void PageInfo::connectSignals()
--- a/QTfrontend/pagetraining.cpp Wed Sep 28 04:21:24 2011 +0200
+++ b/QTfrontend/pagetraining.cpp Wed Sep 28 06:24:10 2011 +0200
@@ -23,6 +23,8 @@
#include <QListWidgetItem>
#include <QPushButton>
+#include <QFile>
+#include <QLocale>
#include <QSettings>
#include "pagetraining.h"
@@ -110,9 +112,28 @@
{
initPage();
- // preload localized descriptions/etc TODO; this is just mockup code
- m_info = new QSettings(datadir->absolutePath() + "/Locale/missions_en.txt",
- QSettings::IniFormat, this);
+ // get locale
+ QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini",
+ QSettings::IniFormat);
+
+ QString loc = settings.value("misc/locale", "").toString();
+ if (loc.isEmpty())
+ loc = QLocale::system().name();
+
+ QString infoFile =
+ datadir->absolutePath() + "/Locale/missions_" + loc + ".txt";
+
+ // if file is non-existant try with language only
+ if (!QFile::exists(infoFile))
+ infoFile = datadir->absolutePath() + "/Locale/missions_" +
+ loc.replace(QRegExp("_.*$"),"") + ".txt";
+
+ // fallback if file for current locale is non-existant
+ if (!QFile::exists(infoFile))
+ infoFile = datadir->absolutePath() + "/Locale/missions_en.txt";
+
+ // preload mission info for current locale
+ m_info = new QSettings(infoFile, QSettings::IniFormat, this);
// TODO -> this should be done in a tool "DataDir" class
QDir tmpdir;
@@ -138,8 +159,13 @@
{
QListWidgetItem * item = new QListWidgetItem(mission);
- // replace underscores in mission name with spaces
- item->setText(item->text().replace("_", " "));
+ // fallback name: replace underscores in mission name with spaces
+ QString name = item->text().replace("_", " ");
+
+ // see if we can get a prettier/translated name
+ name = m_info->value(mission + ".name", name).toString();
+
+ item->setText(name);
// store original name in data
item->setData(Qt::UserRole, mission);
--- a/share/hedgewars/Data/Locale/CMakeLists.txt Wed Sep 28 04:21:24 2011 +0200
+++ b/share/hedgewars/Data/Locale/CMakeLists.txt Wed Sep 28 06:24:10 2011 +0200
@@ -2,6 +2,7 @@
file(GLOB txttrans5 ?????.txt)
file(GLOB tsfiles *.ts)
file(GLOB luafiles *.lua)
+file(GLOB missionfiles missions_*.txt)
QT4_ADD_TRANSLATION(QM ${tsfiles})
@@ -15,6 +16,7 @@
${txttrans5}
${QM}
${luafiles}
+ ${missionfiles}
DESTINATION ${SHAREPATH}Data/Locale
)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Locale/missions_de.txt Wed Sep 28 06:24:10 2011 +0200
@@ -0,0 +1,32 @@
+Basic_Training_-_Bazooka.name=Training: Bazooka - Grundlagen
+Basic_Training_-_Bazooka.desc="Nutze den Wind zu deinem Vorteil aus!"
+
+Basic_Training_-_Grenade.name=Training: Granate - Grundlagen
+Basic_Training_-_Grenade.desc="Vergiss nicht: Stift ziehen UND werfen!"
+
+Basic_Training_-_Shotgun.name=Training: Schrotflinte - Grundlagen
+Basic_Training_-_Shotgun.desc="Zuerst schießen, dann fragen!"
+
+Basic_Training_-_Sniper_Rifle.name=Training: Scharfschützengewehr - Grundlagen
+Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!"
+
+User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings
+User_Mission_-_Dangerous_Ducklings.desc="Nun gut, Rekrut! Es ist Zeit, dass du das im Grundlagentraining gelernte in die Tag umsetzt!"
+
+User_Mission_-_Diver.name=Mission: Taucher
+User_Mission_-_Diver.desc="Diese amphibische Angriffstrategie ist schwieriger als sie aussieht."
+
+User_Mission_-_Teamwork.name=Mission: Teamwork
+User_Mission_-_Teamwork.desc="Ab und zu... tut Liebe weh."
+
+User_Mission_-_Spooky_Tree.name=Mission: Spukiger Baum
+User_Mission_-_Spooky_Tree.desc="Viele Kisten hier draußen. Ich hoffe jedenfalls, dass dieser Vogel hier nicht hungrig wird."
+
+User_Mission_-_Bamboo_Thicket.name=Mission: Bambusdickicht
+User_Mission_-_Bamboo_Thicket.desc="Tod von oben."
+
+User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling
+User_Mission_-_That_Sinking_Feeling.desc="Hier steht einen das Wasser ganz schön schnell bis zu Hals. Viele sind hieran gescheitert. Kannst du alle Igel retten?"
+
+User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton und die Hängematte
+User_Mission_-_Newton_and_the_Hammock.desc="Nicht vergessen Igelinge: Die Geschwindigkeit eines Körpers bleibt konstant, es sei denn es wirkt eine äußere Kraft wird auf ihn ein!
--- a/share/hedgewars/Data/Locale/missions_en.txt Wed Sep 28 04:21:24 2011 +0200
+++ b/share/hedgewars/Data/Locale/missions_en.txt Wed Sep 28 06:24:10 2011 +0200
@@ -10,23 +10,23 @@
Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training
Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!"
-User_Mission_-_Dangerous_Ducklings.name=Dangerous Ducklings
+User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings
User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!"
-User_Mission_-_Diver.name=Diver
-User_Mission_-_Diver.desc="This 'amphibious assualt' thing is harder than it looks..."
+User_Mission_-_Diver.name=Mission: Diver
+User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..."
-User_Mission_-_Teamwork.name=Teamwork
+User_Mission_-_Teamwork.name=Mission: Teamwork
User_Mission_-_Teamwork.desc="Sometimes, love hurts."
-User_Mission_-_Spooky_Tree.name=Spooky Tree
+User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree
User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry."
-User_Mission_-_Bamboo_Thicket.name=Bamboo Thicket
+User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket
User_Mission_-_Bamboo_Thicket.desc="Death comes from above."
-User_Mission_-_That_Sinking_Feeling.name=That Sinking Feeling
+User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling
User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?"
-User_Mission_-_Newton_and_the_Hammock.name=Newton and the Hammock
+User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock
User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!"