JsonWizard: Allow for better compatibility with QtC 3.3 project wizards

Support for a description was added in 3.4. Keep wizards without that
working.

Change-Id: I13b4506ea154018cac6f337196846a881439628d
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-03-02 16:18:27 +01:00
parent 9a798af144
commit a064280ca3

View File

@@ -181,7 +181,7 @@ Utils::WizardPage *ProjectPageFactory::create(JsonWizard *wizard, Core::Id typeI
JsonProjectPage *page = new JsonProjectPage; JsonProjectPage *page = new JsonProjectPage;
QVariantMap tmp = data.toMap(); QVariantMap tmp = data.isNull() ? QVariantMap() : data.toMap();
QString description = tmp.value(QLatin1String("trDescription")).toString(); QString description = tmp.value(QLatin1String("trDescription")).toString();
page->setDescription(description); page->setDescription(description);
@@ -193,12 +193,11 @@ bool ProjectPageFactory::validateData(Core::Id typeId, const QVariant &data, QSt
Q_UNUSED(errorMessage); Q_UNUSED(errorMessage);
QTC_ASSERT(canCreate(typeId), return false); QTC_ASSERT(canCreate(typeId), return false);
if (data.isNull() || data.type() != QVariant::Map) { if (!data.isNull() && data.type() != QVariant::Map) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
"\"data\" must be a JSON object for \"Project\" pages."); "\"data\" must be empty or a JSON object for \"Project\" pages.");
return false; return false;
} }
return true; return true;
} }