equal
deleted
inserted
replaced
19 #include <QGridLayout> |
19 #include <QGridLayout> |
20 #include <QHBoxLayout> |
20 #include <QHBoxLayout> |
21 #include <QPushButton> |
21 #include <QPushButton> |
22 #include <QLabel> |
22 #include <QLabel> |
23 #include <QTime> |
23 #include <QTime> |
|
24 #include <QSettings> |
24 |
25 |
25 #include "pagemain.h" |
26 #include "pagemain.h" |
26 #include "hwconsts.h" |
27 #include "hwconsts.h" |
27 #include "hwform.h" |
28 #include "hwform.h" |
|
29 #include "DataManager.h" |
28 |
30 |
29 QLayout * PageMain::bodyLayoutDefinition() |
31 QLayout * PageMain::bodyLayoutDefinition() |
30 { |
32 { |
31 QGridLayout * pageLayout = new QGridLayout(); |
33 QGridLayout * pageLayout = new QGridLayout(); |
32 //pageLayout->setColumnStretch(0, 1); |
34 //pageLayout->setColumnStretch(0, 1); |
148 #elif defined __APPLE__ |
150 #elif defined __APPLE__ |
149 int platform = 2; |
151 int platform = 2; |
150 #else |
152 #else |
151 int platform = 3; |
153 int platform = 3; |
152 #endif |
154 #endif |
|
155 DataManager & dataMgr = DataManager::instance(); |
|
156 |
|
157 // get locale |
|
158 QSettings settings(dataMgr.settingsFileName(), |
|
159 QSettings::IniFormat); |
|
160 |
|
161 QString loc = settings.value("misc/locale", "").toString(); |
|
162 if (loc.isEmpty()) |
|
163 loc = QLocale::system().name(); |
|
164 |
|
165 QString tipFile = QString("physfs://Locale/tips_" + loc + ".xml"); |
|
166 |
|
167 // if file is non-existant try with language only |
|
168 if (!QFile::exists(tipFile)) |
|
169 tipFile = QString("physfs://Locale/tips_" + loc.remove(QRegExp("_.*$")) + ".xml"); |
|
170 |
|
171 // fallback if file for current locale is non-existant |
|
172 if (!QFile::exists(tipFile)) |
|
173 tipFile = QString("physfs://Locale/tips_en.xml"); |
|
174 |
153 QStringList Tips; |
175 QStringList Tips; |
154 QFile file(":/res/xml/tips.xml"); |
176 QFile file(tipFile); |
155 file.open(QIODevice::ReadOnly); |
177 file.open(QIODevice::ReadOnly); |
156 QTextStream in(&file); |
178 QTextStream in(&file); |
157 QString line = in.readLine(); |
179 QString line = in.readLine(); |
158 int tip_platform = 0; |
180 int tip_platform = 0; |
159 while (!line.isNull()) { |
181 while (!line.isNull()) { |