--- Vago/trunk/Vago/soundWizard/soundwizard.cpp 2013/04/04 14:46:11 789 +++ Vago/trunk/Vago/soundWizard/soundwizard.cpp 2016/10/12 21:35:13 1054 @@ -1,7 +1,8 @@ #include "soundwizard.h" -SoundWizard::SoundWizard(QString workspaceWizardLocation, Logger *myLogger, QHash *commandMap) +SoundWizard::SoundWizard(QString AppDir, QString workspaceWizardLocation, Logger *myLogger, QHash *commandMap) { + this->appLocation=AppDir; this->workspaceWizardLocation=workspaceWizardLocation; this->myLogger=myLogger; this->soundsLocation=this->workspaceWizardLocation+"/Sounds"; @@ -9,44 +10,47 @@ SoundWizard::SoundWizard(QString workspa } int SoundWizard::exec(){ - this->myWizard = new QWizard(); - QPushButton *restartButton = new QPushButton("Restart"); - this->myWizard->setButton(QWizard::CustomButton1,restartButton); - this->myWizard->setOption(QWizard::HaveCustomButton1, true); + this->myWizard.setButton(QWizard::CustomButton1,restartButton); + this->myWizard.setOption(QWizard::HaveCustomButton1, true); - connect(this->myWizard, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int))); + connect(&this->myWizard, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int))); connect(restartButton, SIGNAL(clicked(bool)), this, SLOT(restartWizard())); - this->myWizard->setWindowIcon(QIcon(":/new/icons/sound.png")); + this->myWizard.setWindowIcon(QIcon(":/new/icons/sound.png")); //Center and resize QWizard (http://www.thedazzlersinc.com/source/2012/06/04/qt-center-window-in-screen/) - this->myWizard->resize(640,480); - QRect position = this->myWizard->frameGeometry(); +#ifdef Q_OS_WIN + this->myWizard.resize(640,480); +#else + this->myWizard.resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better + // because the components on mac use more space +#endif + QRect position =this->myWizard.frameGeometry(); position.moveCenter(QDesktopWidget().availableGeometry().center()); - this->myWizard->move(position.topLeft()); + this->myWizard.move(position.topLeft()); // - SoundPage2 *page2 = new SoundPage2(); + SoundPage2 *page2 = new SoundPage2(this->appLocation); SoundPage3 *page3 = new SoundPage3(); SoundPage4 *page4 = new SoundPage4(); - SoundPageFinal *pageFinal = new SoundPageFinal(this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap); + SoundPage5 *page5 = new SoundPage5(); + SoundPageFinal *pageFinal = new SoundPageFinal(this->appLocation, this->soundsLocation,page2->soundTable,this->myLogger, this->commandMap); - this->myWizard->addPage(createIntroPage()); - this->myWizard->addPage(page2); - this->myWizard->addPage(page3); - this->myWizard->addPage(page4); - this->myWizard->addPage(pageFinal); + this->myWizard.addPage(createIntroPage()); + this->myWizard.addPage(page2); + this->myWizard.addPage(page3); + this->myWizard.addPage(page4); + this->myWizard.addPage(page5); + this->myWizard.addPage(pageFinal); - this->myWizard->setWindowTitle("Sound wizard"); + this->myWizard.setWindowTitle("Sound wizard"); //If wizard finished with sucess - if(this->myWizard->exec()){ //modal and wait for finalization + if(myWizard.exec()){ //modal and wait for finalization //createPackage(this->myWizard, page4); } - delete this->myWizard; // not needed anymore - return 0; } @@ -66,16 +70,16 @@ QWizardPage* SoundWizard::createIntroPag } void SoundWizard::restartWizard(){ - this->myWizard->restart(); + this->myWizard.restart(); } void SoundWizard::pageChanged(int pageId){ // Last page? - if(pageId==4){ - this->myWizard->setOption(QWizard::HaveCustomButton1, true); // set visible - this->myWizard->button(QWizard::BackButton)->setEnabled(false); // disable back button, use restart if needed + if(pageId==5){ + this->myWizard.setOption(QWizard::HaveCustomButton1, true); // set visible + this->myWizard.button(QWizard::BackButton)->setEnabled(false); // disable back button, use restart if needed return; } - this->myWizard->setOption(QWizard::HaveCustomButton1, false); // set invisible - this->myWizard->button(QWizard::BackButton)->setEnabled(true); // set enable back button + this->myWizard.setOption(QWizard::HaveCustomButton1, false); // set invisible + this->myWizard.button(QWizard::BackButton)->setEnabled(true); // set enable back button }