From 06d7d58c88cd5fb5d539549ee038b9163f91a5dd Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 15 Oct 2014 15:08:15 +0200 Subject: [PATCH] JsonWizard: Clean up page factories Improve error reporting and remove useless setup code. Change-Id: I97e9fba0aa1cf6bb2cba26f70d46d1ba87bbd192 Reviewed-by: Daniel Teske --- .../jsonwizard/jsonwizardpagefactory_p.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp index 4be83b743e5..8499a10cf09 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp @@ -134,11 +134,11 @@ ProjectPageFactory::ProjectPageFactory() Utils::WizardPage *ProjectPageFactory::create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) { + Q_UNUSED(wizard); Q_UNUSED(data); QTC_ASSERT(canCreate(typeId), return 0); JsonProjectPage *page = new JsonProjectPage; - page->setPath(wizard->value(QStringLiteral("GivenPath")).toString()); return page; } @@ -148,7 +148,13 @@ bool ProjectPageFactory::validateData(Core::Id typeId, const QVariant &data, QSt Q_UNUSED(errorMessage); QTC_ASSERT(canCreate(typeId), return false); - return data.isNull(); + if (!data.isNull() && (data.type() != QVariant::Map || !data.toMap().isEmpty())) { + *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", + "\"data\" for a \"Project\" page needs to be unset or an empty object."); + return false; + } + + return true; } // --------------------------------------------------------------------