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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user