Incredibuild: Use standard layout for plugin setup code

Change-Id: Ic9bbf8eb23fc4a2ed65b97e96cadcc4495ecdae6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-09-17 08:22:33 +02:00
parent 7fe6fb43b5
commit 75a52875d1
2 changed files with 16 additions and 41 deletions

View File

@@ -25,51 +25,33 @@
#include "incredibuildplugin.h"
#include "incredibuildconstants.h"
#include "buildconsolebuildstep.h"
#include "ibconsolebuildstep.h"
namespace IncrediBuild {
namespace Internal {
class IncrediBuildPluginPrivate
{
public:
BuildConsoleStepFactory buildConsoleStepFactory;
IBConsoleStepFactory iBConsoleStepFactory;
};
IncrediBuildPlugin::~IncrediBuildPlugin()
{
// Unregister objects from the plugin manager's object pool
// Delete members
delete m_iBConsoleStepFactory;
delete m_buildConsoleStepFactory;
delete d;
}
bool IncrediBuildPlugin::initialize(const QStringList &arguments, QString *errorString)
{
// Register objects in the plugin manager's object pool
// Load settings
// Add actions to menus
// Connect to other plugins' signals
// In the initialize function, a plugin can be sure that the plugins it
// depends on have initialized their members.
Q_UNUSED(arguments)
Q_UNUSED(errorString)
m_buildConsoleStepFactory = new BuildConsoleStepFactory();
m_iBConsoleStepFactory = new IBConsoleStepFactory();
d = new IncrediBuildPluginPrivate;
return true;
}
void IncrediBuildPlugin::extensionsInitialized()
{
// Retrieve objects from the plugin manager's object pool
// In the extensionsInitialized function, a plugin can be sure that all
// plugins that depend on it are completely initialized.
}
ExtensionSystem::IPlugin::ShutdownFlag IncrediBuildPlugin::aboutToShutdown()
{
// Save settings
// Disconnect from signals that are not needed during shutdown
// Hide UI (if you add UI that is not in the main window directly)
return SynchronousShutdown;
}
} // namespace Internal
} // namespace IncrediBuild

View File

@@ -25,31 +25,24 @@
#pragma once
#include "incredibuild_global.h"
#include "buildconsolebuildstep.h"
#include "ibconsolebuildstep.h"
#include <extensionsystem/iplugin.h>
namespace IncrediBuild {
namespace Internal {
class IncrediBuildPlugin : public ExtensionSystem::IPlugin
class IncrediBuildPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "IncrediBuild.json")
public:
IncrediBuildPlugin() {}
~IncrediBuildPlugin();
IncrediBuildPlugin() = default;
~IncrediBuildPlugin() final;
bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized();
ShutdownFlag aboutToShutdown();
bool initialize(const QStringList &arguments, QString *errorString) final;
private:
BuildConsoleStepFactory *m_buildConsoleStepFactory{};
IBConsoleStepFactory *m_iBConsoleStepFactory{};
class IncrediBuildPluginPrivate *d = nullptr;
};
} // namespace Internal