summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2013-09-20 15:12:44 +0200
committerhjk <hjk121@nokiamail.com>2013-09-24 09:57:32 +0200
commit49d0789e641e118dd412d3094e1f121f6ddfcb86 (patch)
tree8c19f6d76670e4c097edc44338b2b9813ebb0cb9 /src/plugins/cppeditor
parentaa32c2be87f7192e03f06b8b5223100354e269a6 (diff)
downloadqt-creator-49d0789e641e118dd412d3094e1f121f6ddfcb86.tar.gz
Cleanup IWizard interface and users
Added 639 lines, removed 1391. Change-Id: I15ec7dd056d4f7ad79c6dd6a4181007ad14f6a43 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/cppeditor')
-rw-r--r--src/plugins/cppeditor/cppclasswizard.cpp9
-rw-r--r--src/plugins/cppeditor/cppclasswizard.h13
-rw-r--r--src/plugins/cppeditor/cppeditorplugin.cpp51
-rw-r--r--src/plugins/cppeditor/cppfilewizard.cpp8
-rw-r--r--src/plugins/cppeditor/cppfilewizard.h9
5 files changed, 38 insertions, 52 deletions
diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp
index b7358be5db..d56ea5cc5d 100644
--- a/src/plugins/cppeditor/cppclasswizard.cpp
+++ b/src/plugins/cppeditor/cppclasswizard.cpp
@@ -140,17 +140,10 @@ CppClassWizardParameters CppClassWizardDialog::parameters() const
// ========= CppClassWizard =========
-CppClassWizard::CppClassWizard(const Core::BaseFileWizardParameters &parameters,
- 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));
diff --git a/src/plugins/cppeditor/cppclasswizard.h b/src/plugins/cppeditor/cppclasswizard.h
index 0fe581e278..7fc40ec74e 100644
--- a/src/plugins/cppeditor/cppclasswizard.h
+++ b/src/plugins/cppeditor/cppclasswizard.h
@@ -96,25 +96,20 @@ class CppClassWizard : public Core::BaseFileWizard
Q_OBJECT
public:
- explicit CppClassWizard(const Core::BaseFileWizardParameters &parameters,
- 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 &params,
QString *header, QString *source);
-
};
} // namespace Internal
diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp
index 17afbf148e..3b939b49d0 100644
--- a/src/plugins/cppeditor/cppeditorplugin.cpp
+++ b/src/plugins/cppeditor/cppeditorplugin.cpp
@@ -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);
-
- 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));
-
- 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));
-
- 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));
+ QString trCat = QCoreApplication::translate(Constants::WIZARD_CATEGORY, Constants::WIZARD_TR_CATEGORY);
+
+ 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);
+
+ 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);
+
+ 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);
diff --git a/src/plugins/cppeditor/cppfilewizard.cpp b/src/plugins/cppeditor/cppfilewizard.cpp
index 6fa07c58b2..262a2acaec 100644
--- a/src/plugins/cppeditor/cppfilewizard.cpp
+++ b/src/plugins/cppeditor/cppfilewizard.cpp
@@ -43,18 +43,14 @@ using namespace CppEditor::Internal;
enum { debugWizard = 0 };
-CppFileWizard::CppFileWizard(const BaseFileWizardParameters &parameters,
- 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));
diff --git a/src/plugins/cppeditor/cppfilewizard.h b/src/plugins/cppeditor/cppfilewizard.h
index 7b9f05174c..38bea28a47 100644
--- a/src/plugins/cppeditor/cppfilewizard.h
+++ b/src/plugins/cppeditor/cppfilewizard.h
@@ -42,16 +42,11 @@ class CppFileWizard : public Core::StandardFileWizard
Q_OBJECT
public:
- typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
+ CppFileWizard(FileType type);
- CppFileWizard(const BaseFileWizardParameters &parameters,
- 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;