ScxmlEditor: Simplify plugin setup

Change-Id: Ib28cca1c24780a710f6eae29d168203cbf235ef2
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-07-21 10:52:11 +02:00
parent c9505c4412
commit e607005096
4 changed files with 24 additions and 52 deletions

View File

@@ -89,7 +89,7 @@ add_qtc_plugin(ScxmlEditor
scxmleditordata.cpp scxmleditordata.h scxmleditordata.cpp scxmleditordata.h
scxmleditordocument.cpp scxmleditordocument.h scxmleditordocument.cpp scxmleditordocument.h
scxmleditorfactory.cpp scxmleditorfactory.h scxmleditorfactory.cpp scxmleditorfactory.h
scxmleditorplugin.cpp scxmleditorplugin.h scxmleditorplugin.cpp
scxmleditorstack.cpp scxmleditorstack.h scxmleditorstack.cpp scxmleditorstack.h
scxmltexteditor.cpp scxmltexteditor.h scxmltexteditor.cpp scxmltexteditor.h
) )

View File

@@ -24,7 +24,7 @@ QtcPlugin {
"scxmleditordata.cpp", "scxmleditordata.h", "scxmleditordata.cpp", "scxmleditordata.h",
"scxmleditordocument.cpp", "scxmleditordocument.h", "scxmleditordocument.cpp", "scxmleditordocument.h",
"scxmleditorfactory.cpp", "scxmleditorfactory.h", "scxmleditorfactory.cpp", "scxmleditorfactory.h",
"scxmleditorplugin.cpp", "scxmleditorplugin.h", "scxmleditorplugin.cpp",
"scxmleditorstack.cpp", "scxmleditorstack.h", "scxmleditorstack.cpp", "scxmleditorstack.h",
"scxmltexteditor.cpp", "scxmltexteditor.h", "scxmltexteditor.cpp", "scxmltexteditor.h",
] ]

View File

@@ -1,37 +1,35 @@
// Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "scxmleditorplugin.h"
#include "scxmleditorfactory.h" #include "scxmleditorfactory.h"
#include <extensionsystem/iplugin.h>
#include <coreplugin/designmode.h> #include <coreplugin/designmode.h>
using namespace Core; #include <memory>
namespace ScxmlEditor { namespace ScxmlEditor::Internal {
namespace Internal {
class ScxmlEditorPluginPrivate class ScxmlEditorPlugin : public ExtensionSystem::IPlugin
{ {
public: Q_OBJECT
ScxmlEditorFactory editorFactory; Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ScxmlEditor.json")
private:
void initialize() final
{
editorFactory = std::make_unique<ScxmlEditorFactory>();
}
void extensionsInitialized() final
{
DesignMode::setDesignModeIsRequired();
}
std::unique_ptr<ScxmlEditorFactory> editorFactory;
}; };
ScxmlEditorPlugin::~ScxmlEditorPlugin() } // ScxmlEditor::Internal
{
delete d;
}
void ScxmlEditorPlugin::initialize() #include "scxmleditorplugin.moc"
{
d = new ScxmlEditorPluginPrivate;
}
void ScxmlEditorPlugin::extensionsInitialized()
{
DesignMode::setDesignModeIsRequired();
}
} // Internal
} // ScxmlEditor

View File

@@ -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 <extensionsystem/iplugin.h>
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