Changeset 1061 for Vago/trunk/Vago/bgImageWizard
- Timestamp:
- Dec 9, 2016, 8:04:18 PM (8 years ago)
- Location:
- Vago/trunk/Vago/bgImageWizard
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Vago/trunk/Vago/bgImageWizard/bgimagepagefinal.h
r1054 r1061 4 4 #include <QWizardPage> 5 5 #include <QImage> 6 #include <pugixml.hpp> 7 6 8 #include "utilvago.h" 7 #include "libs/pugixml/pugixml.hpp"8 9 #include "converter.h" 9 10 -
Vago/trunk/Vago/bgImageWizard/bgimagewizard.cpp
r1054 r1061 2 2 3 3 BGImageWizard::BGImageWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger) 4 :AbstractWizard(appDir, workspaceWizardLocation, vagoSettings, myLogger, true) 4 5 { 5 6 this->appDir = appDir; … … 10 11 } 11 12 12 int BGImageWizard::exec(){ 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/background_image.png")); 22 23 //Center and resize QWizard (http://www.thedazzlersinc.com/source/2012/06/04/qt-center-window-in-screen/) 24 #ifdef Q_OS_WIN 25 this->myWizard.resize(640,480); 26 #else 27 this->myWizard.resize(800,600); // Mac OS pcs should be able to render this resolution without any problem. It's also better 28 // because the components on mac use more space 29 #endif 30 QRect position = this->myWizard.frameGeometry(); 31 position.moveCenter(QDesktopWidget().availableGeometry().center()); 32 this->myWizard.move(position.topLeft()); 33 // 13 void BGImageWizard::exec(){ 34 14 35 15 BGImagePage2 *page2 = new BGImagePage2(this->myLogger); … … 37 17 BGImagePageFinal *pageFinal = new BGImagePageFinal(this->appDir, this->myLogger, this->bgImagesLocation); 38 18 39 this->myWizard.addPage(createIntroPage()); 19 this->myWizard.addPage 20 ( 21 createIntroPage 22 ( 23 "Welcome to the Oni Background Image Wizard.\n" 24 "This wizard will allow you to create in a few and simple steps Oni background images (TXMB) " 25 "that can be used in the menus or as backgrounds screens for the levels." 26 ) 27 ); 28 40 29 this->myWizard.addPage(page2); 41 30 this->myWizard.addPage(page3); 42 31 this->myWizard.addPage(pageFinal); 43 32 44 this->myWizard.setWindowTitle("Background Image Wizard"); 45 46 if(this->myWizard.exec()){ //modal and wait for finalization 47 48 } 49 50 return 0; 33 showWizard("Background Image Wizard", ":/new/icons/background_image.png"); 51 34 } 52 35 53 QWizardPage* BGImageWizard::createIntroPage() { 54 QWizardPage *page = new QWizardPage; 55 page->setTitle("Introduction"); 36 void BGImageWizard::beforeClose(QDialog::DialogCode){ 56 37 57 QLabel *label = new QLabel("Welcome to the Oni Background Image Wizard.\n"58 "This wizard will allow you to create in a few and simple steps Oni background images (TXMB) "59 "that can be used in the menus or as backgrounds screens for the levels.");60 label->setWordWrap(true);61 62 QVBoxLayout *layout = new QVBoxLayout;63 layout->addWidget(label);64 page->setLayout(layout);65 66 return page;67 38 } 68 69 void BGImageWizard::restartWizard(){70 this->myWizard.restart();71 }72 73 void BGImageWizard::pageChanged(int pageId){74 // Last page?75 if(pageId==3){76 this->myWizard.setOption(QWizard::HaveCustomButton1, true); // set visible77 this->myWizard.button(QWizard::BackButton)->setEnabled(false); // disable back button, use restart if needed78 return;79 }80 this->myWizard.setOption(QWizard::HaveCustomButton1, false); // set invisible81 this->myWizard.button(QWizard::BackButton)->setEnabled(true); // set enable back button82 } -
Vago/trunk/Vago/bgImageWizard/bgimagewizard.h
r1054 r1061 2 2 #define BGIMAGEWIZARD_H 3 3 4 // System includes5 #include <QString>6 #include <QWizard>7 #include <QWizardPage>8 #include <QLabel>9 #include <QDesktopWidget>10 #include <QVBoxLayout>11 #include <QPushButton>12 13 4 // Local includes 5 #include "abstractwizard.h" 14 6 #include "bgimagepage2.h" 15 7 #include "bgimagepage3.h" 16 8 #include "bgimagepagefinal.h" 17 9 18 class BGImageWizard: public QObject// for signals and slots10 class BGImageWizard: public AbstractWizard // for signals and slots 19 11 { 20 Q_OBJECT // for signals and slots 21 public: 12 protected: 22 13 BGImageWizard(const QString &appDir, const QString &workspaceWizardLocation, QSettings *vagoSettings, Logger *myLogger); 23 intexec();14 void exec(); 24 15 private: 25 QWizard myWizard;26 QWizardPage *createIntroPage();27 28 Logger *myLogger;29 QString workspaceWizardLocation;30 16 QString bgImagesLocation; 31 QString appDir; 32 QSettings *vagoSettings; 33 private slots: 34 void restartWizard(); 35 void pageChanged(int pageId); 17 private: 18 void beforeClose(QDialog::DialogCode resultStatus); 36 19 }; 37 20
Note:
See TracChangeset
for help on using the changeset viewer.