From 5efd576020a5407cd09a86112e5655e621e9d53f Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 8 Feb 2018 09:42:38 +0100 Subject: ScxmlEditor: Avoid use of global object pool Including some code cosmetics. Change-Id: I6d7f11404ea489020d0c74e43cbe25cdcaa48e85 Reviewed-by: Christian Stenger --- src/plugins/scxmleditor/scxmleditorfactory.cpp | 3 ++- src/plugins/scxmleditor/scxmleditorfactory.h | 2 +- src/plugins/scxmleditor/scxmleditorplugin.cpp | 25 +++++-------------------- src/plugins/scxmleditor/scxmleditorplugin.h | 9 ++++----- 4 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/plugins/scxmleditor/scxmleditorfactory.cpp b/src/plugins/scxmleditor/scxmleditorfactory.cpp index 6a923237d1..013ce959e7 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.cpp +++ b/src/plugins/scxmleditor/scxmleditorfactory.cpp @@ -38,7 +38,8 @@ using namespace ScxmlEditor::Constants; using namespace ScxmlEditor::Internal; -ScxmlEditorFactory::ScxmlEditorFactory() +ScxmlEditorFactory::ScxmlEditorFactory(QObject *parent) + : IEditorFactory(parent) { setId(K_SCXML_EDITOR_ID); setDisplayName(QCoreApplication::translate("ScxmlEditor", C_SCXMLEDITOR_DISPLAY_NAME)); diff --git a/src/plugins/scxmleditor/scxmleditorfactory.h b/src/plugins/scxmleditor/scxmleditorfactory.h index 1e621e0615..8732d94acc 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.h +++ b/src/plugins/scxmleditor/scxmleditorfactory.h @@ -37,7 +37,7 @@ class ScxmlEditorFactory : public Core::IEditorFactory Q_OBJECT public: - explicit ScxmlEditorFactory(); + explicit ScxmlEditorFactory(QObject *parent); Core::IEditor *createEditor() override; diff --git a/src/plugins/scxmleditor/scxmleditorplugin.cpp b/src/plugins/scxmleditor/scxmleditorplugin.cpp index 30bddf6b2f..d8b1514a17 100644 --- a/src/plugins/scxmleditor/scxmleditorplugin.cpp +++ b/src/plugins/scxmleditor/scxmleditorplugin.cpp @@ -24,34 +24,21 @@ ****************************************************************************/ #include "scxmleditorplugin.h" -#include "scxmleditorconstants.h" #include "scxmleditorfactory.h" -#include #include -#include -#include - -#include -#include -#include -#include - -#include using namespace Core; -using namespace ScxmlEditor::Internal; -ScxmlEditorPlugin::ScxmlEditorPlugin() -{ -} +namespace ScxmlEditor { +namespace Internal { bool ScxmlEditorPlugin::initialize(const QStringList &arguments, QString *errorString) { Q_UNUSED(arguments) Q_UNUSED(errorString) - addAutoReleasedObject(new ScxmlEditorFactory); + (void) new ScxmlEditorFactory(this); return true; } @@ -61,7 +48,5 @@ void ScxmlEditorPlugin::extensionsInitialized() DesignMode::setDesignModeIsRequired(); } -ExtensionSystem::IPlugin::ShutdownFlag ScxmlEditorPlugin::aboutToShutdown() -{ - return SynchronousShutdown; -} +} // Internal +} // ScxmlEditor diff --git a/src/plugins/scxmleditor/scxmleditorplugin.h b/src/plugins/scxmleditor/scxmleditorplugin.h index 71e8552ccf..5555577373 100644 --- a/src/plugins/scxmleditor/scxmleditorplugin.h +++ b/src/plugins/scxmleditor/scxmleditorplugin.h @@ -22,7 +22,6 @@ ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ -#include "scxmleditor_global.h" #include @@ -35,11 +34,11 @@ class ScxmlEditorPlugin : public ExtensionSystem::IPlugin Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ScxmlEditor.json") public: - ScxmlEditorPlugin(); + ScxmlEditorPlugin() = default; - bool initialize(const QStringList &arguments, QString *errorString) override; - void extensionsInitialized() override; - ShutdownFlag aboutToShutdown() override; +private: + bool initialize(const QStringList &arguments, QString *errorString) final; + void extensionsInitialized() final; }; } // namespace Internal -- cgit v1.2.1