ScxmlEditor: Avoid use of global object pool

Including some code cosmetics.

Change-Id: I6d7f11404ea489020d0c74e43cbe25cdcaa48e85
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-02-08 09:42:38 +01:00
parent abe57f73b4
commit 5efd576020
4 changed files with 12 additions and 27 deletions

View File

@@ -38,7 +38,8 @@
using namespace ScxmlEditor::Constants; using namespace ScxmlEditor::Constants;
using namespace ScxmlEditor::Internal; using namespace ScxmlEditor::Internal;
ScxmlEditorFactory::ScxmlEditorFactory() ScxmlEditorFactory::ScxmlEditorFactory(QObject *parent)
: IEditorFactory(parent)
{ {
setId(K_SCXML_EDITOR_ID); setId(K_SCXML_EDITOR_ID);
setDisplayName(QCoreApplication::translate("ScxmlEditor", C_SCXMLEDITOR_DISPLAY_NAME)); setDisplayName(QCoreApplication::translate("ScxmlEditor", C_SCXMLEDITOR_DISPLAY_NAME));

View File

@@ -37,7 +37,7 @@ class ScxmlEditorFactory : public Core::IEditorFactory
Q_OBJECT Q_OBJECT
public: public:
explicit ScxmlEditorFactory(); explicit ScxmlEditorFactory(QObject *parent);
Core::IEditor *createEditor() override; Core::IEditor *createEditor() override;

View File

@@ -24,34 +24,21 @@
****************************************************************************/ ****************************************************************************/
#include "scxmleditorplugin.h" #include "scxmleditorplugin.h"
#include "scxmleditorconstants.h"
#include "scxmleditorfactory.h" #include "scxmleditorfactory.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/designmode.h> #include <coreplugin/designmode.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <QAction>
#include <QMainWindow>
#include <QMenu>
#include <QMessageBox>
#include <QtPlugin>
using namespace Core; using namespace Core;
using namespace ScxmlEditor::Internal;
ScxmlEditorPlugin::ScxmlEditorPlugin() namespace ScxmlEditor {
{ namespace Internal {
}
bool ScxmlEditorPlugin::initialize(const QStringList &arguments, QString *errorString) bool ScxmlEditorPlugin::initialize(const QStringList &arguments, QString *errorString)
{ {
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorString) Q_UNUSED(errorString)
addAutoReleasedObject(new ScxmlEditorFactory); (void) new ScxmlEditorFactory(this);
return true; return true;
} }
@@ -61,7 +48,5 @@ void ScxmlEditorPlugin::extensionsInitialized()
DesignMode::setDesignModeIsRequired(); DesignMode::setDesignModeIsRequired();
} }
ExtensionSystem::IPlugin::ShutdownFlag ScxmlEditorPlugin::aboutToShutdown() } // Internal
{ } // ScxmlEditor
return SynchronousShutdown;
}

View File

@@ -22,7 +22,6 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** **
****************************************************************************/ ****************************************************************************/
#include "scxmleditor_global.h"
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
@@ -35,11 +34,11 @@ class ScxmlEditorPlugin : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ScxmlEditor.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ScxmlEditor.json")
public: public:
ScxmlEditorPlugin(); ScxmlEditorPlugin() = default;
bool initialize(const QStringList &arguments, QString *errorString) override; private:
void extensionsInitialized() override; bool initialize(const QStringList &arguments, QString *errorString) final;
ShutdownFlag aboutToShutdown() override; void extensionsInitialized() final;
}; };
} // namespace Internal } // namespace Internal