2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2023-01-04 08:52:22 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include "extensionsystem_global.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-02-08 10:03:21 +01:00
|
|
|
#include <functional>
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace ExtensionSystem {
|
|
|
|
|
|
2023-02-09 07:23:39 +01:00
|
|
|
namespace Internal { class IPluginPrivate; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-02-10 11:40:27 +01:00
|
|
|
using TestCreator = std::function<QObject *()>;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
class EXTENSIONSYSTEM_EXPORT IPlugin : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-07-13 13:36:47 +02:00
|
|
|
enum ShutdownFlag {
|
|
|
|
|
SynchronousShutdown,
|
|
|
|
|
AsynchronousShutdown
|
|
|
|
|
};
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
IPlugin();
|
2018-05-07 15:04:23 +02:00
|
|
|
~IPlugin() override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-01-20 08:36:32 +01:00
|
|
|
virtual bool initialize(const QStringList &arguments, QString *errorString);
|
2020-02-07 10:27:39 +01:00
|
|
|
virtual void extensionsInitialized() {}
|
2012-02-02 10:47:33 +01:00
|
|
|
virtual bool delayedInitialize() { return false; }
|
2010-07-13 13:36:47 +02:00
|
|
|
virtual ShutdownFlag aboutToShutdown() { return SynchronousShutdown; }
|
2015-03-09 10:59:58 +02:00
|
|
|
virtual QObject *remoteCommand(const QStringList & /* options */,
|
|
|
|
|
const QString & /* workingDirectory */,
|
2018-05-07 17:38:04 +02:00
|
|
|
const QStringList & /* arguments */) { return nullptr; }
|
2023-02-09 15:29:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// Deprecated in 10.0, use addTest()
|
2019-05-27 14:12:11 +02:00
|
|
|
virtual QVector<QObject *> createTestObjects() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-01-20 12:28:36 +01:00
|
|
|
protected:
|
|
|
|
|
virtual void initialize() {}
|
|
|
|
|
|
2023-02-08 10:03:21 +01:00
|
|
|
template <typename Test, typename ...Args>
|
|
|
|
|
void addTest(Args && ...args) { addTestCreator([args...] { return new Test(args...); }); }
|
|
|
|
|
void addTestCreator(const TestCreator &creator);
|
|
|
|
|
|
2010-07-13 13:36:47 +02:00
|
|
|
signals:
|
|
|
|
|
void asynchronousShutdownFinished();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private:
|
|
|
|
|
Internal::IPluginPrivate *d;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ExtensionSystem
|