QTfrontend/ui/page/pagetraining.cpp
author Wuzzy <almikes@aol.com>
Wed, 13 Apr 2016 14:39:17 +0200
changeset 11973 1de4d6b35748
parent 11046 47a8c19ecb60
child 11975 f6fc7e9bef3d
permissions -rw-r--r--
Mission recategorization into trainings, challenges and scenarios. This moves the missions into new folders and adds a nice tab widget in the mission menu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10108
diff changeset
     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
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    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
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
    26
#include <QFile>
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
    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
d187ea93fc4f renaming HWDataManager -> DataManager
sheepluva
parents: 6700
diff changeset
    31
#include "DataManager.h"
6159
c780b8cf4d75 introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents: 6073
diff changeset
    32
5204
e1a5f4d5d86a split pages.h into several header files
koda
parents: 5078
diff changeset
    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
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    42
    btnPreview = formattedButton(":/res/Trainings.png", true);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    43
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    44
    // make both rows equal height
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    45
    pageLayout->setRowStretch(0, 1);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    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
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    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
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    51
    // center preview
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    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
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    57
    // info area (caption on top, description below)
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    58
    QVBoxLayout * infoLayout = new QVBoxLayout();
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    59
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    60
    lblCaption = new QLabel();
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    61
    lblCaption->setMinimumWidth(360);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    62
    lblCaption->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    63
    lblCaption->setWordWrap(true);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    64
    lblDescription = new QLabel();
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    65
    lblDescription->setMinimumWidth(360);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    66
    lblDescription->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    67
    lblDescription->setWordWrap(true);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    68
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    69
    infoLayout->addWidget(lblCaption);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    70
    infoLayout->addWidget(lblDescription);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    71
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    72
    pageLayout->addLayout(infoLayout, 0, 1);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    73
    pageLayout->setAlignment(infoLayout, Qt::AlignLeft);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    74
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    75
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    76
    // tab widget containing all lists
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    77
    tbw = new QTabWidget(this);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    78
    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
    79
    // 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
    80
    tbw->setFixedWidth(400);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    81
    pageLayout->setAlignment(tbw, Qt::AlignHCenter);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    82
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    83
    // training/challenge/scenario lists
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    84
    lstTrainings = new QListWidget(this);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    85
    lstTrainings ->setWhatsThis(tr("Pick the training to play"));
6052
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
    86
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    87
    lstChallenges = new QListWidget(this);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    88
    lstChallenges ->setWhatsThis(tr("Pick the challenge to play"));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    89
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    90
    lstScenarios= new QListWidget(this);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    91
    lstScenarios->setWhatsThis(tr("Pick the scenario 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
    tbw->addTab(lstTrainings, tr("Trainings"));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    94
    tbw->addTab(lstChallenges, tr("Challenges"));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    95
    tbw->addTab(lstScenarios, tr("Scenarios"));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
    96
    tbw->setCurrentWidget(lstTrainings);
5078
3527f0e7bb21 Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff changeset
    97
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
    98
    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
    99
}
6009
14f6fc9869f2 code cleanup/etc
sheepluva
parents: 5238
diff changeset
   100
6052
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   101
QLayout * PageTraining::footerLayoutDefinition()
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   102
{
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   103
    QBoxLayout * bottomLayout = new QVBoxLayout();
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   104
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   105
    btnStart = formattedButton(QPushButton::tr("Go!"));
6699
83dd3447a212 exploit the new setWhatsThis feature in our desktop frontend
koda
parents: 6616
diff changeset
   106
    btnStart->setWhatsThis(tr("Start fighting"));
6052
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   107
    btnStart->setFixedWidth(140);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   108
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   109
    bottomLayout->addWidget(btnStart);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   110
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   111
    bottomLayout->setAlignment(btnStart, Qt::AlignRight | Qt::AlignVCenter);
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   112
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   113
    return bottomLayout;
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   114
}
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   115
6048
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   116
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
   117
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
   118
{
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   119
    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
   120
    connect(lstTrainings, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo()));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   121
    connect(lstTrainings, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected()));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   122
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   123
    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
   124
    connect(lstChallenges, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo()));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   125
    connect(lstChallenges, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected()));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   126
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   127
    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
   128
    connect(lstScenarios, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo()));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   129
    connect(lstScenarios, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected()));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   130
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   131
    connect(tbw, SIGNAL(currentChanged(int)), this, SLOT(updateInfo()));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   132
