Commit 5a051036 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
parent 9bb0292b
...@@ -73,6 +73,7 @@ static const char CATEGORY_KEY[] = "category"; ...@@ -73,6 +73,7 @@ static const char CATEGORY_KEY[] = "category";
static const char CATEGORY_NAME_KEY[] = "trDisplayCategory"; static const char CATEGORY_NAME_KEY[] = "trDisplayCategory";
static const char DISPLAY_NAME_KEY[] = "trDisplayName"; static const char DISPLAY_NAME_KEY[] = "trDisplayName";
static const char ICON_KEY[] = "icon"; static const char ICON_KEY[] = "icon";
static const char IMAGE_KEY[] = "image";
static const char DESCRIPTION_KEY[] = "trDescription"; static const char DESCRIPTION_KEY[] = "trDescription";
static const char REQUIRED_FEATURES_KEY[] = "featuresRequired"; static const char REQUIRED_FEATURES_KEY[] = "featuresRequired";
static const char SUGGESTED_FEATURES_KEY[] = "featuresSuggested"; static const char SUGGESTED_FEATURES_KEY[] = "featuresSuggested";
...@@ -523,12 +524,22 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir, ...@@ -523,12 +524,22 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir,
if (!strVal.isEmpty()) { if (!strVal.isEmpty()) {
strVal = baseDir.absoluteFilePath(strVal); strVal = baseDir.absoluteFilePath(strVal);
if (!QFileInfo::exists(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; return false;
} }
setIcon(QIcon(strVal)); 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())); 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 = Core::FeatureSet::fromStringList(data.value(QLatin1String(SUGGESTED_FEATURES_KEY)).toStringList());
m_preferredFeatures |= requiredFeatures(); m_preferredFeatures |= requiredFeatures();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment