1 |
|
#include "packagewizard.h" |
2 |
|
|
3 |
< |
PackageWizard::PackageWizard(QString workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger) |
3 |
> |
PackageWizard::PackageWizard(const QString &appDir, QString workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger) |
4 |
> |
:AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger, false) |
5 |
|
{ |
5 |
– |
this->workspaceWizardLocation=workspaceWizardLocation; |
6 |
– |
this->vagoSettings=vagoSettings; |
7 |
– |
this->myLogger=myLogger; |
6 |
|
this->packagesLocation=this->workspaceWizardLocation+"/Packages"; |
7 |
|
} |
8 |
|
|
9 |
< |
int PackageWizard::exec(){ |
12 |
< |
QWizard myWizard; |
13 |
< |
|
14 |
< |
myWizard.setWindowIcon(QIcon(":/new/icons/package.png")); |
15 |
< |
|
16 |
< |
//Center and resize QWizard (http://www.thedazzlersinc.com/source/2012/06/04/qt-center-window-in-screen/) |
17 |
< |
#ifdef Q_OS_WIN |
18 |
< |
myWizard.resize(640,480); |
19 |
< |
#else |
20 |
< |
myWizard.resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better |
21 |
< |
// because the components on mac use more space |
22 |
< |
#endif |
23 |
< |
QRect position = myWizard.frameGeometry(); |
24 |
< |
position.moveCenter(QDesktopWidget().availableGeometry().center()); |
25 |
< |
myWizard.move(position.topLeft()); |
26 |
< |
// |
27 |
< |
|
9 |
> |
void PackageWizard::exec(){ |
10 |
|
PackagePage2 *page2 = new PackagePage2(this->myLogger); |
11 |
|
PackagePage3 *page3 = new PackagePage3(); |
12 |
|
PackagePage4 *page4 = new PackagePage4(); |
13 |
+ |
this->page4Pointer = page4; // save the pointer in class variable |
14 |
|
PackagePageFinal *pageFinal = new PackagePageFinal(this->vagoSettings); |
15 |
|
|
16 |
< |
myWizard.addPage(createIntroPage()); |
16 |
> |
myWizard.addPage( |
17 |
> |
createIntroPage( |
18 |
> |
"Welcome to the Anniversary Edition Installer 2 (AIE2) package" |
19 |
> |
" creator wizard.\n" |
20 |
> |
"This wizard will allow you to create in a few and simple steps a package for AIE2." |
21 |
> |
) |
22 |
> |
); |
23 |
|
myWizard.addPage(page2); |
24 |
|
myWizard.addPage(page3); |
25 |
|
myWizard.addPage(page4); |
26 |
|
myWizard.addPage(pageFinal); |
27 |
|
|
28 |
< |
myWizard.setWindowTitle("AIE2 Package Creator"); |
40 |
< |
|
41 |
< |
//If wizard finished with sucess |
42 |
< |
if(myWizard.exec()){ //modal and wait for finalization |
43 |
< |
createPackage(myWizard, page4); |
44 |
< |
} |
45 |
< |
|
46 |
< |
return 0; |
28 |
> |
showWizard("AIE2 Package Creator", ":/new/icons/package.png"); |
29 |
|
} |
30 |
|
|
49 |
– |
QWizardPage* PackageWizard::createIntroPage() { |
50 |
– |
QWizardPage *page = new QWizardPage; |
51 |
– |
page->setTitle("Introduction"); |
52 |
– |
|
53 |
– |
QLabel *label = new QLabel("Welcome to the Anniversary Edition Installer 2 (AIE2) package" |
54 |
– |
" creator wizard.\n" |
55 |
– |
"This wizard will allow you to create in a few and simple steps a package for AIE2."); |
56 |
– |
label->setWordWrap(true); |
57 |
– |
|
58 |
– |
QVBoxLayout *layout = new QVBoxLayout; |
59 |
– |
layout->addWidget(label); |
60 |
– |
page->setLayout(layout); |
31 |
|
|
32 |
< |
return page; |
63 |
< |
} |
64 |
< |
|
65 |
< |
void PackageWizard::createPackage(const QWizard &myWizard, PackagePage4 *page4){ |
32 |
> |
void PackageWizard::createPackage(){ |
33 |
|
const QString aeVersion="2.0"; |
34 |
|
|
35 |
|
//Get info page 2 |
36 |
< |
QString modName=myWizard.field("leModName").toString(); |
37 |
< |
QString authors=myWizard.field("leAuthors").toString(); |
38 |
< |
QString version=myWizard.field("leVersion").toString(); |
39 |
< |
QString description=myWizard.field("ptDescription").toString(); |
40 |
< |
QString packageNumber=myWizard.field("lePackageNumber").toString(); |
41 |
< |
bool bslReplace=myWizard.field("rbReplace").toBool(); |
36 |
> |
QString modName=this->myWizard.field("leModName").toString(); |
37 |
> |
QString authors=this->myWizard.field("leAuthors").toString(); |
38 |
> |
QString version=this->myWizard.field("leVersion").toString(); |
39 |
> |
QString description=this->myWizard.field("ptDescription").toString(); |
40 |
> |
QString packageNumber=this->myWizard.field("lePackageNumber").toString(); |
41 |
> |
bool bslReplace=this->myWizard.field("rbReplace").toBool(); |
42 |
|
|
43 |
|
//Get info page 3 |
44 |
< |
QString dependentPackages=myWizard.field("leDependentPackages").toString(); |
45 |
< |
QString incompatiblePackages=myWizard.field("leIncompatiblePackages").toString(); |
46 |
< |
QString unlockLevels=myWizard.field("leUnlockLevels").toString(); |
44 |
> |
QString dependentPackages=this->myWizard.field("leDependentPackages").toString(); |
45 |
> |
QString incompatiblePackages=this->myWizard.field("leIncompatiblePackages").toString(); |
46 |
> |
QString unlockLevels=this->myWizard.field("leUnlockLevels").toString(); |
47 |
|
|
48 |
|
//Get info page 4 |
49 |
< |
const DropTableWidget *commonTable=page4->commonTable; |
50 |
< |
const DropTableWidget *windowsTable=page4->windowsTable; |
51 |
< |
const DropTableWidget *macTable=page4->macTable; |
49 |
> |
const DropTableWidget *commonTable=this->page4Pointer->commonTable; |
50 |
> |
const DropTableWidget *windowsTable=this->page4Pointer->windowsTable; |
51 |
> |
const DropTableWidget *macTable=this->page4Pointer->macTable; |
52 |
|
|
53 |
|
//Get info from final page |
54 |
< |
bool openFolder=myWizard.field("cbOpenFolder").toBool(); |
55 |
< |
bool createZip=myWizard.field("cbCreateZip").toBool(); |
54 |
> |
bool openFolder=this->myWizard.field("cbOpenFolder").toBool(); |
55 |
> |
bool createZip=this->myWizard.field("cbCreateZip").toBool(); |
56 |
|
//Remember the final page choices to next time |
57 |
|
this->vagoSettings->setValue("PackageCreator/OpenFolder",openFolder); |
58 |
|
this->vagoSettings->setValue("PackageCreator/CreateZip",createZip); |
168 |
|
} |
169 |
|
} |
170 |
|
} |
171 |
+ |
|
172 |
+ |
void PackageWizard::beforeClose(QDialog::DialogCode resultStatus){ |
173 |
+ |
|
174 |
+ |
//If wizard finished with sucess, create the package |
175 |
+ |
if(resultStatus == QDialog::Accepted){ |
176 |
+ |
createPackage(); |
177 |
+ |
} |
178 |
+ |
} |
179 |
+ |
|