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 771 by s10k, Sun Mar 31 19:02:16 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 <    this->myWizard->resize(640,480);
25 <    QRect position = this->myWizard->frameGeometry();
26 <    position.moveCenter(QDesktopWidget().availableGeometry().center());
27 <    this->myWizard->move(position.topLeft());
28 <    //
29 <
30 <    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 <
35 <    this->myWizard->addPage(createIntroPage());
36 <    this->myWizard->addPage(page2);
37 <    this->myWizard->addPage(page3);
38 <    this->myWizard->addPage(page4);
39 <    this->myWizard->addPage(pageFinal);
40 <
41 <    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() {
54 <    QWizardPage *page = new QWizardPage;
55 <    page->setTitle("Introduction");
56 <
57 <    QLabel *label = new QLabel("Welcome to the Oni Sound wizard.\n"
58 <                               "This wizard will allow you to convert in a few and simple steps sounds to oni format.");
59 <    label->setWordWrap(true);
60 <
61 <    QVBoxLayout *layout = new QVBoxLayout;
62 <    layout->addWidget(label);
63 <    page->setLayout(layout);
64 <
65 <    return page;
66 < }
67 <
68 < void SoundWizard::restartWizard(){
69 <    this->myWizard->restart();
70 < }
38 > void SoundWizard::beforeClose(QDialog::DialogCode){
39  
72 void SoundWizard::pageChanged(int pageId){
73    // Last page?
74    if(pageId==4){
75        this->myWizard->setOption(QWizard::HaveCustomButton1, true); // set visible
76        return;
77    }
78    this->myWizard->setOption(QWizard::HaveCustomButton1, false); // set invisible
40   }

Diff Legend

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