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.
Revision 1054 by s10k, Wed Oct 12 21:35:13 2016 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, Logger *myLogger, QHash<QString, QString> *commandMap)
4   {
5 +    this->appLocation=AppDir;
6      this->workspaceWizardLocation=workspaceWizardLocation;
7      this->myLogger=myLogger;
8      this->soundsLocation=this->workspaceWizardLocation+"/Sounds";
# Line 9 | Line 10 | SoundWizard::SoundWizard(QString workspa
10   }
11  
12   int SoundWizard::exec(){
12    this->myWizard = new QWizard();
13
13      QPushButton *restartButton = new QPushButton("Restart");
14 <    this->myWizard->setButton(QWizard::CustomButton1,restartButton);
15 <    this->myWizard->setOption(QWizard::HaveCustomButton1, true);
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)));
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"));
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 <    this->myWizard->resize(640,480);
24 <    QRect position = this->myWizard->frameGeometry();
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());
31 >    this->myWizard.move(position.topLeft());
32      //
33  
34 <    SoundPage2 *page2 = new SoundPage2();
34 >    SoundPage2 *page2 = new SoundPage2(this->appLocation);
35      SoundPage3 *page3 = new SoundPage3();
36      SoundPage4 *page4 = new SoundPage4();
37 <    SoundPageFinal *pageFinal = new SoundPageFinal(this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap);
37 >    SoundPage5 *page5 = new SoundPage5();
38 >    SoundPageFinal *pageFinal = new SoundPageFinal(this->appLocation, this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap);
39  
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);
40 >    this->myWizard.addPage(createIntroPage());
41 >    this->myWizard.addPage(page2);
42 >    this->myWizard.addPage(page3);
43 >    this->myWizard.addPage(page4);
44 >    this->myWizard.addPage(page5);
45 >    this->myWizard.addPage(pageFinal);
46  
47 <    this->myWizard->setWindowTitle("Sound wizard");
47 >    this->myWizard.setWindowTitle("Sound wizard");
48  
49      //If wizard finished with sucess
50 <    if(this->myWizard->exec()){ //modal and wait for finalization
50 >    if(myWizard.exec()){ //modal and wait for finalization
51          //createPackage(this->myWizard, page4);
52      }
53  
48    delete this->myWizard; // not needed anymore
49
54      return 0;
55   }
56  
# Line 66 | Line 70 | QWizardPage* SoundWizard::createIntroPag
70   }
71  
72   void SoundWizard::restartWizard(){
73 <    this->myWizard->restart();
73 >    this->myWizard.restart();
74   }
75  
76   void SoundWizard::pageChanged(int pageId){
77      // Last page?
78 <    if(pageId==4){
79 <        this->myWizard->setOption(QWizard::HaveCustomButton1, true); // set visible
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
83 >    this->myWizard.setOption(QWizard::HaveCustomButton1, false); // set invisible
84 >    this->myWizard.button(QWizard::BackButton)->setEnabled(true); // set enable back button
85   }

Diff Legend

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