JsonWizard: Treat no visible page the same as no page at all

Just accept the dialog and try to generate files when no page is
displayed.

Change-Id: I0ae9aa6c29e55f52f3edad35742869a0cc535521
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-05-04 14:32:21 +02:00
parent 083325fd1c
commit 1e1fee86c4

View File

@@ -396,12 +396,14 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
for (auto i = m_options.constBegin(); i != m_options.constEnd(); ++i) for (auto i = m_options.constBegin(); i != m_options.constEnd(); ++i)
wizard.setValue(i.key(), i.value()); wizard.setValue(i.key(), i.value());
bool havePage = false;
foreach (const Page &data, m_pages) { foreach (const Page &data, m_pages) {
QTC_ASSERT(data.isValid(), continue); QTC_ASSERT(data.isValid(), continue);
if (!JsonWizard::boolFromVariant(data.enabled, wizard.expander())) if (!JsonWizard::boolFromVariant(data.enabled, wizard.expander()))
continue; continue;
havePage = true;
JsonWizardPageFactory *factory = Utils::findOr(s_pageFactories, 0, JsonWizardPageFactory *factory = Utils::findOr(s_pageFactories, 0,
[&data](JsonWizardPageFactory *f) { [&data](JsonWizardPageFactory *f) {
return f->canCreate(data.typeId); return f->canCreate(data.typeId);
@@ -436,7 +438,7 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
wizard.addGenerator(gen); wizard.addGenerator(gen);
} }
if (!m_pages.isEmpty()) { if (havePage) {
Core::ICore::registerWindow(&wizard, Core::Context("Core.NewJSONWizard")); Core::ICore::registerWindow(&wizard, Core::Context("Core.NewJSONWizard"));
wizard.exec(); wizard.exec();
} else { } else {
@@ -475,7 +477,6 @@ QString JsonWizardFactory::localizedString(const QVariant &value)
return QString(); return QString();
} }
return QCoreApplication::translate("ProjectExplorer::JsonWizardFactory", value.toByteArray()); return QCoreApplication::translate("ProjectExplorer::JsonWizardFactory", value.toByteArray());
} }
void JsonWizardFactory::destroyAllFactories() void JsonWizardFactory::destroyAllFactories()