From bcc3cc992befb3308aba0aa30b1c3f31fbd6b2dd Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@theqtcompany.com>
Date: Thu, 28 May 2015 16:03:35 +0200
Subject: [PATCH] JsonWizard: Make description on projects page default to the
 wizard description

Change-Id: Icb8a4856dda4298b3ee901bc7a5c22190ddca5a6
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
---
 .../qtcreator/templates/wizards/projects/plainc/wizard.json | 3 +--
 .../wizards/projects/qmake/qtquickapplication/wizard.json   | 3 +--
 .../projects/qmake/qtquickcontrolsapplication/wizard.json   | 3 +--
 .../projects/qmlproject/qtquickapplication/wizard.json      | 3 +--
 .../qmlproject/qtquickcontrolsapplication/wizard.json       | 3 +--
 .../projectexplorer/jsonwizard/jsonwizardfactory.cpp        | 6 ++++++
 .../projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp  | 5 +++--
 7 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/share/qtcreator/templates/wizards/projects/plainc/wizard.json b/share/qtcreator/templates/wizards/projects/plainc/wizard.json
index 5e1828351a5..fd4188c83cf 100644
--- a/share/qtcreator/templates/wizards/projects/plainc/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/plainc/wizard.json
@@ -24,8 +24,7 @@
         {
             "trDisplayName": "Project Location",
             "trShortTitle": "Location",
-            "typeId": "Project",
-            "data": { "trDescription": "This wizard creates an empty .pro file." }
+            "typeId": "Project"
         },
         {
             "trDisplayName": "Define Build System",
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json
index 841873a91d5..32f6c9d4b90 100644
--- a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json
@@ -23,8 +23,7 @@
         {
             "trDisplayName": "Project Location",
             "trShortTitle": "Location",
-            "typeId": "Project",
-            "data": { "trDescription": "Creates a deployable Qt Quick 2 application." }
+            "typeId": "Project"
         },
         {
             "trDisplayName": "Define Project Details",
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json
index 562fb15ff19..b73dca5261a 100644
--- a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json
@@ -25,8 +25,7 @@
         {
             "trDisplayName": "Project Location",
             "trShortTitle": "Location",
-            "typeId": "Project",
-            "data": { "trDescription": "Creates a deployable Qt Quick 2 application using Qt Quick Controls." }
+            "typeId": "Project"
         },
         {
             "trDisplayName": "Define Project Details",
diff --git a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json
index 30d885eb00a..71004c93c82 100644
--- a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json
@@ -23,8 +23,7 @@
         {
             "trDisplayName": "Project Location",
             "trShortTitle": "Location",
-            "typeId": "Project",
-            "data": { "trDescription": "Creates a Qt Quick UI project." }
+            "typeId": "Project"
         },
         {
             "trDisplayName": "Define Project Details",
diff --git a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json
index ead3eaf47c8..c1978acdeaf 100644
--- a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json
@@ -25,8 +25,7 @@
         {
             "trDisplayName": "Project Location",
             "trShortTitle": "Location",
-            "typeId": "Project",
-            "data": { "trDescription": "Creates a Qt Quick UI project using Qt Quick Controls." }
+            "typeId": "Project"
         },
         {
             "trDisplayName": "Define Project Details",
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
index a80f7404b76..ba5cc0bcf04 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
@@ -388,6 +388,12 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
         kindStr = QLatin1String(Core::Constants::WIZARD_KIND_PROJECT);
     wizard.setValue(QStringLiteral("kind"), kindStr);
 
+    wizard.setValue(QStringLiteral("trDescription"), description());
+    wizard.setValue(QStringLiteral("trDisplayName"), displayName());
+    wizard.setValue(QStringLiteral("trCategory"), displayCategory());
+    wizard.setValue(QStringLiteral("category"), category());
+    wizard.setValue(QStringLiteral("id"), id().toString());
+
     for (auto i = m_options.constBegin(); i != m_options.constEnd(); ++i)
         wizard.setValue(i.key(), i.value());
 
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
index bca42a7f527..46c7bfe27bc 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
@@ -182,8 +182,9 @@ Utils::WizardPage *ProjectPageFactory::create(JsonWizard *wizard, Core::Id typeI
     JsonProjectPage *page = new JsonProjectPage;
 
     QVariantMap tmp = data.isNull() ? QVariantMap() : data.toMap();
-    QString description = tmp.value(QLatin1String("trDescription")).toString();
-    page->setDescription(description);
+    QString description
+            = tmp.value(QLatin1String("trDescription"), QLatin1String("%{trDescription}")).toString();
+    page->setDescription(wizard->expander()->expand(description));
 
     return page;
 }
-- 
GitLab