Skip to content

Commit

Permalink
Merge pull request #285 from allywarner/bringtofront
Browse files Browse the repository at this point in the history
Bringtofront
  • Loading branch information
allywarner authored Jul 10, 2018
2 parents 0450022 + 129a097 commit 5e3b3cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
45 changes: 24 additions & 21 deletions src/Interface/Application/ProjectWizard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_ );

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions src/Interface/Application/ProjectWizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <QPushButton>
#include <QCheckBox>
#include <QFileDialog>
#include <QDebug>

#endif

Expand Down Expand Up @@ -95,6 +96,7 @@ Q_OBJECT

private Q_SLOTS:
void set_path();
void set_name(const QString& name);
};

class SummaryPage : public QWizardPage
Expand Down

0 comments on commit 5e3b3cf

Please sign in to comment.