author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 17 Jul 2018 12:55:07 +0200 | |
changeset 13498 | 424944a835a7 |
parent 13274 | e381f5260b45 |
child 13632 | 4c49a4944884 |
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 |
|
13087
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
26 |
#include <QTextStream> |
6059 | 27 |
#include <QFile> |
28 |
#include <QLocale> |
|
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
29 |
#include <QSettings> |
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
30 |
|
6159
c780b8cf4d75
introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents:
6073
diff
changeset
|
31 |
#include "hwconsts.h" |
6930 | 32 |
#include "DataManager.h" |
6159
c780b8cf4d75
introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents:
6073
diff
changeset
|
33 |
|
5204 | 34 |
#include "pagetraining.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
35 |
|
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
|
36 |
QLayout * PageTraining::bodyLayoutDefinition() |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
37 |
{ |
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
|
38 |
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
|
39 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
40 |
// left column |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
41 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
42 |
// declare start button, caption and description |
6052 | 43 |
btnPreview = formattedButton(":/res/Trainings.png", true); |
44 |
||
45 |
// make both rows equal height |
|
46 |
pageLayout->setRowStretch(0, 1); |
|
47 |
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
|
48 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
49 |
// add start button, caption and description to 3 different rows |
6052 | 50 |
pageLayout->addWidget(btnPreview, 0, 0); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
51 |
|
6052 | 52 |
// center preview |
53 |
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
|
54 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
55 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
56 |
// right column |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
57 |
|
6052 | 58 |
// info area (caption on top, description below) |
59 |
QVBoxLayout * infoLayout = new QVBoxLayout(); |
|
60 |
||
61 |
lblCaption = new QLabel(); |
|
62 |
lblCaption->setMinimumWidth(360); |
|
63 |
lblCaption->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); |
|
64 |
lblCaption->setWordWrap(true); |
|
65 |
lblDescription = new QLabel(); |
|
66 |
lblDescription->setMinimumWidth(360); |
|
67 |
lblDescription->setAlignment(Qt::AlignHCenter | Qt::AlignTop); |
|
68 |
lblDescription->setWordWrap(true); |
|
69 |
||
70 |
infoLayout->addWidget(lblCaption); |
|
71 |
infoLayout->addWidget(lblDescription); |
|
72 |
||
73 |
pageLayout->addLayout(infoLayout, 0, 1); |
|
74 |
pageLayout->setAlignment(infoLayout, Qt::AlignLeft); |
|
75 |
||
76 |
||
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
77 |
// tab widget containing all lists |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
78 |
tbw = new QTabWidget(this); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
79 |
pageLayout->addWidget(tbw, 1, 0, 1, 2); // span 2 columns |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
80 |
// let's not make the tab widget use more space than needed |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
81 |
tbw->setFixedWidth(400); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
82 |
pageLayout->setAlignment(tbw, Qt::AlignHCenter); |
11970
f6fc7e9bef3d
Make tab of mission list tab header blend into mission list
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
83 |
|
f6fc7e9bef3d
Make tab of mission list tab header blend into mission list
Wuzzy <almikes@aol.com>
parents:
11968
diff
changeset
|
84 |
tbw->setStyleSheet("QListWidget { border-style: none; padding-top: 6px; }"); |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
85 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
86 |
// training/challenge/scenario lists |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
87 |
lstTrainings = new QListWidget(this); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
88 |
lstTrainings ->setWhatsThis(tr("Pick the training to play")); |
6052 | 89 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
90 |
lstChallenges = new QListWidget(this); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
91 |
lstChallenges ->setWhatsThis(tr("Pick the challenge to play")); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
92 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
93 |
lstScenarios= new QListWidget(this); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
94 |
lstScenarios->setWhatsThis(tr("Pick the scenario to play")); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
95 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
96 |
tbw->addTab(lstTrainings, tr("Trainings")); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
97 |
tbw->addTab(lstChallenges, tr("Challenges")); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
98 |
tbw->addTab(lstScenarios, tr("Scenarios")); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
99 |
tbw->setCurrentWidget(lstTrainings); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
100 |
|
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
|
101 |
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
|
102 |
} |
6009 | 103 |
|
6052 | 104 |
QLayout * PageTraining::footerLayoutDefinition() |
105 |
{ |
|
106 |
QBoxLayout * bottomLayout = new QVBoxLayout(); |
|
107 |
||
11973
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
108 |
const QIcon& lp = QIcon(":/res/Start.png"); |
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
109 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
110 |
btnStart = new QPushButton(); |
12236
a0ed4caa6d35
Apply minimal padding to all text buttons in frontend
Wuzzy <almikes@aol.com>
parents:
11973
diff
changeset
|
111 |
btnStart->setStyleSheet("padding: 5px 10px"); |
11973
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
112 |
btnStart->setText(QPushButton::tr("Start")); |
6699
83dd3447a212
exploit the new setWhatsThis feature in our desktop frontend
koda
parents:
6616
diff
changeset
|
113 |
btnStart->setWhatsThis(tr("Start fighting")); |
11973
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
114 |
btnStart->setMinimumWidth(sz.width() + 60); |
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
115 |
btnStart->setIcon(lp); |
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
116 |
btnStart->setFixedHeight(50); |
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
117 |
btnStart->setIconSize(sz); |
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
118 |
btnStart->setFlat(true); |
de1b616fd5e6
Use proper start button in training menu
Wuzzy <almikes@aol.com>
parents:
11970
diff
changeset
|
119 |
btnStart->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
6052 | 120 |
|
121 |
bottomLayout->addWidget(btnStart); |
|
122 |
||
123 |
bottomLayout->setAlignment(btnStart, Qt::AlignRight | Qt::AlignVCenter); |
|
124 |
||
125 |
return bottomLayout; |
|
126 |
} |
|
127 |
||
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
128 |
|
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
|
129 |
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
|
130 |
{ |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
131 |
connect(lstTrainings, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateInfo())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
132 |
connect(lstTrainings, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
133 |
connect(lstTrainings, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
134 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
135 |
connect(lstChallenges, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateInfo())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
136 |
connect(lstChallenges, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
137 |
connect(lstChallenges, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
138 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
139 |
connect(lstScenarios, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateInfo())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
140 |
connect(lstScenarios, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
141 |
connect(lstScenarios, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
142 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
143 |
connect(tbw, SIGNAL(currentChanged(int)), this, SLOT(updateInfo())); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
144 |
|
6052 | 145 |
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
|
146 |
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
|
147 |
} |
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 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
149 |
|
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
|
150 |
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
|
151 |
{ |
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
|
152 |
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
|
153 |
|
6930 | 154 |
DataManager & dataMgr = DataManager::instance(); |
6196 | 155 |
|
6059 | 156 |
// get locale |
8918
512753ea4b1b
Switch to 'settings.ini'. Copies old ini file if necessary on startup.
unc0rr
parents:
8098
diff
changeset
|
157 |
QSettings settings(dataMgr.settingsFileName(), |
6059 | 158 |
QSettings::IniFormat); |
159 |
||
13274
e381f5260b45
Change how locale is loaded in frontend, and fix some bugs
Wuzzy <Wuzzy2@mail.ru>
parents:
13087
diff
changeset
|
160 |
QString loc = QLocale().name(); |
6059 | 161 |
|
8049 | 162 |
QString infoFile = QString("physfs://Locale/missions_" + loc + ".txt"); |
6059 | 163 |
|
164 |
// if file is non-existant try with language only |
|
6167 | 165 |
if (!QFile::exists(infoFile)) |
8049 | 166 |
infoFile = QString("physfs://Locale/missions_" + loc.remove(QRegExp("_.*$")) + ".txt"); |
6059 | 167 |
|
168 |
// fallback if file for current locale is non-existant |
|
6167 | 169 |
if (!QFile::exists(infoFile)) |
8049 | 170 |
infoFile = QString("physfs://Locale/missions_en.txt"); |
6159
c780b8cf4d75
introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents:
6073
diff
changeset
|
171 |
|
6059 | 172 |
|
173 |
// preload mission info for current locale |
|
6167 | 174 |
m_info = new QSettings(infoFile, QSettings::IniFormat, this); |
6257 | 175 |
m_info->setIniCodec("UTF-8"); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
176 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
177 |
QStringList m_list; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
178 |
QListWidget * m_widget; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
179 |
QString subFolder; |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
180 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
181 |
for(int i=1; i<=3; i++) { |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
182 |
switch(i) { |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
183 |
case 1: |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
184 |
subFolder = "Training"; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
185 |
m_widget = lstTrainings; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
186 |
break; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
187 |
case 2: |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
188 |
subFolder = "Challenge"; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
189 |
m_widget = lstChallenges; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
190 |
break; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
191 |
case 3: |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
192 |
subFolder = "Scenario"; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
193 |
m_widget = lstScenarios; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
194 |
break; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
195 |
} |
13087
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
196 |
// scripts to load |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
197 |
// first, load scripts in order specified in order.cfg (if present) |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
198 |
QFile orderFile(QString("physfs://Missions/%1/order.cfg").arg(subFolder)); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
199 |
QStringList orderedMissions; |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
200 |
if (orderFile.open(QFile::ReadOnly)) |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
201 |
{ |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
202 |
QString m_id; |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
203 |
QTextStream input(&orderFile); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
204 |
while(true) |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
205 |
{ |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
206 |
m_id = input.readLine(); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
207 |
if(m_id.isNull() || m_id.isEmpty()) |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
208 |
{ |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
209 |
break; |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
210 |
} |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
211 |
QListWidgetItem * item = new QListWidgetItem(m_id); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
212 |
QString name = item->text().replace("_", " "); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
213 |
name = m_info->value(m_id + ".name", name).toString(); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
214 |
item->setText(name); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
215 |
item->setData(Qt::UserRole, m_id); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
216 |
m_widget->addItem(item); |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
217 |
|
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
218 |
orderedMissions << m_id; |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
219 |
} |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
220 |
} |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
221 |
|
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
222 |
// then, just load anything else in no particular order |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
223 |
m_list = dataMgr.entryList( |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
224 |
"Missions/" + subFolder, |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
225 |
QDir::Files, QStringList("*.lua")). |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
226 |
replaceInStrings(QRegExp("\\.lua$"), ""); |
6059 | 227 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
228 |
foreach (const QString & m_id, m_list) |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
229 |
{ |
13087
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
230 |
// Disallow duplicates from order.cfg |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
231 |
if (orderedMissions.contains(m_id)) |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
232 |
{ |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
233 |
continue; |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
234 |
} |
b6df6283e2ba
Sort all core missions in training menu more logically
Wuzzy <Wuzzy2@mail.ru>
parents:
12240
diff
changeset
|
235 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
236 |
QListWidgetItem * item = new QListWidgetItem(m_id); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
237 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
238 |
// fallback name: replace underscores in mission name with spaces |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
239 |
QString name = item->text().replace("_", " "); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
240 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
241 |
// see if we can get a prettier/translated name |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
242 |
name = m_info->value(m_id + ".name", name).toString(); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
243 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
244 |
item->setText(name); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
245 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
246 |
// store original name in data |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
247 |
item->setData(Qt::UserRole, m_id); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
248 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
249 |
m_widget->addItem(item); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
250 |
} |
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
|
251 |
} |
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
|
252 |
|
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
253 |
updateInfo(); |
6052 | 254 |
|
255 |
// pre-select first mission |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
256 |
if (lstTrainings->count() > 0) |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
257 |
lstTrainings->setCurrentRow(0); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
258 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
259 |
if (lstChallenges->count() > 0) |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
260 |
lstChallenges->setCurrentRow(0); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
261 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
262 |
if (lstScenarios->count() > 0) |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
263 |
lstScenarios->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
|
264 |
} |
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
|
265 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
266 |
QString PageTraining::getSubFolderOfSelected() |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
267 |
{ |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
268 |
QString subFolder; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
269 |
if (tbw->currentWidget() == lstTrainings) { |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
270 |
subFolder = "Training"; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
271 |
} else if (tbw->currentWidget() == lstChallenges) { |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
272 |
subFolder = "Challenge"; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
273 |
} else if (tbw->currentWidget() == lstScenarios) { |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
274 |
subFolder = "Scenario"; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
275 |
} else { |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
276 |
subFolder = "Training"; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
277 |
} |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
278 |
return subFolder; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
279 |
} |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
280 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
281 |
void PageTraining::startSelected() |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
282 |
{ |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
283 |
QListWidget *list; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
284 |
list = (QListWidget*) tbw->currentWidget(); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
285 |
QListWidgetItem * curItem = list->currentItem(); |
6050
07561ade87ca
oops, I forgot I wanted to fix that before committing xD
sheepluva
parents:
6048
diff
changeset
|
286 |
|
07561ade87ca
oops, I forgot I wanted to fix that before committing xD
sheepluva
parents:
6048
diff
changeset
|
287 |
if (curItem != NULL) |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
288 |
emit startMission(curItem->data(Qt::UserRole).toString(), getSubFolderOfSelected()); |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
289 |
} |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
290 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
291 |
|
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
292 |
void PageTraining::updateInfo() |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
293 |
{ |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
294 |
if (tbw->currentWidget()) |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
295 |
{ |
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
296 |
QString subFolder; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
297 |
QListWidget *list; |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
298 |
subFolder = getSubFolderOfSelected(); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
299 |
list = (QListWidget*) tbw->currentWidget(); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
300 |
if (list->currentItem()) |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
301 |
{ |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
302 |
// TODO also use .pngs in userdata folder |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
303 |
QString thumbFile = "physfs://Graphics/Missions/" + |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
304 |
subFolder + "/" + |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
305 |
list->currentItem()->data(Qt::UserRole).toString() + |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
306 |
"@2x.png"; |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
307 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
308 |
if (QFile::exists(thumbFile)) |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
309 |
btnPreview->setIcon(QIcon(thumbFile)); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
310 |
else |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
311 |
btnPreview->setIcon(QIcon(":/res/Trainings.png")); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
312 |
|
12240
88b31fdc760b
Add a few WhatsThis texts in frontend, rename “Stereo rendering” to “Stereoscopy”
Wuzzy <almikes@aol.com>
parents:
12236
diff
changeset
|
313 |
btnPreview->setWhatsThis(tr("Start fighting")); |
88b31fdc760b
Add a few WhatsThis texts in frontend, rename “Stereo rendering” to “Stereoscopy”
Wuzzy <almikes@aol.com>
parents:
12236
diff
changeset
|
314 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
315 |
QString realName = list->currentItem()->data( |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
316 |
Qt::UserRole).toString(); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
317 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
318 |
QString caption = m_info->value(realName + ".name", |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
319 |
list->currentItem()->text()).toString(); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
320 |
|
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
321 |
QString description = m_info->value(realName + ".desc", |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
322 |
tr("No description available")).toString(); |
6058
ae8684864a6e
load mission caption and description from localization file (WIP)
sheepluva
parents:
6054
diff
changeset
|
323 |
|
11968
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
324 |
lblCaption->setText("<h2>" + caption +"</h2>"); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
325 |
lblDescription->setText(description); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
326 |
} |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
327 |
else |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
328 |
{ |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
329 |
btnPreview->setIcon(QIcon(":/res/Trainings.png")); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
330 |
lblCaption->setText(tr("Select a mission!")); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
331 |
// TODO better text and tr() |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
332 |
lblDescription->setText(""); |
1de4d6b35748
Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
333 |
} |
6048
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
334 |
} |
ae213ef7030a
PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents:
6042
diff
changeset
|
335 |
} |