forked from qt-creator/qt-creator
JsonWizard: Show error if some files fail to generate
Do not overwrite error messages by an empty string, if the last file in the list successfully is determined. Also do not show the error message twice by avoiding the summarySettingsHaveChanged() call at the end of initialize(), which tries to contruct the generated file list again. Change-Id: Icaa329fcdd8882d49c4776aaced23e0094cfe857 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -90,7 +90,14 @@ void JsonSummaryPage::initializePage()
|
||||
connect(m_wizard, &JsonWizard::filesReady, this, &JsonSummaryPage::triggerCommit);
|
||||
connect(m_wizard, &JsonWizard::filesReady, this, &JsonSummaryPage::addToProject);
|
||||
|
||||
// set result to accepted, so we can check if updateFileList -> m_wizard->generateFileList
|
||||
// called reject()
|
||||
m_wizard->setResult(QDialog::Accepted);
|
||||
updateFileList();
|
||||
// if there were errors while updating the file list, the dialog is rejected
|
||||
// so don't continue the setup (which also avoids showing the error message again)
|
||||
if (m_wizard->result() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
IWizardFactory::WizardKind kind = wizardKind(m_wizard);
|
||||
bool isProject = (kind == IWizardFactory::ProjectWizard);
|
||||
|
@@ -238,13 +238,17 @@ Core::GeneratedFiles JsonWizardFileGenerator::fileList(MacroExpander *expander,
|
||||
}
|
||||
|
||||
const Core::GeneratedFiles result
|
||||
= Utils::transform(fileList,
|
||||
[this, &expander, &errorMessage](const File &f) {
|
||||
return generateFile(f, expander, errorMessage);
|
||||
});
|
||||
= Utils::transform(fileList, [this, &expander, &errorMessage](const File &f) {
|
||||
QString generateError;
|
||||
const Core::GeneratedFile file = generateFile(f, expander, &generateError);
|
||||
if (!generateError.isEmpty())
|
||||
*errorMessage = generateError;
|
||||
return file;
|
||||
});
|
||||
|
||||
if (Utils::contains(result,
|
||||
[](const Core::GeneratedFile &gf) { return gf.filePath().isEmpty(); }))
|
||||
if (Utils::contains(result, [](const Core::GeneratedFile &gf) {
|
||||
return gf.filePath().isEmpty();
|
||||
}))
|
||||
return Core::GeneratedFiles();
|
||||
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user