From e607005096a6c01bb4d7763efdb76ceb50f5ee7f Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 21 Jul 2023 10:52:11 +0200 Subject: [PATCH] ScxmlEditor: Simplify plugin setup Change-Id: Ib28cca1c24780a710f6eae29d168203cbf235ef2 Reviewed-by: Jarek Kobus --- src/plugins/scxmleditor/CMakeLists.txt | 2 +- src/plugins/scxmleditor/scxmleditor.qbs | 2 +- src/plugins/scxmleditor/scxmleditorplugin.cpp | 46 +++++++++---------- src/plugins/scxmleditor/scxmleditorplugin.h | 26 ----------- 4 files changed, 24 insertions(+), 52 deletions(-) delete mode 100644 src/plugins/scxmleditor/scxmleditorplugin.h diff --git a/src/plugins/scxmleditor/CMakeLists.txt b/src/plugins/scxmleditor/CMakeLists.txt index 358c407233c..396a03820e3 100644 --- a/src/plugins/scxmleditor/CMakeLists.txt +++ b/src/plugins/scxmleditor/CMakeLists.txt @@ -89,7 +89,7 @@ add_qtc_plugin(ScxmlEditor scxmleditordata.cpp scxmleditordata.h scxmleditordocument.cpp scxmleditordocument.h scxmleditorfactory.cpp scxmleditorfactory.h - scxmleditorplugin.cpp scxmleditorplugin.h + scxmleditorplugin.cpp scxmleditorstack.cpp scxmleditorstack.h scxmltexteditor.cpp scxmltexteditor.h ) diff --git a/src/plugins/scxmleditor/scxmleditor.qbs b/src/plugins/scxmleditor/scxmleditor.qbs index d8457e6e1a3..3f8bbad3d03 100644 --- a/src/plugins/scxmleditor/scxmleditor.qbs +++ b/src/plugins/scxmleditor/scxmleditor.qbs @@ -24,7 +24,7 @@ QtcPlugin { "scxmleditordata.cpp", "scxmleditordata.h", "scxmleditordocument.cpp", "scxmleditordocument.h", "scxmleditorfactory.cpp", "scxmleditorfactory.h", - "scxmleditorplugin.cpp", "scxmleditorplugin.h", + "scxmleditorplugin.cpp", "scxmleditorstack.cpp", "scxmleditorstack.h", "scxmltexteditor.cpp", "scxmltexteditor.h", ] diff --git a/src/plugins/scxmleditor/scxmleditorplugin.cpp b/src/plugins/scxmleditor/scxmleditorplugin.cpp index f2a0de589e2..fdf554b7e40 100644 --- a/src/plugins/scxmleditor/scxmleditorplugin.cpp +++ b/src/plugins/scxmleditor/scxmleditorplugin.cpp @@ -1,37 +1,35 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#include "scxmleditorplugin.h" - #include "scxmleditorfactory.h" +#include + #include -using namespace Core; +#include -namespace ScxmlEditor { -namespace Internal { +namespace ScxmlEditor::Internal { -class ScxmlEditorPluginPrivate +class ScxmlEditorPlugin : public ExtensionSystem::IPlugin { -public: - ScxmlEditorFactory editorFactory; + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ScxmlEditor.json") + +private: + void initialize() final + { + editorFactory = std::make_unique(); + } + + void extensionsInitialized() final + { + DesignMode::setDesignModeIsRequired(); + } + + std::unique_ptr editorFactory; }; -ScxmlEditorPlugin::~ScxmlEditorPlugin() -{ - delete d; -} +} // ScxmlEditor::Internal -void ScxmlEditorPlugin::initialize() -{ - d = new ScxmlEditorPluginPrivate; -} - -void ScxmlEditorPlugin::extensionsInitialized() -{ - DesignMode::setDesignModeIsRequired(); -} - -} // Internal -} // ScxmlEditor +#include "scxmleditorplugin.moc" diff --git a/src/plugins/scxmleditor/scxmleditorplugin.h b/src/plugins/scxmleditor/scxmleditorplugin.h deleted file mode 100644 index 485ba92def0..00000000000 --- a/src/plugins/scxmleditor/scxmleditorplugin.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include - -namespace ScxmlEditor { -namespace Internal { - -class ScxmlEditorPlugin : public ExtensionSystem::IPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ScxmlEditor.json") - -public: - ScxmlEditorPlugin() = default; - ~ScxmlEditorPlugin(); - -private: - void initialize() final; - void extensionsInitialized() final; - - class ScxmlEditorPluginPrivate *d = nullptr; -}; - -} // namespace Internal -} // namespace ScxmlEditor