forked from qt-creator/qt-creator
Cleanup IWizard interface and users
Added 639 lines, removed 1391. Change-Id: I15ec7dd056d4f7ad79c6dd6a4181007ad14f6a43 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -43,27 +43,13 @@
|
||||
|
||||
using namespace Bazaar::Internal;
|
||||
|
||||
CloneWizard::CloneWizard(QObject *parent)
|
||||
: VcsBase::BaseCheckoutWizard(parent),
|
||||
m_icon(QIcon(QLatin1String(":/bazaar/images/bazaar.png")))
|
||||
CloneWizard::CloneWizard()
|
||||
{
|
||||
setId(QLatin1String(VcsBase::Constants::VCS_ID_BAZAAR));
|
||||
setCustomLabels(tr("Cloning"), tr("Cloning started..."));
|
||||
}
|
||||
|
||||
QIcon CloneWizard::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
QString CloneWizard::description() const
|
||||
{
|
||||
return tr("Clones a Bazaar branch and tries to load the contained project.");
|
||||
}
|
||||
|
||||
QString CloneWizard::displayName() const
|
||||
{
|
||||
return tr("Bazaar Clone (Or Branch)");
|
||||
setIcon(QIcon(QLatin1String(":/bazaar/images/bazaar.png")));
|
||||
setDescription(tr("Clones a Bazaar branch and tries to load the contained project."));
|
||||
setDisplayName(tr("Bazaar Clone (Or Branch)"));
|
||||
}
|
||||
|
||||
QList<QWizardPage *> CloneWizard::createParameterPages(const QString &path)
|
||||
|
||||
@@ -42,19 +42,12 @@ class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CloneWizard(QObject *parent = 0);
|
||||
CloneWizard();
|
||||
|
||||
QIcon icon() const;
|
||||
QString description() const;
|
||||
QString displayName() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
QList<QWizardPage *> createParameterPages(const QString &path);
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath);
|
||||
|
||||
private:
|
||||
const QIcon m_icon;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -63,189 +63,6 @@ static int indexOfFile(const GeneratedFiles &f, const QString &path)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ------------ BaseFileWizardParameterData
|
||||
class BaseFileWizardParameterData : public QSharedData
|
||||
{
|
||||
public:
|
||||
explicit BaseFileWizardParameterData(IWizard::WizardKind kind = IWizard::FileWizard);
|
||||
void clear();
|
||||
|
||||
IWizard::WizardKind kind;
|
||||
QIcon icon;
|
||||
QString description;
|
||||
QString displayName;
|
||||
QString id;
|
||||
QString category;
|
||||
QString displayCategory;
|
||||
FeatureSet requiredFeatures;
|
||||
IWizard::WizardFlags flags;
|
||||
QString descriptionImage;
|
||||
};
|
||||
|
||||
BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::WizardKind k) :
|
||||
kind(k)
|
||||
{
|
||||
}
|
||||
|
||||
void BaseFileWizardParameterData::clear()
|
||||
{
|
||||
kind = IWizard::FileWizard;
|
||||
icon = QIcon();
|
||||
description.clear();
|
||||
displayName.clear();
|
||||
id.clear();
|
||||
category.clear();
|
||||
displayCategory.clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Core::BaseFileWizardParameters
|
||||
\brief The BaseFileWizardParameters class is a parameter class for
|
||||
passing parameters to instances of the class Wizard containing name, icon,
|
||||
and so on.
|
||||
|
||||
\sa Core::GeneratedFile, Core::BaseFileWizard, Core::StandardFileWizard
|
||||
\sa Core::Internal::WizardEventLoop
|
||||
*/
|
||||
|
||||
BaseFileWizardParameters::BaseFileWizardParameters(IWizard::WizardKind kind) :
|
||||
m_d(new BaseFileWizardParameterData(kind))
|
||||
{
|
||||
}
|
||||
|
||||
BaseFileWizardParameters::BaseFileWizardParameters(const BaseFileWizardParameters &rhs) :
|
||||
m_d(rhs.m_d)
|
||||
{
|
||||
}
|
||||
|
||||
BaseFileWizardParameters &BaseFileWizardParameters::operator=(const BaseFileWizardParameters &rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
m_d.operator=(rhs.m_d);
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseFileWizardParameters::~BaseFileWizardParameters()
|
||||
{
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::clear()
|
||||
{
|
||||
m_d->clear();
|
||||
}
|
||||
|
||||
CORE_EXPORT QDebug operator<<(QDebug d, const BaseFileWizardParameters &p)
|
||||
{
|
||||
d.nospace() << "Kind: " << p.kind() << " Id: " << p.id()
|
||||
<< " Category: " << p.category()
|
||||
<< " DisplayName: " << p.displayName()
|
||||
<< " Description: " << p.description()
|
||||
<< " DisplayCategory: " << p.displayCategory()
|
||||
<< " Required Features: " << p.requiredFeatures().toStringList();
|
||||
return d;
|
||||
}
|
||||
|
||||
IWizard::WizardKind BaseFileWizardParameters::kind() const
|
||||
{
|
||||
return m_d->kind;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setKind(IWizard::WizardKind k)
|
||||
{
|
||||
m_d->kind = k;
|
||||
}
|
||||
|
||||
QIcon BaseFileWizardParameters::icon() const
|
||||
{
|
||||
return m_d->icon;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setIcon(const QIcon &icon)
|
||||
{
|
||||
m_d->icon = icon;
|
||||
}
|
||||
|
||||
QString BaseFileWizardParameters::description() const
|
||||
{
|
||||
return m_d->description;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setDescription(const QString &v)
|
||||
{
|
||||
m_d->description = v;
|
||||
}
|
||||
|
||||
QString BaseFileWizardParameters::displayName() const
|
||||
{
|
||||
return m_d->displayName;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setDisplayName(const QString &v)
|
||||
{
|
||||
m_d->displayName = v;
|
||||
}
|
||||
|
||||
QString BaseFileWizardParameters::id() const
|
||||
{
|
||||
return m_d->id;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setId(const QString &v)
|
||||
{
|
||||
m_d->id = v;
|
||||
}
|
||||
|
||||
QString BaseFileWizardParameters::category() const
|
||||
{
|
||||
return m_d->category;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setCategory(const QString &v)
|
||||
{
|
||||
m_d->category = v;
|
||||
}
|
||||
|
||||
QString BaseFileWizardParameters::displayCategory() const
|
||||
{
|
||||
return m_d->displayCategory;
|
||||
}
|
||||
|
||||
FeatureSet BaseFileWizardParameters::requiredFeatures() const
|
||||
{
|
||||
return m_d->requiredFeatures;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setRequiredFeatures(FeatureSet features)
|
||||
{
|
||||
|
||||
m_d->requiredFeatures = features;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setDisplayCategory(const QString &v)
|
||||
{
|
||||
m_d->displayCategory = v;
|
||||
}
|
||||
|
||||
IWizard::WizardFlags BaseFileWizardParameters::flags() const
|
||||
{
|
||||
return m_d->flags;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setFlags(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.
|
||||
@@ -359,72 +176,15 @@ void WizardEventLoop::rejected()
|
||||
\sa Core::Internal::WizardEventLoop
|
||||
*/
|
||||
|
||||
struct BaseFileWizardPrivate
|
||||
{
|
||||
explicit BaseFileWizardPrivate(const Core::BaseFileWizardParameters ¶meters)
|
||||
: m_parameters(parameters), m_wizardDialog(0)
|
||||
{}
|
||||
|
||||
const Core::BaseFileWizardParameters m_parameters;
|
||||
QWizard *m_wizardDialog;
|
||||
};
|
||||
|
||||
// ---------------- Wizard
|
||||
BaseFileWizard::BaseFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent) :
|
||||
IWizard(parent),
|
||||
d(new BaseFileWizardPrivate(parameters))
|
||||
BaseFileWizard::BaseFileWizard(QObject *parent) :
|
||||
IWizard(parent)
|
||||
{
|
||||
}
|
||||
|
||||
BaseFileWizardParameters BaseFileWizard::baseFileWizardParameters() const
|
||||
{
|
||||
return d->m_parameters;
|
||||
}
|
||||
|
||||
BaseFileWizard::~BaseFileWizard()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
IWizard::WizardKind BaseFileWizard::kind() const
|
||||
{
|
||||
return d->m_parameters.kind();
|
||||
}
|
||||
|
||||
QIcon BaseFileWizard::icon() const
|
||||
{
|
||||
return d->m_parameters.icon();
|
||||
}
|
||||
|
||||
QString BaseFileWizard::description() const
|
||||
{
|
||||
return d->m_parameters.description();
|
||||
}
|
||||
|
||||
QString BaseFileWizard::displayName() const
|
||||
{
|
||||
return d->m_parameters.displayName();
|
||||
}
|
||||
|
||||
QString BaseFileWizard::id() const
|
||||
{
|
||||
return d->m_parameters.id();
|
||||
}
|
||||
|
||||
QString BaseFileWizard::category() const
|
||||
{
|
||||
return d->m_parameters.category();
|
||||
}
|
||||
|
||||
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, const QVariantMap &extraValues)
|
||||
@@ -548,17 +308,6 @@ void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QStri
|
||||
QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
|
||||
}
|
||||
|
||||
|
||||
FeatureSet BaseFileWizard::requiredFeatures() const
|
||||
{
|
||||
return d->m_parameters.requiredFeatures();
|
||||
}
|
||||
|
||||
IWizard::WizardFlags BaseFileWizard::flags() const
|
||||
{
|
||||
return d->m_parameters.flags();
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QWizard *Core::BaseFileWizard::createWizardDialog(QWidget *parent,
|
||||
const WizardDialogParameters &wizardDialogParameters) const
|
||||
@@ -799,9 +548,8 @@ QString BaseFileWizard::preferredSuffix(const QString &mimeType)
|
||||
\brief Newly introduced virtual that creates the files under the path.
|
||||
*/
|
||||
|
||||
StandardFileWizard::StandardFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent) :
|
||||
BaseFileWizard(parameters, parent)
|
||||
StandardFileWizard::StandardFileWizard(QObject *parent) :
|
||||
BaseFileWizard(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -48,64 +48,10 @@ class QWizardPage;
|
||||
class QDebug;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class Wizard;
|
||||
}
|
||||
namespace Utils { class Wizard; }
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IEditor;
|
||||
class IFileWizardExtension;
|
||||
|
||||
class BaseFileWizardParameterData;
|
||||
struct BaseFileWizardPrivate;
|
||||
|
||||
class CORE_EXPORT BaseFileWizardParameters
|
||||
{
|
||||
public:
|
||||
explicit BaseFileWizardParameters(IWizard::WizardKind kind = IWizard::FileWizard);
|
||||
BaseFileWizardParameters(const BaseFileWizardParameters &);
|
||||
BaseFileWizardParameters &operator=(const BaseFileWizardParameters&);
|
||||
~BaseFileWizardParameters();
|
||||
|
||||
void clear();
|
||||
|
||||
IWizard::WizardKind kind() const;
|
||||
void setKind(IWizard::WizardKind k);
|
||||
|
||||
QIcon icon() const;
|
||||
void setIcon(const QIcon &icon);
|
||||
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
QString id() const;
|
||||
void setId(const QString &id);
|
||||
|
||||
QString category() const;
|
||||
void setCategory(const QString &category);
|
||||
|
||||
QString displayCategory() const;
|
||||
void setDisplayCategory(const QString &trCategory);
|
||||
|
||||
Core::FeatureSet requiredFeatures() const;
|
||||
void setRequiredFeatures(Core::FeatureSet features);
|
||||
|
||||
Core::IWizard::WizardFlags flags() const;
|
||||
void setFlags(Core::IWizard::WizardFlags flags);
|
||||
|
||||
QString descriptionImage() const;
|
||||
void setDescriptionImage(const QString &path);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<BaseFileWizardParameterData> m_d;
|
||||
};
|
||||
|
||||
CORE_EXPORT QDebug operator<<(QDebug d, const BaseFileWizardParameters &);
|
||||
|
||||
class CORE_EXPORT WizardDialogParameters
|
||||
{
|
||||
public:
|
||||
@@ -163,20 +109,7 @@ public:
|
||||
virtual ~BaseFileWizard();
|
||||
|
||||
// IWizard
|
||||
virtual WizardKind kind() const;
|
||||
virtual QIcon icon() const;
|
||||
virtual QString description() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString id() const;
|
||||
|
||||
virtual QString category() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QString descriptionImage() const;
|
||||
|
||||
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues);
|
||||
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 *);
|
||||
@@ -185,9 +118,7 @@ public:
|
||||
protected:
|
||||
typedef QList<QWizardPage *> WizardPageList;
|
||||
|
||||
explicit BaseFileWizard(const BaseFileWizardParameters ¶meters, QObject *parent = 0);
|
||||
|
||||
BaseFileWizardParameters baseFileWizardParameters() const;
|
||||
explicit BaseFileWizard(QObject *parent = 0);
|
||||
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
const WizardDialogParameters &wizardDialogParameters) const = 0;
|
||||
@@ -205,9 +136,6 @@ protected:
|
||||
OverwriteResult promptOverwrite(GeneratedFiles *files,
|
||||
QString *errorMessage) const;
|
||||
static bool postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage = 0);
|
||||
|
||||
private:
|
||||
BaseFileWizardPrivate *d;
|
||||
};
|
||||
|
||||
class CORE_EXPORT StandardFileWizard : public BaseFileWizard
|
||||
@@ -215,25 +143,13 @@ class CORE_EXPORT StandardFileWizard : public BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
explicit StandardFileWizard(const BaseFileWizardParameters ¶meters, QObject *parent = 0);
|
||||
explicit StandardFileWizard(QObject *parent = 0);
|
||||
virtual QWizard *createWizardDialog(QWidget *parent, const WizardDialogParameters &wizardDialogParameters) const;
|
||||
virtual GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
virtual GeneratedFiles generateFilesFromPath(const QString &path, const QString &name,
|
||||
QString *errorMessage) const = 0;
|
||||
};
|
||||
|
||||
template <class WizardClass>
|
||||
QList<WizardClass*> createMultipleBaseFileWizardInstances(const QList<BaseFileWizardParameters> ¶metersList, ExtensionSystem::IPlugin *plugin)
|
||||
{
|
||||
QList<WizardClass*> list;
|
||||
foreach (const BaseFileWizardParameters ¶meters, parametersList) {
|
||||
WizardClass *wc = new WizardClass(parameters, 0);
|
||||
plugin->addAutoReleasedObject(wc);
|
||||
list << wc;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::GeneratedFile::Attributes)
|
||||
|
||||
@@ -31,18 +31,15 @@
|
||||
#define IWIZARD_H
|
||||
|
||||
#include <coreplugin/core_global.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/featureprovider.h>
|
||||
|
||||
#include <QIcon>
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QIcon;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
class FeatureSet;
|
||||
|
||||
class CORE_EXPORT IWizard
|
||||
: public QObject
|
||||
{
|
||||
@@ -60,22 +57,49 @@ public:
|
||||
};
|
||||
Q_DECLARE_FLAGS(WizardFlags, WizardFlag)
|
||||
|
||||
class CORE_EXPORT Data
|
||||
{
|
||||
public:
|
||||
Data() : kind(IWizard::FileWizard) {}
|
||||
|
||||
IWizard::WizardKind kind;
|
||||
QIcon icon;
|
||||
QString description;
|
||||
QString displayName;
|
||||
QString id;
|
||||
QString category;
|
||||
QString displayCategory;
|
||||
FeatureSet requiredFeatures;
|
||||
IWizard::WizardFlags flags;
|
||||
QString descriptionImage;
|
||||
};
|
||||
|
||||
IWizard(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~IWizard() {}
|
||||
~IWizard() {}
|
||||
|
||||
virtual WizardKind kind() const = 0;
|
||||
virtual QIcon icon() const = 0;
|
||||
virtual QString description() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QString id() const = 0;
|
||||
QString id() const { return m_data.id; }
|
||||
WizardKind kind() const { return m_data.kind; }
|
||||
QIcon icon() const { return m_data.icon; }
|
||||
QString description() const { return m_data.description; }
|
||||
QString displayName() const { return m_data.displayName; }
|
||||
QString category() const { return m_data.category; }
|
||||
QString displayCategory() const { return m_data.displayCategory; }
|
||||
QString descriptionImage() const { return m_data.descriptionImage; }
|
||||
FeatureSet requiredFeatures() const { return m_data.requiredFeatures; }
|
||||
WizardFlags flags() const { return m_data.flags; }
|
||||
|
||||
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;
|
||||
void setData(const Data &data) { m_data = data; }
|
||||
void setId(const QString &id) { m_data.id = id; }
|
||||
void setWizardKind(WizardKind kind) { m_data.kind = kind; }
|
||||
void setIcon(const QIcon &icon) { m_data.icon = icon; }
|
||||
void setDescription(const QString &description) { m_data.description = description; }
|
||||
void setDisplayName(const QString &displayName) { m_data.displayName = displayName; }
|
||||
void setCategory(const QString &category) { m_data.category = category; }
|
||||
void setDisplayCategory(const QString &displayCategory) { m_data.displayCategory = displayCategory; }
|
||||
void setDescriptionImage(const QString &descriptionImage) { m_data.descriptionImage = descriptionImage; }
|
||||
void setRequiredFeatures(const FeatureSet &featureSet) { m_data.requiredFeatures = featureSet; }
|
||||
void addRequiredFeature(const Feature &feature) { m_data.requiredFeatures |= feature; }
|
||||
void setFlags(WizardFlags flags) { m_data.flags = flags; }
|
||||
|
||||
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &variables) = 0;
|
||||
|
||||
@@ -88,6 +112,9 @@ public:
|
||||
static QList<IWizard*> wizardsOfKind(WizardKind kind);
|
||||
static QStringList allAvailablePlatforms();
|
||||
static QString displayNameForPlatform(const QString &string);
|
||||
|
||||
private:
|
||||
Data m_data;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -140,17 +140,10 @@ CppClassWizardParameters CppClassWizardDialog::parameters() const
|
||||
|
||||
// ========= CppClassWizard =========
|
||||
|
||||
CppClassWizard::CppClassWizard(const Core::BaseFileWizardParameters ¶meters,
|
||||
QObject *parent)
|
||||
: Core::BaseFileWizard(parameters, parent)
|
||||
CppClassWizard::CppClassWizard()
|
||||
{
|
||||
}
|
||||
|
||||
Core::FeatureSet CppClassWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::FeatureSet();
|
||||
}
|
||||
|
||||
QString CppClassWizard::sourceSuffix() const
|
||||
{
|
||||
return preferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE));
|
||||
|
||||
@@ -96,25 +96,20 @@ class CppClassWizard : public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CppClassWizard(const Core::BaseFileWizardParameters ¶meters,
|
||||
QObject *parent = 0);
|
||||
CppClassWizard();
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
QString sourceSuffix() const;
|
||||
QString headerSuffix() const;
|
||||
|
||||
private:
|
||||
static bool generateHeaderAndSource(const CppClassWizardParameters ¶ms,
|
||||
QString *header, QString *source);
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -163,28 +163,35 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
addAutoReleasedObject(m_quickFixProvider);
|
||||
CppEditor::Internal::registerQuickFixes(this);
|
||||
|
||||
QObject *core = ICore::instance();
|
||||
CppFileWizard::BaseFileWizardParameters wizardParameters(IWizard::FileWizard);
|
||||
QString trCat = QCoreApplication::translate(Constants::WIZARD_CATEGORY, Constants::WIZARD_TR_CATEGORY);
|
||||
|
||||
wizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
|
||||
wizardParameters.setDisplayCategory(QCoreApplication::translate(Constants::WIZARD_CATEGORY,
|
||||
Constants::WIZARD_TR_CATEGORY));
|
||||
wizardParameters.setDisplayName(tr("C++ Class"));
|
||||
wizardParameters.setId(QLatin1String("A.Class"));
|
||||
wizardParameters.setKind(IWizard::ClassWizard);
|
||||
wizardParameters.setDescription(tr("Creates a C++ header and a source file for a new class that you can add to a C++ project."));
|
||||
addAutoReleasedObject(new CppClassWizard(wizardParameters, core));
|
||||
IWizard *wizard = new CppClassWizard;
|
||||
wizard->setWizardKind(IWizard::ClassWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
|
||||
wizard->setDisplayCategory(trCat);
|
||||
wizard->setDisplayName(tr("C++ Class"));
|
||||
wizard->setId(QLatin1String("A.Class"));
|
||||
wizard->setDescription(tr("Creates a C++ header and a source file for a new class that you can add to a C++ project."));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizardParameters.setKind(IWizard::FileWizard);
|
||||
wizardParameters.setDescription(tr("Creates a C++ source file that you can add to a C++ project."));
|
||||
wizardParameters.setDisplayName(tr("C++ Source File"));
|
||||
wizardParameters.setId(QLatin1String("B.Source"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
|
||||
wizard = new CppFileWizard(Source);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
|
||||
wizard->setDisplayCategory(trCat);
|
||||
wizard->setDisplayName(tr("C++ Class"));
|
||||
wizard->setDescription(tr("Creates a C++ source file that you can add to a C++ project."));
|
||||
wizard->setDisplayName(tr("C++ Source File"));
|
||||
wizard->setId(QLatin1String("B.Source"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
wizardParameters.setDescription(tr("Creates a C++ header file that you can add to a C++ project."));
|
||||
wizardParameters.setDisplayName(tr("C++ Header File"));
|
||||
wizardParameters.setId(QLatin1String("C.Header"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
|
||||
wizard = new CppFileWizard(Header);
|
||||
wizard->setWizardKind(IWizard::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."));
|
||||
wizard->setDisplayName(tr("C++ Header File"));
|
||||
wizard->setId(QLatin1String("C.Header"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
Context context(CppEditor::Constants::C_CPPEDITOR);
|
||||
|
||||
|
||||
@@ -43,18 +43,14 @@ using namespace CppEditor::Internal;
|
||||
|
||||
enum { debugWizard = 0 };
|
||||
|
||||
CppFileWizard::CppFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
FileType type,
|
||||
QObject *parent) :
|
||||
Core::StandardFileWizard(parameters, parent),
|
||||
m_type(type)
|
||||
CppFileWizard::CppFileWizard(FileType type)
|
||||
: m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
Core::GeneratedFiles CppFileWizard::generateFilesFromPath(const QString &path,
|
||||
const QString &name,
|
||||
QString * /*errorMessage*/) const
|
||||
|
||||
{
|
||||
const QString mimeType = m_type == Source ? QLatin1String(Constants::CPP_SOURCE_MIMETYPE) : QLatin1String(Constants::CPP_HEADER_MIMETYPE);
|
||||
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, preferredSuffix(mimeType));
|
||||
|
||||
@@ -42,16 +42,11 @@ class CppFileWizard : public Core::StandardFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
CppFileWizard(FileType type);
|
||||
|
||||
CppFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
FileType type,
|
||||
QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
private:
|
||||
QString fileContents(FileType type, const QString &baseName) const;
|
||||
|
||||
protected:
|
||||
Core::GeneratedFiles generateFilesFromPath(const QString &path,
|
||||
const QString &fileName,
|
||||
QString *errorMessage) const;
|
||||
|
||||
@@ -37,30 +37,15 @@
|
||||
#include <vcsbase/vcsconfigurationpage.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Cvs {
|
||||
namespace Internal {
|
||||
|
||||
CheckoutWizard::CheckoutWizard(QObject *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parent)
|
||||
CheckoutWizard::CheckoutWizard()
|
||||
{
|
||||
setId(QLatin1String(VcsBase::Constants::VCS_ID_CVS));
|
||||
}
|
||||
|
||||
QIcon CheckoutWizard::icon() const
|
||||
{
|
||||
return QIcon(QLatin1String(":/cvs/images/cvs.png"));
|
||||
}
|
||||
|
||||
QString CheckoutWizard::description() const
|
||||
{
|
||||
return tr("Checks out a CVS repository and tries to load the contained project.");
|
||||
}
|
||||
|
||||
QString CheckoutWizard::displayName() const
|
||||
{
|
||||
return tr("CVS Checkout");
|
||||
setIcon(QIcon(QLatin1String(":/cvs/images/cvs.png")));
|
||||
setDescription(tr("Checks out a CVS repository and tries to load the contained project."));
|
||||
setDisplayName(tr("CVS Checkout"));
|
||||
}
|
||||
|
||||
QList<QWizardPage*> CheckoutWizard::createParameterPages(const QString &path)
|
||||
|
||||
@@ -38,15 +38,11 @@ namespace Internal {
|
||||
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CheckoutWizard(QObject *parent = 0);
|
||||
CheckoutWizard();
|
||||
|
||||
// IWizard
|
||||
QIcon icon() const;
|
||||
QString description() const;
|
||||
QString displayName() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPage,
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
namespace Designer {
|
||||
namespace Internal {
|
||||
|
||||
FormClassWizard::FormClassWizard(const BaseFileWizardParameters ¶meters, QObject *parent)
|
||||
: Core::BaseFileWizard(parameters, parent)
|
||||
FormClassWizard::FormClassWizard()
|
||||
{
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS));
|
||||
}
|
||||
|
||||
QString FormClassWizard::headerSuffix() const
|
||||
@@ -60,11 +60,6 @@ QString FormClassWizard::formSuffix() const
|
||||
return preferredSuffix(QLatin1String(Constants::FORM_MIMETYPE));
|
||||
}
|
||||
|
||||
Core::FeatureSet FormClassWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS);
|
||||
}
|
||||
|
||||
QWizard *FormClassWizard::createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const
|
||||
{
|
||||
|
||||
@@ -37,28 +37,22 @@
|
||||
namespace Designer {
|
||||
namespace Internal {
|
||||
|
||||
class FormClassWizardParameters;
|
||||
|
||||
class FormClassWizard : public Core::BaseFileWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
|
||||
FormClassWizard(const BaseFileWizardParameters ¶meters, QObject *parent);
|
||||
FormClassWizard();
|
||||
|
||||
QString headerSuffix() const;
|
||||
QString sourceSuffix() const;
|
||||
QString formSuffix() const;
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -109,23 +109,27 @@ void FormEditorPlugin::extensionsInitialized()
|
||||
|
||||
void FormEditorPlugin::initializeTemplates()
|
||||
{
|
||||
FormWizard::BaseFileWizardParameters wizardParameters(IWizard::FileWizard);
|
||||
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizardParameters.setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
const QString formFileType = QLatin1String(Constants::FORM_FILE_TYPE);
|
||||
wizardParameters.setDisplayName(tr("Qt Designer Form"));
|
||||
wizardParameters.setId(QLatin1String("D.Form"));
|
||||
wizardParameters.setDescription(tr("Creates a Qt Designer form that you can add to a Qt Widget Project. "
|
||||
IWizard *wizard = new FormWizard;
|
||||
wizard->setWizardKind(IWizard::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"));
|
||||
wizard->setId(QLatin1String("D.Form"));
|
||||
wizard->setDescription(tr("Creates a Qt Designer form that you can add to a Qt Widget Project. "
|
||||
"This is useful if you already have an existing class for the UI business logic."));
|
||||
addAutoReleasedObject(new FormWizard(wizardParameters, this));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
#ifdef CPP_ENABLED
|
||||
wizardParameters.setKind(IWizard::ClassWizard);
|
||||
wizardParameters.setDisplayName(tr("Qt Designer Form Class"));
|
||||
wizardParameters.setId(QLatin1String("C.FormClass"));
|
||||
wizardParameters.setDescription(tr("Creates a Qt Designer form along with a matching class (C++ header and source file) "
|
||||
wizard = new FormClassWizard;
|
||||
wizard->setWizardKind(IWizard::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"));
|
||||
wizard->setId(QLatin1String("C.FormClass"));
|
||||
wizard->setDescription(tr("Creates a Qt Designer form along with a matching class (C++ header and source file) "
|
||||
"for implementation purposes. You can add the form and class to an existing Qt Widget Project."));
|
||||
addAutoReleasedObject(new FormClassWizard(wizardParameters, this));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
addAutoReleasedObject(new CppSettingsPage);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -37,14 +37,9 @@
|
||||
using namespace Designer;
|
||||
using namespace Designer::Internal;
|
||||
|
||||
FormWizard::FormWizard(const BaseFileWizardParameters ¶meters, QObject *parent)
|
||||
: Core::BaseFileWizard(parameters, parent)
|
||||
FormWizard::FormWizard()
|
||||
{
|
||||
}
|
||||
|
||||
Core::FeatureSet FormWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS);
|
||||
addRequiredFeature(Core::Id(QtSupport::Constants::FEATURE_QWIDGETS));
|
||||
}
|
||||
|
||||
QWizard *FormWizard::createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -40,17 +40,13 @@ class FormWizard : public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
FormWizard();
|
||||
|
||||
FormWizard(const BaseFileWizardParameters ¶meters, QObject *parent);
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -108,33 +108,23 @@ QString GenericProjectWizardDialog::projectName() const
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericProjectWizard::GenericProjectWizard()
|
||||
: Core::BaseFileWizard(parameters())
|
||||
{ }
|
||||
|
||||
Core::FeatureSet GenericProjectWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::FeatureSet();
|
||||
}
|
||||
|
||||
Core::BaseFileWizardParameters GenericProjectWizard::parameters()
|
||||
{
|
||||
Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||
setWizardKind(ProjectWizard);
|
||||
// TODO do something about the ugliness of standard icons in sizes different than 16, 32, 64, 128
|
||||
{
|
||||
QPixmap icon(22, 22);
|
||||
icon.fill(Qt::transparent);
|
||||
QPainter p(&icon);
|
||||
p.drawPixmap(3, 3, 16, 16, qApp->style()->standardIcon(QStyle::SP_DirIcon).pixmap(16));
|
||||
parameters.setIcon(icon);
|
||||
setIcon(icon);
|
||||
}
|
||||
parameters.setDisplayName(tr("Import Existing Project"));
|
||||
parameters.setId(QLatin1String("Z.Makefile"));
|
||||
parameters.setDescription(tr("Imports existing projects that do not use qmake, CMake or Autotools. "
|
||||
"This allows you to use Qt Creator as a code editor."));
|
||||
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY));
|
||||
parameters.setDisplayCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY_DISPLAY));
|
||||
parameters.setFlags(Core::IWizard::PlatformIndependent);
|
||||
return parameters;
|
||||
setDisplayName(tr("Import Existing Project"));
|
||||
setId(QLatin1String("Z.Makefile"));
|
||||
setDescription(tr("Imports existing projects that do not use qmake, CMake or Autotools. "
|
||||
"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);
|
||||
}
|
||||
|
||||
QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -64,9 +64,6 @@ class GenericProjectWizard : public Core::BaseFileWizard
|
||||
|
||||
public:
|
||||
GenericProjectWizard();
|
||||
Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
static Core::BaseFileWizardParameters parameters();
|
||||
|
||||
protected:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -37,31 +37,16 @@
|
||||
#include <vcsbase/vcsconfigurationpage.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
CloneWizard::CloneWizard(QObject *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parent)
|
||||
CloneWizard::CloneWizard()
|
||||
{
|
||||
setId(QLatin1String(VcsBase::Constants::VCS_ID_GIT));
|
||||
setCustomLabels(tr("Cloning"), tr("Cloning started..."));
|
||||
}
|
||||
|
||||
QIcon CloneWizard::icon() const
|
||||
{
|
||||
return QIcon(QLatin1String(":/git/images/git.png"));
|
||||
}
|
||||
|
||||
QString CloneWizard::description() const
|
||||
{
|
||||
return tr("Clones a Git repository and tries to load the contained project.");
|
||||
}
|
||||
|
||||
QString CloneWizard::displayName() const
|
||||
{
|
||||
return tr("Git Repository Clone");
|
||||
setIcon(QIcon(QLatin1String(":/git/images/git.png")));
|
||||
setDescription(tr("Clones a Git repository and tries to load the contained project."));
|
||||
setDisplayName(tr("Git Repository Clone"));
|
||||
}
|
||||
|
||||
QList<QWizardPage*> CloneWizard::createParameterPages(const QString &path)
|
||||
|
||||
@@ -38,15 +38,11 @@ namespace Internal {
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CloneWizard(QObject *parent = 0);
|
||||
CloneWizard();
|
||||
|
||||
// IWizard
|
||||
QIcon icon() const;
|
||||
QString description() const;
|
||||
QString displayName() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QIcon>
|
||||
|
||||
namespace Gitorious {
|
||||
namespace Internal {
|
||||
@@ -70,25 +69,12 @@ void GitoriousCloneWizardPage::initializePage()
|
||||
}
|
||||
|
||||
// -------- GitoriousCloneWizard
|
||||
GitoriousCloneWizard::GitoriousCloneWizard(QObject *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parent)
|
||||
GitoriousCloneWizard::GitoriousCloneWizard()
|
||||
{
|
||||
setId(QLatin1String(VcsBase::Constants::VCS_ID_GIT));
|
||||
}
|
||||
|
||||
QIcon GitoriousCloneWizard::icon() const
|
||||
{
|
||||
return QIcon(QLatin1String(":/git/images/gitorious.png"));
|
||||
}
|
||||
|
||||
QString GitoriousCloneWizard::description() const
|
||||
{
|
||||
return tr("Clones a Gitorious repository and tries to load the contained project.");
|
||||
}
|
||||
|
||||
QString GitoriousCloneWizard::displayName() const
|
||||
{
|
||||
return tr("Gitorious Repository Clone");
|
||||
setIcon(QIcon(QLatin1String(":/git/images/gitorious.png")));
|
||||
setDescription(tr("Clones a Gitorious repository and tries to load the contained project."));
|
||||
setDisplayName(tr("Gitorious Repository Clone"));
|
||||
}
|
||||
|
||||
QList<QWizardPage*> GitoriousCloneWizard::createParameterPages(const QString &path)
|
||||
|
||||
@@ -40,15 +40,11 @@ namespace Internal {
|
||||
class GitoriousCloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GitoriousCloneWizard(QObject *parent = 0);
|
||||
GitoriousCloneWizard();
|
||||
|
||||
// IWizard
|
||||
QIcon icon() const;
|
||||
QString description() const;
|
||||
QString displayName() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPages,
|
||||
|
||||
@@ -178,48 +178,58 @@ 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);
|
||||
|
||||
QObject *core = ICore::instance();
|
||||
BaseFileWizardParameters fragWizardParameters(IWizard::FileWizard);
|
||||
fragWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
fragWizardParameters.setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
fragWizardParameters.setDescription
|
||||
IWizard *wizard = new GLSLFileWizard(GLSLFileWizard::FragmentShaderES);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
(tr("Creates a fragment shader in the OpenGL/ES 2.0 Shading "
|
||||
"Language (GLSL/ES). Fragment shaders generate the final "
|
||||
"pixel colors for triangles, points and lines rendered "
|
||||
"with OpenGL."));
|
||||
fragWizardParameters.setDisplayName(tr("Fragment Shader (OpenGL/ES 2.0)"));
|
||||
fragWizardParameters.setId(QLatin1String("F.GLSL"));
|
||||
addAutoReleasedObject(new GLSLFileWizard(fragWizardParameters, GLSLFileWizard::FragmentShaderES, core));
|
||||
wizard->setDisplayName(tr("Fragment Shader (OpenGL/ES 2.0)"));
|
||||
wizard->setId(QLatin1String("F.GLSL"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
BaseFileWizardParameters vertWizardParameters(IWizard::FileWizard);
|
||||
vertWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
vertWizardParameters.setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
vertWizardParameters.setDescription
|
||||
wizard = new GLSLFileWizard(GLSLFileWizard::VertexShaderES);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
(tr("Creates a vertex shader in the OpenGL/ES 2.0 Shading "
|
||||
"Language (GLSL/ES). Vertex shaders transform the "
|
||||
"positions, normals and texture co-ordinates of "
|
||||
"triangles, points and lines rendered with OpenGL."));
|
||||
vertWizardParameters.setDisplayName(tr("Vertex Shader (OpenGL/ES 2.0)"));
|
||||
vertWizardParameters.setId(QLatin1String("G.GLSL"));
|
||||
addAutoReleasedObject(new GLSLFileWizard(vertWizardParameters, GLSLFileWizard::VertexShaderES, core));
|
||||
wizard->setDisplayName(tr("Vertex Shader (OpenGL/ES 2.0)"));
|
||||
wizard->setId(QLatin1String("G.GLSL"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
fragWizardParameters.setDescription
|
||||
wizard = new GLSLFileWizard(GLSLFileWizard::FragmentShaderDesktop);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
(tr("Creates a fragment shader in the Desktop OpenGL Shading "
|
||||
"Language (GLSL). Fragment shaders generate the final "
|
||||
"pixel colors for triangles, points and lines rendered "
|
||||
"with OpenGL."));
|
||||
fragWizardParameters.setDisplayName(tr("Fragment Shader (Desktop OpenGL)"));
|
||||
fragWizardParameters.setId(QLatin1String("J.GLSL"));
|
||||
addAutoReleasedObject(new GLSLFileWizard(fragWizardParameters, GLSLFileWizard::FragmentShaderDesktop, core));
|
||||
wizard->setDisplayName(tr("Fragment Shader (Desktop OpenGL)"));
|
||||
wizard->setId(QLatin1String("J.GLSL"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
vertWizardParameters.setDescription
|
||||
wizard = new GLSLFileWizard(GLSLFileWizard::VertexShaderDesktop);
|
||||
wizard->setWizardKind(IWizard::FileWizard);
|
||||
wizard->setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
|
||||
wizard->setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
|
||||
wizard->setDescription
|
||||
(tr("Creates a vertex shader in the Desktop OpenGL Shading "
|
||||
"Language (GLSL). Vertex shaders transform the "
|
||||
"positions, normals and texture co-ordinates of "
|
||||
"triangles, points and lines rendered with OpenGL."));
|
||||
vertWizardParameters.setDisplayName(tr("Vertex Shader (Desktop OpenGL)"));
|
||||
vertWizardParameters.setId(QLatin1String("K.GLSL"));
|
||||
addAutoReleasedObject(new GLSLFileWizard(vertWizardParameters, GLSLFileWizard::VertexShaderDesktop, core));
|
||||
wizard->setDisplayName(tr("Vertex Shader (Desktop OpenGL)"));
|
||||
wizard->setId(QLatin1String("K.GLSL"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
addAutoReleasedObject(new GLSLHighlighterFactory);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -52,21 +52,10 @@ public:
|
||||
|
||||
using namespace GLSLEditor;
|
||||
|
||||
GLSLFileWizard::GLSLFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
ShaderType shaderType, QObject *parent):
|
||||
Core::BaseFileWizard(parameters, parent),
|
||||
m_shaderType(shaderType)
|
||||
GLSLFileWizard::GLSLFileWizard(ShaderType shaderType)
|
||||
: m_shaderType(shaderType)
|
||||
{
|
||||
}
|
||||
|
||||
Core::FeatureSet GLSLFileWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::FeatureSet();
|
||||
}
|
||||
|
||||
Core::IWizard::WizardFlags GLSLFileWizard::flags() const
|
||||
{
|
||||
return Core::IWizard::PlatformIndependent;
|
||||
setFlags(Core::IWizard::PlatformIndependent);
|
||||
}
|
||||
|
||||
Core::GeneratedFiles GLSLFileWizard::generateFiles(const QWizard *w,
|
||||
|
||||
@@ -39,8 +39,6 @@ class GLSLFileWizard: public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
|
||||
enum ShaderType
|
||||
{
|
||||
VertexShaderES,
|
||||
@@ -49,22 +47,18 @@ public:
|
||||
FragmentShaderDesktop
|
||||
};
|
||||
|
||||
explicit GLSLFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
ShaderType shaderType, QObject *parent = 0);
|
||||
explicit GLSLFileWizard(ShaderType shaderType);
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
virtual WizardFlags flags() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
QString fileContents(const QString &baseName, ShaderType shaderType) const;
|
||||
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
|
||||
virtual QString preferredSuffix(ShaderType shaderType) const;
|
||||
QString preferredSuffix(ShaderType shaderType) const;
|
||||
|
||||
private:
|
||||
ShaderType m_shaderType;
|
||||
|
||||
@@ -40,27 +40,13 @@
|
||||
using namespace Mercurial::Internal;
|
||||
using namespace VcsBase;
|
||||
|
||||
CloneWizard::CloneWizard(QObject *parent)
|
||||
: BaseCheckoutWizard(parent),
|
||||
m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
|
||||
CloneWizard::CloneWizard()
|
||||
{
|
||||
setId(QLatin1String(Constants::VCS_ID_MERCURIAL));
|
||||
setCustomLabels(tr("Cloning"), tr("Cloning started..."));
|
||||
}
|
||||
|
||||
QIcon CloneWizard::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
QString CloneWizard::description() const
|
||||
{
|
||||
return tr("Clones a Mercurial repository and tries to load the contained project.");
|
||||
}
|
||||
|
||||
QString CloneWizard::displayName() const
|
||||
{
|
||||
return tr("Mercurial Clone");
|
||||
setIcon(QIcon(QLatin1String(":/mercurial/images/hg.png")));
|
||||
setDescription(tr("Clones a Mercurial repository and tries to load the contained project."));
|
||||
setDisplayName(tr("Mercurial Clone"));
|
||||
}
|
||||
|
||||
QList<QWizardPage *> CloneWizard::createParameterPages(const QString &path)
|
||||
|
||||
@@ -40,12 +40,9 @@ namespace Internal {
|
||||
class CloneWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CloneWizard(QObject *parent = 0);
|
||||
|
||||
QIcon icon() const;
|
||||
QString description() const;
|
||||
QString displayName() const;
|
||||
public:
|
||||
CloneWizard();
|
||||
|
||||
protected:
|
||||
QList<QWizardPage *> createParameterPages(const QString &path);
|
||||
|
||||
@@ -88,10 +88,8 @@ int CustomWizardPrivate::verbose = 0;
|
||||
of type "class" or "file". Serves as base class for project wizards.
|
||||
*/
|
||||
|
||||
CustomWizard::CustomWizard(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent) :
|
||||
Core::BaseFileWizard(baseFileParameters, parent),
|
||||
d(new CustomWizardPrivate)
|
||||
CustomWizard::CustomWizard()
|
||||
: d(new CustomWizardPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -249,11 +247,6 @@ Core::GeneratedFiles CustomWizard::generateFiles(const QWizard *dialog, QString
|
||||
return generateWizardFiles(errorMessage);
|
||||
}
|
||||
|
||||
Core::FeatureSet CustomWizard::requiredFeatures() const
|
||||
{
|
||||
return baseFileWizardParameters().requiredFeatures();
|
||||
}
|
||||
|
||||
bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorMessage)
|
||||
{
|
||||
if (!Core::BaseFileWizard::writeFiles(files, errorMessage))
|
||||
@@ -346,30 +339,31 @@ void CustomWizard::registerFactory(const QString &name, const ICustomWizardFacto
|
||||
customWizardFactoryMap()->insert(name, f);
|
||||
}
|
||||
|
||||
CustomWizard *CustomWizard::createWizard(const CustomWizardParametersPtr &p, const Core::BaseFileWizardParameters &b)
|
||||
CustomWizard *CustomWizard::createWizard(const CustomProjectWizard::CustomWizardParametersPtr &p, const Core::IWizard::Data &b)
|
||||
{
|
||||
CustomWizard * rc = 0;
|
||||
if (p->klass.isEmpty()) {
|
||||
// Use defaults for empty class names
|
||||
switch (b.kind()) {
|
||||
switch (b.kind) {
|
||||
case Core::IWizard::ProjectWizard:
|
||||
rc = new CustomProjectWizard(b);
|
||||
rc = new CustomProjectWizard;
|
||||
break;
|
||||
case Core::IWizard::FileWizard:
|
||||
case Core::IWizard::ClassWizard:
|
||||
rc = new CustomWizard(b);
|
||||
rc = new CustomWizard;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Look up class name in map
|
||||
const CustomWizardFactoryMap::const_iterator it = customWizardFactoryMap()->constFind(p->klass);
|
||||
if (it != customWizardFactoryMap()->constEnd())
|
||||
rc = it.value()->create(b);
|
||||
rc = it.value()->create();
|
||||
}
|
||||
if (!rc) {
|
||||
qWarning("Unable to create custom wizard for class %s.", qPrintable(p->klass));
|
||||
return 0;
|
||||
}
|
||||
rc->setData(b);
|
||||
rc->setParameters(p);
|
||||
return rc;
|
||||
}
|
||||
@@ -457,20 +451,20 @@ QList<CustomWizard*> CustomWizard::createWizards()
|
||||
verboseLog += QString::fromLatin1("CustomWizard: Scanning %1\n").arg(dirFi.absoluteFilePath());
|
||||
if (dir.exists(configFile)) {
|
||||
CustomWizardParametersPtr parameters(new Internal::CustomWizardParameters);
|
||||
Core::BaseFileWizardParameters baseFileParameters;
|
||||
switch (parameters->parse(dir.absoluteFilePath(configFile), &baseFileParameters, &errorMessage)) {
|
||||
IWizard::Data data;
|
||||
switch (parameters->parse(dir.absoluteFilePath(configFile), &data, &errorMessage)) {
|
||||
case Internal::CustomWizardParameters::ParseOk:
|
||||
parameters->directory = dir.absolutePath();
|
||||
if (CustomWizardPrivate::verbose)
|
||||
QTextStream(&verboseLog)
|
||||
<< "\n### Adding: " << baseFileParameters.id() << " / " << baseFileParameters.displayName() << '\n'
|
||||
<< baseFileParameters.category() << " / " <<baseFileParameters.displayCategory() << '\n'
|
||||
<< " (" << baseFileParameters.description() << ")\n"
|
||||
<< "\n### Adding: " << data.id << " / " << data.displayName << '\n'
|
||||
<< data.category << " / " << data.displayCategory << '\n'
|
||||
<< " (" << data.description << ")\n"
|
||||
<< parameters->toString();
|
||||
if (CustomWizard *w = createWizard(parameters, baseFileParameters))
|
||||
if (CustomWizard *w = createWizard(parameters, data))
|
||||
rc.push_back(w);
|
||||
else
|
||||
qWarning("Custom wizard factory function failed for %s", qPrintable(baseFileParameters.id()));
|
||||
qWarning("Custom wizard factory function failed for %s", qPrintable(data.id));
|
||||
break;
|
||||
case Internal::CustomWizardParameters::ParseDisabled:
|
||||
if (CustomWizardPrivate::verbose)
|
||||
@@ -512,9 +506,7 @@ QList<CustomWizard*> CustomWizard::createWizards()
|
||||
for QLineEdit-type fields' default text.
|
||||
*/
|
||||
|
||||
CustomProjectWizard::CustomProjectWizard(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent) :
|
||||
CustomWizard(baseFileParameters, parent)
|
||||
CustomProjectWizard::CustomProjectWizard()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -57,30 +57,29 @@ namespace Internal {
|
||||
}
|
||||
|
||||
// Documentation inside.
|
||||
class ICustomWizardFactory {
|
||||
class ICustomWizardFactory
|
||||
{
|
||||
public:
|
||||
virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent = 0) const = 0;
|
||||
virtual CustomWizard *create(QObject *parent = 0) const = 0;
|
||||
virtual ~ICustomWizardFactory() {}
|
||||
};
|
||||
|
||||
// Convenience template to create wizard factory classes.
|
||||
template <class Wizard> class CustomWizardFactory : public ICustomWizardFactory {
|
||||
virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent = 0) const
|
||||
{ return new Wizard(baseFileParameters, parent); }
|
||||
template <class Wizard> class CustomWizardFactory : public ICustomWizardFactory
|
||||
{
|
||||
CustomWizard *create(QObject * = 0) const { return new Wizard; }
|
||||
};
|
||||
|
||||
// Documentation inside.
|
||||
class PROJECTEXPLORER_EXPORT CustomWizard : public Core::BaseFileWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef QMap<QString, QString> FieldReplacementMap;
|
||||
typedef QSharedPointer<ICustomWizardFactory> ICustomWizardFactoryPtr;
|
||||
|
||||
explicit CustomWizard(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent = 0);
|
||||
CustomWizard();
|
||||
virtual ~CustomWizard();
|
||||
|
||||
// Can be reimplemented to create custom wizards. initWizardDialog() needs to be
|
||||
@@ -90,9 +89,6 @@ public:
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
|
||||
// Register a factory for a derived custom widget
|
||||
static void registerFactory(const QString &name, const ICustomWizardFactoryPtr &f);
|
||||
template <class Wizard> static void registerFactory(const QString &name)
|
||||
@@ -121,11 +117,12 @@ protected:
|
||||
CustomWizardParametersPtr parameters() const;
|
||||
CustomWizardContextPtr context() const;
|
||||
|
||||
static CustomWizard *createWizard(const CustomWizardParametersPtr &p, const Core::IWizard::Data &b);
|
||||
|
||||
private:
|
||||
void setParameters(const CustomWizardParametersPtr &p);
|
||||
|
||||
static CustomWizard *createWizard(const CustomWizardParametersPtr &p,
|
||||
const Core::BaseFileWizardParameters &b);
|
||||
static CustomWizard *createWizard(const CustomWizardParametersPtr &p);
|
||||
CustomWizardPrivate *d;
|
||||
};
|
||||
|
||||
@@ -133,17 +130,18 @@ private:
|
||||
class PROJECTEXPLORER_EXPORT CustomProjectWizard : public CustomWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CustomProjectWizard(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent = 0);
|
||||
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
CustomProjectWizard();
|
||||
|
||||
static bool postGenerateOpen(const Core::GeneratedFiles &l, QString *errorMessage = 0);
|
||||
|
||||
protected:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
|
||||
signals:
|
||||
void projectLocationChanged(const QString &path);
|
||||
|
||||
|
||||
@@ -267,36 +267,12 @@ static inline bool assignLanguageElementText(QXmlStreamReader &reader,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy&paste from above to call a setter of BaseFileParameters.
|
||||
// Implementation of a sophisticated mem_fun pattern is left
|
||||
// as an exercise to the reader.
|
||||
static inline bool assignLanguageElementText(QXmlStreamReader &reader,
|
||||
const QString &desiredLanguage,
|
||||
BaseFileWizardParameters *bp,
|
||||
void (BaseFileWizardParameters::*setter)(const QString &))
|
||||
{
|
||||
const QStringRef elementLanguage = reader.attributes().value(QLatin1String(langAttributeC));
|
||||
if (elementLanguage.isEmpty()) {
|
||||
// Try to find a translation for our built-in Wizards
|
||||
const QString translated = QCoreApplication::translate("ProjectExplorer::CustomWizard", reader.readElementText().toLatin1().constData());
|
||||
(bp->*setter)(translated);
|
||||
return true;
|
||||
}
|
||||
if (elementLanguage == desiredLanguage) {
|
||||
(bp->*setter)(reader.readElementText());
|
||||
return true;
|
||||
}
|
||||
// Language mismatch: forward to end element.
|
||||
skipOverElementText(reader);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read level sub-elements of "wizard"
|
||||
static bool parseCustomProjectElement(QXmlStreamReader &reader,
|
||||
const QString &configFileFullPath,
|
||||
const QString &language,
|
||||
CustomWizardParameters *p,
|
||||
BaseFileWizardParameters *bp)
|
||||
IWizard::Data *bp)
|
||||
{
|
||||
const QStringRef elementName = reader.name();
|
||||
if (elementName == QLatin1String(iconElementC)) {
|
||||
@@ -306,23 +282,20 @@ static bool parseCustomProjectElement(QXmlStreamReader &reader,
|
||||
qWarning("Invalid icon path '%s' encountered in custom project template %s.",
|
||||
qPrintable(path), qPrintable(configFileFullPath));
|
||||
} else {
|
||||
bp->setIcon(icon);
|
||||
bp->icon = icon;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (elementName == QLatin1String(descriptionElementC)) {
|
||||
assignLanguageElementText(reader, language, bp,
|
||||
&BaseFileWizardParameters::setDescription);
|
||||
assignLanguageElementText(reader, language, &bp->description);
|
||||
return true;
|
||||
}
|
||||
if (elementName == QLatin1String(displayNameElementC)) {
|
||||
assignLanguageElementText(reader, language, bp,
|
||||
&BaseFileWizardParameters::setDisplayName);
|
||||
assignLanguageElementText(reader, language, &bp->displayName);
|
||||
return true;
|
||||
}
|
||||
if (elementName == QLatin1String(displayCategoryElementC)) {
|
||||
assignLanguageElementText(reader, language, bp,
|
||||
&BaseFileWizardParameters::setDisplayCategory);
|
||||
assignLanguageElementText(reader, language, &bp->displayCategory);
|
||||
return true;
|
||||
}
|
||||
if (elementName == QLatin1String(fieldPageTitleElementC)) {
|
||||
@@ -579,7 +552,7 @@ GeneratorScriptArgument::GeneratorScriptArgument(const QString &v) :
|
||||
CustomWizardParameters::ParseResult
|
||||
CustomWizardParameters::parse(QIODevice &device,
|
||||
const QString &configFileFullPath,
|
||||
BaseFileWizardParameters *bp,
|
||||
IWizard::Data *bp,
|
||||
QString *errorMessage)
|
||||
{
|
||||
int comboEntryCount = 0;
|
||||
@@ -587,8 +560,8 @@ CustomWizardParameters::ParseResult
|
||||
QXmlStreamReader::TokenType token = QXmlStreamReader::EndDocument;
|
||||
ParseState state = ParseBeginning;
|
||||
clear();
|
||||
bp->clear();
|
||||
bp->setKind(IWizard::ProjectWizard);
|
||||
*bp = IWizard::Data();
|
||||
bp->kind = IWizard::ProjectWizard;
|
||||
const QString language = languageSetting();
|
||||
CustomWizardField field;
|
||||
do {
|
||||
@@ -613,11 +586,11 @@ CustomWizardParameters::ParseResult
|
||||
case ParseWithinWizard:
|
||||
if (!booleanAttributeValue(reader, wizardEnabledAttributeC, true))
|
||||
return ParseDisabled;
|
||||
bp->setId(attributeValue(reader, idAttributeC));
|
||||
bp->setCategory(attributeValue(reader, categoryAttributeC));
|
||||
bp->setKind(kindAttribute(reader));
|
||||
bp->setRequiredFeatures(requiredFeatures(reader));
|
||||
bp->setFlags(wizardFlags(reader));
|
||||
bp->id = attributeValue(reader, idAttributeC);
|
||||
bp->category = attributeValue(reader, categoryAttributeC);
|
||||
bp->kind = kindAttribute(reader);
|
||||
bp->requiredFeatures = requiredFeatures(reader);
|
||||
bp->flags = wizardFlags(reader);
|
||||
klass = attributeValue(reader, klassAttributeC);
|
||||
firstPageId = integerAttributeValue(reader, firstPageAttributeC, -1);
|
||||
break;
|
||||
@@ -731,7 +704,7 @@ CustomWizardParameters::ParseResult
|
||||
|
||||
CustomWizardParameters::ParseResult
|
||||
CustomWizardParameters::parse(const QString &configFileFullPath,
|
||||
BaseFileWizardParameters *bp,
|
||||
IWizard::Data *bp,
|
||||
QString *errorMessage)
|
||||
{
|
||||
QFile configFile(configFileFullPath);
|
||||
|
||||
@@ -106,9 +106,9 @@ public:
|
||||
CustomWizardParameters();
|
||||
void clear();
|
||||
ParseResult parse(QIODevice &device, const QString &configFileFullPath,
|
||||
Core::BaseFileWizardParameters *bp, QString *errorMessage);
|
||||
Core::IWizard::Data *bp, QString *errorMessage);
|
||||
ParseResult parse(const QString &configFileFullPath,
|
||||
Core::BaseFileWizardParameters *bp, QString *errorMessage);
|
||||
Core::IWizard::Data *bp, QString *errorMessage);
|
||||
QString toString() const;
|
||||
|
||||
QString directory;
|
||||
|
||||
@@ -236,8 +236,8 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
|
||||
Core::FileIconProvider::registerIconOverlayForMimeType(icon, C_PY_MIMETYPE);
|
||||
|
||||
// Add Python files and classes creation dialogs
|
||||
addAutoReleasedObject(new FileWizard(Core::ICore::instance()));
|
||||
addAutoReleasedObject(new ClassWizard(Core::ICore::instance()));
|
||||
addAutoReleasedObject(new FileWizard);
|
||||
addAutoReleasedObject(new ClassWizard);
|
||||
addAutoReleasedObject(new Internal::PythonHighlighterFactory);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -45,22 +45,14 @@ using namespace ProjectExplorer;
|
||||
namespace PythonEditor {
|
||||
namespace Internal {
|
||||
|
||||
static Core::BaseFileWizardParameters getDefaultParams()
|
||||
{
|
||||
Core::BaseFileWizardParameters p(Core::IWizard::FileWizard);
|
||||
|
||||
p.setId(QLatin1String(Constants::C_PY_CLASS_WIZARD_ID));
|
||||
p.setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
|
||||
p.setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
|
||||
p.setDisplayName(ClassWizard::tr(Constants::EN_PY_CLASS_DISPLAY_NAME));
|
||||
p.setDescription(ClassWizard::tr(Constants::EN_PY_CLASS_DESCRIPTION));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
ClassWizard::ClassWizard(QObject *parent) :
|
||||
Core::BaseFileWizard(getDefaultParams(), parent)
|
||||
ClassWizard::ClassWizard()
|
||||
{
|
||||
setWizardKind(Core::IWizard::FileWizard);
|
||||
setId(QLatin1String(Constants::C_PY_CLASS_WIZARD_ID));
|
||||
setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
|
||||
setDisplayName(ClassWizard::tr(Constants::EN_PY_CLASS_DISPLAY_NAME));
|
||||
setDescription(ClassWizard::tr(Constants::EN_PY_CLASS_DESCRIPTION));
|
||||
}
|
||||
|
||||
QWizard *ClassWizard::createWizardDialog(
|
||||
|
||||
@@ -46,9 +46,9 @@ class ClassWizard : public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClassWizard(QObject *parent = 0);
|
||||
ClassWizard();
|
||||
|
||||
protected:
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶ms) const;
|
||||
|
||||
|
||||
@@ -41,32 +41,18 @@
|
||||
|
||||
namespace PythonEditor {
|
||||
|
||||
/**
|
||||
* @brief GetDefaultParams
|
||||
* @return Default parameters for menu item "Files&Classes->Python->Python file"
|
||||
*/
|
||||
static const Core::BaseFileWizardParameters GetDefaultParams()
|
||||
{
|
||||
Core::BaseFileWizardParameters p(Core::IWizard::FileWizard);
|
||||
|
||||
p.setId(QLatin1String(Constants::C_PY_SOURCE_WIZARD_ID));
|
||||
p.setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
|
||||
p.setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
|
||||
p.setDisplayName(
|
||||
FileWizard::tr(Constants::EN_PY_SOURCE_DISPLAY_NAME));
|
||||
p.setDescription(
|
||||
FileWizard::tr(Constants::EN_PY_SOURCE_DESCRIPTION));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize wizard and add new option to "New..." dialog.
|
||||
* @param parent
|
||||
*/
|
||||
FileWizard::FileWizard(QObject *parent)
|
||||
:Core::BaseFileWizard(GetDefaultParams(), parent)
|
||||
FileWizard::FileWizard()
|
||||
{
|
||||
setWizardKind(Core::IWizard::FileWizard);
|
||||
setId(QLatin1String(Constants::C_PY_SOURCE_WIZARD_ID));
|
||||
setCategory(QLatin1String(Constants::C_PY_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(Constants::C_PY_DISPLAY_CATEGORY));
|
||||
setDisplayName(FileWizard::tr(Constants::EN_PY_SOURCE_DISPLAY_NAME));
|
||||
setDescription(FileWizard::tr(Constants::EN_PY_SOURCE_DESCRIPTION));
|
||||
}
|
||||
|
||||
FileWizard::~FileWizard()
|
||||
|
||||
@@ -39,16 +39,14 @@ class FileWizard : public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FileWizard(QObject *parent = 0);
|
||||
virtual ~FileWizard();
|
||||
FileWizard();
|
||||
~FileWizard();
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(
|
||||
QWidget *parent,
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶ms) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(
|
||||
const QWizard *dialog,
|
||||
Core::GeneratedFiles generateFiles( const QWizard *dialog,
|
||||
QString *errorMessage) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -88,17 +88,10 @@ public:
|
||||
|
||||
using namespace QmlJSEditor;
|
||||
|
||||
JsFileWizard::JsFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent):
|
||||
Core::BaseFileWizard(parameters, parent)
|
||||
JsFileWizard::JsFileWizard()
|
||||
{
|
||||
}
|
||||
|
||||
Core::FeatureSet JsFileWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::FeatureSet();
|
||||
}
|
||||
|
||||
Core::GeneratedFiles JsFileWizard::generateFiles(const QWizard *w,
|
||||
QString * /*errorMessage*/) const
|
||||
{
|
||||
|
||||
@@ -39,21 +39,15 @@ class JsFileWizard: public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
JsFileWizard();
|
||||
|
||||
explicit JsFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent = 0);
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
QString fileContents(const QString &baseName, bool statelessLibrary) const;
|
||||
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
};
|
||||
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
|
||||
using namespace QmlJSEditor;
|
||||
|
||||
QmlFileWizard::QmlFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent):
|
||||
Core::StandardFileWizard(parameters, parent)
|
||||
QmlFileWizard::QmlFileWizard()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -62,7 +60,7 @@ QString QmlFileWizard::fileContents(const QString &) const
|
||||
QString contents;
|
||||
QTextStream str(&contents);
|
||||
|
||||
if (baseFileWizardParameters().id() == QLatin1String(Constants::WIZARD_QML1FILE))
|
||||
if (id() == QLatin1String(Constants::WIZARD_QML1FILE))
|
||||
str << QLatin1String("import QtQuick 1.1\n");
|
||||
else
|
||||
str << QLatin1String("import QtQuick 2.0\n");
|
||||
|
||||
@@ -39,15 +39,11 @@ class QmlFileWizard: public Core::StandardFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
QmlFileWizard();
|
||||
|
||||
explicit QmlFileWizard(const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
private:
|
||||
QString fileContents(const QString &baseName) const;
|
||||
|
||||
protected:
|
||||
Core::GeneratedFiles generateFilesFromPath(const QString &path,
|
||||
const QString &fileName,
|
||||
QString *errorMessage) const;
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
|
||||
#include <qmldesigner/qmldesignerconstants.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -79,6 +79,7 @@
|
||||
|
||||
using namespace QmlJSEditor::Constants;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Core;
|
||||
|
||||
enum {
|
||||
QUICKFIX_INTERVAL = 20
|
||||
@@ -137,30 +138,32 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
m_editor = new QmlJSEditorFactory(this);
|
||||
addObject(m_editor);
|
||||
|
||||
QObject *core = Core::ICore::instance();
|
||||
Core::BaseFileWizardParameters qml1WizardParameters(Core::IWizard::FileWizard);
|
||||
qml1WizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
qml1WizardParameters.setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
qml1WizardParameters.setDescription(tr("Creates a QML file with boilerplate code, starting with \"import QtQuick 1.1\"."));
|
||||
qml1WizardParameters.setDisplayName(tr("QML File (Qt Quick 1)"));
|
||||
qml1WizardParameters.setId(QLatin1String(Constants::WIZARD_QML1FILE));
|
||||
addAutoReleasedObject(new QmlFileWizard(qml1WizardParameters, core));
|
||||
IWizard *wizard = new QmlFileWizard;
|
||||
wizard->setWizardKind(Core::IWizard::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\"."));
|
||||
wizard->setDisplayName(tr("QML File (Qt Quick 1)"));
|
||||
wizard->setId(QLatin1String(Constants::WIZARD_QML1FILE));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
Core::BaseFileWizardParameters qml2WizardParameters(Core::IWizard::FileWizard);
|
||||
qml2WizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
qml2WizardParameters.setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
qml2WizardParameters.setDescription(tr("Creates a QML file with boilerplate code, starting with \"import QtQuick 2.0\"."));
|
||||
qml2WizardParameters.setDisplayName(tr("QML File (Qt Quick 2)"));
|
||||
qml2WizardParameters.setId(QLatin1String(Constants::WIZARD_QML2FILE));
|
||||
addAutoReleasedObject(new QmlFileWizard(qml2WizardParameters, core));
|
||||
wizard = new QmlFileWizard;
|
||||
wizard->setWizardKind(Core::IWizard::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\"."));
|
||||
wizard->setDisplayName(tr("QML File (Qt Quick 2)"));
|
||||
wizard->setId(QLatin1String(Constants::WIZARD_QML2FILE));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
Core::BaseFileWizardParameters jsWizardParameters(Core::IWizard::FileWizard);
|
||||
jsWizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
jsWizardParameters.setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
jsWizardParameters.setDescription(tr("Creates a JavaScript file."));
|
||||
jsWizardParameters.setDisplayName(tr("JS File"));
|
||||
jsWizardParameters.setId(QLatin1String("Z.Js"));
|
||||
addAutoReleasedObject(new JsFileWizard(jsWizardParameters, core));
|
||||
wizard = new JsFileWizard;
|
||||
wizard->setWizardKind(Core::IWizard::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."));
|
||||
wizard->setDisplayName(tr("JS File"));
|
||||
wizard->setId(QLatin1String("Z.Js"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
m_actionHandler = new TextEditor::TextEditorActionHandler(Constants::C_QMLJSEDITOR_ID,
|
||||
TextEditor::TextEditorActionHandler::Format
|
||||
|
||||
@@ -65,29 +65,36 @@ QmlApp *QmlApplicationWizardDialog::qmlApp() const
|
||||
return m_qmlApp;
|
||||
}
|
||||
|
||||
QmlApplicationWizard::QmlApplicationWizard(const BaseFileWizardParameters ¶meters,
|
||||
const TemplateInfo &templateInfo, QObject *parent)
|
||||
: BaseFileWizard(parameters, parent),
|
||||
m_qmlApp(new QmlApp(this))
|
||||
QmlApplicationWizard::QmlApplicationWizard(const TemplateInfo &templateInfo)
|
||||
: m_qmlApp(new QmlApp(this))
|
||||
{
|
||||
setWizardKind(ProjectWizard);
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
setId(QLatin1String("QA.QMLB Application"));
|
||||
setIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_QTQUICK_APP)));
|
||||
setDisplayCategory(
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Qt Quick Application"));
|
||||
setDescription(tr("Creates a Qt Quick application project."));
|
||||
|
||||
m_qmlApp->setTemplateInfo(templateInfo);
|
||||
}
|
||||
|
||||
void QmlApplicationWizard::createInstances(ExtensionSystem::IPlugin *plugin)
|
||||
{
|
||||
foreach (const TemplateInfo &templateInfo, QmlApp::templateInfos()) {
|
||||
BaseFileWizardParameters parameters;
|
||||
parameters.setDisplayName(templateInfo.displayName);
|
||||
parameters.setDescription(templateInfo.description);
|
||||
QmlApplicationWizard *wizard = new QmlApplicationWizard(templateInfo);
|
||||
wizard->setDisplayName(templateInfo.displayName);
|
||||
wizard->setDescription(templateInfo.description);
|
||||
const QString imagePath = templateInfo.templatePath + QLatin1String("/template.png");
|
||||
if (QFileInfo(imagePath).exists())
|
||||
parameters.setDescriptionImage(imagePath);
|
||||
parameters.setCategory(
|
||||
wizard->setDescriptionImage(imagePath);
|
||||
wizard->setCategory(
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
parameters.setDisplayCategory(
|
||||
wizard->setDisplayCategory(
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
parameters.setKind(IWizard::ProjectWizard);
|
||||
parameters.setId(templateInfo.wizardId);
|
||||
wizard->setWizardKind(IWizard::ProjectWizard);
|
||||
wizard->setId(templateInfo.wizardId);
|
||||
|
||||
QStringList stringList =
|
||||
templateInfo.featuresRequired.split(QLatin1Char(','), QString::SkipEmptyParts);
|
||||
@@ -97,26 +104,12 @@ void QmlApplicationWizard::createInstances(ExtensionSystem::IPlugin *plugin)
|
||||
features |= feature;
|
||||
}
|
||||
|
||||
parameters.setRequiredFeatures(features);
|
||||
parameters.setIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_QTQUICK_APP)));
|
||||
QmlApplicationWizard *wizard = new QmlApplicationWizard(parameters, templateInfo);
|
||||
wizard->setRequiredFeatures(features);
|
||||
wizard->setIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_QTQUICK_APP)));
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
}
|
||||
}
|
||||
|
||||
BaseFileWizardParameters QmlApplicationWizard::parameters()
|
||||
{
|
||||
BaseFileWizardParameters params(ProjectWizard);
|
||||
params.setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
params.setId(QLatin1String("QA.QMLB Application"));
|
||||
params.setIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_QTQUICK_APP)));
|
||||
params.setDisplayCategory(
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
params.setDisplayName(tr("Qt Quick Application"));
|
||||
params.setDescription(tr("Creates a Qt Quick application project."));
|
||||
return params;
|
||||
}
|
||||
|
||||
QWizard *QmlApplicationWizard::createWizardDialog(QWidget *parent,
|
||||
const WizardDialogParameters &wizardDialogParameters) const
|
||||
{
|
||||
|
||||
@@ -60,25 +60,21 @@ private:
|
||||
class QmlApplicationWizard : public Core::BaseFileWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(QmlApplicationWizard)
|
||||
|
||||
public:
|
||||
QmlApplicationWizard(const Core::BaseFileWizardParameters ¶meters,
|
||||
const TemplateInfo &templateInfo, QObject *parent = 0);
|
||||
explicit QmlApplicationWizard(const TemplateInfo &templateInfo);
|
||||
|
||||
static void createInstances(ExtensionSystem::IPlugin *plugin);
|
||||
|
||||
|
||||
private: // functions
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
void writeUserFile(const QString &fileName) const;
|
||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
|
||||
static Core::BaseFileWizardParameters parameters();
|
||||
|
||||
private: //variables
|
||||
mutable QString m_id;
|
||||
private:
|
||||
// mutable QString m_id;
|
||||
QmlApp *m_qmlApp;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,24 +37,21 @@
|
||||
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <QIcon>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
CustomWidgetWizard::CustomWidgetWizard() :
|
||||
QtWizard(QLatin1String("P.Qt4CustomWidget"),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY),
|
||||
tr("Qt Custom Designer Widget"),
|
||||
tr("Creates a Qt Custom Designer Widget or a Custom Widget Collection."),
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
||||
CustomWidgetWizard::CustomWidgetWizard()
|
||||
{
|
||||
}
|
||||
|
||||
Core::FeatureSet CustomWidgetWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS);
|
||||
setId(QLatin1String("P.Qt4CustomWidget"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Qt Custom Designer Widget"));
|
||||
setDescription(tr("Creates a Qt Custom Designer Widget or a Custom Widget Collection."));
|
||||
setIcon(QIcon(QLatin1String(":/wizards/images/gui.png")));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS));
|
||||
}
|
||||
|
||||
QWizard *CustomWidgetWizard::createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -41,15 +41,12 @@ class CustomWidgetWizard : public QtWizard
|
||||
|
||||
public:
|
||||
CustomWidgetWizard();
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -226,8 +226,8 @@ QList<Core::Id> AbstractMobileAppWizardDialog::selectedKits() const
|
||||
|
||||
|
||||
|
||||
AbstractMobileAppWizard::AbstractMobileAppWizard(const Core::BaseFileWizardParameters ¶ms,
|
||||
QObject *parent) : Core::BaseFileWizard(params, parent)
|
||||
AbstractMobileAppWizard::AbstractMobileAppWizard(QObject *parent)
|
||||
: Core::BaseFileWizard(parent)
|
||||
{ }
|
||||
|
||||
QWizard *AbstractMobileAppWizard::createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -101,8 +101,7 @@ class QT4PROJECTMANAGER_EXPORT AbstractMobileAppWizard : public Core::BaseFileWi
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
explicit AbstractMobileAppWizard(const Core::BaseFileWizardParameters ¶ms,
|
||||
QObject *parent = 0);
|
||||
explicit AbstractMobileAppWizard(QObject *parent = 0);
|
||||
|
||||
private slots:
|
||||
void useProjectPath(const QString &projectName, const QString &projectPath);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <cpptools/abstracteditorsupport.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <QIcon>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QTextStream>
|
||||
|
||||
@@ -53,14 +53,16 @@ namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
ConsoleAppWizard::ConsoleAppWizard()
|
||||
: QtWizard(QLatin1String("E.Qt4Core"),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY),
|
||||
tr("Qt Console Application"),
|
||||
tr("Creates a project containing a single main.cpp file with a stub implementation.\n\n"
|
||||
"Preselects a desktop Qt for building the application if available."),
|
||||
QIcon(QLatin1String(":/wizards/images/console.png")))
|
||||
{
|
||||
setId(QLatin1String("E.Qt4Core"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Qt Console Application"));
|
||||
setDescription(tr("Creates a project containing a single main.cpp file with a stub implementation.\n\n"
|
||||
"Preselects a desktop Qt for building the application if available."));
|
||||
setIcon(QIcon(QLatin1String(":/wizards/images/console.png")));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE));
|
||||
}
|
||||
|
||||
QWizard *ConsoleAppWizard::createWizardDialog(QWidget *parent,
|
||||
@@ -102,10 +104,5 @@ Core::GeneratedFiles
|
||||
return Core::GeneratedFiles() << source << profile;
|
||||
}
|
||||
|
||||
Core::FeatureSet ConsoleAppWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
@@ -45,13 +45,11 @@ public:
|
||||
ConsoleAppWizard();
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -34,25 +34,22 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <QIcon>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
EmptyProjectWizard::EmptyProjectWizard()
|
||||
: QtWizard(QLatin1String("U.Qt4Empty"),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY),
|
||||
tr("Empty Qt Project"),
|
||||
tr("Creates a qmake-based project without any files. This allows you to create "
|
||||
"an application without any default classes."),
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
||||
{
|
||||
}
|
||||
|
||||
Core::FeatureSet EmptyProjectWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QT);
|
||||
setId(QLatin1String("U.Qt4Empty"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Empty Qt Project"));
|
||||
setDescription(tr("Creates a qmake-based project without any files. This allows you to create "
|
||||
"an application without any default classes."));
|
||||
setIcon(QIcon(QLatin1String(":/wizards/images/gui.png")));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT));
|
||||
}
|
||||
|
||||
QWizard *EmptyProjectWizard::createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -41,14 +41,12 @@ class EmptyProjectWizard : public QtWizard
|
||||
|
||||
public:
|
||||
EmptyProjectWizard();
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -40,13 +40,12 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QTextStream>
|
||||
#include <QFileInfo>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
static const char mainSourceFileC[] = "main";
|
||||
static const char mainSourceShowC[] = " w.show();\n";
|
||||
static const char mainSourceMobilityShowC[] = " w.show();\n";
|
||||
@@ -73,34 +72,19 @@ static inline QStringList baseClasses()
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
GuiAppWizard::GuiAppWizard()
|
||||
: QtWizard(QLatin1String("C.Qt4Gui"),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY),
|
||||
tr("Qt Gui Application"),
|
||||
tr("Creates a Qt application for the desktop. "
|
||||
GuiAppWizard::GuiAppWizard(bool isMobile)
|
||||
{
|
||||
setId(QLatin1String("C.Qt4Gui"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Qt Gui Application"));
|
||||
setDescription(tr("Creates a Qt application for the desktop. "
|
||||
"Includes a Qt Designer-based main window.\n\n"
|
||||
"Preselects a desktop Qt for building the application if available."),
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png"))),
|
||||
m_createMobileProject(false)
|
||||
{
|
||||
}
|
||||
|
||||
Core::FeatureSet GuiAppWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS);
|
||||
}
|
||||
|
||||
GuiAppWizard::GuiAppWizard(const QString &id,
|
||||
const QString &category,
|
||||
const QString &displayCategory,
|
||||
const QString &name,
|
||||
const QString &description,
|
||||
const QIcon &icon,
|
||||
bool createMobile)
|
||||
: QtWizard(id, category, displayCategory, name, description, icon),
|
||||
m_createMobileProject(createMobile)
|
||||
{
|
||||
"Preselects a desktop Qt for building the application if available."));
|
||||
setIcon(QIcon(QLatin1String(":/wizards/images/gui.png")));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS));
|
||||
m_createMobileProject = isMobile;
|
||||
}
|
||||
|
||||
QWizard *GuiAppWizard::createWizardDialog(QWidget *parent,
|
||||
|
||||
@@ -42,22 +42,13 @@ class GuiAppWizard : public QtWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiAppWizard();
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
GuiAppWizard(bool isMobile = false);
|
||||
|
||||
protected:
|
||||
GuiAppWizard(const QString &id,
|
||||
const QString &category,
|
||||
const QString &displayCategory,
|
||||
const QString &name,
|
||||
const QString &description,
|
||||
const QIcon &icon,
|
||||
bool createMobile);
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
|
||||
private:
|
||||
static bool parametrizeTemplate(const QString &templatePath, const QString &templateName,
|
||||
|
||||
@@ -79,9 +79,20 @@ class Html5AppWizardPrivate
|
||||
};
|
||||
|
||||
Html5AppWizard::Html5AppWizard()
|
||||
: AbstractMobileAppWizard(parameters())
|
||||
, d(new Html5AppWizardPrivate)
|
||||
: d(new Html5AppWizardPrivate)
|
||||
{
|
||||
setWizardKind(ProjectWizard);
|
||||
setIcon(QIcon(QLatin1String(Constants::ICON_HTML5_APP)));
|
||||
setDisplayName(tr("HTML5 Application"));
|
||||
setId(QLatin1String("QA.HTML5A Application"));
|
||||
setDescription(tr("Creates an HTML5 application project that can contain "
|
||||
"both HTML5 and C++ code and includes a WebKit view.\n\n"
|
||||
"You can build the application and deploy it on desktop and "
|
||||
"mobile target platforms."));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT));
|
||||
|
||||
d->app = new Html5App;
|
||||
d->wizardDialog = 0;
|
||||
}
|
||||
@@ -92,26 +103,6 @@ Html5AppWizard::~Html5AppWizard()
|
||||
delete d;
|
||||
}
|
||||
|
||||
Core::FeatureSet Html5AppWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT);
|
||||
}
|
||||
|
||||
Core::BaseFileWizardParameters Html5AppWizard::parameters()
|
||||
{
|
||||
Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||
parameters.setIcon(QIcon(QLatin1String(Constants::ICON_HTML5_APP)));
|
||||
parameters.setDisplayName(tr("HTML5 Application"));
|
||||
parameters.setId(QLatin1String("QA.HTML5A Application"));
|
||||
parameters.setDescription(tr("Creates an HTML5 application project that can contain "
|
||||
"both HTML5 and C++ code and includes a WebKit view.\n\n"
|
||||
"You can build the application and deploy it on desktop and "
|
||||
"mobile target platforms."));
|
||||
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
parameters.setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
AbstractMobileAppWizardDialog *Html5AppWizard::createWizardDialogInternal(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
|
||||
@@ -41,15 +41,12 @@ class Html5AppWizard : public AbstractMobileAppWizard
|
||||
|
||||
public:
|
||||
Html5AppWizard();
|
||||
virtual ~Html5AppWizard();
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
~Html5AppWizard();
|
||||
|
||||
protected:
|
||||
QString fileToOpenPostGeneration() const;
|
||||
|
||||
private:
|
||||
static Core::BaseFileWizardParameters parameters();
|
||||
|
||||
virtual AbstractMobileApp *app() const;
|
||||
virtual AbstractMobileAppWizardDialog *wizardDialog() const;
|
||||
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent,
|
||||
|
||||
@@ -37,24 +37,25 @@
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QTextStream>
|
||||
#include <QIcon>
|
||||
#include <QCoreApplication>
|
||||
|
||||
static const char sharedHeaderPostfixC[] = "_global";
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
LibraryWizard::LibraryWizard()
|
||||
: QtWizard(QLatin1String("H.Qt4Library"),
|
||||
QLatin1String(ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY_DISPLAY),
|
||||
tr("C++ Library"),
|
||||
tr("Creates a C++ library based on qmake. This can be used to create:<ul>"
|
||||
"<li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li>"
|
||||
"<li>a shared or static C++ library for use with another project at linktime</li></ul>"),
|
||||
QIcon(QLatin1String(":/wizards/images/lib.png")))
|
||||
{
|
||||
setId(QLatin1String("H.Qt4Library"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("C++ Library"));
|
||||
setDescription(tr("Creates a C++ library based on qmake. This can be used to create:<ul>"
|
||||
"<li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li>"
|
||||
"<li>a shared or static C++ library for use with another project at linktime</li></ul>"));
|
||||
setIcon(QIcon(QLatin1String(":/wizards/images/lib.png")));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT));
|
||||
}
|
||||
|
||||
QWizard *LibraryWizard::createWizardDialog(QWidget *parent, const Core::WizardDialogParameters &wizardDialogParameters) const
|
||||
@@ -152,10 +153,5 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
|
||||
return rc;
|
||||
}
|
||||
|
||||
Core::FeatureSet LibraryWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QT);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
@@ -36,9 +36,6 @@
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
struct LibraryParameters;
|
||||
class ModulesPage;
|
||||
|
||||
class LibraryWizard : public QtWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -47,12 +44,10 @@ public:
|
||||
LibraryWizard();
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -105,17 +105,14 @@ class QtQuickAppWizardPrivate
|
||||
};
|
||||
|
||||
QtQuickAppWizard::QtQuickAppWizard()
|
||||
: AbstractMobileAppWizard(baseParameters())
|
||||
, d(new QtQuickAppWizardPrivate)
|
||||
: d(new QtQuickAppWizardPrivate)
|
||||
{
|
||||
d->app = new QtQuickApp;
|
||||
d->wizardDialog = 0;
|
||||
}
|
||||
setWizardKind(ProjectWizard);
|
||||
setIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_QTQUICK_APP)));
|
||||
setId(QLatin1String("D.QMLA Application"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
|
||||
QtQuickAppWizard::QtQuickAppWizard(const Core::BaseFileWizardParameters ¶ms, QObject *parent)
|
||||
: AbstractMobileAppWizard(params, parent)
|
||||
, d(new QtQuickAppWizardPrivate)
|
||||
{
|
||||
d->app = new QtQuickApp;
|
||||
d->wizardDialog = 0;
|
||||
}
|
||||
@@ -128,83 +125,68 @@ QtQuickAppWizard::~QtQuickAppWizard()
|
||||
|
||||
void QtQuickAppWizard::createInstances(ExtensionSystem::IPlugin *plugin)
|
||||
{
|
||||
Core::BaseFileWizardParameters base = baseParameters();
|
||||
QList<Core::BaseFileWizardParameters> list;
|
||||
Core::BaseFileWizardParameters parameter;
|
||||
|
||||
const QString basicDescription = tr("Creates a Qt Quick 1 application project that can contain "
|
||||
"both QML and C++ code and includes a QDeclarativeView.\n\n");
|
||||
const QString basicDescription2 = tr("Creates a Qt Quick 2 application project that can contain "
|
||||
"both QML and C++ code and includes a QQuickView.\n\n");
|
||||
|
||||
Core::FeatureSet basicFeatures;
|
||||
basicFeatures = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1);
|
||||
Core::FeatureSet basicFeatures = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1);
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick 1 Application (Built-in Types)"));
|
||||
parameter.setDescription(basicDescription + tr("The built-in QML types in the QtQuick 1 namespace allow "
|
||||
QtQuickAppWizard *wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(QtQuick1_1);
|
||||
wizard->setDisplayName(tr("Qt Quick 1 Application (Built-in Types)"));
|
||||
wizard->setDescription(basicDescription + tr("The built-in QML types in the QtQuick 1 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 4.7.0</b> or newer."));
|
||||
parameter.setRequiredFeatures(basicFeatures);
|
||||
list << parameter;
|
||||
wizard->setRequiredFeatures(basicFeatures);
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick 2 Application (Built-in Types)"));
|
||||
parameter.setDescription(basicDescription2 + tr("The built-in QML types in the QtQuick 2 namespace allow "
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(QtQuick2_0);
|
||||
wizard->setDisplayName(tr("Qt Quick 2 Application (Built-in Types)"));
|
||||
wizard->setDescription(basicDescription2 + tr("The built-in QML types in the QtQuick 2 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 5.0</b> or newer."));
|
||||
parameter.setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2));
|
||||
list << parameter;
|
||||
wizard->setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2));
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick 1 Application for MeeGo Harmattan"));
|
||||
parameter.setDescription(basicDescription + tr("The Qt Quick Components for MeeGo Harmattan are "
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(MeegoComponents);
|
||||
wizard->setDisplayName(tr("Qt Quick 1 Application for MeeGo Harmattan"));
|
||||
wizard->setDescription(basicDescription + tr("The Qt Quick Components for MeeGo Harmattan are "
|
||||
"a set of ready-made components that are designed "
|
||||
"with specific native appearance for the MeeGo Harmattan "
|
||||
"platform.\n\nRequires <b>Qt 4.7.4</b> or newer, and the "
|
||||
"component set installed for your Qt version."));
|
||||
parameter.setRequiredFeatures(basicFeatures | Core::Feature(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO)
|
||||
wizard->setRequiredFeatures(basicFeatures | Core::Feature(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO)
|
||||
| Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1_1));
|
||||
list << parameter;
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick 1 Application (from Existing QML File)"));
|
||||
parameter.setDescription(basicDescription + tr("Creates a deployable Qt Quick application from "
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(ImportQml);
|
||||
wizard->setDisplayName(tr("Qt Quick 1 Application (from Existing QML File)"));
|
||||
wizard->setDescription(basicDescription + tr("Creates a deployable Qt Quick application from "
|
||||
"existing QML files. All files and directories that "
|
||||
"reside in the same directory as the main .qml file "
|
||||
"are deployed. You can modify the contents of the "
|
||||
"directory any time before deploying.\n\nRequires <b>Qt 4.7.0</b> or newer."));
|
||||
parameter.setRequiredFeatures(basicFeatures);
|
||||
list << parameter;
|
||||
wizard->setRequiredFeatures(basicFeatures);
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick 2 Application (from Existing QML File)"));
|
||||
parameter.setDescription(basicDescription2 + tr("Creates a deployable Qt Quick application from "
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(ImportQml2);
|
||||
wizard->setDisplayName(tr("Qt Quick 2 Application (from Existing QML File)"));
|
||||
wizard->setDescription(basicDescription2 + tr("Creates a deployable Qt Quick application from "
|
||||
"existing QML files. All files and directories that "
|
||||
"reside in the same directory as the main .qml file "
|
||||
"are deployed. You can modify the contents of the "
|
||||
"directory any time before deploying.\n\nRequires <b>Qt 5.0</b> or newer."));
|
||||
parameter.setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2));
|
||||
list << parameter;
|
||||
|
||||
QList<QtQuickAppWizard*> wizardList = Core::createMultipleBaseFileWizardInstances<QtQuickAppWizard>(list, plugin);
|
||||
|
||||
Q_ASSERT(wizardList.count() == 5);
|
||||
|
||||
for (int i = 0; i < wizardList.count(); i++) {
|
||||
wizardList.at(i)->setQtQuickKind(Kind(i));
|
||||
}
|
||||
}
|
||||
|
||||
Core::BaseFileWizardParameters QtQuickAppWizard::baseParameters()
|
||||
{
|
||||
Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||
parameters.setIcon(QIcon(QLatin1String(Qt4ProjectManager::Constants::ICON_QTQUICK_APP)));
|
||||
parameters.setId(QLatin1String("D.QMLA Application"));
|
||||
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
parameters.setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
|
||||
return parameters;
|
||||
wizard->setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2));
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
}
|
||||
|
||||
AbstractMobileAppWizardDialog *QtQuickAppWizard::createWizardDialogInternal(QWidget *parent,
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace Internal {
|
||||
class QtQuickAppWizard : public AbstractMobileAppWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
public:
|
||||
enum Kind {
|
||||
QtQuick1_1 = 0,
|
||||
QtQuick2_0 = 1,
|
||||
@@ -49,16 +49,14 @@ public:
|
||||
};
|
||||
|
||||
QtQuickAppWizard();
|
||||
explicit QtQuickAppWizard(const Core::BaseFileWizardParameters ¶ms, QObject *parent = 0);
|
||||
virtual ~QtQuickAppWizard();
|
||||
~QtQuickAppWizard();
|
||||
|
||||
static void createInstances(ExtensionSystem::IPlugin *plugin);
|
||||
|
||||
protected:
|
||||
QString fileToOpenPostGeneration() const;
|
||||
|
||||
private:
|
||||
static Core::BaseFileWizardParameters baseParameters();
|
||||
|
||||
virtual AbstractMobileApp *app() const;
|
||||
virtual AbstractMobileAppWizardDialog *wizardDialog() const;
|
||||
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent,
|
||||
|
||||
@@ -53,38 +53,10 @@ using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
static Core::BaseFileWizardParameters
|
||||
wizardParameters(const QString &id,
|
||||
const QString &category,
|
||||
const QString &displayCategory,
|
||||
const QString &name,
|
||||
const QString &description,
|
||||
const QIcon &icon)
|
||||
{
|
||||
Core::BaseFileWizardParameters rc(Core::IWizard::ProjectWizard);
|
||||
rc.setCategory(category);
|
||||
rc.setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
displayCategory.toLatin1()));
|
||||
rc.setIcon(icon);
|
||||
rc.setDisplayName(name);
|
||||
rc.setId(id);
|
||||
rc.setDescription(description);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// -------------------- QtWizard
|
||||
QtWizard::QtWizard(const QString &id,
|
||||
const QString &category,
|
||||
const QString &displayCategory,
|
||||
const QString &name,
|
||||
const QString &description, const QIcon &icon) :
|
||||
Core::BaseFileWizard(wizardParameters(id,
|
||||
category,
|
||||
displayCategory,
|
||||
name,
|
||||
description,
|
||||
icon))
|
||||
QtWizard::QtWizard()
|
||||
{
|
||||
setWizardKind(Core::IWizard::ProjectWizard);
|
||||
}
|
||||
|
||||
QString QtWizard::sourceSuffix()
|
||||
@@ -156,14 +128,12 @@ bool QtWizard::showModulesPageForLibraries()
|
||||
}
|
||||
|
||||
// ------------ CustomQt4ProjectWizard
|
||||
CustomQt4ProjectWizard::CustomQt4ProjectWizard(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent) :
|
||||
ProjectExplorer::CustomProjectWizard(baseFileParameters, parent)
|
||||
CustomQt4ProjectWizard::CustomQt4ProjectWizard()
|
||||
{
|
||||
}
|
||||
|
||||
QWizard *CustomQt4ProjectWizard::createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const
|
||||
QWizard *CustomQt4ProjectWizard::createWizardDialog
|
||||
(QWidget *parent, const Core::WizardDialogParameters &wizardDialogParameters) const
|
||||
{
|
||||
BaseQt4ProjectWizardDialog *wizard = new BaseQt4ProjectWizardDialog(false, parent, wizardDialogParameters);
|
||||
|
||||
|
||||
@@ -58,15 +58,9 @@ class QtWizard : public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QtWizard(const QString &id,
|
||||
const QString &category,
|
||||
const QString &displayCategory,
|
||||
const QString &name,
|
||||
const QString &description,
|
||||
const QIcon &icon);
|
||||
QtWizard();
|
||||
|
||||
public:
|
||||
|
||||
static QString templateDir();
|
||||
|
||||
static QString sourceSuffix();
|
||||
@@ -88,17 +82,18 @@ private:
|
||||
};
|
||||
|
||||
// A custom wizard with an additional Qt 4 target page
|
||||
class CustomQt4ProjectWizard : public ProjectExplorer::CustomProjectWizard {
|
||||
class CustomQt4ProjectWizard : public ProjectExplorer::CustomProjectWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomQt4ProjectWizard(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||
QObject *parent = 0);
|
||||
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
public:
|
||||
CustomQt4ProjectWizard();
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
protected:
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
virtual bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
|
||||
private:
|
||||
|
||||
@@ -35,20 +35,22 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <QIcon>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
SubdirsProjectWizard::SubdirsProjectWizard()
|
||||
: QtWizard(QLatin1String("U.Qt4Subdirs"),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY),
|
||||
tr("Subdirs Project"),
|
||||
tr("Creates a qmake-based subdirs project. This allows you to group "
|
||||
"your projects in a tree structure."),
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
||||
{
|
||||
setId(QLatin1String("U.Qt4Subdirs"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Subdirs Project"));
|
||||
setDescription(tr("Creates a qmake-based subdirs project. This allows you to group "
|
||||
"your projects in a tree structure."));
|
||||
setIcon(QIcon(QLatin1String(":/wizards/images/gui.png")));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT));
|
||||
}
|
||||
|
||||
QWizard *SubdirsProjectWizard::createWizardDialog(QWidget *parent,
|
||||
@@ -97,10 +99,5 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::FeatureSet SubdirsProjectWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QT);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
@@ -42,14 +42,12 @@ class SubdirsProjectWizard : public QtWizard
|
||||
public:
|
||||
SubdirsProjectWizard();
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
private:
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
virtual bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -36,24 +36,26 @@
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QTextStream>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
TestWizard::TestWizard() :
|
||||
QtWizard(QLatin1String("L.Qt4Test"),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY),
|
||||
QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY),
|
||||
tr("Qt Unit Test"),
|
||||
tr("Creates a QTestLib-based unit test for a feature or a class. "
|
||||
"Unit tests allow you to verify that the code is fit for use "
|
||||
"and that there are no regressions."),
|
||||
QIcon(QLatin1String(":/wizards/images/console.png")))
|
||||
TestWizard::TestWizard()
|
||||
{
|
||||
setId(QLatin1String("L.Qt4Test"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Qt Unit Test"));
|
||||
setDescription(tr("Creates a QTestLib-based unit test for a feature or a class. "
|
||||
"Unit tests allow you to verify that the code is fit for use "
|
||||
"and that there are no regressions."));
|
||||
setIcon(QIcon(QLatin1String(":/wizards/images/console.png")));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE) |
|
||||
Core::Feature(QtSupport::Constants::FEATURE_QT));
|
||||
}
|
||||
|
||||
QWizard *TestWizard::createWizardDialog(QWidget *parent,
|
||||
@@ -181,11 +183,5 @@ Core::GeneratedFiles TestWizard::generateFiles(const QWizard *w, QString *errorM
|
||||
return Core::GeneratedFiles() << source << profile;
|
||||
}
|
||||
|
||||
Core::FeatureSet TestWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE) |
|
||||
Core::Feature(QtSupport::Constants::FEATURE_QT);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
@@ -41,14 +41,12 @@ class TestWizard : public QtWizard
|
||||
|
||||
public:
|
||||
TestWizard();
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
protected:
|
||||
virtual QWizard *createWizardDialog(QWidget *parent,
|
||||
QWizard *createWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters &wizardDialogParameters) const;
|
||||
|
||||
virtual Core::GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -73,14 +73,13 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
|
||||
m_editor = new ResourceEditorFactory(this);
|
||||
addObject(m_editor);
|
||||
|
||||
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
wizardParameters.setDescription(tr("Creates a Qt Resource file (.qrc) that you can add to a Qt Widget Project."));
|
||||
wizardParameters.setDisplayName(tr("Qt Resource file"));
|
||||
wizardParameters.setId(QLatin1String("F.Resource"));
|
||||
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizardParameters.setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
m_wizard = new ResourceWizard(this);
|
||||
m_wizard->setDescription(tr("Creates a Qt Resource file (.qrc) that you can add to a Qt Widget Project."));
|
||||
m_wizard->setDisplayName(tr("Qt Resource file"));
|
||||
m_wizard->setId(QLatin1String("F.Resource"));
|
||||
m_wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
m_wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
|
||||
m_wizard = new ResourceWizard(wizardParameters, this);
|
||||
addObject(m_wizard);
|
||||
|
||||
errorMessage->clear();
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
using namespace ResourceEditor;
|
||||
using namespace ResourceEditor::Internal;
|
||||
|
||||
ResourceWizard::ResourceWizard(const BaseFileWizardParameters ¶meters, QObject *parent)
|
||||
: Core::StandardFileWizard(parameters, parent)
|
||||
ResourceWizard::ResourceWizard(QObject *parent)
|
||||
: Core::StandardFileWizard(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,7 @@ class ResourceWizard : public Core::StandardFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
explicit ResourceWizard(const BaseFileWizardParameters ¶meters, QObject *parent);
|
||||
explicit ResourceWizard(QObject *parent);
|
||||
|
||||
protected:
|
||||
virtual Core::GeneratedFiles
|
||||
|
||||
@@ -42,25 +42,12 @@
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
CheckoutWizard::CheckoutWizard(QObject *parent) :
|
||||
VcsBase::BaseCheckoutWizard(parent)
|
||||
CheckoutWizard::CheckoutWizard()
|
||||
{
|
||||
setId(QLatin1String(VcsBase::Constants::VCS_ID_SUBVERSION));
|
||||
}
|
||||
|
||||
QIcon CheckoutWizard::icon() const
|
||||
{
|
||||
return QIcon(QLatin1String(":/subversion/images/subversion.png"));
|
||||
}
|
||||
|
||||
QString CheckoutWizard::description() const
|
||||
{
|
||||
return tr("Checks out a Subversion repository and tries to load the contained project.");
|
||||
}
|
||||
|
||||
QString CheckoutWizard::displayName() const
|
||||
{
|
||||
return tr("Subversion Checkout");
|
||||
setIcon(QIcon(QLatin1String(":/subversion/images/subversion.png")));
|
||||
setDescription(tr("Checks out a Subversion repository and tries to load the contained project."));
|
||||
setDisplayName(tr("Subversion Checkout"));
|
||||
}
|
||||
|
||||
QList<QWizardPage*> CheckoutWizard::createParameterPages(const QString &path)
|
||||
|
||||
@@ -38,15 +38,11 @@ namespace Internal {
|
||||
class CheckoutWizard : public VcsBase::BaseCheckoutWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CheckoutWizard(QObject *parent = 0);
|
||||
CheckoutWizard();
|
||||
|
||||
// IWizard
|
||||
QIcon icon() const;
|
||||
QString description() const;
|
||||
QString displayName() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
// BaseCheckoutWizard
|
||||
QList<QWizardPage*> createParameterPages(const QString &path);
|
||||
VcsBase::Command *createCommand(const QList<QWizardPage*> ¶meterPage,
|
||||
|
||||
@@ -102,25 +102,18 @@ class ScratchFileWizard : public Core::IWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
virtual WizardKind kind() const { return FileWizard; }
|
||||
virtual QIcon icon() const { return QIcon(); }
|
||||
virtual QString description() const
|
||||
{ return TextEditorPlugin::tr("Creates a scratch buffer using a temporary file."); }
|
||||
virtual QString displayName() const
|
||||
{ return TextEditorPlugin::tr("Scratch Buffer"); }
|
||||
virtual QString id() const
|
||||
{ return QLatin1String("Z.ScratchFile"); }
|
||||
virtual QString category() const
|
||||
{ return QLatin1String(wizardCategoryC); }
|
||||
virtual QString displayCategory() const
|
||||
{ return wizardDisplayCategory(); }
|
||||
virtual QString descriptionImage() const
|
||||
{ return QString(); }
|
||||
virtual Core::FeatureSet requiredFeatures() const
|
||||
{ return Core::FeatureSet(); }
|
||||
virtual WizardFlags flags() const
|
||||
{ return Core::IWizard::PlatformIndependent; }
|
||||
virtual void runWizard(const QString &, QWidget *, const QString &, const QVariantMap &)
|
||||
ScratchFileWizard()
|
||||
{
|
||||
setWizardKind(FileWizard);
|
||||
setDescription(TextEditorPlugin::tr("Creates a scratch buffer using a temporary file."));
|
||||
setDisplayName(TextEditorPlugin::tr("Scratch Buffer"));
|
||||
setId(QLatin1String("Z.ScratchFile"));
|
||||
setCategory(QLatin1String(wizardCategoryC));
|
||||
setDisplayCategory(wizardDisplayCategory());
|
||||
setFlags(Core::IWizard::PlatformIndependent);
|
||||
}
|
||||
|
||||
void runWizard(const QString &, QWidget *, const QString &, const QVariantMap &)
|
||||
{ createFile(); }
|
||||
|
||||
public Q_SLOTS:
|
||||
@@ -148,16 +141,16 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
|
||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage))
|
||||
return false;
|
||||
|
||||
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
wizardParameters.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."));
|
||||
wizardParameters.setDisplayName(tr("Text File"));
|
||||
wizardParameters.setCategory(QLatin1String(wizardCategoryC));
|
||||
wizardParameters.setDisplayCategory(wizardDisplayCategory());
|
||||
wizardParameters.setFlags(Core::IWizard::PlatformIndependent);
|
||||
TextFileWizard *wizard = new TextFileWizard(QLatin1String(Constants::C_TEXTEDITOR_MIMETYPE_TEXT),
|
||||
QLatin1String("text$"),
|
||||
wizardParameters);
|
||||
QLatin1String("text$"));
|
||||
wizard->setWizardKind(Core::IWizard::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);
|
||||
|
||||
// Add text file wizard
|
||||
addAutoReleasedObject(wizard);
|
||||
ScratchFileWizard *scratchFile = new ScratchFileWizard;
|
||||
|
||||
@@ -28,15 +28,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "textfilewizard.h"
|
||||
#include <QDebug>
|
||||
|
||||
using namespace TextEditor;
|
||||
namespace TextEditor {
|
||||
|
||||
TextFileWizard::TextFileWizard(const QString &mimeType,
|
||||
const QString &suggestedFileName,
|
||||
const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent) :
|
||||
Core::StandardFileWizard(parameters, parent),
|
||||
const QString &suggestedFileName) :
|
||||
m_mimeType(mimeType),
|
||||
m_suggestedFileName(suggestedFileName)
|
||||
{
|
||||
@@ -52,3 +48,5 @@ Core::GeneratedFiles
|
||||
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
||||
return Core::GeneratedFiles() << file;
|
||||
}
|
||||
|
||||
} // namespace TextEditor
|
||||
|
||||
@@ -41,11 +41,8 @@ class TEXTEDITOR_EXPORT TextFileWizard : public Core::StandardFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
|
||||
TextFileWizard(const QString &mimeType,
|
||||
const QString &suggestedFileName,
|
||||
const BaseFileWizardParameters ¶meters,
|
||||
QObject *parent = 0);
|
||||
const QString &suggestedFileName);
|
||||
|
||||
protected:
|
||||
virtual Core::GeneratedFiles
|
||||
|
||||
@@ -71,7 +71,6 @@ public:
|
||||
Internal::CheckoutWizardDialog *dialog;
|
||||
QList<QWizardPage *> parameterPages;
|
||||
QString checkoutPath;
|
||||
QString id;
|
||||
QString progressTitle;
|
||||
QString startedStatus;
|
||||
};
|
||||
@@ -89,6 +88,11 @@ BaseCheckoutWizard::BaseCheckoutWizard(QObject *parent) :
|
||||
Core::IWizard(parent),
|
||||
d(new Internal::BaseCheckoutWizardPrivate)
|
||||
{
|
||||
setWizardKind(IWizard::ProjectWizard);
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
|
||||
ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY_DISPLAY));
|
||||
setFlags(Core::IWizard::PlatformIndependent);
|
||||
}
|
||||
|
||||
BaseCheckoutWizard::~BaseCheckoutWizard()
|
||||
@@ -96,36 +100,6 @@ BaseCheckoutWizard::~BaseCheckoutWizard()
|
||||
delete d;
|
||||
}
|
||||
|
||||
Core::IWizard::WizardKind BaseCheckoutWizard::kind() const
|
||||
{
|
||||
return Core::IWizard::ProjectWizard;
|
||||
}
|
||||
|
||||
QString BaseCheckoutWizard::category() const
|
||||
{
|
||||
return QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY);
|
||||
}
|
||||
|
||||
QString BaseCheckoutWizard::displayCategory() const
|
||||
{
|
||||
return QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY_DISPLAY);
|
||||
}
|
||||
|
||||
QString BaseCheckoutWizard::id() const
|
||||
{
|
||||
return d->id;
|
||||
}
|
||||
|
||||
QString BaseCheckoutWizard::descriptionImage() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
void BaseCheckoutWizard::setId(const QString &id)
|
||||
{
|
||||
d->id = id;
|
||||
}
|
||||
|
||||
void BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent, const QString & /*platform*/, const QVariantMap &extraValues)
|
||||
{
|
||||
Q_UNUSED(extraValues)
|
||||
@@ -154,16 +128,6 @@ void BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent, const Q
|
||||
}
|
||||
}
|
||||
|
||||
Core::FeatureSet BaseCheckoutWizard::requiredFeatures() const
|
||||
{
|
||||
return Core::FeatureSet();
|
||||
}
|
||||
|
||||
Core::IWizard::WizardFlags BaseCheckoutWizard::flags() const
|
||||
{
|
||||
return Core::IWizard::PlatformIndependent;
|
||||
}
|
||||
|
||||
static inline QString msgNoProjectFiles(const QDir &dir, const QStringList &patterns)
|
||||
{
|
||||
return BaseCheckoutWizard::tr("Could not find any project files matching (%1) in the directory '%2'.").arg(patterns.join(QLatin1String(", ")), QDir::toNativeSeparators(dir.absolutePath()));
|
||||
|
||||
@@ -53,21 +53,9 @@ class VCSBASE_EXPORT BaseCheckoutWizard : public Core::IWizard
|
||||
|
||||
public:
|
||||
explicit BaseCheckoutWizard(QObject *parent = 0);
|
||||
virtual ~BaseCheckoutWizard();
|
||||
~BaseCheckoutWizard();
|
||||
|
||||
virtual WizardKind kind() const;
|
||||
|
||||
virtual QString category() const;
|
||||
virtual QString displayCategory() const;
|
||||
virtual QString id() const;
|
||||
|
||||
virtual QString descriptionImage() const;
|
||||
|
||||
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues);
|
||||
|
||||
virtual Core::FeatureSet requiredFeatures() const;
|
||||
|
||||
virtual WizardFlags flags() const;
|
||||
void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues);
|
||||
|
||||
static QString openProject(const QString &path, QString *errorMessage);
|
||||
|
||||
@@ -77,9 +65,6 @@ protected:
|
||||
virtual Command *createCommand(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath) = 0;
|
||||
|
||||
public slots:
|
||||
void setId(const QString &id);
|
||||
|
||||
private slots:
|
||||
void slotProgressPageShown();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user