source: Vago/trunk/Vago/bgImageWizard/bgimagepage3.cpp@ 1054

Last change on this file since 1054 was 1054, checked in by s10k, 8 years ago

Vago 1.1

File size: 3.5 KB
Line 
1#include "bgimagepage3.h"
2#include "ui_bgimagepage3.h"
3
4BGImagePage3::BGImagePage3(QWidget *parent) :
5 QWizardPage(parent),
6 ui(new Ui::BGImagePage3)
7{
8 ui->setupUi(this);
9
10 //Register fields
11 registerField("cbCreateTXMB", ui->cbCreateTXMB);
12 registerField("cbCreateTXMP", ui->cbCreateTXMP);
13 registerField("leLevelId", ui->leLevelId);
14 registerField("leImageName", ui->leImageName);
15 registerField("leTXMBName", ui->leTXMBName);
16}
17
18BGImagePage3::~BGImagePage3()
19{
20 delete ui;
21}
22
23void BGImagePage3::initializePage()
24{
25 // To the first time the page is displayed and when the wizard is restarted
26 generateImageName();
27}
28
29void BGImagePage3::on_cbCreateTXMP_toggled(bool checked)
30{
31 if(!checked){
32 ui->cbCreateTXMB->setDisabled(true);
33 ui->cbCreateTXMB->setChecked(false);
34 }
35 else{
36 ui->cbCreateTXMB->setDisabled(false);
37 }
38
39}
40
41void BGImagePage3::on_cbCreateTXMB_toggled(bool checked)
42{
43 if(!checked){
44 ui->leTXMBName->setDisabled(true);
45 ui->leTXMBName->clear();
46 }
47 else{
48 ui->leTXMBName->setDisabled(false);
49 }
50}
51
52void BGImagePage3::on_leLevelId_textChanged(const QString &arg1)
53{
54 if(!arg1.isEmpty() && !Util::isStringInteger(arg1)){
55 Util::showErrorPopUp("Level id must be a number.");
56 ui->leLevelId->clear();
57 return;
58 }
59
60 if(!arg1.trimmed().isEmpty()){
61 generateImageName();
62 }
63}
64
65void BGImagePage3::on_cbTargetForImage_currentIndexChanged(const QString)
66{
67 generateImageName();
68}
69
70void BGImagePage3::generateImageName(){
71
72 QString type = ui->cbTargetForImage->currentText();
73 QString backgroundName;
74 QString txmbName;
75 QString levelNumber = "00";
76
77 if(ui->leLevelId->text().length() == 1){
78 levelNumber = ("0" + ui->leLevelId->text());
79 }
80 else if(ui->leLevelId->text().length() > 1){
81 levelNumber = ui->leLevelId->text();
82 }
83
84 if(type == "Other"){
85 backgroundName = "TXMPother";
86 txmbName = "TXMBother";
87 }
88 else if(type == "Intro Screen"){
89 backgroundName = "TXMPlevel" + levelNumber + "_intro_";
90 txmbName = "TXMBintro_splash_screen";
91 }
92 else if(type == "Win Screen"){
93 backgroundName = "TXMPlevel" + levelNumber + "_win_";
94 txmbName = "TXMBwin_splash_screen";
95 }
96 else if(type == "Loose Screen"){
97 backgroundName = "TXMPfail01_";
98 txmbName = "TXMBfail_splash_screen";
99 }
100 else if(type == "Main Menu Screen"){
101 backgroundName = "TXMPOni_startup_";
102 txmbName = "TXMBpict_mainmenu";
103 }
104 else if(type == "Options Menu Screen"){
105 backgroundName = "TXMPoptions_";
106 txmbName = "TXMBpict_options_background";
107 }
108 else if(type == "Load Level Screen"){
109 backgroundName = "TXMPoni_kanji_";
110 txmbName = "TXMBpict_loadgame_background";
111 }
112
113 ui->leImageName->setText(backgroundName);
114
115 if(ui->cbCreateTXMB->isChecked()){
116 ui->leTXMBName->setText(txmbName);
117 }
118}
119
120
121bool BGImagePage3::validatePage(){
122
123 QStringList namesList;
124
125 if(ui->leImageName->text().trimmed().isEmpty()){
126 Util::showErrorPopUp("You need to input a name to the image!");
127 return false;
128 }
129
130 if(ui->cbCreateTXMB->isChecked() && ui->leTXMBName->text().trimmed().isEmpty()){
131 Util::showErrorPopUp("You need to input a name to the TXMB file!");
132 return false;
133 }
134
135 return true;
136}
137
Note: See TracBrowser for help on using the repository browser.