File indexing completed on 2024-04-28 16:45:13

0001 /*
0002 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
0003 
0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 #pragma once
0007 
0008 #include <KConfigPropertyMap>
0009 #include <KPackage/Package>
0010 #include <KSharedConfig>
0011 
0012 class KConfigLoader;
0013 
0014 namespace ScreenLocker
0015 {
0016 class WallpaperIntegration : public QObject
0017 {
0018     Q_OBJECT
0019 
0020     Q_PROPERTY(QString pluginName READ pluginName NOTIFY packageChanged)
0021     Q_PROPERTY(KConfigPropertyMap *configuration READ configuration NOTIFY configurationChanged)
0022 
0023 public:
0024     explicit WallpaperIntegration(QObject *parent);
0025     ~WallpaperIntegration() override;
0026 
0027     void init();
0028 
0029     void setConfig(const KSharedConfig::Ptr &config)
0030     {
0031         m_config = config;
0032     }
0033     QString pluginName() const
0034     {
0035         return m_pluginName;
0036     }
0037     void setPluginName(const QString &name);
0038 
0039     KPackage::Package package() const
0040     {
0041         return m_package;
0042     }
0043 
0044     KConfigPropertyMap *configuration() const
0045     {
0046         return m_configuration;
0047     }
0048 
0049     KConfigLoader *configScheme();
0050 
0051 Q_SIGNALS:
0052     void packageChanged();
0053     void configurationChanged();
0054 
0055     /**
0056      * This is to keep compatible with WallpaperInterface in plasma-framework.
0057      * It doesn't have any practical use.
0058      */
0059     void repaintNeeded();
0060 
0061 private:
0062     QString m_pluginName;
0063     KPackage::Package m_package;
0064     KSharedConfig::Ptr m_config;
0065     KConfigLoader *m_configLoader = nullptr;
0066     KConfigPropertyMap *m_configuration = nullptr;
0067 };
0068 
0069 }