6052
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   133
    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
   134
    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
   135
}
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
   136
6048
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   137
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
   138
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
   139
{
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
   140
    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
   141
6930
d187ea93fc4f renaming HWDataManager -> DataManager
sheepluva
parents: 6700
diff changeset
   142
    DataManager & dataMgr = DataManager::instance();
6196
c16e84558f71 minor cleanups, mostly in own code
sheepluva
parents: 6183
diff changeset
   143
6059
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   144
    // get locale
8918
512753ea4b1b Switch to 'settings.ini'. Copies old ini file if necessary on startup.
unc0rr
parents: 8098
diff changeset
   145
    QSettings settings(dataMgr.settingsFileName(),
6059
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   146
                       QSettings::IniFormat);
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   147
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   148
    QString loc = settings.value("misc/locale", "").toString();
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   149
    if (loc.isEmpty())
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   150
        loc = QLocale::system().name();
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   151
8049
133e22b5c410 Get rid of DataManager::findFileForRead
unc0rr
parents: 6952
diff changeset
   152
    QString infoFile = QString("physfs://Locale/missions_" + loc + ".txt");
6059
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   153
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   154
    // if file is non-existant try with language only
6167
728cabee2c9f simplified some stuff I wrote
sheepluva
parents: 6160
diff changeset
   155
    if (!QFile::exists(infoFile))
8049
133e22b5c410 Get rid of DataManager::findFileForRead
unc0rr
parents: 6952
diff changeset
   156
        infoFile = QString("physfs://Locale/missions_" + loc.remove(QRegExp("_.*$")) + ".txt");
6059
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   157
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   158
    // fallback if file for current locale is non-existant
6167
728cabee2c9f simplified some stuff I wrote
sheepluva
parents: 6160
diff changeset
   159
    if (!QFile::exists(infoFile))
8049
133e22b5c410 Get rid of DataManager::findFileForRead
unc0rr
parents: 6952
diff changeset
   160
        infoFile = QString("physfs://Locale/missions_en.txt");
6159
c780b8cf4d75 introduce HWDataManager util for transparent access to [user-]data files
sheepluva
parents: 6073
diff changeset
   161
6059
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   162
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   163
    // preload mission info for current locale
6167
728cabee2c9f simplified some stuff I wrote
sheepluva
parents: 6160
diff changeset
   164
    m_info = new QSettings(infoFile, QSettings::IniFormat, this);
6257
e6690d3a8a44 mission locale -> UTF-8
sheepluva
parents: 6196
diff changeset
   165
    m_info->setIniCodec("UTF-8");
6058
ae8684864a6e load mission caption and description from localization file (WIP)
sheepluva
parents: 6054
diff changeset
   166
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   167
    QStringList m_list;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   168
    QListWidget * m_widget;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   169
    QString subFolder;
6048
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   170
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   171
    for(int i=1; i<=3; i++) {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   172
        switch(i) {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   173
            case 1:
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   174
                subFolder = "Training";
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   175
                m_widget = lstTrainings;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   176
                break;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   177
            case 2:
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   178
                subFolder = "Challenge";
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   179
                m_widget = lstChallenges;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   180
                break;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   181
            case 3:
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   182
                subFolder = "Scenario";
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   183
                m_widget = lstScenarios;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   184
                break;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   185
        }
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   186
        m_list = dataMgr.entryList(
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   187
                    "Missions/" + subFolder,
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   188
                    QDir::Files, QStringList("*.lua")).
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   189
               replaceInStrings(QRegExp("\\.lua$"), "");
6059
ddf020d0941a training screen localization works now
sheepluva
parents: 6058
diff changeset
   190
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   191
        // scripts to load - TODO: model?
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   192
        foreach (const QString & m_id, m_list)
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   193
        {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   194
            QListWidgetItem * item = new QListWidgetItem(m_id);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   195
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   196
            // 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
   197
            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
   198
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   199
            // 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
   200
            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
   201
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   202
            item->setText(name);
6048
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   203
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   204
            // store original name in data
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   205
            item->setData(Qt::UserRole, m_id);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   206
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   207
            m_widget->addItem(item);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   208
        }
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
   209
    }
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
   210
6048
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   211
    updateInfo();
6052
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   212
5e3e7d19bdb5 stuffToBeAvoidedInFuture->append("layouting");
sheepluva
parents: 6050
diff changeset
   213
    // pre-select first mission
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   214
    if (lstTrainings->count() > 0)
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   215
        lstTrainings->setCurrentRow(0);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   216
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   217
    if (lstChallenges->count() > 0)
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   218
        lstChallenges->setCurrentRow(0);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   219
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   220
    if (lstScenarios->count() > 0)
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   221
        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
   222
}
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
   223
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   224
QString PageTraining::getSubFolderOfSelected()
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   225
{
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   226
    QString subFolder;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   227
    if (tbw->currentWidget() == lstTrainings) {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   228
        subFolder = "Training";
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   229
    } else if (tbw->currentWidget() == lstChallenges) {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   230
        subFolder = "Challenge";
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   231
    } else if (tbw->currentWidget() == lstScenarios) {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   232
        subFolder = "Scenario";
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   233
    } else {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   234
        subFolder = "Training";
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   235
    }
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   236
    return subFolder;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   237
}
6048
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   238
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   239
void PageTraining::startSelected()
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   240
{
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   241
    QListWidget *list;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   242
    list = (QListWidget*) tbw->currentWidget();
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   243
    QListWidgetItem * curItem = list->currentItem();
6050
07561ade87ca oops, I forgot I wanted to fix that before committing xD
sheepluva
parents: 6048
diff changeset
   244
07561ade87ca oops, I forgot I wanted to fix that before committing xD
sheepluva
parents: 6048
diff changeset
   245
    if (curItem != NULL)
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   246
        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
   247
}
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   248
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   249
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   250
void PageTraining::updateInfo()
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   251
{
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   252
    if (tbw->currentWidget())
6048
ae213ef7030a PIMP'ed up training screen. special thanks to mikade for supplying the pics <3
sheepluva
parents: 6042
diff changeset
   253
    {
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   254
        QString subFolder;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   255
        QListWidget *list;
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   256
        subFolder = getSubFolderOfSelected();
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   257
        list = (QListWidget*) tbw->currentWidget();
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   258
        if (list->currentItem())
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   259
        {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   260
            // TODO also use .pngs in userdata folder
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   261
            QString thumbFile =     "physfs://Graphics/Missions/" +
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   262
                                    subFolder + "/" +
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   263
                                    list->currentItem()->data(Qt::UserRole).toString() +
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   264
                                    "@2x.png";
6058
ae8684864a6e load mission caption and description from localization file (WIP)
sheepluva
parents: 6054
diff changeset
   265
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   266
            if (QFile::exists(thumbFile))
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   267
                btnPreview->setIcon(QIcon(thumbFile));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   268
            else
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   269
                btnPreview->setIcon(QIcon(":/res/Trainings.png"));
6058
ae8684864a6e load mission caption and description from localization file (WIP)
sheepluva
parents: 6054
diff changeset
   270
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   271
            QString realName = list->currentItem()->data(
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   272
                                    Qt::UserRole).toString();
6058
ae8684864a6e load mission caption and description from localization file (WIP)
sheepluva
parents: 6054
diff changeset
   273
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   274
            QString caption = m_info->value(realName + ".name",
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   275
                                            list->currentItem()->text()).toString();
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   276
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   277
            QString description = m_info->value(realName + ".desc",
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   278
                                                tr("No description available")).toString();
6058
ae8684864a6e load mission caption and description from localization file (WIP)
sheepluva
parents: 6054
diff changeset
   279
11973
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   280
            lblCaption->setText("<h2>" + caption +"</h2>");
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   281
            lblDescription->setText(description);
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   282
        }
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   283
        else
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   284
        {
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   285
            btnPreview->setIcon(QIcon(":/res/Trainings.png"));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   286
            lblCaption->setText(tr("Select a mission!"));
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   287
            // TODO better text and tr()
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   288
            lblDescription->setText("");
1de4d6b35748 Mission recategorization into trainings, challenges and scenarios.
Wuzzy <almikes@aol.com>
parents: 11046
diff changeset
   289
        }
6048
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
}