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 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 "soundwizard.h"
2  
3 < SoundWizard::SoundWizard(QString AppDir, 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->appLocation=AppDir;
6 <    this->workspaceWizardLocation=workspaceWizardLocation;
7 <    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(){
13 <    QPushButton *restartButton = new QPushButton("Restart");
14 <    this->myWizard.setButton(QWizard::CustomButton1,restartButton);
15 <    this->myWizard.setOption(QWizard::HaveCustomButton1, true);
16 <
17 <    connect(&this->myWizard, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int)));
18 <    connect(restartButton, SIGNAL(clicked(bool)), this, SLOT(restartWizard()));
19 <
20 <    this->myWizard.setWindowIcon(QIcon(":/new/icons/sound.png"));
21 <
22 <    //Center and resize QWizard (http://www.thedazzlersinc.com/source/2012/06/04/qt-center-window-in-screen/)
23 < #ifdef Q_OS_WIN
24 <    this->myWizard.resize(640,480);
25 < #else
26 <    this->myWizard.resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better
27 <    // because the components on mac use more space
28 < #endif
29 <    QRect position =this->myWizard.frameGeometry();
30 <    position.moveCenter(QDesktopWidget().availableGeometry().center());
31 <    this->myWizard.move(position.topLeft());
32 <    //
33 <
34 <    SoundPage2 *page2 = new SoundPage2(this->appLocation);
12 >    SoundPage2 *page2 = new SoundPage2(this->appDir);
13      SoundPage3 *page3 = new SoundPage3();
14      SoundPage4 *page4 = new SoundPage4();
15      SoundPage5 *page5 = new SoundPage5();
16 <    SoundPageFinal *pageFinal = new SoundPageFinal(this->appLocation, this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap);
16 >    SoundPageFinal *pageFinal = new SoundPageFinal(this->appDir, this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap);
17 >
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  
40    this->myWizard.addPage(createIntroPage());
27      this->myWizard.addPage(page2);
28      this->myWizard.addPage(page3);
29      this->myWizard.addPage(page4);
# Line 46 | Line 32 | int SoundWizard::exec(){
32  
33      this->myWizard.setWindowTitle("Sound wizard");
34  
35 <    //If wizard finished with sucess
50 <    if(myWizard.exec()){ //modal and wait for finalization
51 <        //createPackage(this->myWizard, page4);
52 <    }
53 <
54 <    return 0;
35 >    showWizard("Sound wizard", ":/new/icons/sound.png");
36   }
37  
38 < QWizardPage* SoundWizard::createIntroPage() {
58 <    QWizardPage *page = new QWizardPage;
59 <    page->setTitle("Introduction");
60 <
61 <    QLabel *label = new QLabel("Welcome to the Oni Sound wizard.\n"
62 <                               "This wizard will allow you to convert in a few and simple steps sounds to oni format.");
63 <    label->setWordWrap(true);
64 <
65 <    QVBoxLayout *layout = new QVBoxLayout;
66 <    layout->addWidget(label);
67 <    page->setLayout(layout);
68 <
69 <    return page;
70 < }
71 <
72 < void SoundWizard::restartWizard(){
73 <    this->myWizard.restart();
74 < }
38 > void SoundWizard::beforeClose(QDialog::DialogCode){
39  
76 void SoundWizard::pageChanged(int pageId){
77    // Last page?
78    if(pageId==5){
79        this->myWizard.setOption(QWizard::HaveCustomButton1, true); // set visible
80        this->myWizard.button(QWizard::BackButton)->setEnabled(false); // disable back button, use restart if needed
81        return;
82    }
83    this->myWizard.setOption(QWizard::HaveCustomButton1, false); // set invisible
84    this->myWizard.button(QWizard::BackButton)->setEnabled(true); // set enable back button
40   }

Diff Legend

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