diff options
Diffstat (limited to 'src/plugins/cppeditor')
-rw-r--r-- | src/plugins/cppeditor/cppclasswizard.cpp | 9 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppclasswizard.h | 13 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditorplugin.cpp | 51 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppfilewizard.cpp | 8 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppfilewizard.h | 9 |
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 ¶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)); 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 ¶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 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 ¶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)); 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 ¶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; |