Commit 97be7954 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Add support for non-linear wizard.

parent acca36a6
......@@ -12,3 +12,10 @@ LoadPage::LoadPage( QWidget* parent )
setSubTitle( tr( "Open or create a project" ) );
}
int LoadPage::nextId() const
{
if ( m_ui.createRadioButton->isChecked() )
return ProjectWizard::Page_General;
else
return ProjectWizard::Page_Open;
}
......@@ -2,6 +2,7 @@
#define LOADPAGE_H
#include <QWizardPage>
#include "ProjectWizard.h"
#include "ui_LoadPage.h"
class QWizard;
......@@ -13,6 +14,8 @@ class LoadPage : public QWizardPage
LoadPage( QWidget* parent = 0 );
~LoadPage() { }
int nextId() const;
private:
Ui::LoadPage m_ui;
};
......
......@@ -22,6 +22,7 @@
#include <QString>
#include <QFileDialog>
#include <QMessageBox>
#include "ProjectManager.h"
#include "ProjectWizard.h"
#include "ProjectPreferences.h"
......@@ -35,28 +36,58 @@ ProjectWizard::ProjectWizard( QWidget* parent )
: QWizard( parent )
{
// Create Wizard
#ifndef Q_WS_MAC
setWizardStyle( QWizard::ModernStyle );
#endif
QPixmap logo = QPixmap( ":/images/images/vlmc.png" )
.scaledToHeight( 50, Qt::SmoothTransformation );
setPixmap( QWizard::LogoPixmap, logo );
setPixmap( QWizard::WatermarkPixmap, QPixmap( ":/images/wizard_watermark" ) );
setWindowTitle( tr( "Project wizard" ) );
// Show and connect the help button
setOption( HaveHelpButton, true );
connect( this, SIGNAL( helpRequested() ), this, SLOT( showHelp() ) );
// Create pages
QWizardPage* loadPage = new LoadPage( this );
QWizardPage* generalPage = PageFactory::generateWizardPage<ProjectPreferences>( "General Settings", this );
QWizardPage* videoPage = PageFactory::generateWizardPage<VideoProjectPreferences>( "Video Settings", this );
QWizardPage* audioPage = PageFactory::generateWizardPage<AudioProjectPreferences>( "Audio Settings", this );
QWizardPage* loadPage = new LoadPage( this );
addPage( loadPage );
addPage( generalPage );
addPage( videoPage );
addPage( audioPage );
setPage( Page_Welcome, loadPage );
setPage( Page_General, generalPage );
setPage( Page_Video, videoPage );
setPage( Page_Audio, audioPage );
// Set the start page
setStartId( Page_Welcome );
}
ProjectWizard::~ProjectWizard()
{
}
void ProjectWizard::showHelp()
{
QString message;
switch ( currentId() )
{
case Page_Welcome:
message = tr( "Choose the appropriate action then click Next to continue." );
break;
default:
message = tr( "This help is likely not to be of any help." );
}
QMessageBox::information( this, tr( "Project wizard help" ), message );
}
void ProjectWizard::accept()
{
SettingsManager::getInstance()->commit();
......
......@@ -28,14 +28,20 @@
class ProjectWizard : public QWizard
{
Q_OBJECT
public:
ProjectWizard( QWidget* parent = 0 );
~ProjectWizard();
enum { Page_Welcome,
Page_General, Page_Video, Page_Audio,
Page_Open };
ProjectWizard( QWidget* parent = 0 );
~ProjectWizard();
void accept();
void reject();
private slots:
void showHelp();
void loadProject();
signals:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment