--- Vago/trunk/Vago/soundWizard/soundwizard.cpp 2014/04/25 21:05:54 998 +++ Vago/trunk/Vago/soundWizard/soundwizard.cpp 2016/10/12 21:35:13 1054 @@ -10,49 +10,47 @@ SoundWizard::SoundWizard(QString AppDir, } 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/) #ifdef Q_OS_WIN - this->myWizard->resize(640,480); + 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 + 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(); + QRect position =this->myWizard.frameGeometry(); position.moveCenter(QDesktopWidget().availableGeometry().center()); - this->myWizard->move(position.topLeft()); + this->myWizard.move(position.topLeft()); // SoundPage2 *page2 = new SoundPage2(this->appLocation); SoundPage3 *page3 = new SoundPage3(); SoundPage4 *page4 = new SoundPage4(); + 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; } @@ -72,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 }