Commit c85b9123 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

The wizzard now really creates a project.

If a project is currently oppened, it is closed.
parent 8be771a5
......@@ -34,6 +34,8 @@
#include "WelcomePage.h"
#include "OpenPage.h"
#include <QtDebug>
ProjectWizard::ProjectWizard( QWidget* parent )
: QWizard( parent )
{
......@@ -98,6 +100,8 @@ void ProjectWizard::accept()
{
SettingsManager::getInstance()->commit();
}
ProjectManager::getInstance()->newProject(
SettingsManager::getInstance()->getValue( "project", "ProjectName" )->get().toString() );
emit flush();
QDialog::accept();
return ;
......
......@@ -93,6 +93,9 @@ void ProjectManager::loadProject( const QString& fileName )
if ( fileName.length() == 0 )
return;
if ( closeProject() == false )
return ;
// Append the item to the recents list
m_recentsProjects.removeAll( fileName );
m_recentsProjects.prepend( fileName );
......@@ -102,8 +105,6 @@ void ProjectManager::loadProject( const QString& fileName )
QSettings s;
s.setValue( "RecentsProjects", m_recentsProjects );
closeProject();
m_projectFile = new QFile( fileName );
m_domDocument = new QDomDocument;
......@@ -176,22 +177,25 @@ void ProjectManager::saveProject( bool saveAs /*= true*/ )
emit projectSaved();
}
//void ProjectManager::newProject( const QString &projectName )
//{
// if ( closeProject()
// m_fi
//}
void ProjectManager::newProject( const QString &projectName )
{
if ( closeProject() == false )
return ;
m_projectName = projectName;
emit projectUpdated( m_projectName, true );
}
void ProjectManager::closeProject()
bool ProjectManager::closeProject()
{
if ( askForSaveIfModified() == false )
return ;
return false;
if ( m_projectFile != NULL )
{
delete m_projectFile;
m_projectFile = NULL;
}
emit projectClosed();
return true;
}
bool ProjectManager::askForSaveIfModified()
......
......@@ -43,7 +43,7 @@ public:
void saveProject( bool saveAs = true );
bool needSave() const;
QStringList recentsProjects() const;
void closeProject();
bool closeProject();
bool askForSaveIfModified();
private:
......
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