Commit 390a4194 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Wizard: code prettification.

Use the field() method of QWizard.
parent 8d5c29b9
......@@ -50,11 +50,10 @@ void OpenPage::changeEvent( QEvent *e )
bool OpenPage::validatePage()
{
ProjectWizard* pw = qobject_cast<ProjectWizard*>( wizard() );
if ( pw )
{
ProjectManager* pm = ProjectManager::getInstance();
pm->loadProject( pw->projectFileName() );
}
ProjectManager* pm = ProjectManager::getInstance();
QStringList recents = pm->recentsProjects();
pm->loadProject( recents.at( field( "loadProject" ).toInt() ) );
return true;
}
......@@ -110,13 +110,3 @@ void ProjectWizard::reject()
QDialog::reject();
return ;
}
QString ProjectWizard::projectFileName() const
{
return m_projectFileName;
}
void ProjectWizard::setProjectFile( const QString& fileName )
{
m_projectFileName = fileName;
}
......@@ -40,8 +40,6 @@ class ProjectWizard : public QWizard
ProjectWizard( QWidget* parent = 0 );
~ProjectWizard();
QString projectFileName() const;
protected slots:
virtual void accept();
virtual void reject();
......@@ -49,14 +47,8 @@ class ProjectWizard : public QWizard
private slots:
void showHelp();
private:
void setProjectFile( const QString& fileName );
QString m_projectFileName;
signals:
void flush();
friend class WelcomePage;
};
#endif
......@@ -40,6 +40,8 @@ WelcomePage::WelcomePage( QWidget* parent )
this, SLOT( loadProject() ) );
connect( m_ui.projectsListWidget, SIGNAL( itemActivated(QListWidgetItem*) ),
this, SLOT( selectOpenRadio() ) );
registerField( "loadProject", m_ui.projectsListWidget );
}
void WelcomePage::changeEvent( QEvent *e )
......@@ -79,15 +81,6 @@ bool WelcomePage::validatePage()
"the list.\nThen click next to continue..." ) );
return false;
}
// Pass the project filename to the QWizard
// so the next page can load it.
ProjectWizard* pw = qobject_cast<ProjectWizard*>( wizard() );
if ( pw )
{
QList<QListWidgetItem*> items = m_ui.projectsListWidget->selectedItems();
pw->setProjectFile( items.at( 0 )->data( FilePath ).toString() );
}
return true;
}
return true;
......
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