Skip to content

Commit 5e3b3cf

Browse files
authored
Merge pull request #285 from allywarner/bringtofront
Bringtofront
2 parents 0450022 + 129a097 commit 5e3b3cf

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

src/Interface/Application/ProjectWizard.cc

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ ProjectInfoPage::ProjectInfoPage( QWidget *parent )
128128

129129
this->project_path_change_button_ = new QPushButton( "Choose Alternative Location" );
130130
connect( this->project_path_change_button_, SIGNAL( clicked() ), this, SLOT( set_path() ) );
131-
this->project_path_change_button_->setFocusPolicy( Qt::NoFocus );
131+
this->project_path_change_button_->setFocusPolicy( Qt::NoFocus );
132132

133133
this->registerField( "projectName", this->project_name_lineedit_ );
134134

@@ -161,29 +161,32 @@ void ProjectInfoPage::initializePage()
161161

162162
void ProjectInfoPage::set_path()
163163
{
164-
//QDir converts the empty QString "" to the current directory
165-
this->warning_message_->hide();
166-
167-
168-
QString path_name = QFileDialog::getExistingDirectory ( this,
169-
tr( "Choose Save Directory..." ), this->project_path_lineedit_->text(),
170-
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks );
171-
172-
// getExistingString generates an empty string if canceled or closed.
173-
// If either happens, this will exit without changing anything.
174-
if(path_name == "")
164+
//QDir converts the empty QString "" to the current directory
165+
this->warning_message_->hide();
166+
167+
QString path_name;
168+
QFileDialog *dialog = new QFileDialog( this, tr( "Choose Save Directory..." ));
169+
dialog->setAcceptMode(QFileDialog::AcceptOpen);
170+
dialog->setFileMode(QFileDialog::DirectoryOnly);
171+
dialog->setOption(QFileDialog::ShowDirsOnly);
172+
dialog->setOption(QFileDialog::DontResolveSymlinks);
173+
174+
dialog->open( this, SLOT( set_name( const QString& ) ) );
175+
}
176+
177+
void ProjectInfoPage::set_name(const QString& name)
178+
{
179+
if(!name.isEmpty())
175180
{
176-
return;
177-
}
178-
QDir project_directory_ = QDir(path_name);
179-
181+
QDir project_directory_ = QDir(name);
182+
180183
if( project_directory_.exists() )
181-
{
182-
this->project_path_lineedit_->setText( project_directory_.canonicalPath() );
184+
{
185+
this->project_path_lineedit_->setText( project_directory_.canonicalPath() );
183186
this->most_recent_path_ = &project_directory_;
184-
}
185-
186-
registerField( "projectPath", this->project_path_lineedit_ );
187+
}
188+
}
189+
187190
}
188191

189192
bool ProjectInfoPage::validatePage()

src/Interface/Application/ProjectWizard.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <QPushButton>
3939
#include <QCheckBox>
4040
#include <QFileDialog>
41+
#include <QDebug>
4142

4243
#endif
4344

@@ -95,6 +96,7 @@ Q_OBJECT
9596

9697
private Q_SLOTS:
9798
void set_path();
99+
void set_name(const QString& name);
98100
};
99101

100102
class SummaryPage : public QWizardPage

0 commit comments

Comments
 (0)