ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/bgImageWizard/bgimagewizard.cpp
(Generate patch)

Comparing Vago/trunk/Vago/bgImageWizard/bgimagewizard.cpp (file contents):
Revision 1054 by s10k, Wed Oct 12 21:35:13 2016 UTC vs.
Revision 1061 by s10k, Fri Dec 9 19:04:18 2016 UTC

# Line 1 | Line 1
1   #include "bgimagewizard.h"
2  
3   BGImageWizard::BGImageWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger)
4 + :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger, true)
5   {
6      this->appDir = appDir;
7      this->workspaceWizardLocation=workspaceWizardLocation;
# Line 9 | Line 10 | BGImageWizard::BGImageWizard(const QStri
10      this->bgImagesLocation=this->workspaceWizardLocation+"/BGImages";
11   }
12  
13 < int BGImageWizard::exec(){
13 <
14 <    QPushButton *restartButton = new QPushButton("Restart");
15 <    this->myWizard.setButton(QWizard::CustomButton1,restartButton);
16 <    this->myWizard.setOption(QWizard::HaveCustomButton1, true);
17 <
18 <    connect(&this->myWizard, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int)));
19 <    connect(restartButton, SIGNAL(clicked(bool)), this, SLOT(restartWizard()));
20 <
21 <    this->myWizard.setWindowIcon(QIcon(":/new/icons/background_image.png"));
22 <
23 <    //Center and resize QWizard (http://www.thedazzlersinc.com/source/2012/06/04/qt-center-window-in-screen/)
24 < #ifdef Q_OS_WIN
25 <    this->myWizard.resize(640,480);
26 < #else
27 <    this->myWizard.resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
28 <    // because the components on mac use more space
29 < #endif
30 <    QRect position = this->myWizard.frameGeometry();
31 <    position.moveCenter(QDesktopWidget().availableGeometry().center());
32 <    this->myWizard.move(position.topLeft());
33 <    //
13 > void BGImageWizard::exec(){
14  
15      BGImagePage2 *page2 = new BGImagePage2(this->myLogger);
16      BGImagePage3 *page3 = new BGImagePage3();
17      BGImagePageFinal *pageFinal = new BGImagePageFinal(this->appDir, this->myLogger, this->bgImagesLocation);
18  
19 <    this->myWizard.addPage(createIntroPage());
19 >    this->myWizard.addPage
20 >    (
21 >        createIntroPage
22 >        (
23 >            "Welcome to the Oni Background Image Wizard.\n"
24 >            "This wizard will allow you to create in a few and simple steps Oni background images (TXMB) "
25 >            "that can be used in the menus or as backgrounds screens for the levels."
26 >        )
27 >    );
28 >
29      this->myWizard.addPage(page2);
30      this->myWizard.addPage(page3);
31      this->myWizard.addPage(pageFinal);
32  
33 <    this->myWizard.setWindowTitle("Background Image Wizard");
45 <
46 <    if(this->myWizard.exec()){ //modal and wait for finalization
47 <
48 <    }
49 <
50 <    return 0;
33 >    showWizard("Background Image Wizard", ":/new/icons/background_image.png");
34   }
35  
36 < QWizardPage* BGImageWizard::createIntroPage() {
54 <    QWizardPage *page = new QWizardPage;
55 <    page->setTitle("Introduction");
56 <
57 <    QLabel *label = new QLabel("Welcome to the Oni Background Image Wizard.\n"
58 <                               "This wizard will allow you to create in a few and simple steps Oni background images (TXMB) "
59 <                               "that can be used in the menus or as backgrounds screens for the levels.");
60 <    label->setWordWrap(true);
61 <
62 <    QVBoxLayout *layout = new QVBoxLayout;
63 <    layout->addWidget(label);
64 <    page->setLayout(layout);
65 <
66 <    return page;
67 < }
68 <
69 < void BGImageWizard::restartWizard(){
70 <    this->myWizard.restart();
71 < }
36 > void BGImageWizard::beforeClose(QDialog::DialogCode){
37  
73 void BGImageWizard::pageChanged(int pageId){
74    // Last page?
75    if(pageId==3){
76       this->myWizard.setOption(QWizard::HaveCustomButton1, true); // set visible
77       this->myWizard.button(QWizard::BackButton)->setEnabled(false); // disable back button, use restart if needed
78        return;
79    }
80   this->myWizard.setOption(QWizard::HaveCustomButton1, false); // set invisible
81   this->myWizard.button(QWizard::BackButton)->setEnabled(true); // set enable back button
38   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)