JsonWizard: Allow for descriptions of wizards

Allow for descriptions of project wizards that will be displayed in the
Project location page.

Task-number: QTCREATORBUG-13924
Change-Id: I7d65aba0e07f074cc0935318cff9b93f166a1c51
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-02-20 14:24:45 +01:00
parent c992a9ff08
commit 6c49356471
3 changed files with 12 additions and 5 deletions

View File

@@ -410,13 +410,15 @@
\section2 Project
A Project page has the \c typeId value \c Project. It contains no data or an
empty object.
object with the \c trDescription property which will be shown on the generated
page.
\code
{
"trDisplayName": "Project Location",
"trShortTitle": "Location",
"typeId": "Project"
"typeId": "Project",
"data": { "trDescription": "A description of the wizard" }
},
\endcode

View File

@@ -20,7 +20,8 @@
{
"trDisplayName": "Project Location",
"trShortTitle": "Location",
"typeId": "Project"
"typeId": "Project",
"data": { "trDescription": "This wizard creates an empty .pro file." }
},
{
"trDisplayName": "Kit Selection",

View File

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