ENH: Allow cancelling the dialog that prompts for the generator.
This commit is contained in:
parent
05060801d9
commit
76ed89cede
|
@ -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)
|
||||
|
|
|
@ -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&);
|
||||
|
|
Loading…
Reference in New Issue