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
scxmleditordocument.cpp scxmleditordocument.h
scxmleditorfactory.cpp scxmleditorfactory.h
scxmleditorplugin.cpp scxmleditorplugin.h
scxmleditorplugin.cpp
scxmleditorstack.cpp scxmleditorstack.h
scxmltexteditor.cpp scxmltexteditor.h
)

View File

@@ -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",
]

View File

@@ -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 <extensionsystem/iplugin.h>
#include <coreplugin/designmode.h>
using namespace Core;
#include <memory>
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")
ScxmlEditorPlugin::~ScxmlEditorPlugin()
private:
void initialize() final
{
delete d;
editorFactory = std::make_unique<ScxmlEditorFactory>();
}
void ScxmlEditorPlugin::initialize()
{
d = new ScxmlEditorPluginPrivate;
}
void ScxmlEditorPlugin::extensionsInitialized()
void extensionsInitialized() final
{
DesignMode::setDesignModeIsRequired();
}
} // Internal
} // ScxmlEditor
std::unique_ptr<ScxmlEditorFactory> editorFactory;
};
} // ScxmlEditor::Internal
#include "scxmleditorplugin.moc"

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