forked from qt-creator/qt-creator
IWizard->IWizardFactory
Start at splitting up the wizard functionality a bit. Currently it is a factory but also contains a lot of logic that is invoked by the real wizard dialogs. This change renames/moves a couple of things only. Change-Id: I1fa114ee3ee262f7c0690841f361bbf09e674725 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -39,7 +39,7 @@ using namespace Android::Internal;
|
||||
|
||||
JavaFileWizard::JavaFileWizard()
|
||||
{
|
||||
setWizardKind(Core::IWizard::FileWizard);
|
||||
setWizardKind(Core::IWizardFactory::FileWizard);
|
||||
setCategory(QLatin1String(Constants::JAVA_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("Android", Constants::JAVA_DISPLAY_CATEGORY));
|
||||
setDescription(tr("Creates a Java file with boilerplate code."));
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "generatedfile.h"
|
||||
#include "featureprovider.h"
|
||||
|
||||
#include <coreplugin/dialogs/iwizard.h>
|
||||
#include <coreplugin/iwizardfactory.h>
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
QVariantMap m_extraValues;
|
||||
};
|
||||
|
||||
class CORE_EXPORT BaseFileWizard : public IWizard
|
||||
class CORE_EXPORT BaseFileWizard : public IWizardFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ include(../../shared/scriptwrapper/scriptwrapper.pri)
|
||||
win32-msvc*:QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250
|
||||
SOURCES += mainwindow.cpp \
|
||||
editmode.cpp \
|
||||
iwizardfactory.cpp \
|
||||
tabpositionindicator.cpp \
|
||||
fancyactionbar.cpp \
|
||||
fancytabwidget.cpp \
|
||||
@@ -71,7 +72,6 @@ SOURCES += mainwindow.cpp \
|
||||
infobar.cpp \
|
||||
editormanager/ieditor.cpp \
|
||||
dialogs/ioptionspage.cpp \
|
||||
dialogs/iwizard.cpp \
|
||||
settingsdatabase.cpp \
|
||||
imode.cpp \
|
||||
editormanager/systemeditor.cpp \
|
||||
@@ -102,6 +102,7 @@ SOURCES += mainwindow.cpp \
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
editmode.h \
|
||||
iwizardfactory.h \
|
||||
tabpositionindicator.h \
|
||||
fancyactionbar.h \
|
||||
fancytabwidget.h \
|
||||
@@ -136,7 +137,6 @@ HEADERS += mainwindow.h \
|
||||
dialogs/readonlyfilesdialog.h \
|
||||
dialogs/shortcutsettings.h \
|
||||
dialogs/openwithdialog.h \
|
||||
dialogs/iwizard.h \
|
||||
dialogs/ioptionspage.h \
|
||||
progressmanager/progressmanager_p.h \
|
||||
progressmanager/progressview.h \
|
||||
|
||||
@@ -41,27 +41,27 @@
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
|
||||
Q_DECLARE_METATYPE(Core::IWizard*)
|
||||
Q_DECLARE_METATYPE(Core::IWizardFactory*)
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
const int ICON_SIZE = 22;
|
||||
|
||||
class WizardContainer
|
||||
class WizardFactoryContainer
|
||||
{
|
||||
public:
|
||||
WizardContainer() : wizard(0), wizardOption(0) {}
|
||||
WizardContainer(Core::IWizard *w, int i): wizard(w), wizardOption(i) {}
|
||||
Core::IWizard *wizard;
|
||||
WizardFactoryContainer() : wizard(0), wizardOption(0) {}
|
||||
WizardFactoryContainer(Core::IWizardFactory *w, int i): wizard(w), wizardOption(i) {}
|
||||
Core::IWizardFactory *wizard;
|
||||
int wizardOption;
|
||||
};
|
||||
|
||||
inline Core::IWizard *wizardOfItem(const QStandardItem *item = 0)
|
||||
inline Core::IWizardFactory *factoryOfItem(const QStandardItem *item = 0)
|
||||
{
|
||||
if (!item)
|
||||
return 0;
|
||||
return item->data(Qt::UserRole).value<WizardContainer>().wizard;
|
||||
return item->data(Qt::UserRole).value<WizardFactoryContainer>().wizard;
|
||||
}
|
||||
|
||||
class PlatformFilterProxyModel : public QSortFilterProxyModel
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
return true;
|
||||
|
||||
QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
Core::IWizard *wizard = wizardOfItem(qobject_cast<QStandardItemModel*>(sourceModel())->itemFromIndex(sourceIndex));
|
||||
Core::IWizardFactory *wizard = factoryOfItem(qobject_cast<QStandardItemModel*>(sourceModel())->itemFromIndex(sourceIndex));
|
||||
if (wizard)
|
||||
return m_platform.isEmpty() || wizard->isAvailable(m_platform);
|
||||
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(WizardContainer)
|
||||
Q_DECLARE_METATYPE(WizardFactoryContainer)
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
@@ -229,25 +229,25 @@ NewDialog::NewDialog(QWidget *parent) :
|
||||
}
|
||||
|
||||
// Sort by category. id
|
||||
bool wizardLessThan(const IWizard *w1, const IWizard *w2)
|
||||
static bool wizardFactoryLessThan(const IWizardFactory *f1, const IWizardFactory *f2)
|
||||
{
|
||||
if (const int cc = w1->category().compare(w2->category()))
|
||||
if (const int cc = f1->category().compare(f2->category()))
|
||||
return cc < 0;
|
||||
return w1->id().compare(w2->id()) < 0;
|
||||
return f1->id().compare(f2->id()) < 0;
|
||||
}
|
||||
|
||||
void NewDialog::setWizards(QList<IWizard*> wizards)
|
||||
void NewDialog::setWizardFactories(QList<IWizardFactory*> factories)
|
||||
{
|
||||
qStableSort(wizards.begin(), wizards.end(), wizardLessThan);
|
||||
qStableSort(factories.begin(), factories.end(), wizardFactoryLessThan);
|
||||
|
||||
m_model->clear();
|
||||
QStandardItem *parentItem = m_model->invisibleRootItem();
|
||||
|
||||
QStandardItem *projectKindItem = new QStandardItem(tr("Projects"));
|
||||
projectKindItem->setData(IWizard::ProjectWizard, Qt::UserRole);
|
||||
projectKindItem->setData(IWizardFactory::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->setData(IWizardFactory::FileWizard, Qt::UserRole);
|
||||
filesClassesKindItem->setFlags(0); // disable item to prevent focus
|
||||
|
||||
parentItem->appendRow(projectKindItem);
|
||||
@@ -256,11 +256,11 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
|
||||
if (m_dummyIcon.isNull())
|
||||
m_dummyIcon = QIcon(QLatin1String(Core::Constants::ICON_NEWFILE));
|
||||
|
||||
QStringList availablePlatforms = IWizard::allAvailablePlatforms();
|
||||
QStringList availablePlatforms = IWizardFactory::allAvailablePlatforms();
|
||||
m_ui->comboBox->addItem(tr("All Templates"), QString());
|
||||
|
||||
foreach (const QString &platform, availablePlatforms) {
|
||||
const QString displayNameForPlatform = IWizard::displayNameForPlatform(platform);
|
||||
const QString displayNameForPlatform = IWizardFactory::displayNameForPlatform(platform);
|
||||
m_ui->comboBox->addItem(tr("%1 Templates").arg(displayNameForPlatform), platform);
|
||||
}
|
||||
|
||||
@@ -269,25 +269,25 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
|
||||
else
|
||||
m_ui->comboBox->setDisabled(true);
|
||||
|
||||
foreach (IWizard *wizard, wizards) {
|
||||
foreach (IWizardFactory *factory, factories) {
|
||||
QStandardItem *kindItem;
|
||||
switch (wizard->kind()) {
|
||||
case IWizard::ProjectWizard:
|
||||
switch (factory->kind()) {
|
||||
case IWizardFactory::ProjectWizard:
|
||||
kindItem = projectKindItem;
|
||||
break;
|
||||
case IWizard::ClassWizard:
|
||||
case IWizard::FileWizard:
|
||||
case IWizardFactory::ClassWizard:
|
||||
case IWizardFactory::FileWizard:
|
||||
default:
|
||||
kindItem = filesClassesKindItem;
|
||||
break;
|
||||
}
|
||||
addItem(kindItem, wizard);
|
||||
addItem(kindItem, factory);
|
||||
}
|
||||
if (projectKindItem->columnCount() == 0)
|
||||
parentItem->removeRow(0);
|
||||
}
|
||||
|
||||
Core::IWizard *NewDialog::showDialog()
|
||||
Core::IWizardFactory *NewDialog::showDialog()
|
||||
{
|
||||
static QString lastCategory;
|
||||
QModelIndex idx;
|
||||
@@ -323,7 +323,7 @@ Core::IWizard *NewDialog::showDialog()
|
||||
if (retVal != Accepted)
|
||||
return 0;
|
||||
|
||||
return currentWizard();
|
||||
return currentWizardFactory();
|
||||
}
|
||||
|
||||
QString NewDialog::selectedPlatform() const
|
||||
@@ -338,15 +338,15 @@ NewDialog::~NewDialog()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
IWizard *NewDialog::currentWizard() const
|
||||
IWizardFactory *NewDialog::currentWizardFactory() const
|
||||
{
|
||||
QModelIndex index = m_filterProxyModel->mapToSource(m_ui->templatesView->currentIndex());
|
||||
return wizardOfItem(m_model->itemFromIndex(index));
|
||||
return factoryOfItem(m_model->itemFromIndex(index));
|
||||
}
|
||||
|
||||
void NewDialog::addItem(QStandardItem *topLevelCategoryItem, IWizard *wizard)
|
||||
void NewDialog::addItem(QStandardItem *topLevelCategoryItem, IWizardFactory *factory)
|
||||
{
|
||||
const QString categoryName = wizard->category();
|
||||
const QString categoryName = factory->category();
|
||||
QStandardItem *categoryItem = 0;
|
||||
for (int i = 0; i < topLevelCategoryItem->rowCount(); i++) {
|
||||
if (topLevelCategoryItem->child(i, 0)->data(Qt::UserRole) == categoryName)
|
||||
@@ -357,20 +357,20 @@ void NewDialog::addItem(QStandardItem *topLevelCategoryItem, IWizard *wizard)
|
||||
topLevelCategoryItem->appendRow(categoryItem);
|
||||
m_categoryItems.append(categoryItem);
|
||||
categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
categoryItem->setText(QLatin1String(" ") + wizard->displayCategory());
|
||||
categoryItem->setData(wizard->category(), Qt::UserRole);
|
||||
categoryItem->setText(QLatin1String(" ") + factory->displayCategory());
|
||||
categoryItem->setData(factory->category(), Qt::UserRole);
|
||||
}
|
||||
|
||||
QStandardItem *wizardItem = new QStandardItem(wizard->displayName());
|
||||
QStandardItem *wizardItem = new QStandardItem(factory->displayName());
|
||||
QIcon wizardIcon;
|
||||
|
||||
// spacing hack. Add proper icons instead
|
||||
if (wizard->icon().isNull())
|
||||
if (factory->icon().isNull())
|
||||
wizardIcon = m_dummyIcon;
|
||||
else
|
||||
wizardIcon = wizard->icon();
|
||||
wizardIcon = factory->icon();
|
||||
wizardItem->setIcon(wizardIcon);
|
||||
wizardItem->setData(QVariant::fromValue(WizardContainer(wizard, 0)), Qt::UserRole);
|
||||
wizardItem->setData(QVariant::fromValue(WizardFactoryContainer(factory, 0)), Qt::UserRole);
|
||||
wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
|
||||
categoryItem->appendRow(wizardItem);
|
||||
|
||||
@@ -391,15 +391,15 @@ void NewDialog::currentItemChanged(const QModelIndex &index)
|
||||
{
|
||||
QModelIndex sourceIndex = m_filterProxyModel->mapToSource(index);
|
||||
QStandardItem* cat = (m_model->itemFromIndex(sourceIndex));
|
||||
if (const IWizard *wizard = wizardOfItem(cat)) {
|
||||
if (const IWizardFactory *wizard = factoryOfItem(cat)) {
|
||||
QString desciption = wizard->description();
|
||||
QStringList displayNamesForSupportedPlatforms;
|
||||
foreach (const QString &platform, wizard->supportedPlatforms())
|
||||
displayNamesForSupportedPlatforms << IWizard::displayNameForPlatform(platform);
|
||||
displayNamesForSupportedPlatforms << IWizardFactory::displayNameForPlatform(platform);
|
||||
if (!Qt::mightBeRichText(desciption))
|
||||
desciption.replace(QLatin1Char('\n'), QLatin1String("<br>"));
|
||||
desciption += QLatin1String("<br><br><b>");
|
||||
if (wizard->flags().testFlag(IWizard::PlatformIndependent))
|
||||
if (wizard->flags().testFlag(IWizardFactory::PlatformIndependent))
|
||||
desciption += tr("Platform independent") + QLatin1String("</b>");
|
||||
else
|
||||
desciption += tr("Supported Platforms")
|
||||
@@ -430,7 +430,7 @@ void NewDialog::okButtonClicked()
|
||||
|
||||
void NewDialog::updateOkButton()
|
||||
{
|
||||
m_okButton->setEnabled(currentWizard() != 0);
|
||||
m_okButton->setEnabled(currentWizardFactory() != 0);
|
||||
}
|
||||
|
||||
void NewDialog::setSelectedPlatform(const QString & /*platform*/)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef NEWDIALOG_H
|
||||
#define NEWDIALOG_H
|
||||
|
||||
#include "iwizard.h"
|
||||
#include "../iwizardfactory.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QIcon>
|
||||
@@ -60,9 +60,9 @@ public:
|
||||
explicit NewDialog(QWidget *parent);
|
||||
virtual ~NewDialog();
|
||||
|
||||
void setWizards(QList<IWizard*> wizards);
|
||||
void setWizardFactories(QList<IWizardFactory*> factories);
|
||||
|
||||
Core::IWizard *showDialog();
|
||||
Core::IWizardFactory *showDialog();
|
||||
QString selectedPlatform() const;
|
||||
|
||||
private slots:
|
||||
@@ -73,8 +73,8 @@ private slots:
|
||||
void setSelectedPlatform(const QString &platform);
|
||||
|
||||
private:
|
||||
Core::IWizard *currentWizard() const;
|
||||
void addItem(QStandardItem *topLevelCategoryItem, IWizard *wizard);
|
||||
Core::IWizardFactory *currentWizardFactory() const;
|
||||
void addItem(QStandardItem *topLevelCategoryItem, IWizardFactory *factory);
|
||||
|
||||
Ui::NewDialog *m_ui;
|
||||
QStandardItemModel *m_model;
|
||||
|
||||
@@ -327,11 +327,11 @@ ICore::~ICore()
|
||||
}
|
||||
|
||||
void ICore::showNewItemDialog(const QString &title,
|
||||
const QList<IWizard *> &wizards,
|
||||
const QList<IWizardFactory *> &factories,
|
||||
const QString &defaultLocation,
|
||||
const QVariantMap &extraVariables)
|
||||
{
|
||||
m_mainwindow->showNewItemDialog(title, wizards, defaultLocation, extraVariables);
|
||||
m_mainwindow->showNewItemDialog(title, factories, defaultLocation, extraVariables);
|
||||
}
|
||||
|
||||
bool ICore::showOptionsDialog(const Id group, const Id page, QWidget *parent)
|
||||
|
||||
@@ -44,7 +44,7 @@ template <class T> class QList;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IWizard;
|
||||
class IWizardFactory;
|
||||
class Context;
|
||||
class IContext;
|
||||
class ProgressManager;
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
static ICore *instance();
|
||||
|
||||
static void showNewItemDialog(const QString &title,
|
||||
const QList<IWizard *> &wizards,
|
||||
const QList<IWizardFactory *> &factories,
|
||||
const QString &defaultLocation = QString(),
|
||||
const QVariantMap &extraVariables = QVariantMap());
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IWizard;
|
||||
class IWizardFactory;
|
||||
class GeneratedFile;
|
||||
|
||||
/*!
|
||||
@@ -55,7 +55,7 @@ class CORE_EXPORT IFileWizardExtension : public QObject
|
||||
public:
|
||||
/* Return a list of pages to be added to the Wizard (empty list if not
|
||||
* applicable). */
|
||||
virtual QList<QWizardPage *> extensionPages(const IWizard *wizard) = 0;
|
||||
virtual QList<QWizardPage *> extensionPages(const IWizardFactory *wizard) = 0;
|
||||
|
||||
/* Process the files using the extension parameters */
|
||||
virtual bool processFiles(const QList<GeneratedFile> &files,
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "iwizard.h"
|
||||
#include "iwizardfactory.h"
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/featureprovider.h>
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
#include <QStringList>
|
||||
|
||||
/*!
|
||||
\class Core::IWizard
|
||||
\class Core::IWizardFactory
|
||||
\mainclass
|
||||
|
||||
\brief The class IWizard is the base class for all wizards
|
||||
\brief The class IWizardFactory is the base class for all wizard factories
|
||||
(for example shown in \gui {File | New}).
|
||||
|
||||
The wizard interface is a very thin abstraction for the \gui{New...} wizards.
|
||||
@@ -50,13 +50,13 @@
|
||||
creating files. Often it is not necessary to create your own wizard from scratch,
|
||||
instead use one of the predefined wizards and adapt it to your needs.
|
||||
|
||||
To make your wizard known to the system, add your IWizard instance to the
|
||||
To make your wizard known to the system, add your IWizardFactory instance to the
|
||||
plugin manager's object pool in your plugin's initialize function:
|
||||
\code
|
||||
bool MyPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
{
|
||||
// ... do setup
|
||||
addAutoReleasedObject(new MyWizard);
|
||||
addAutoReleasedObject(new MyWizardFactory);
|
||||
// ... do more setup
|
||||
}
|
||||
\endcode
|
||||
@@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Core::IWizard::WizardKind
|
||||
\enum Core::IWizardFactory::WizardKind
|
||||
Used to specify what kind of objects the wizard creates. This information is used
|
||||
to show e.g. only wizards that create projects when selecting a \gui{New Project}
|
||||
menu item.
|
||||
@@ -78,57 +78,57 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn IWizard::IWizard(QObject *parent)
|
||||
\fn IWizardFactory::IWizardFactory(QObject *parent)
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn IWizard::~IWizard()
|
||||
\fn IWizardFactory::~IWizardFactory()
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Kind IWizard::kind() const
|
||||
\fn Kind IWizardFactory::kind() const
|
||||
Returns what kind of objects are created by the wizard.
|
||||
\sa Kind
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QIcon IWizard::icon() const
|
||||
\fn QIcon IWizardFactory::icon() const
|
||||
Returns an icon to show in the wizard selection dialog.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString IWizard::description() const
|
||||
\fn QString IWizardFactory::description() const
|
||||
Returns a translated description to show when this wizard is selected
|
||||
in the dialog.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString IWizard::displayName() const
|
||||
\fn QString IWizardFactory::displayName() const
|
||||
Returns the translated name of the wizard, how it should appear in the
|
||||
dialog.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString IWizard::id() const
|
||||
\fn QString IWizardFactory::id() const
|
||||
Returns an arbitrary id that is used for sorting within the category.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn QString IWizard::category() const
|
||||
\fn QString IWizardFactory::category() const
|
||||
Returns a category ID to add the wizard to.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString IWizard::displayCategory() const
|
||||
\fn QString IWizardFactory::displayCategory() const
|
||||
Returns the translated string of the category, how it should appear
|
||||
in the dialog.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void IWizard::runWizard(const QString &path,
|
||||
\fn void IWizardFactory::runWizard(const QString &path,
|
||||
QWidget *parent,
|
||||
const QString &platform,
|
||||
const QVariantMap &variables)
|
||||
@@ -144,43 +144,43 @@ using namespace Core;
|
||||
|
||||
/* A utility to find all wizards supporting a view mode and matching a predicate */
|
||||
template <class Predicate>
|
||||
QList<IWizard*> findWizards(Predicate predicate)
|
||||
QList<IWizardFactory*> findWizardFactories(Predicate predicate)
|
||||
{
|
||||
// Hack: Trigger delayed creation of wizards
|
||||
ICore::emitNewItemsDialogRequested();
|
||||
// Filter all wizards
|
||||
const QList<IWizard*> allWizards = IWizard::allWizards();
|
||||
QList<IWizard*> rc;
|
||||
const QList<IWizard*>::const_iterator cend = allWizards.constEnd();
|
||||
for (QList<IWizard*>::const_iterator it = allWizards.constBegin(); it != cend; ++it)
|
||||
const QList<IWizardFactory*> allFactories = IWizardFactory::allWizardFactories();
|
||||
QList<IWizardFactory*> rc;
|
||||
const QList<IWizardFactory*>::const_iterator cend = allFactories.constEnd();
|
||||
for (QList<IWizardFactory*>::const_iterator it = allFactories.constBegin(); it != cend; ++it)
|
||||
if (predicate(*(*it)))
|
||||
rc.push_back(*it);
|
||||
return rc;
|
||||
}
|
||||
|
||||
QList<IWizard*> IWizard::allWizards()
|
||||
QList<IWizardFactory*> IWizardFactory::allWizardFactories()
|
||||
{
|
||||
// Hack: Trigger delayed creation of wizards
|
||||
ICore::emitNewItemsDialogRequested();
|
||||
return ExtensionSystem::PluginManager::getObjects<IWizard>();
|
||||
return ExtensionSystem::PluginManager::getObjects<IWizardFactory>();
|
||||
}
|
||||
|
||||
// Utility to find all registered wizards of a certain kind
|
||||
|
||||
class WizardKindPredicate {
|
||||
public:
|
||||
WizardKindPredicate(IWizard::WizardKind kind) : m_kind(kind) {}
|
||||
bool operator()(const IWizard &w) const { return w.kind() == m_kind; }
|
||||
WizardKindPredicate(IWizardFactory::WizardKind kind) : m_kind(kind) {}
|
||||
bool operator()(const IWizardFactory &w) const { return w.kind() == m_kind; }
|
||||
private:
|
||||
const IWizard::WizardKind m_kind;
|
||||
const IWizardFactory::WizardKind m_kind;
|
||||
};
|
||||
|
||||
QList<IWizard*> IWizard::wizardsOfKind(WizardKind kind)
|
||||
QList<IWizardFactory*> IWizardFactory::wizardFactoriesOfKind(WizardKind kind)
|
||||
{
|
||||
return findWizards(WizardKindPredicate(kind));
|
||||
return findWizardFactories(WizardKindPredicate(kind));
|
||||
}
|
||||
|
||||
bool IWizard::isAvailable(const QString &platformName) const
|
||||
bool IWizardFactory::isAvailable(const QString &platformName) const
|
||||
{
|
||||
FeatureSet availableFeatures;
|
||||
|
||||
@@ -192,7 +192,7 @@ bool IWizard::isAvailable(const QString &platformName) const
|
||||
return availableFeatures.contains(requiredFeatures());
|
||||
}
|
||||
|
||||
QStringList IWizard::supportedPlatforms() const
|
||||
QStringList IWizardFactory::supportedPlatforms() const
|
||||
{
|
||||
QStringList stringList;
|
||||
|
||||
@@ -204,7 +204,7 @@ QStringList IWizard::supportedPlatforms() const
|
||||
return stringList;
|
||||
}
|
||||
|
||||
QStringList IWizard::allAvailablePlatforms()
|
||||
QStringList IWizardFactory::allAvailablePlatforms()
|
||||
{
|
||||
QStringList platforms;
|
||||
|
||||
@@ -217,7 +217,7 @@ QStringList IWizard::allAvailablePlatforms()
|
||||
return platforms;
|
||||
}
|
||||
|
||||
QString IWizard::displayNameForPlatform(const QString &string)
|
||||
QString IWizardFactory::displayNameForPlatform(const QString &string)
|
||||
{
|
||||
const QList<Core::IFeatureProvider*> featureManagers =
|
||||
ExtensionSystem::PluginManager::getObjects<Core::IFeatureProvider>();
|
||||
@@ -27,8 +27,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef IWIZARD_H
|
||||
#define IWIZARD_H
|
||||
#ifndef IWIZARDFACTORY_H
|
||||
#define IWIZARDFACTORY_H
|
||||
|
||||
#include <coreplugin/core_global.h>
|
||||
#include <coreplugin/id.h>
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
namespace Core {
|
||||
|
||||
class CORE_EXPORT IWizard
|
||||
class CORE_EXPORT IWizardFactory
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -60,9 +60,9 @@ public:
|
||||
class CORE_EXPORT Data
|
||||
{
|
||||
public:
|
||||
Data() : kind(IWizard::FileWizard) {}
|
||||
Data() : kind(IWizardFactory::FileWizard) {}
|
||||
|
||||
IWizard::WizardKind kind;
|
||||
IWizardFactory::WizardKind kind;
|
||||
QIcon icon;
|
||||
QString description;
|
||||
QString displayName;
|
||||
@@ -70,11 +70,11 @@ public:
|
||||
QString category;
|
||||
QString displayCategory;
|
||||
FeatureSet requiredFeatures;
|
||||
IWizard::WizardFlags flags;
|
||||
IWizardFactory::WizardFlags flags;
|
||||
QString descriptionImage;
|
||||
};
|
||||
|
||||
IWizard() { }
|
||||
IWizardFactory() { }
|
||||
|
||||
QString id() const { return m_data.id; }
|
||||
WizardKind kind() const { return m_data.kind; }
|
||||
@@ -106,9 +106,9 @@ public:
|
||||
QStringList supportedPlatforms() const;
|
||||
|
||||
// Utility to find all registered wizards
|
||||
static QList<IWizard*> allWizards();
|
||||
static QList<IWizardFactory*> allWizardFactories();
|
||||
// Utility to find all registered wizards of a certain kind
|
||||
static QList<IWizard*> wizardsOfKind(WizardKind kind);
|
||||
static QList<IWizardFactory*> wizardFactoriesOfKind(WizardKind kind);
|
||||
static QStringList allAvailablePlatforms();
|
||||
static QString displayNameForPlatform(const QString &string);
|
||||
|
||||
@@ -118,7 +118,7 @@ private:
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizard::WizardKinds)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizard::WizardFlags)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizardFactory::WizardKinds)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizardFactory::WizardFlags)
|
||||
|
||||
#endif // IWIZARD_H
|
||||
#endif // IWIZARDFACTORY_H
|
||||
@@ -785,7 +785,7 @@ void MainWindow::registerDefaultActions()
|
||||
|
||||
void MainWindow::newFile()
|
||||
{
|
||||
showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), QString());
|
||||
showNewItemDialog(tr("New", "Title of dialog"), IWizardFactory::allWizardFactories(), QString());
|
||||
}
|
||||
|
||||
void MainWindow::openFile()
|
||||
@@ -865,23 +865,23 @@ void MainWindow::setFocusToEditor()
|
||||
}
|
||||
|
||||
void MainWindow::showNewItemDialog(const QString &title,
|
||||
const QList<IWizard *> &wizards,
|
||||
const QList<IWizardFactory *> &factories,
|
||||
const QString &defaultLocation,
|
||||
const QVariantMap &extraVariables)
|
||||
{
|
||||
// Scan for wizards matching the filter and pick one. Don't show
|
||||
// dialog if there is only one.
|
||||
IWizard *wizard = 0;
|
||||
IWizardFactory *wizard = 0;
|
||||
QString selectedPlatform;
|
||||
switch (wizards.size()) {
|
||||
switch (factories.size()) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
wizard = wizards.front();
|
||||
wizard = factories.front();
|
||||
break;
|
||||
default: {
|
||||
NewDialog dlg(this);
|
||||
dlg.setWizards(wizards);
|
||||
dlg.setWizardFactories(factories);
|
||||
dlg.setWindowTitle(title);
|
||||
wizard = dlg.showDialog();
|
||||
selectedPlatform = dlg.selectedPlatform();
|
||||
@@ -895,7 +895,7 @@ void MainWindow::showNewItemDialog(const QString &title,
|
||||
QString path = defaultLocation;
|
||||
if (path.isEmpty()) {
|
||||
switch (wizard->kind()) {
|
||||
case IWizard::ProjectWizard:
|
||||
case IWizardFactory::ProjectWizard:
|
||||
// Project wizards: Check for projects directory or
|
||||
// use last visited directory of file dialog. Never start
|
||||
// at current.
|
||||
|
||||
@@ -53,7 +53,7 @@ class ExternalToolManager;
|
||||
class DocumentManager;
|
||||
class HelpManager;
|
||||
class IDocument;
|
||||
class IWizard;
|
||||
class IWizardFactory;
|
||||
class MessageManager;
|
||||
class MimeDatabase;
|
||||
class ModeManager;
|
||||
@@ -117,7 +117,7 @@ public slots:
|
||||
void setFullScreen(bool on);
|
||||
|
||||
void showNewItemDialog(const QString &title,
|
||||
const QList<IWizard *> &wizards,
|
||||
const QList<IWizardFactory *> &factories,
|
||||
const QString &defaultLocation = QString(),
|
||||
const QVariantMap &extraVariables = QVariantMap());
|
||||
|
||||
|
||||
@@ -172,8 +172,8 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
|
||||
QString trCat = QCoreApplication::translate(Constants::WIZARD_CATEGORY, Constants::WIZARD_TR_CATEGORY);
|
||||
|
||||
IWizard *wizard = new CppClassWizard;
|
||||
wizard->setWizardKind(IWizard::ClassWizard);
|
||||
IWizardFactory *wizard = new CppClassWizard;
|
||||
wizard->setWizardKind(IWizardFactory::ClassWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
|
||||
wizard->setDisplayCategory(trCat);
|
||||
wizard->setDisplayName(tr("C++ Class"));
|
||||
@@ -182,7 +182,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new CppFileWizard(Source);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setWizardKind(IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
|
||||
wizard->setDisplayCategory(trCat);
|
||||
wizard->setDisplayName(tr("C++ Class"));
|
||||
@@ -192,7 +192,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new CppFileWizard(Header);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setWizardKind(IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
|
||||
wizard->setDisplayCategory(trCat);
|
||||
wizard->setDescription(tr("Creates a C++ header file that you can add to a C++ project."));
|
||||
|
||||
@@ -126,8 +126,8 @@ void FormEditorPlugin::extensionsInitialized()
|
||||
|
||||
void FormEditorPlugin::initializeTemplates()
|
||||
{
|
||||
IWizard *wizard = new FormWizard;
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
IWizardFactory *wizard = new FormWizard;
|
||||
wizard->setWizardKind(IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
wizard->setDisplayName(tr("Qt Designer Form"));
|
||||
@@ -138,7 +138,7 @@ void FormEditorPlugin::initializeTemplates()
|
||||
|
||||
#ifdef CPP_ENABLED
|
||||
wizard = new FormClassWizard;
|
||||
wizard->setWizardKind(IWizard::ClassWizard);
|
||||
wizard->setWizardKind(IWizardFactory::ClassWizard);
|
||||
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
wizard->setDisplayName(tr("Qt Designer Form Class"));
|
||||
|
||||
@@ -129,7 +129,7 @@ GenericProjectWizard::GenericProjectWizard()
|
||||
"This allows you to use Qt Creator as a code editor."));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY_DISPLAY));
|
||||
setFlags(Core::IWizard::PlatformIndependent);
|
||||
setFlags(Core::IWizardFactory::PlatformIndependent);
|
||||
}
|
||||
|
||||
QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -167,8 +167,8 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/glsleditor/images/glslfile.png", Constants::GLSL_MIMETYPE_VERT_ES);
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/glsleditor/images/glslfile.png", Constants::GLSL_MIMETYPE_FRAG_ES);
|
||||
|
||||
IWizard *wizard = new GLSLFileWizard(GLSLFileWizard::FragmentShaderES);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
IWizardFactory *wizard = new GLSLFileWizard(GLSLFileWizard::FragmentShaderES);
|
||||
wizard->setWizardKind(IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
@@ -181,7 +181,7 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new GLSLFileWizard(GLSLFileWizard::VertexShaderES);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setWizardKind(IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
@@ -194,7 +194,7 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new GLSLFileWizard(GLSLFileWizard::FragmentShaderDesktop);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setWizardKind(IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
@@ -207,7 +207,7 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new GLSLFileWizard(GLSLFileWizard::VertexShaderDesktop);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setWizardKind(IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
|
||||
@@ -55,7 +55,7 @@ using namespace GLSLEditor;
|
||||
GLSLFileWizard::GLSLFileWizard(ShaderType shaderType)
|
||||
: m_shaderType(shaderType)
|
||||
{
|
||||
setFlags(Core::IWizard::PlatformIndependent);
|
||||
setFlags(Core::IWizardFactory::PlatformIndependent);
|
||||
}
|
||||
|
||||
Core::GeneratedFiles GLSLFileWizard::generateFiles(const QWizard *w,
|
||||
|
||||
@@ -333,7 +333,7 @@ CustomWizard::CustomWizardContextPtr CustomWizard::context() const
|
||||
}
|
||||
|
||||
CustomWizard *CustomWizard::createWizard(const CustomProjectWizard::CustomWizardParametersPtr &p,
|
||||
const Core::IWizard::Data &b)
|
||||
const Core::IWizardFactory::Data &b)
|
||||
{
|
||||
ICustomWizardFactory * factory = ExtensionSystem::PluginManager::getObject<ICustomWizardFactory>(
|
||||
[&p, &b](ICustomWizardFactory *factory) {
|
||||
@@ -358,20 +358,20 @@ CustomWizard *CustomWizard::createWizard(const CustomProjectWizard::CustomWizard
|
||||
// Format all wizards for display
|
||||
static QString listWizards()
|
||||
{
|
||||
typedef QMultiMap<QString, const Core::IWizard *> CategoryWizardMap;
|
||||
typedef QMultiMap<QString, const Core::IWizardFactory *> CategoryWizardMap;
|
||||
|
||||
// Sort by category via multimap
|
||||
QString rc;
|
||||
QTextStream str(&rc);
|
||||
CategoryWizardMap categoryWizardMap;
|
||||
foreach (const Core::IWizard *w, Core::IWizard::allWizards())
|
||||
foreach (const Core::IWizardFactory *w, Core::IWizardFactory::allWizardFactories())
|
||||
categoryWizardMap.insert(w->category(), w);
|
||||
str << "### Registered wizards (" << categoryWizardMap.size() << ")\n";
|
||||
// Format
|
||||
QString lastCategory;
|
||||
const CategoryWizardMap::const_iterator cend = categoryWizardMap.constEnd();
|
||||
for (CategoryWizardMap::const_iterator it = categoryWizardMap.constBegin(); it != cend; ++it) {
|
||||
const Core::IWizard *wizard = it.value();
|
||||
const Core::IWizardFactory *wizard = it.value();
|
||||
if (it.key() != lastCategory) {
|
||||
lastCategory = it.key();
|
||||
str << "\nCategory: '" << lastCategory << "' / '" << wizard->displayCategory() << "'\n";
|
||||
@@ -438,7 +438,7 @@ QList<CustomWizard*> CustomWizard::createWizards()
|
||||
verboseLog += QString::fromLatin1("CustomWizard: Scanning %1\n").arg(dirFi.absoluteFilePath());
|
||||
if (dir.exists(configFile)) {
|
||||
CustomWizardParametersPtr parameters(new Internal::CustomWizardParameters);
|
||||
IWizard::Data data;
|
||||
IWizardFactory::Data data;
|
||||
switch (parameters->parse(dir.absoluteFilePath(configFile), &data, &errorMessage)) {
|
||||
case Internal::CustomWizardParameters::ParseOk:
|
||||
parameters->directory = dir.absolutePath();
|
||||
|
||||
@@ -60,7 +60,7 @@ class PROJECTEXPLORER_EXPORT ICustomWizardFactory : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ICustomWizardFactory(const QString &klass, Core::IWizard::WizardKind kind) :
|
||||
ICustomWizardFactory(const QString &klass, Core::IWizardFactory::WizardKind kind) :
|
||||
m_klass(klass), m_kind(kind)
|
||||
{ }
|
||||
|
||||
@@ -70,15 +70,15 @@ public:
|
||||
|
||||
private:
|
||||
QString m_klass;
|
||||
Core::IWizard::WizardKind m_kind;
|
||||
Core::IWizardFactory::WizardKind m_kind;
|
||||
};
|
||||
|
||||
// Convenience template to create wizard factory classes.
|
||||
template <class Wizard> class CustomWizardFactory : public ICustomWizardFactory
|
||||
{
|
||||
public:
|
||||
CustomWizardFactory(const QString &klass, Core::IWizard::WizardKind kind) : ICustomWizardFactory(klass, kind) { }
|
||||
CustomWizardFactory(Core::IWizard::WizardKind kind) : ICustomWizardFactory(QString(), kind) { }
|
||||
CustomWizardFactory(const QString &klass, Core::IWizardFactory::WizardKind kind) : ICustomWizardFactory(klass, kind) { }
|
||||
CustomWizardFactory(Core::IWizardFactory::WizardKind kind) : ICustomWizardFactory(QString(), kind) { }
|
||||
CustomWizard *create() const { return new Wizard; }
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ protected:
|
||||
CustomWizardParametersPtr parameters() const;
|
||||
CustomWizardContextPtr context() const;
|
||||
|
||||
static CustomWizard *createWizard(const CustomWizardParametersPtr &p, const Core::IWizard::Data &b);
|
||||
static CustomWizard *createWizard(const CustomWizardParametersPtr &p, const Core::IWizardFactory::Data &b);
|
||||
|
||||
private:
|
||||
void setParameters(const CustomWizardParametersPtr &p);
|
||||
|
||||
@@ -273,7 +273,7 @@ static bool parseCustomProjectElement(QXmlStreamReader &reader,
|
||||
const QString &configFileFullPath,
|
||||
const QString &language,
|
||||
CustomWizardParameters *p,
|
||||
IWizard::Data *bp)
|
||||
IWizardFactory::Data *bp)
|
||||
{
|
||||
const QStringRef elementName = reader.name();
|
||||
if (elementName == QLatin1String(iconElementC)) {
|
||||
@@ -448,16 +448,16 @@ static ParseState nextClosingState(ParseState in, const QStringRef &name)
|
||||
}
|
||||
|
||||
// Parse kind attribute
|
||||
static inline IWizard::WizardKind kindAttribute(const QXmlStreamReader &r)
|
||||
static inline IWizardFactory::WizardKind kindAttribute(const QXmlStreamReader &r)
|
||||
{
|
||||
const QStringRef value = r.attributes().value(QLatin1String(kindAttributeC));
|
||||
if (!value.isEmpty()) {
|
||||
if (value == QLatin1String("file"))
|
||||
return IWizard::FileWizard;
|
||||
return IWizardFactory::FileWizard;
|
||||
if (value == QLatin1String("class"))
|
||||
return IWizard::ClassWizard;
|
||||
return IWizardFactory::ClassWizard;
|
||||
}
|
||||
return IWizard::ProjectWizard;
|
||||
return IWizardFactory::ProjectWizard;
|
||||
}
|
||||
|
||||
static inline FeatureSet requiredFeatures(const QXmlStreamReader &reader)
|
||||
@@ -472,13 +472,13 @@ static inline FeatureSet requiredFeatures(const QXmlStreamReader &reader)
|
||||
return features;
|
||||
}
|
||||
|
||||
static inline IWizard::WizardFlags wizardFlags(const QXmlStreamReader &reader)
|
||||
static inline IWizardFactory::WizardFlags wizardFlags(const QXmlStreamReader &reader)
|
||||
{
|
||||
IWizard::WizardFlags flags;
|
||||
IWizardFactory::WizardFlags flags;
|
||||
const QStringRef value = reader.attributes().value(QLatin1String(platformIndependentC));
|
||||
|
||||
if (!value.isEmpty() && value == QLatin1String("true"))
|
||||
flags |= IWizard::PlatformIndependent;
|
||||
flags |= IWizardFactory::PlatformIndependent;
|
||||
|
||||
return flags;
|
||||
}
|
||||
@@ -552,7 +552,7 @@ GeneratorScriptArgument::GeneratorScriptArgument(const QString &v) :
|
||||
CustomWizardParameters::ParseResult
|
||||
CustomWizardParameters::parse(QIODevice &device,
|
||||
const QString &configFileFullPath,
|
||||
IWizard::Data *bp,
|
||||
IWizardFactory::Data *bp,
|
||||
QString *errorMessage)
|
||||
{
|
||||
int comboEntryCount = 0;
|
||||
@@ -560,8 +560,8 @@ CustomWizardParameters::ParseResult
|
||||
QXmlStreamReader::TokenType token = QXmlStreamReader::EndDocument;
|
||||
ParseState state = ParseBeginning;
|
||||
clear();
|
||||
*bp = IWizard::Data();
|
||||
bp->kind = IWizard::ProjectWizard;
|
||||
*bp = IWizardFactory::Data();
|
||||
bp->kind = IWizardFactory::ProjectWizard;
|
||||
const QString language = languageSetting();
|
||||
CustomWizardField field;
|
||||
do {
|
||||
@@ -705,7 +705,7 @@ CustomWizardParameters::ParseResult
|
||||
|
||||
CustomWizardParameters::ParseResult
|
||||
CustomWizardParameters::parse(const QString &configFileFullPath,
|
||||
IWizard::Data *bp,
|
||||
IWizardFactory::Data *bp,
|
||||
QString *errorMessage)
|
||||
{
|
||||
QFile configFile(configFileFullPath);
|
||||
|
||||
@@ -107,9 +107,9 @@ public:
|
||||
CustomWizardParameters();
|
||||
void clear();
|
||||
ParseResult parse(QIODevice &device, const QString &configFileFullPath,
|
||||
Core::IWizard::Data *bp, QString *errorMessage);
|
||||
Core::IWizardFactory::Data *bp, QString *errorMessage);
|
||||
ParseResult parse(const QString &configFileFullPath,
|
||||
Core::IWizard::Data *bp, QString *errorMessage);
|
||||
Core::IWizardFactory::Data *bp, QString *errorMessage);
|
||||
QString toString() const;
|
||||
|
||||
QString id;
|
||||
|
||||
@@ -398,9 +398,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
connect(sessionManager, SIGNAL(sessionLoaded(QString)),
|
||||
this, SLOT(updateWelcomePage()));
|
||||
|
||||
addAutoReleasedObject(new CustomWizardFactory<CustomProjectWizard>(Core::IWizard::ProjectWizard));
|
||||
addAutoReleasedObject(new CustomWizardFactory<CustomWizard>(Core::IWizard::FileWizard));
|
||||
addAutoReleasedObject(new CustomWizardFactory<CustomWizard>(Core::IWizard::ClassWizard));
|
||||
addAutoReleasedObject(new CustomWizardFactory<CustomProjectWizard>(Core::IWizardFactory::ProjectWizard));
|
||||
addAutoReleasedObject(new CustomWizardFactory<CustomWizard>(Core::IWizardFactory::FileWizard));
|
||||
addAutoReleasedObject(new CustomWizardFactory<CustomWizard>(Core::IWizardFactory::ClassWizard));
|
||||
|
||||
d->m_proWindow = new ProjectWindow;
|
||||
addAutoReleasedObject(d->m_proWindow);
|
||||
@@ -1144,7 +1144,7 @@ void ProjectExplorerPlugin::loadCustomWizards()
|
||||
static bool firstTime = true;
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
foreach (IWizard *cpw, ProjectExplorer::CustomWizard::createWizards())
|
||||
foreach (IWizardFactory *cpw, ProjectExplorer::CustomWizard::createWizards())
|
||||
addAutoReleasedObject(cpw);
|
||||
}
|
||||
}
|
||||
@@ -1237,7 +1237,7 @@ void ProjectExplorerPlugin::newProject()
|
||||
qDebug() << "ProjectExplorerPlugin::newProject";
|
||||
|
||||
ICore::showNewItemDialog(tr("New Project", "Title of dialog"),
|
||||
IWizard::wizardsOfKind(IWizard::ProjectWizard));
|
||||
IWizardFactory::wizardFactoriesOfKind(IWizardFactory::ProjectWizard));
|
||||
updateActions();
|
||||
}
|
||||
|
||||
@@ -2833,8 +2833,8 @@ void ProjectExplorerPlugin::addNewFile()
|
||||
map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), QVariant::fromValue(profileIds));
|
||||
}
|
||||
ICore::showNewItemDialog(tr("New File", "Title of dialog"),
|
||||
IWizard::wizardsOfKind(IWizard::FileWizard)
|
||||
+ IWizard::wizardsOfKind(IWizard::ClassWizard),
|
||||
IWizardFactory::wizardFactoriesOfKind(IWizardFactory::FileWizard)
|
||||
+ IWizardFactory::wizardFactoriesOfKind(IWizardFactory::ClassWizard),
|
||||
location, map);
|
||||
}
|
||||
|
||||
@@ -2856,7 +2856,7 @@ void ProjectExplorerPlugin::addNewSubproject()
|
||||
}
|
||||
|
||||
ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"),
|
||||
IWizard::wizardsOfKind(IWizard::ProjectWizard),
|
||||
IWizardFactory::wizardFactoriesOfKind(IWizardFactory::ProjectWizard),
|
||||
location, map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,11 +238,11 @@ static inline AddNewTree *buildAddFilesTree(SessionNode *root, const QStringList
|
||||
}
|
||||
|
||||
static inline AddNewTree *getChoices(const QStringList &generatedFiles,
|
||||
IWizard::WizardKind wizardKind,
|
||||
IWizardFactory::WizardKind wizardKind,
|
||||
Node *contextNode,
|
||||
BestNodeSelector *selector)
|
||||
{
|
||||
if (wizardKind == IWizard::ProjectWizard)
|
||||
if (wizardKind == IWizardFactory::ProjectWizard)
|
||||
return buildAddProjectTree(SessionManager::sessionNode(), generatedFiles.first(), contextNode, selector);
|
||||
else
|
||||
return buildAddFilesTree(SessionManager::sessionNode(), generatedFiles, contextNode, selector);
|
||||
@@ -259,7 +259,7 @@ struct ProjectWizardContext
|
||||
QPointer<ProjectWizardPage> page; // this is managed by the wizard!
|
||||
bool repositoryExists; // Is VCS 'add' sufficient, or should a repository be created?
|
||||
QString commonDirectory;
|
||||
const IWizard *wizard;
|
||||
const IWizardFactory *wizard;
|
||||
};
|
||||
|
||||
ProjectWizardContext::ProjectWizardContext() :
|
||||
@@ -312,7 +312,7 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
|
||||
|
||||
QStringList filePaths;
|
||||
ProjectExplorer::ProjectAction projectAction;
|
||||
if (m_context->wizard->kind()== IWizard::ProjectWizard) {
|
||||
if (m_context->wizard->kind()== IWizardFactory::ProjectWizard) {
|
||||
projectAction = ProjectExplorer::AddSubProject;
|
||||
filePaths << generatedProjectFilePath(files);
|
||||
} else {
|
||||
@@ -392,7 +392,7 @@ void ProjectFileWizardExtension::initializeVersionControlChoices()
|
||||
}
|
||||
}
|
||||
|
||||
QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const IWizard *wizard)
|
||||
QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const IWizardFactory *wizard)
|
||||
{
|
||||
if (!m_context)
|
||||
m_context = new ProjectWizardContext;
|
||||
@@ -437,7 +437,7 @@ bool ProjectFileWizardExtension::processProject(
|
||||
FolderNode *folder = m_context->page->currentNode();
|
||||
if (!folder)
|
||||
return true;
|
||||
if (m_context->wizard->kind() == IWizard::ProjectWizard) {
|
||||
if (m_context->wizard->kind() == IWizardFactory::ProjectWizard) {
|
||||
if (!static_cast<ProjectNode *>(folder)->addSubProjects(QStringList(generatedProject))) {
|
||||
*errorMessage = tr("Failed to add subproject \"%1\"\nto project \"%2\".")
|
||||
.arg(generatedProject).arg(folder->path());
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
explicit ProjectFileWizardExtension();
|
||||
~ProjectFileWizardExtension();
|
||||
|
||||
QList<QWizardPage *> extensionPages(const Core::IWizard *wizard);
|
||||
QList<QWizardPage *> extensionPages(const Core::IWizardFactory *wizard);
|
||||
bool processFiles(const QList<Core::GeneratedFile> &files,
|
||||
bool *removeOpenProjectAttribute, QString *errorMessage);
|
||||
void applyCodeStyle(Core::GeneratedFile *file) const;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <QDir>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/dialogs/iwizard.h>
|
||||
#include <coreplugin/iwizardfactory.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/sessiondialog.h>
|
||||
@@ -243,7 +243,7 @@ void ProjectWelcomePage::reloadWelcomeScreenData()
|
||||
void ProjectWelcomePage::newProject()
|
||||
{
|
||||
Core::ICore::showNewItemDialog(tr("New Project"),
|
||||
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard));
|
||||
Core::IWizardFactory::wizardFactoriesOfKind(Core::IWizardFactory::ProjectWizard));
|
||||
}
|
||||
|
||||
void ProjectWelcomePage::openProject()
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Internal {
|
||||
|
||||
ClassWizard::ClassWizard()
|
||||
{
|
||||
setWizardKind(Core::IWizard::FileWizard);
|
||||
setWizardKind(Core::IWizardFactory::FileWizard);
|
||||
setId(QLatin1String(Constants::C_PY_CLASS_WIZARD_ID));
|
||||
setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace PythonEditor {
|
||||
*/
|
||||
FileWizard::FileWizard()
|
||||
{
|
||||
setWizardKind(Core::IWizard::FileWizard);
|
||||
setWizardKind(Core::IWizardFactory::FileWizard);
|
||||
setId(QLatin1String(Constants::C_PY_SOURCE_WIZARD_ID));
|
||||
setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
|
||||
|
||||
@@ -128,7 +128,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
||||
addAutoReleasedObject(new CustomWidgetWizard);
|
||||
|
||||
addAutoReleasedObject(new CustomWizardFactory<CustomQmakeProjectWizard>
|
||||
(QLatin1String("qmakeproject"), Core::IWizard::ProjectWizard));
|
||||
(QLatin1String("qmakeproject"), Core::IWizardFactory::ProjectWizard));
|
||||
|
||||
addAutoReleasedObject(new QMakeStepFactory);
|
||||
addAutoReleasedObject(new MakeStepFactory);
|
||||
|
||||
@@ -57,7 +57,7 @@ using namespace QmakeProjectManager::Internal;
|
||||
// -------------------- QtWizard
|
||||
QtWizard::QtWizard()
|
||||
{
|
||||
setWizardKind(Core::IWizard::ProjectWizard);
|
||||
setWizardKind(Core::IWizardFactory::ProjectWizard);
|
||||
}
|
||||
|
||||
QString QtWizard::sourceSuffix()
|
||||
|
||||
@@ -90,7 +90,7 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
|
||||
map.insert(QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE), profileName);
|
||||
map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS), QVariant::fromValue(wizard->selectedKits()));
|
||||
Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"),
|
||||
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard),
|
||||
Core::IWizardFactory::wizardFactoriesOfKind(Core::IWizardFactory::ProjectWizard),
|
||||
wizard->parameters().projectPath(),
|
||||
map);
|
||||
} else {
|
||||
|
||||
@@ -136,8 +136,8 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
m_editor = new QmlJSEditorFactory(this);
|
||||
addObject(m_editor);
|
||||
|
||||
IWizard *wizard = new QmlFileWizard;
|
||||
wizard->setWizardKind(Core::IWizard::FileWizard);
|
||||
IWizardFactory *wizard = new QmlFileWizard;
|
||||
wizard->setWizardKind(Core::IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
wizard->setDescription(tr("Creates a QML file with boilerplate code, starting with \"import QtQuick 1.1\"."));
|
||||
@@ -146,7 +146,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new QmlFileWizard;
|
||||
wizard->setWizardKind(Core::IWizard::FileWizard);
|
||||
wizard->setWizardKind(Core::IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
wizard->setDescription(tr("Creates a QML file with boilerplate code, starting with \"import QtQuick 2.0\"."));
|
||||
@@ -155,7 +155,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new JsFileWizard;
|
||||
wizard->setWizardKind(Core::IWizard::FileWizard);
|
||||
wizard->setWizardKind(Core::IWizardFactory::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
wizard->setDescription(tr("Creates a JavaScript file."));
|
||||
|
||||
@@ -97,7 +97,7 @@ static inline QString wizardDisplayCategory()
|
||||
|
||||
// A wizard that quickly creates a scratch buffer
|
||||
// based on a temporary file without prompting for a path.
|
||||
class ScratchFileWizard : public Core::IWizard
|
||||
class ScratchFileWizard : public Core::IWizardFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
setId(QLatin1String("Z.ScratchFile"));
|
||||
setCategory(QLatin1String(wizardCategoryC));
|
||||
setDisplayCategory(wizardDisplayCategory());
|
||||
setFlags(Core::IWizard::PlatformIndependent);
|
||||
setFlags(Core::IWizardFactory::PlatformIndependent);
|
||||
}
|
||||
|
||||
void runWizard(const QString &, QWidget *, const QString &, const QVariantMap &)
|
||||
@@ -143,13 +143,13 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
|
||||
|
||||
TextFileWizard *wizard = new TextFileWizard(QLatin1String(Constants::C_TEXTEDITOR_MIMETYPE_TEXT),
|
||||
QLatin1String("text$"));
|
||||
wizard->setWizardKind(Core::IWizard::FileWizard);
|
||||
wizard->setWizardKind(Core::IWizardFactory::FileWizard);
|
||||
wizard->setDescription(tr("Creates a text file. The default file extension is <tt>.txt</tt>. "
|
||||
"You can specify a different extension as part of the filename."));
|
||||
wizard->setDisplayName(tr("Text File"));
|
||||
wizard->setCategory(QLatin1String(wizardCategoryC));
|
||||
wizard->setDisplayCategory(wizardDisplayCategory());
|
||||
wizard->setFlags(Core::IWizard::PlatformIndependent);
|
||||
wizard->setFlags(Core::IWizardFactory::PlatformIndependent);
|
||||
|
||||
// Add text file wizard
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
@@ -87,11 +87,11 @@ void BaseCheckoutWizardPrivate::clear()
|
||||
BaseCheckoutWizard::BaseCheckoutWizard() :
|
||||
d(new Internal::BaseCheckoutWizardPrivate)
|
||||
{
|
||||
setWizardKind(IWizard::ProjectWizard);
|
||||
setWizardKind(IWizardFactory::ProjectWizard);
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY_DISPLAY));
|
||||
setFlags(Core::IWizard::PlatformIndependent);
|
||||
setFlags(Core::IWizardFactory::PlatformIndependent);
|
||||
}
|
||||
|
||||
BaseCheckoutWizard::~BaseCheckoutWizard()
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define BASECHECKOUTWIZARD_H
|
||||
|
||||
#include "vcsbase_global.h"
|
||||
#include <coreplugin/dialogs/iwizard.h>
|
||||
#include <coreplugin/iwizardfactory.h>
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <QList>
|
||||
@@ -45,7 +45,7 @@ namespace Internal { class BaseCheckoutWizardPrivate; }
|
||||
|
||||
class Command;
|
||||
|
||||
class VCSBASE_EXPORT BaseCheckoutWizard : public Core::IWizard
|
||||
class VCSBASE_EXPORT BaseCheckoutWizard : public Core::IWizardFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/imode.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/iwizardfactory.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
Reference in New Issue
Block a user