author | sheepluva |
Mon, 10 Aug 2015 03:53:11 +0200 | |
changeset 11046 | 47a8c19ecb60 |
parent 10108 | c68cf030eded |
child 11968 | 1de4d6b35748 |
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 |
11046 | 3 |
* Copyright (c) 2004-2015 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 |
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:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
17 |
*/ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
18 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
19 |
#include <QGridLayout> |
6052 | 20 |
#include <QVBoxLayout> |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
21 |
#include <QLabel> |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
22 |
#include <QListWidget> |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
23 |
#include <QListWidgetItem> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
24 |
#include <QPushButton> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
25 |
|
6059 | 26 |
#include <QFile> |
27 |
#include <QLocale> |
|
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
28 |
#include <QSettings> |
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
29 |
|
6159
c780b8cf4d75
introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents:
6073
diff
changeset
|
30 |
#include "hwconsts.h" |
6930 | 31 |
#include "DataManager.h" |
6159
c780b8cf4d75
introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents:
6073
diff
changeset
|
32 |
|
5204 | 33 |
#include "pagetraining.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
34 |
|
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:
6009
diff
changeset
|
35 |
QLayout * PageTraining::bodyLayoutDefinition() |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
36 |
{ |
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:
6009
diff
changeset
|
37 |
QGridLayout * pageLayout = new QGridLayout(); |
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:
6009
diff
changeset
|
38 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
39 |
// left column |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
40 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
41 |
// declare start button, caption and description |
6052 | 42 |
btnPreview = formattedButton(":/res/Trainings.png", true); |
43 |
||
44 |
// make both rows equal height |
|
45 |
pageLayout->setRowStretch(0, 1); |
|
46 |
pageLayout->setRowStretch(1, 1); |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
47 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
48 |
// add start button, caption and description to 3 different rows |
6052 | 49 |
pageLayout->addWidget(btnPreview, 0, 0); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
50 |
|
6052 | 51 |
// center preview |
52 |
pageLayout->setAlignment(btnPreview, Qt::AlignRight | Qt::AlignVCenter); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
53 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
54 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
55 |
// right column |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
56 |
|
6052 | 57 |
// info area (caption on top, description below) |
58 |
QVBoxLayout * infoLayout = new QVBoxLayout(); |
|
59 |
||
60 |
lblCaption = new QLabel(); |
|
61 |
lblCaption->setMinimumWidth(360); |
|
62 |
lblCaption->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); |
|
63 |
lblCaption->setWordWrap(true); |
|
64 |
lblDescription = new QLabel(); |
|
65 |
lblDescription->setMinimumWidth(360); |
|
66 |
lblDescription->setAlignment(Qt::AlignHCenter | Qt::AlignTop); |
|
67 |
lblDescription->setWordWrap(true); |
|
68 |
||
69 |
infoLayout->addWidget(lblCaption); |
|
70 |
infoLayout->addWidget(lblDescription); |
|
71 |
||
72 |
pageLayout->addLayout(infoLayout, 0, 1); |
|
73 |
pageLayout->setAlignment(infoLayout, Qt::AlignLeft); |
|
74 |
||
75 |
||
76 |
// mission list |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
77 |
lstMissions = new QListWidget(this); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
78 |
lstMissions->setWhatsThis(tr("Pick the mission or training to play")); |
6052 | 79 |
pageLayout->addWidget(lstMissions, 1, 0, 1, 2); // span 2 columns |
80 |
||
81 |
// let's not make the list use more space than needed |
|
6258 | 82 |
lstMissions->setFixedWidth(400); |
6052 | 83 |
pageLayout->setAlignment(lstMissions, Qt::AlignHCenter); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
84 |
|
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:
6009
diff
changeset
|
85 |
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:
6009
diff
changeset
|
86 |
} |
6009 | 87 |
|
6052 | 88 |
QLayout * PageTraining::footerLayoutDefinition() |
89 |
{ |
|
90 |
QBoxLayout * bottomLayout = new QVBoxLayout(); |
|
91 |
||
92 |
btnStart = formattedButton(QPushButton::tr("Go!")); |
|
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
93 |
btnStart->setWhatsThis(tr("Start fighting")); |
6052 | 94 |
btnStart->setFixedWidth(140); |
95 |
||
96 |
bottomLayout->addWidget(btnStart); |
|
97 |
||
98 |
bottomLayout->setAlignment(btnStart, Qt::AlignRight | Qt::AlignVCenter); |
|
99 |
||
100 |
return bottomLayout; |
|
101 |
} |
|
102 |
||
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
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:
6009
diff
changeset
|
104 |
void PageTraining::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:
6009
diff
changeset
|
105 |
{ |
6054
d3751a18cecb
use currentItemChanged signal instead of itemSelectionChanged - since the latter is always one item behind if you hold down the mousebutton and move the cursor through the list
sheepluva
parents:
6052
diff
changeset
|
106 |
connect(lstMissions, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateInfo())); |
6183 | 107 |
connect(lstMissions, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo())); |
6054
d3751a18cecb
use currentItemChanged signal instead of itemSelectionChanged - since the latter is always one item behind if you hold down the mousebutton and move the cursor through the list
sheepluva
parents:
6052
diff
changeset
|
108 |
connect(lstMissions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected())); |
6052 | 109 |
connect(btnPreview, SIGNAL(clicked()), this, SLOT(startSelected())); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
110 |
connect(btnStart, SIGNAL(clicked()), this, SLOT(startSelected())); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
111 |
} |
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:
6009
diff
changeset
|
112 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
113 |
|
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:
6009
diff
changeset
|
114 |
PageTraining::PageTraining(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:
6009
diff
changeset
|
115 |
{ |
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:
6009
diff
changeset
|
116 |
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:
6009
diff
changeset
|
117 |
|
6930 | 118 |
DataManager & dataMgr = DataManager::instance(); |
6196 | 119 |
|
6059 | 120 |
// get locale |
8918
512753ea4b1b
Switch to 'settings.ini'. Copies old ini file if necessary on startup.
unc0rr
parents:
8098
diff
changeset
|
121 |
QSettings settings(dataMgr.settingsFileName(), |
6059 | 122 |
QSettings::IniFormat); |
123 |
||
124 |
QString loc = settings.value("misc/locale", "").toString(); |
|
125 |
if (loc.isEmpty()) |
|
126 |
loc = QLocale::system().name(); |
|
127 |
||
8049 | 128 |
QString infoFile = QString("physfs://Locale/missions_" + loc + ".txt"); |
6059 | 129 |
|
130 |
// if file is non-existant try with language only |
|
6167 | 131 |
if (!QFile::exists(infoFile)) |
8049 | 132 |
infoFile = QString("physfs://Locale/missions_" + loc.remove(QRegExp("_.*$")) + ".txt"); |
6059 | 133 |
|
134 |
// fallback if file for current locale is non-existant |
|
6167 | 135 |
if (!QFile::exists(infoFile)) |
8049 | 136 |
infoFile = QString("physfs://Locale/missions_en.txt"); |
6159
c780b8cf4d75
introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents:
6073
diff
changeset
|
137 |
|
6059 | 138 |
|
139 |
// preload mission info for current locale |
|
6167 | 140 |
m_info = new QSettings(infoFile, QSettings::IniFormat, this); |
6257 | 141 |
m_info->setIniCodec("UTF-8"); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
142 |
|
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:
6009
diff
changeset
|
143 |
|
6196 | 144 |
QStringList missionList = dataMgr.entryList( |
145 |
"Missions/Training", |
|
146 |
QDir::Files, QStringList("*.lua")). |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6258
diff
changeset
|
147 |
replaceInStrings(QRegExp("\\.lua$"), ""); |
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:
6009
diff
changeset
|
148 |
|
6159
c780b8cf4d75
introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents:
6073
diff
changeset
|
149 |
// scripts to lost - TODO: model? |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
150 |
foreach (const QString & mission, missionList) |
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:
6009
diff
changeset
|
151 |
{ |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
152 |
QListWidgetItem * item = new QListWidgetItem(mission); |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
153 |
|
6059 | 154 |
// fallback name: replace underscores in mission name with spaces |
6196 | 155 |
QString name = item->text().replace("_", " "); |
6059 | 156 |
|
157 |
// see if we can get a prettier/translated name |
|
158 |
name = m_info->value(mission + ".name", name).toString(); |
|
159 |
||
160 |
item->setText(name); |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
161 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
162 |
// store original name in data |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
163 |
item->setData(Qt::UserRole, mission); |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
164 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
165 |
lstMissions->addItem(item); |
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:
6009
diff
changeset
|
166 |
} |
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:
6009
diff
changeset
|
167 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
168 |
updateInfo(); |
6052 | 169 |
|
170 |
// pre-select first mission |
|
171 |
if (lstMissions->count() > 0) |
|
172 |
lstMissions->setCurrentRow(0); |
|
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:
6009
diff
changeset
|
173 |
} |
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:
6009
diff
changeset
|
174 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
175 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
176 |
void PageTraining::startSelected() |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
177 |
{ |
6050
07561ade87ca
oops, I forgot I wanted to fix that before committing xD
sheepluva
parents:
6048
diff
changeset
|
178 |
QListWidgetItem * curItem = lstMissions->currentItem(); |
07561ade87ca
oops, I forgot I wanted to fix that before committing xD
sheepluva
parents:
6048
diff
changeset
|
179 |
|
07561ade87ca
oops, I forgot I wanted to fix that before committing xD
sheepluva
parents:
6048
diff
changeset
|
180 |
if (curItem != NULL) |
07561ade87ca
oops, I forgot I wanted to fix that before committing xD
sheepluva
parents:
6048
diff
changeset
|
181 |
emit startMission(curItem->data(Qt::UserRole).toString()); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
182 |
} |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
183 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
184 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
185 |
void PageTraining::updateInfo() |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
186 |
{ |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
187 |
if (lstMissions->currentItem()) |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
188 |
{ |
6050
07561ade87ca
oops, I forgot I wanted to fix that before committing xD
sheepluva
parents:
6048
diff
changeset
|
189 |
// TODO also use .pngs in userdata folder |
8049 | 190 |
QString thumbFile = "physfs://Graphics/Missions/Training/" + |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6258
diff
changeset
|
191 |
lstMissions->currentItem()->data(Qt::UserRole).toString() + |
8049 | 192 |
"@2x.png"; |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
193 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
194 |
if (QFile::exists(thumbFile)) |
6052 | 195 |
btnPreview->setIcon(QIcon(thumbFile)); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
196 |
else |
6052 | 197 |
btnPreview->setIcon(QIcon(":/res/Trainings.png")); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
198 |
|
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
199 |
QString realName = lstMissions->currentItem()->data( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6258
diff
changeset
|
200 |
Qt::UserRole).toString(); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
201 |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6258
diff
changeset
|
202 |
QString caption = m_info->value(realName + ".name", |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6258
diff
changeset
|
203 |
lstMissions->currentItem()->text()).toString(); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
204 |
|
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
205 |
QString description = m_info->value(realName + ".desc", |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6258
diff
changeset
|
206 |
tr("No description available")).toString(); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
207 |
|
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
208 |
lblCaption->setText("<h2>" + caption +"</h2>"); |
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
209 |
lblDescription->setText(description); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
210 |
} |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
211 |
else |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
212 |
{ |
6052 | 213 |
btnPreview->setIcon(QIcon(":/res/Trainings.png")); |
214 |
lblCaption->setText(tr("Select a mission!")); |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
215 |
// TODO better text and tr() |
6052 | 216 |
lblDescription->setText(""); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
217 |
} |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
218 |
} |