diff --git a/src/Interface/Application/ProjectWizard.cc b/src/Interface/Application/ProjectWizard.cc index 01b032d55..fd2e53431 100644 --- a/src/Interface/Application/ProjectWizard.cc +++ b/src/Interface/Application/ProjectWizard.cc @@ -128,7 +128,7 @@ ProjectInfoPage::ProjectInfoPage( QWidget *parent ) this->project_path_change_button_ = new QPushButton( "Choose Alternative Location" ); connect( this->project_path_change_button_, SIGNAL( clicked() ), this, SLOT( set_path() ) ); - this->project_path_change_button_->setFocusPolicy( Qt::NoFocus ); + this->project_path_change_button_->setFocusPolicy( Qt::NoFocus ); this->registerField( "projectName", this->project_name_lineedit_ ); @@ -161,29 +161,32 @@ void ProjectInfoPage::initializePage() void ProjectInfoPage::set_path() { - //QDir converts the empty QString "" to the current directory - this->warning_message_->hide(); - - - QString path_name = QFileDialog::getExistingDirectory ( this, - tr( "Choose Save Directory..." ), this->project_path_lineedit_->text(), - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - - // getExistingString generates an empty string if canceled or closed. - // If either happens, this will exit without changing anything. - if(path_name == "") + //QDir converts the empty QString "" to the current directory + this->warning_message_->hide(); + + QString path_name; + QFileDialog *dialog = new QFileDialog( this, tr( "Choose Save Directory..." )); + dialog->setAcceptMode(QFileDialog::AcceptOpen); + dialog->setFileMode(QFileDialog::DirectoryOnly); + dialog->setOption(QFileDialog::ShowDirsOnly); + dialog->setOption(QFileDialog::DontResolveSymlinks); + + dialog->open( this, SLOT( set_name( const QString& ) ) ); +} + +void ProjectInfoPage::set_name(const QString& name) +{ + if(!name.isEmpty()) { - return; - } - QDir project_directory_ = QDir(path_name); - + QDir project_directory_ = QDir(name); + if( project_directory_.exists() ) - { - this->project_path_lineedit_->setText( project_directory_.canonicalPath() ); + { + this->project_path_lineedit_->setText( project_directory_.canonicalPath() ); this->most_recent_path_ = &project_directory_; -} - - registerField( "projectPath", this->project_path_lineedit_ ); + } + } + } bool ProjectInfoPage::validatePage() diff --git a/src/Interface/Application/ProjectWizard.h b/src/Interface/Application/ProjectWizard.h index 01d67b128..bc8338fd0 100644 --- a/src/Interface/Application/ProjectWizard.h +++ b/src/Interface/Application/ProjectWizard.h @@ -38,6 +38,7 @@ #include #include #include +#include #endif @@ -95,6 +96,7 @@ Q_OBJECT private Q_SLOTS: void set_path(); + void set_name(const QString& name); }; class SummaryPage : public QWizardPage