Wizards: changes the structure of Wizards

This patch introduces platforms as a top level topic when choosing
a wizard. Also I changed the categories and priorities.

Details:

1. I did change the way the dialog/view is structured in newdialog.cpp

2. I added platformName() and supportsPlatform() to BaseQtVersion.
   I needed two functions because the Simulator does not provide a platform
   and therefore has no platformName but supports two platforms.
   I still have to turn the platform names into proper constants.

3. I changed the categories and priorities to get the layout that was
   discussed. (I had to touch quite alot of files but this is mostly trivial)

4. I added a combobox that allows filtering for platforms.

5. I added flags() to IWizard to indicate that a wizard is platform independent.

Change-Id: I86c7ad628a431ad06505c76580885c6e6c3ddc23
Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com>
This commit is contained in:
Thomas Hartmann
2012-02-08 17:25:35 +01:00
committed by Alessandro Portale
parent ea23486847
commit 95a028e835
63 changed files with 667 additions and 172 deletions

View File

@@ -87,6 +87,7 @@ public:
QString category;
QString displayCategory;
Core::FeatureSet requiredFeatures;
Core::IWizard::WizardFlags flags;
};
BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::WizardKind k) :
@@ -232,6 +233,15 @@ void BaseFileWizardParameters::setDisplayCategory(const QString &v)
m_d->displayCategory = v;
}
Core::IWizard::WizardFlags BaseFileWizardParameters::flags() const
{
return m_d->flags;
}
void BaseFileWizardParameters::setFlags(Core::IWizard::WizardFlags flags)
{
m_d->flags = flags;
}
/*!
\class Core::Internal::WizardEventLoop
\brief Special event loop that runs a QWizard and terminates if the page changes.
@@ -407,7 +417,7 @@ QString BaseFileWizard::displayCategory() const
return d->m_parameters.displayCategory();
}
void BaseFileWizard::runWizard(const QString &path, QWidget *parent)
void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QString &platform)
{
QTC_ASSERT(!path.isEmpty(), return);
@@ -437,11 +447,10 @@ void BaseFileWizard::runWizard(const QString &path, QWidget *parent)
// Create dialog and run it. Ensure that the dialog is deleted when
// leaving the func, but not before the IFileWizardExtension::process
// has been called
const QScopedPointer<QWizard> wizard(createWizardDialog(parent,
WizardDialogParameters(path,
allExtensionPages,
QString(),
requiredFeatures())));
const QScopedPointer<QWizard> wizard(createWizardDialog(parent, WizardDialogParameters(path,
allExtensionPages,
platform,
requiredFeatures())));
QTC_ASSERT(!wizard.isNull(), return);
GeneratedFiles files;
@@ -525,6 +534,11 @@ Core::FeatureSet BaseFileWizard::requiredFeatures() const
return d->m_parameters.requiredFeatures();
}
Core::IWizard::WizardFlags BaseFileWizard::flags() const
{
return d->m_parameters.flags();
}
/*!
\fn virtual QWizard *Core::BaseFileWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath,

View File

@@ -94,6 +94,8 @@ public:
Core::FeatureSet requiredFeatures() const;
void setRequiredFeatures(Core::FeatureSet features);
Core::IWizard::WizardFlags flags() const;
void setFlags(Core::IWizard::WizardFlags flags);
private:
QSharedDataPointer<BaseFileWizardParameterData> m_d;
};
@@ -148,8 +150,9 @@ public:
virtual QString category() const;
virtual QString displayCategory() const;
virtual void runWizard(const QString &path, QWidget *parent);
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform);
virtual Core::FeatureSet requiredFeatures() const;
virtual WizardFlags flags() const;
static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);
static void setupWizard(QWizard *);

View File

@@ -178,14 +178,52 @@ QList<IWizard*> IWizard::wizardsOfKind(WizardKind kind)
return findWizards(WizardKindPredicate(kind));
}
bool IWizard::isAvailable() const
bool IWizard::isAvailable(const QString &platformName) const
{
FeatureSet availableFeatures;
const QList<Core::IFeatureProvider*> featureManagers = ExtensionSystem::PluginManager::instance()->getObjects<Core::IFeatureProvider>();
foreach (const Core::IFeatureProvider *featureManager, featureManagers)
availableFeatures |= featureManager->availableFeatures();
availableFeatures |= featureManager->availableFeatures(platformName);
return availableFeatures.contains(requiredFeatures());
}
QStringList IWizard::supportedPlatforms() const
{
QStringList stringList;
foreach (const QString &platform, allAvailablePlatforms()) {
if (isAvailable(platform))
stringList.append(platform);
}
return stringList;
}
QStringList IWizard::allAvailablePlatforms()
{
QStringList platforms;
const QList<Core::IFeatureProvider*> featureManagers =
ExtensionSystem::PluginManager::instance()->getObjects<Core::IFeatureProvider>();
foreach (const Core::IFeatureProvider *featureManager, featureManagers)
platforms.append(featureManager->availablePlatforms());
return platforms;
}
QString IWizard::displayNameForPlatform(const QString &string)
{
const QList<Core::IFeatureProvider*> featureManagers =
ExtensionSystem::PluginManager::instance()->getObjects<Core::IFeatureProvider>();
foreach (const Core::IFeatureProvider *featureManager, featureManagers) {
QString displayName = featureManager->displayNameForPlatform(string);
if (!displayName.isEmpty())
return displayName;
}
return QString();
}

View File

@@ -55,6 +55,10 @@ public:
ProjectWizard = 0x04
};
Q_DECLARE_FLAGS(WizardKinds, WizardKind)
enum WizardFlag {
PlatformIndependent = 0x01
};
Q_DECLARE_FLAGS(WizardFlags, WizardFlag)
IWizard(QObject *parent = 0) : QObject(parent) {}
virtual ~IWizard() {}
@@ -69,19 +73,24 @@ public:
virtual QString displayCategory() const = 0;
virtual FeatureSet requiredFeatures() const = 0;
virtual WizardFlags flags() const = 0;
virtual void runWizard(const QString &path, QWidget *parent) = 0;
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform) = 0;
bool isAvailable() const;
bool isAvailable(const QString &platformName) const;
QStringList supportedPlatforms() const;
// Utility to find all registered wizards
static QList<IWizard*> allWizards();
// Utility to find all registered wizards of a certain kind
static QList<IWizard*> wizardsOfKind(WizardKind kind);
static QStringList allAvailablePlatforms();
static QString displayNameForPlatform(const QString &string);
};
} // namespace Core
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizard::WizardKinds)
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizard::WizardFlags)
#endif // IWIZARD_H

View File

@@ -40,6 +40,7 @@
#include <coreplugin/featureprovider.h>
#include <QtGui/QAbstractProxyModel>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QItemSelectionModel>
#include <QtGui/QHeaderView>
#include <QtGui/QPushButton>
@@ -55,6 +56,49 @@ namespace {
const int ICON_SIZE = 22;
struct WizardContainer
{
WizardContainer() : wizard(0), wizardOption(0) {}
WizardContainer(Core::IWizard *w, int i): wizard(w), wizardOption(i) {}
Core::IWizard *wizard;
int wizardOption;
};
inline Core::IWizard *wizardOfItem(const QStandardItem *item = 0)
{
if (!item)
return 0;
return item->data(Qt::UserRole).value<WizardContainer>().wizard;
}
class PlatformFilterProxyModel : public QSortFilterProxyModel
{
// Q_OBJECT
public:
PlatformFilterProxyModel(QObject *parent = 0): QSortFilterProxyModel(parent) {}
void setPlatform(const QString& platform)
{
m_platform = platform;
invalidateFilter();
}
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
if (!sourceParent.isValid())
return true;
QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent);
Core::IWizard *wizard = wizardOfItem(qobject_cast<QStandardItemModel*>(sourceModel())->itemFromIndex(sourceIndex));
if (wizard)
return wizard->isAvailable(m_platform);
return true;
}
private:
QString m_platform;
};
class TwoLevelProxyModel : public QAbstractProxyModel
{
// Q_OBJECT
@@ -139,15 +183,9 @@ public:
}
};
inline Core::IWizard *wizardOfItem(const QStandardItem *item = 0)
{
if (!item)
return 0;
return item->data(Qt::UserRole).value<Core::IWizard*>();
}
}
Q_DECLARE_METATYPE(WizardContainer)
using namespace Core;
using namespace Core::Internal;
@@ -166,9 +204,12 @@ NewDialog::NewDialog(QWidget *parent) :
m_okButton->setText(tr("&Choose..."));
m_model = new QStandardItemModel(this);
m_proxyModel = new TwoLevelProxyModel(this);
m_proxyModel->setSourceModel(m_model);
m_ui->templateCategoryView->setModel(m_proxyModel);
m_twoLevelProxyModel = new TwoLevelProxyModel(this);
m_twoLevelProxyModel->setSourceModel(m_model);
m_filterProxyModel = new PlatformFilterProxyModel(this);
m_filterProxyModel->setSourceModel(m_model);
m_ui->templateCategoryView->setModel(m_twoLevelProxyModel);
m_ui->templateCategoryView->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_ui->templateCategoryView->setItemDelegate(new FancyTopLevelDelegate);
@@ -188,6 +229,8 @@ NewDialog::NewDialog(QWidget *parent) :
connect(m_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setSelectedPlatform(QString)));
}
// Sort by category. id
@@ -204,32 +247,44 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
qStableSort(wizards.begin(), wizards.end(), wizardLessThan);
CategoryItemMap categories;
CategoryItemMap platformMap;
m_model->clear();
QStandardItem *parentItem = m_model->invisibleRootItem();
QStandardItem *projectKindItem = new QStandardItem(tr("Projects"));
projectKindItem->setData(IWizard::ProjectWizard, Qt::UserRole);
projectKindItem->setFlags(0); // disable item to prevent focus
QStandardItem *filesClassesKindItem = new QStandardItem(tr("Files and Classes"));
filesClassesKindItem->setData(IWizard::FileWizard, Qt::UserRole);
filesClassesKindItem->setFlags(0); // disable item to prevent focus
QStandardItem *parentItem = m_model->invisibleRootItem();
parentItem->appendRow(projectKindItem);
parentItem->appendRow(filesClassesKindItem);
if (m_dummyIcon.isNull()) {
m_dummyIcon = QPixmap(ICON_SIZE, ICON_SIZE);
m_dummyIcon.fill(Qt::transparent);
m_dummyIcon = QIcon(QLatin1String(Core::Constants::ICON_NEWFILE));
}
QStringList availablePlatforms = IWizard::allAvailablePlatforms();
if (availablePlatforms.count() > 1) {
m_ui->comboBox->addItem(tr("All templates"), QString());
foreach (const QString &platform, availablePlatforms) {
m_ui->comboBox->addItem(tr("%1 templates").arg(platform), platform);
}
} else {
if (availablePlatforms.isEmpty()) {
m_ui->comboBox->addItem(tr("All templates"), QString());
} else {
const QString platform = availablePlatforms.first();
m_ui->comboBox->addItem(tr("%1 templates").arg(platform), platform);
}
m_ui->comboBox->setDisabled(true);
}
foreach (IWizard *wizard, wizards) {
// ensure category root
const QString categoryName = wizard->category();
CategoryItemMap::iterator cit = categories.find(categoryName);
if (cit == categories.end()) {
QStandardItem *categoryItem = new QStandardItem();
if (wizard->isAvailable(selectedPlatform())) {
QStandardItem *kindItem;
switch (wizard->kind()) {
case IWizard::ProjectWizard:
@@ -241,39 +296,8 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
kindItem = filesClassesKindItem;
break;
}
kindItem->appendRow(categoryItem);
m_categoryItems.append(categoryItem);
categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
categoryItem->setText(wizard->displayCategory());
categoryItem->setData(wizard->category(), Qt::UserRole);
cit = categories.insert(categoryName, categoryItem);
addItem(kindItem, wizard);
}
// add item
if (wizard->isAvailable()) {
QStandardItem *wizardItem = new QStandardItem(wizard->displayName());
QIcon wizardIcon;
// spacing hack. Add proper icons instead
if (wizard->icon().isNull()) {
wizardIcon = m_dummyIcon;
} else {
wizardIcon = wizard->icon();
}
wizardItem->setIcon(wizardIcon);
wizardItem->setData(QVariant::fromValue(wizard), Qt::UserRole);
wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
cit.value()->appendRow(wizardItem);
}
}
if (!projectKindItem->hasChildren()) {
QModelIndex idx = projectKindItem->index();
m_model->removeRow(idx.row());
}
if (!filesClassesKindItem->hasChildren()) {
QModelIndex idx = filesClassesKindItem->index();
m_model->removeRow(idx.row());
}
}
@@ -285,19 +309,19 @@ Core::IWizard *NewDialog::showDialog()
if (!lastCategory.isEmpty())
foreach(QStandardItem* item, m_categoryItems) {
if (item->data(Qt::UserRole) == lastCategory) {
idx = m_proxyModel->mapToSource(m_model->indexFromItem(item));
idx = m_twoLevelProxyModel->mapToSource(m_model->indexFromItem(item));
}
}
if (!idx.isValid())
idx = m_proxyModel->index(0,0, m_proxyModel->index(0,0));
idx = m_twoLevelProxyModel->index(0,0, m_twoLevelProxyModel->index(0,0));
m_ui->templateCategoryView->setCurrentIndex(idx);
// We need to set ensure that the category has default focus
m_ui->templateCategoryView->setFocus(Qt::NoFocusReason);
for (int row = 0; row < m_proxyModel->rowCount(); ++row)
m_ui->templateCategoryView->setExpanded(m_proxyModel->index(row, 0), true);
for (int row = 0; row < m_twoLevelProxyModel->rowCount(); ++row)
m_ui->templateCategoryView->setExpanded(m_twoLevelProxyModel->index(row, 0), true);
// Ensure that item description is visible on first show
currentItemChanged(m_ui->templatesView->rootIndex().child(0,0));
@@ -307,7 +331,7 @@ Core::IWizard *NewDialog::showDialog()
const int retVal = exec();
idx = m_ui->templateCategoryView->currentIndex();
lastCategory = m_model->itemFromIndex(m_proxyModel->mapToSource(idx))->data(Qt::UserRole).toString();
lastCategory = m_model->itemFromIndex(m_twoLevelProxyModel->mapToSource(idx))->data(Qt::UserRole).toString();
if (retVal != Accepted)
return 0;
@@ -315,6 +339,19 @@ Core::IWizard *NewDialog::showDialog()
return currentWizard();
}
QString NewDialog::selectedPlatform() const
{
int index = m_ui->comboBox->currentIndex();
return m_ui->comboBox->itemData(index).toString();
}
int NewDialog::selectedWizardOption() const
{
QStandardItem *item = m_model->itemFromIndex(m_ui->templatesView->currentIndex());
return item->data(Qt::UserRole).value<WizardContainer>().wizardOption;
}
NewDialog::~NewDialog()
{
delete m_ui;
@@ -322,15 +359,50 @@ NewDialog::~NewDialog()
IWizard *NewDialog::currentWizard() const
{
return wizardOfItem(m_model->itemFromIndex(m_ui->templatesView->currentIndex()));
QModelIndex index = m_filterProxyModel->mapToSource(m_ui->templatesView->currentIndex());
return wizardOfItem(m_model->itemFromIndex(index));
}
void NewDialog::addItem(QStandardItem *topLEvelCategoryItem, IWizard *wizard)
{
const QString categoryName = wizard->category();
QStandardItem *categoryItem = 0;
for (int i = 0; i < topLEvelCategoryItem->rowCount(); i++) {
if (topLEvelCategoryItem->child(i, 0)->data(Qt::UserRole) == categoryName)
categoryItem = topLEvelCategoryItem->child(i, 0);
}
if (!categoryItem) {
categoryItem = new QStandardItem();
topLEvelCategoryItem->appendRow(categoryItem);
m_categoryItems.append(categoryItem);
categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
categoryItem->setText(QLatin1String(" ") + wizard->displayCategory());
categoryItem->setData(wizard->category(), Qt::UserRole);
}
QStandardItem *wizardItem = new QStandardItem(wizard->displayName());
QIcon wizardIcon;
// spacing hack. Add proper icons instead
if (wizard->icon().isNull()) {
wizardIcon = m_dummyIcon;
} else {
wizardIcon = wizard->icon();
}
wizardItem->setIcon(wizardIcon);
wizardItem->setData(QVariant::fromValue(WizardContainer(wizard, 0)), Qt::UserRole);
wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
categoryItem->appendRow(wizardItem);
}
void NewDialog::currentCategoryChanged(const QModelIndex &index)
{
if (index.parent() != m_model->invisibleRootItem()->index()) {
m_ui->templatesView->setModel(m_model);
m_ui->templatesView->setRootIndex(m_proxyModel->mapToSource(index));
m_ui->templatesView->setModel(m_filterProxyModel);
QModelIndex sourceIndex = m_twoLevelProxyModel->mapToSource(index);
sourceIndex = m_filterProxyModel->mapFromSource(sourceIndex);
m_ui->templatesView->setRootIndex(sourceIndex);
// Focus the first item by default
m_ui->templatesView->setCurrentIndex(m_ui->templatesView->rootIndex().child(0,0));
@@ -342,11 +414,26 @@ void NewDialog::currentCategoryChanged(const QModelIndex &index)
void NewDialog::currentItemChanged(const QModelIndex &index)
{
QStandardItem* cat = m_model->itemFromIndex(index);
if (const IWizard *wizard = wizardOfItem(cat))
m_ui->templateDescription->setText(wizard->description());
else
QModelIndex sourceIndex = m_filterProxyModel->mapToSource(index);
QStandardItem* cat = (m_model->itemFromIndex(sourceIndex));
if (const IWizard *wizard = wizardOfItem(cat)) {
QString desciption = wizard->description();
if (!Qt::mightBeRichText(desciption))
desciption.replace(QLatin1Char('\n'), QLatin1String("<br>"));
desciption += QLatin1String("<br><br><b>");
if (wizard->flags().testFlag(IWizard::PlatformIndependent))
desciption += tr("Platform independent") + QLatin1String("</b>");
else
desciption += tr("Supported Platforms")
+ QLatin1String("</b>: <tt>")
+ wizard->supportedPlatforms().join(QLatin1String(" "))
+ QLatin1String("</tt>");
m_ui->templateDescription->setHtml(desciption);
} else {
m_ui->templateDescription->setText(QString());
}
updateOkButton();
}
@@ -360,3 +447,9 @@ void NewDialog::updateOkButton()
{
m_okButton->setEnabled(currentWizard() != 0);
}
void NewDialog::setSelectedPlatform(const QString & /*platform*/)
{
//The static cast allows us to keep PlatformFilterProxyModel anonymous
static_cast<PlatformFilterProxyModel*>(m_filterProxyModel)->setPlatform(selectedPlatform());
}

