Commit 57443c8f authored by Frédéric Larue's avatar Frédéric Larue

Bug fixed in the import of a file when no project exists and the user presses...

Bug fixed in the import of a file when no project exists and the user presses the "Cancel" button in the "New project" dialog box.
parent 7ad7f5aa
......@@ -487,7 +487,7 @@ void UIMainWindow::update( bool mustBeUpdated )
}
void UIMainWindow::newProject()
bool UIMainWindow::newProject()
{
/* Create the dialog box for asking information about the project to create */
UIParamDialog dlg( "Project settings", this );
......@@ -497,26 +497,28 @@ void UIMainWindow::newProject()
dlg.GetParameters().GetString("name")->Widget()->setFocus();
/* */
if( dlg.exec() == QDialog::Accepted )
if( dlg.exec() != QDialog::Accepted )
return false;
QString projectName = dlg.GetParameters().GetString("name")->Value();
if( !projectName.size() )
{
QString projectName = dlg.GetParameters().GetString("name")->Value();
if( !projectName.size() )
{
QMessageBox::warning(
this,
"Project creation error",
"Unable to create the project. The name field is not specified."
);
return;
}
QMessageBox::warning(
this,
"Project creation error",
"Unable to create the project. The name field is not specified."
);
return false;
}
ProjectHandle *pHndl = new ProjectHandle();
pHndl->project = onCreatingProject( projectName, &dlg.GetParameters() );
ui->comboProject->addItem( pHndl->project->Name(), QVariant::fromValue<void*>(pHndl) );
ui->comboProject->setCurrentIndex( ui->comboProject->count()-1 );
ProjectHandle *pHndl = new ProjectHandle();
pHndl->project = onCreatingProject( projectName, &dlg.GetParameters() );
ui->comboProject->addItem( pHndl->project->Name(), QVariant::fromValue<void*>(pHndl) );
ui->comboProject->setCurrentIndex( ui->comboProject->count()-1 );
setViewerMode( DISPLAY_DOF_3D, true );
}
setViewerMode( DISPLAY_DOF_3D, true );
return true;
}
......@@ -1907,8 +1909,8 @@ void UIMainWindow::importFiles(const QStringList& selectedFiles)
{
// If none exists, ask for the creation a a new project.
if( !getCurrentProject() )
newProject();
if( !getCurrentProject() && !newProject() )
return;
// Change mouse cursor to "waiting" state.
......
......@@ -161,7 +161,7 @@ private slots:
public slots:
void toolExecutionFinished( bool needUpdate );
void newProject();
bool newProject();
void openProject();
void currentProjectChanged();
void updateCurrentProjectContent();
......
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