Commit 3aa2b087 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

Wizards: add option to show an image for description



IWizard::descriptionImage() can return the path to an image.
An empty string is interpreted as no image available.

Change-Id: Ia2012eecbfdeb9bec123ed666fff2d73d79e05ce
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@nokia.com>
parent 5d28d58c
......@@ -88,6 +88,7 @@ public:
QString displayCategory;
Core::FeatureSet requiredFeatures;
Core::IWizard::WizardFlags flags;
QString descriptionImage;
};
BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::WizardKind k) :
......@@ -242,6 +243,17 @@ void BaseFileWizardParameters::setFlags(Core::IWizard::WizardFlags flags)
{
m_d->flags = flags;
}
QString BaseFileWizardParameters::descriptionImage() const
{
return m_d->descriptionImage;
}
void BaseFileWizardParameters::setDescriptionImage(const QString &path)
{
m_d->descriptionImage = path;
}
/*!
\class Core::Internal::WizardEventLoop
\brief Special event loop that runs a QWizard and terminates if the page changes.
......@@ -417,6 +429,11 @@ QString BaseFileWizard::displayCategory() const
return d->m_parameters.displayCategory();
}
QString BaseFileWizard::descriptionImage() const
{
return d->m_parameters.descriptionImage();
}
void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QString &platform)
{
QTC_ASSERT(!path.isEmpty(), return);
......
......@@ -96,6 +96,10 @@ public:
Core::IWizard::WizardFlags flags() const;
void setFlags(Core::IWizard::WizardFlags flags);
QString descriptionImage() const;
void setDescriptionImage(const QString &path);
private:
QSharedDataPointer<BaseFileWizardParameterData> m_d;
};
......@@ -150,6 +154,8 @@ public:
virtual QString category() const;
virtual QString displayCategory() const;
virtual QString descriptionImage() const;
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform);
virtual Core::FeatureSet requiredFeatures() const;
virtual WizardFlags flags() const;
......
......@@ -72,6 +72,8 @@ public:
virtual QString category() const = 0;
virtual QString displayCategory() const = 0;
virtual QString descriptionImage() const = 0;
virtual FeatureSet requiredFeatures() const = 0;
virtual WizardFlags flags() const = 0;
......
......@@ -436,6 +436,13 @@ void NewDialog::currentItemChanged(const QModelIndex &index)
m_ui->templateDescription->setHtml(desciption);
if (!wizard->descriptionImage().isEmpty()) {
m_ui->imageLabel->setVisible(true);
m_ui->imageLabel->setPixmap(wizard->descriptionImage());
} else {
m_ui->imageLabel->setVisible(false);
}
} else {
m_ui->templateDescription->setText(QString());
}
......
......@@ -33,42 +33,16 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QTextBrowser" name="templateDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTreeView" name="templateCategoryView">
<property name="sizePolicy">
......@@ -170,16 +144,64 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<item row="1" column="2">
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">QFrame { background: white }</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="imageLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="templateDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
......
......@@ -119,6 +119,11 @@ QString BaseCheckoutWizard::id() const
return d->id;
}
QString BaseCheckoutWizard::descriptionImage() const
{
return QString();
}
void BaseCheckoutWizard::setId(const QString &id)
{
d->id = id;
......
......@@ -64,6 +64,8 @@ public:
virtual QString displayCategory() const;
virtual QString id() const;
virtual QString descriptionImage() const;
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform);
virtual Core::FeatureSet requiredFeatures() const;
......
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