ClangStaticAnalyzer: Remove uses of global object pool

Change-Id: I6cdfade5ecbfb48d714c6055fab733b8061369b4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
hjk
2018-02-07 10:03:16 +01:00
parent e30c872e61
commit e3e3477307
2 changed files with 15 additions and 40 deletions

View File

@@ -98,56 +98,34 @@ private:
QPointer<QWidget> m_widget;
};
ClangStaticAnalyzerPlugin::ClangStaticAnalyzerPlugin()
class ClangStaticAnalyzerPluginPrivate
{
// Create your members
}
public:
ClangStaticAnalyzerTool tool;
ClangStaticAnalyzerOptionsPage optionsPage;
};
ClangStaticAnalyzerPlugin::~ClangStaticAnalyzerPlugin()
{
// Unregister objects from the plugin manager's object pool
// Delete members
delete d;
}
bool ClangStaticAnalyzerPlugin::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 method, a plugin can be sure that the plugins it
// depends on have initialized their members.
Q_UNUSED(arguments);
Q_UNUSED(errorString);
d = new ClangStaticAnalyzerPluginPrivate;
auto panelFactory = new ProjectPanelFactory();
panelFactory->setPriority(100);
panelFactory->setDisplayName(tr("Clang Static Analyzer"));
panelFactory->setCreateWidgetFunction([](Project *project) { return new ProjectSettingsWidget(project); });
ProjectPanelFactory::registerFactory(panelFactory);
addAutoReleasedObject(new ClangStaticAnalyzerTool);
addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage);
return true;
}
void ClangStaticAnalyzerPlugin::extensionsInitialized()
{
// Retrieve objects from the plugin manager's object pool
// In the extensionsInitialized method, a plugin can be sure that all
// plugins that depend on it are completely initialized.
}
ExtensionSystem::IPlugin::ShutdownFlag ClangStaticAnalyzerPlugin::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;
}
QList<QObject *> ClangStaticAnalyzerPlugin::createTestObjects() const
{
QList<QObject *> tests;

View File

@@ -30,24 +30,21 @@
namespace ClangStaticAnalyzer {
namespace Internal {
class ClangStaticAnalyzerSettings;
class ClangStaticAnalyzerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClangStaticAnalyzer.json")
public:
ClangStaticAnalyzerPlugin();
~ClangStaticAnalyzerPlugin();
bool initialize(const QStringList &arguments, QString *errorString);
bool initializeEnterpriseFeatures(const QStringList &arguments, QString *errorString);
void extensionsInitialized();
ShutdownFlag aboutToShutdown();
ClangStaticAnalyzerPlugin() = default;
~ClangStaticAnalyzerPlugin() final;
private:
QList<QObject *> createTestObjects() const;
bool initialize(const QStringList &arguments, QString *errorString) final;
void extensionsInitialized() final {}
QList<QObject *> createTestObjects() const final;
class ClangStaticAnalyzerPluginPrivate *d = nullptr;
};
} // namespace Internal