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

Comparing:
Vago/trunk/Vago/soundWizard/soundwizard.cpp (file contents), Revision 793 by s10k, Sat Apr 6 23:30:00 2013 UTC vs.
s10k/Vago/soundWizard/soundwizard.cpp (file contents), Revision 1092 by s10k, Sat Dec 30 13:43:28 2017 UTC

# Line 1 | Line 1
1   #include "soundwizard.h"
2  
3 < SoundWizard::SoundWizard(QString workspaceWizardLocation, Logger *myLogger, QHash<QString, QString> *commandMap)
3 > SoundWizard::SoundWizard(QString appDir, QString workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger, QHash<QString, QString> *commandMap)
4 >    :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger, true)
5   {
6 <    this->workspaceWizardLocation=workspaceWizardLocation;
6 <    this->myLogger=myLogger;
6 >    this->appDir=appDir;
7      this->soundsLocation=this->workspaceWizardLocation+"/Sounds";
8      this->commandMap=commandMap;
9   }
10 + void SoundWizard::exec(){
11  
12 < int SoundWizard::exec(){
12 <    this->myWizard = new QWizard();
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/sound.png"));
22 <
23 <    //Center and resize QWizard (http://www.thedazzlersinc.com/source/2012/06/04/qt-center-window-in-screen/)
24 < #ifdef Q_WS_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 <    //
34 <
35 <    SoundPage2 *page2 = new SoundPage2();
12 >    SoundPage2 *page2 = new SoundPage2(this->appDir);
13      SoundPage3 *page3 = new SoundPage3();
14      SoundPage4 *page4 = new SoundPage4();
15 <    SoundPageFinal *pageFinal = new SoundPageFinal(this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap);
16 <
40 <    this->myWizard->addPage(createIntroPage());
41 <    this->myWizard->addPage(page2);
42 <    this->myWizard->addPage(page3);
43 <    this->myWizard->addPage(page4);
44 <    this->myWizard->addPage(pageFinal);
45 <
46 <    this->myWizard->setWindowTitle("Sound wizard");
15 >    SoundPage5 *page5 = new SoundPage5();
16 >    SoundPageFinal *pageFinal = new SoundPageFinal(this->appDir, this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap);
17  
18 <    //If wizard finished with sucess
19 <    if(this->myWizard->exec()){ //modal and wait for finalization
20 <        //createPackage(this->myWizard, page4);
21 <    }
18 >    this->myWizard.addPage
19 >    (
20 >        createIntroPage
21 >        (
22 >            "Welcome to the Oni Sound wizard.\n"
23 >            "This wizard will allow you to convert in a few and simple steps sounds to oni format."
24 >        )
25 >    );
26 >
27 >    this->myWizard.addPage(page2);
28 >    this->myWizard.addPage(page3);
29 >    this->myWizard.addPage(page4);
30 >    this->myWizard.addPage(page5);
31 >    this->myWizard.addPage(pageFinal);
32  
33 <    delete this->myWizard; // not needed anymore
33 >    this->myWizard.setWindowTitle("Sound wizard");
34  
35 <    return 0;
35 >    showWizard("Sound wizard", ":/new/icons/sound.png");
36   }
37  
38 < QWizardPage* SoundWizard::createIntroPage() {
59 <    QWizardPage *page = new QWizardPage;
60 <    page->setTitle("Introduction");
61 <
62 <    QLabel *label = new QLabel("Welcome to the Oni Sound wizard.\n"
63 <                               "This wizard will allow you to convert in a few and simple steps sounds to oni format.");
64 <    label->setWordWrap(true);
65 <
66 <    QVBoxLayout *layout = new QVBoxLayout;
67 <    layout->addWidget(label);
68 <    page->setLayout(layout);
69 <
70 <    return page;
71 < }
72 <
73 < void SoundWizard::restartWizard(){
74 <    this->myWizard->restart();
75 < }
38 > void SoundWizard::beforeClose(QDialog::DialogCode){
39  
77 void SoundWizard::pageChanged(int pageId){
78    // Last page?
79    if(pageId==4){
80        this->myWizard->setOption(QWizard::HaveCustomButton1, true); // set visible
81        this->myWizard->button(QWizard::BackButton)->setEnabled(false); // disable back button, use restart if needed
82        return;
83    }
84    this->myWizard->setOption(QWizard::HaveCustomButton1, false); // set invisible
85    this->myWizard->button(QWizard::BackButton)->setEnabled(true); // set enable back button
40   }

Diff Legend

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