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 "incredibuildplugin.h"
#include "incredibuildconstants.h" #include "buildconsolebuildstep.h"
#include "ibconsolebuildstep.h"
namespace IncrediBuild { namespace IncrediBuild {
namespace Internal { namespace Internal {
class IncrediBuildPluginPrivate
{
public:
BuildConsoleStepFactory buildConsoleStepFactory;
IBConsoleStepFactory iBConsoleStepFactory;
};
IncrediBuildPlugin::~IncrediBuildPlugin() IncrediBuildPlugin::~IncrediBuildPlugin()
{ {
// Unregister objects from the plugin manager's object pool delete d;
// Delete members
delete m_iBConsoleStepFactory;
delete m_buildConsoleStepFactory;
} }
bool IncrediBuildPlugin::initialize(const QStringList &arguments, QString *errorString) 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(arguments)
Q_UNUSED(errorString) Q_UNUSED(errorString)
m_buildConsoleStepFactory = new BuildConsoleStepFactory(); d = new IncrediBuildPluginPrivate;
m_iBConsoleStepFactory = new IBConsoleStepFactory();
return true; 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 Internal
} // namespace IncrediBuild } // namespace IncrediBuild

View File

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