From 5a05103635412eeab91cc324f5b456b9ca25b69b Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@theqtcompany.com>
Date: Fri, 22 May 2015 12:19:13 +0200
Subject: [PATCH] JsonWizard: Enable support for descriptive images in wizards

These images are displayed above the description in the new file/project dialog.

Change-Id: Ib218e62a40891ebc2c675c49b32b3789c42d740d
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
---
 .../jsonwizard/jsonwizardfactory.cpp                | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
index 51f8a404a4e..e889bd040a1 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
@@ -73,6 +73,7 @@ static const char CATEGORY_KEY[] = "category";
 static const char CATEGORY_NAME_KEY[] = "trDisplayCategory";
 static const char DISPLAY_NAME_KEY[] = "trDisplayName";
 static const char ICON_KEY[] = "icon";
+static const char IMAGE_KEY[] = "image";
 static const char DESCRIPTION_KEY[] = "trDescription";
 static const char REQUIRED_FEATURES_KEY[] = "featuresRequired";
 static const char SUGGESTED_FEATURES_KEY[] = "featuresSuggested";
@@ -523,12 +524,22 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir,
     if (!strVal.isEmpty()) {
         strVal = baseDir.absoluteFilePath(strVal);
         if (!QFileInfo::exists(strVal)) {
-            *errorMessage = tr("Icon \"%1\" not found.").arg(strVal);
+            *errorMessage = tr("Icon file \"%1\" not found.").arg(QDir::toNativeSeparators(strVal));
             return false;
         }
         setIcon(QIcon(strVal));
     }
 
+    strVal = data.value(QLatin1String(IMAGE_KEY)).toString();
+    if (!strVal.isEmpty()) {
+        strVal = baseDir.absoluteFilePath(strVal);
+        if (!QFileInfo::exists(strVal)) {
+            *errorMessage = tr("Image file \"%1\" not found.").arg(QDir::toNativeSeparators(strVal));
+            return false;
+        }
+        setDescriptionImage(strVal);
+    }
+
     setRequiredFeatures(Core::FeatureSet::fromStringList(data.value(QLatin1String(REQUIRED_FEATURES_KEY)).toStringList()));
     m_preferredFeatures = Core::FeatureSet::fromStringList(data.value(QLatin1String(SUGGESTED_FEATURES_KEY)).toStringList());
     m_preferredFeatures |= requiredFeatures();
-- 
GitLab