View File

@@ -36,11 +36,13 @@
#include "iwizard.h"
#include <QtGui/QDialog>
#include <QtGui/QIcon>
#include <QtCore/QList>
#include <QtCore/QModelIndex>
QT_BEGIN_NAMESPACE
class QAbstractProxyModel;
class QSortFilterProxyModel;
class QPushButton;
class QStandardItem;
class QStandardItemModel;
@@ -66,20 +68,26 @@ public:
void setWizards(QList<IWizard*> wizards);
Core::IWizard *showDialog();
QString selectedPlatform() const;
int selectedWizardOption() const;
private slots:
void currentCategoryChanged(const QModelIndex &);
void currentItemChanged(const QModelIndex &);
void okButtonClicked();
void updateOkButton();
void setSelectedPlatform(const QString &platform);
private:
Core::IWizard *currentWizard() const;
void addItem(QStandardItem *topLEvelCategoryItem, IWizard *wizard);
Ui::NewDialog *m_ui;
QStandardItemModel *m_model;
QAbstractProxyModel *m_proxyModel;
QAbstractProxyModel *m_twoLevelProxyModel;
QSortFilterProxyModel *m_filterProxyModel;
QPushButton *m_okButton;
QPixmap m_dummyIcon;
QIcon m_dummyIcon;
QList<QStandardItem*> m_categoryItems;
};

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<height>412</height>
<width>880</width>
<height>520</height>
</rect>
</property>
<property name="sizePolicy">
@@ -26,9 +26,6 @@
<string>New Project</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@@ -36,7 +33,43 @@
</property>
</widget>
</item>
<item row="1" column="0" rowspan="3">
<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>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</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">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
@@ -46,10 +79,47 @@
</property>
<property name="maximumSize">
<size>
<width>225</width>
<width>1000</width>
<height>16777215</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>97</red>
<green>97</green>
<blue>97</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>97</red>
<green>97</green>
<blue>97</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
@@ -75,7 +145,7 @@
</attribute>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<item row="1" column="1">
<widget class="QListView" name="templatesView">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
@@ -100,20 +170,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<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>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="2" column="1" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -125,11 +182,6 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>templateCategoryView</tabstop>
<tabstop>templatesView</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -57,7 +57,9 @@ class CORE_EXPORT IFeatureProvider : public QObject
public:
IFeatureProvider() {}
virtual ~IFeatureProvider() {}
virtual FeatureSet availableFeatures() const = 0;
virtual FeatureSet availableFeatures(const QString &platform) const = 0;
virtual QStringList availablePlatforms() const = 0;
virtual QString displayNameForPlatform(const QString &string) const = 0;
};
class CORE_EXPORT Feature : public Id

View File

@@ -942,6 +942,7 @@ void MainWindow::showNewItemDialog(const QString &title,
// Scan for wizards matching the filter and pick one. Don't show
// dialog if there is only one.
IWizard *wizard = 0;
QString selectedPlatform;
switch (wizards.size()) {
case 0:
break;
@@ -953,6 +954,7 @@ void MainWindow::showNewItemDialog(const QString &title,
dlg.setWizards(wizards);
dlg.setWindowTitle(title);
wizard = dlg.showDialog();
selectedPlatform = dlg.selectedPlatform();
}
break;
}
@@ -976,7 +978,7 @@ void MainWindow::showNewItemDialog(const QString &title,
break;
}
}
wizard->runWizard(path, this);
wizard->runWizard(path, this, selectedPlatform);
}
bool MainWindow::showOptionsDialog(const QString &category,