Commit 1e1fee86 authored by Tobias Hunger's avatar Tobias Hunger

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: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 083325fd
......@@ -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)
wizard.setValue(i.key(), i.value());
bool havePage = false;
foreach (const Page &data, m_pages) {
QTC_ASSERT(data.isValid(), continue);
if (!JsonWizard::boolFromVariant(data.enabled, wizard.expander()))
continue;
havePage = true;
JsonWizardPageFactory *factory = Utils::findOr(s_pageFactories, 0,
[&data](JsonWizardPageFactory *f) {
return f->canCreate(data.typeId);
......@@ -436,7 +438,7 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
wizard.addGenerator(gen);
}
if (!m_pages.isEmpty()) {
if (havePage) {
Core::ICore::registerWindow(&wizard, Core::Context("Core.NewJSONWizard"));
wizard.exec();
} else {
......@@ -475,7 +477,6 @@ QString JsonWizardFactory::localizedString(const QVariant &value)
return QString();
}
return QCoreApplication::translate("ProjectExplorer::JsonWizardFactory", value.toByteArray());
}
void JsonWizardFactory::destroyAllFactories()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment