summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2008-04-02 18:01:37 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2008-04-02 18:01:37 (GMT)
commit76ed89cedebe4b47dcbc8f29442b2f9061a15f8e (patch)
treecd62eefd6d38aec2791fa59ed8cb3c8bdcb262ae /Source/QtDialog
parent05060801d9caf4fd0476ff6854135cdc2151d3d7 (diff)
downloadCMake-76ed89cedebe4b47dcbc8f29442b2f9061a15f8e.zip
CMake-76ed89cedebe4b47dcbc8f29442b2f9061a15f8e.tar.gz
CMake-76ed89cedebe4b47dcbc8f29442b2f9061a15f8e.tar.bz2
ENH: Allow cancelling the dialog that prompts for the generator.
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx28
-rw-r--r--Source/QtDialog/CMakeSetupDialog.h2
2 files changed, 20 insertions, 10 deletions
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 734fc1a..421e2e8 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -237,6 +237,7 @@ void CMakeSetupDialog::doConfigure()
return;
}
+ // make sure build directory exists
QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory();
QDir dir(bindir);
if(!dir.exists())
@@ -257,10 +258,13 @@ void CMakeSetupDialog::doConfigure()
dir.mkpath(".");
}
- // prompt for generator if one doesn't exist
+ // prompt for generator if it hasn't been set
if(this->CMakeThread->cmakeInstance()->generator().isEmpty())
{
- this->promptForGenerator();
+ if(!this->promptForGenerator())
+ {
+ return;
+ }
}
// remember path
@@ -520,7 +524,7 @@ void CMakeSetupDialog::setEnabledState(bool enabled)
this->RemoveEntry->setEnabled(false); // let selection re-enable it
}
-void CMakeSetupDialog::promptForGenerator()
+bool CMakeSetupDialog::promptForGenerator()
{
QSettings settings;
settings.beginGroup("Settings/StartPath");
@@ -540,19 +544,25 @@ void CMakeSetupDialog::promptForGenerator()
{
combo->setCurrentIndex(idx);
}
- QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
+ QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok |
+ QDialogButtonBox::Cancel,
Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
+ QObject::connect(btns, SIGNAL(rejected()), &dialog, SLOT(reject()));
QVBoxLayout* l = new QVBoxLayout(&dialog);
l->addWidget(lab);
l->addWidget(combo);
l->addWidget(btns);
- dialog.exec();
-
- lastGen = combo->currentText();
- settings.setValue("LastGenerator", lastGen);
- this->CMakeThread->cmakeInstance()->setGenerator(combo->currentText());
+ if(dialog.exec() == QDialog::Accepted)
+ {
+ lastGen = combo->currentText();
+ settings.setValue("LastGenerator", lastGen);
+ this->CMakeThread->cmakeInstance()->setGenerator(combo->currentText());
+ return true;
+ }
+
+ return false;
}
void CMakeSetupDialog::updateGeneratorLabel(const QString& gen)
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index ae9128e..424bb55 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -60,7 +60,7 @@ protected slots:
void updateSourceDirectory(const QString& dir);
void showProgress(const QString& msg, float percent);
void setEnabledState(bool);
- void promptForGenerator();
+ bool promptForGenerator();
void updateGeneratorLabel(const QString& gen);
void setExitAfterGenerate(bool);
void addBinaryPath(const QString&);