File indexing completed on 2024-04-28 16:49:43

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Daniel Vratil <dvratil@redhat.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  *
0006  */
0007 
0008 #ifndef BACKENDLAUNCHER_H
0009 #define BACKENDLAUNCHER_H
0010 
0011 #include <QDBusContext>
0012 #include <QObject>
0013 
0014 namespace KScreen
0015 {
0016 class AbstractBackend;
0017 }
0018 
0019 class QPluginLoader;
0020 class BackendDBusWrapper;
0021 
0022 class BackendLoader : public QObject, protected QDBusContext
0023 {
0024     Q_OBJECT
0025     Q_CLASSINFO("D-Bus Interface", "org.kde.KScreen")
0026 
0027 public:
0028     explicit BackendLoader();
0029     ~BackendLoader() override;
0030 
0031     bool init();
0032 
0033     Q_INVOKABLE QString backend() const;
0034     Q_INVOKABLE bool requestBackend(const QString &name, const QVariantMap &arguments);
0035     Q_INVOKABLE void quit();
0036 
0037 private:
0038     KScreen::AbstractBackend *loadBackend(const QString &name, const QVariantMap &arguments);
0039 
0040 private:
0041     QPluginLoader *mLoader = nullptr;
0042     BackendDBusWrapper *mBackend = nullptr;
0043 };
0044 
0045 #endif // BACKENDLAUNCHER_H