Files
qt-creator/src/libs/extensionsystem/iplugin.h

57 lines
1.5 KiB
C
Raw Normal View History

// Copyright (C) 2016 The Qt Company Ltd.
// 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
#pragma once
2008-12-02 12:01:29 +01:00
#include "extensionsystem_global.h"
#include <QObject>
2008-12-02 12:01:29 +01:00
#include <functional>
2008-12-02 12:01:29 +01:00
namespace ExtensionSystem {
namespace Internal { class IPluginPrivate; }
2008-12-02 12:01:29 +01:00
class EXTENSIONSYSTEM_EXPORT IPlugin : public QObject
{
Q_OBJECT
public:
enum ShutdownFlag {
SynchronousShutdown,
AsynchronousShutdown
};
2008-12-02 12:01:29 +01:00
IPlugin();
~IPlugin() override;
2008-12-02 12:01:29 +01:00
virtual bool initialize(const QStringList &arguments, QString *errorString);
virtual void extensionsInitialized() {}
virtual bool delayedInitialize() { return false; }
virtual ShutdownFlag aboutToShutdown() { return SynchronousShutdown; }
virtual QObject *remoteCommand(const QStringList & /* options */,
const QString & /* workingDirectory */,
const QStringList & /* arguments */) { return nullptr; }
// Deprecated in 10.0, use addTest()
virtual QVector<QObject *> createTestObjects() const;
2008-12-02 12:01:29 +01:00
protected:
virtual void initialize() {}
using TestCreator = std::function<QObject *()>;
template <typename Test, typename ...Args>
void addTest(Args && ...args) { addTestCreator([args...] { return new Test(args...); }); }
void addTestCreator(const TestCreator &creator);
signals:
void asynchronousShutdownFinished();
2008-12-02 12:01:29 +01:00
private:
Internal::IPluginPrivate *d;
};
} // namespace ExtensionSystem