File indexing completed on 2024-04-28 16:44:34

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include "decorationdefines.h"
0010 #include <QObject>
0011 #include <QSharedDataPointer>
0012 #include <kdecoration2/kdecoration2_export.h>
0013 
0014 class KPluginMetaData;
0015 class DecorationThemeMetaDataPrivate;
0016 
0017 namespace KDecoration2
0018 {
0019 /**
0020  * Class providing type-safe access to data of themes
0021  *
0022  * @since 5.23
0023  * @author Alexander Lohnau
0024  */
0025 class KDECORATIONS2_EXPORT DecorationThemeMetaData
0026 {
0027 public:
0028     explicit DecorationThemeMetaData();
0029     virtual ~DecorationThemeMetaData();
0030     DecorationThemeMetaData(const DecorationThemeMetaData &other);
0031     DecorationThemeMetaData &operator=(const DecorationThemeMetaData &other);
0032 
0033     /// User-visible name of the theme
0034     QString visibleName() const;
0035     void setVisibleName(const QString &name);
0036 
0037     /// Internal name of the theme
0038     QString themeName() const;
0039     void setThemeName(const QString &name);
0040 
0041     /// Indicates that the theme has KCMs
0042     bool hasConfiguration() const;
0043     void setHasConfiguration(bool hasConfig);
0044 
0045     /// Border size of the decoration, this gets set based on the "recommendedBorderSize" key in the json metadata
0046     /// @internal
0047     KDecoration2::BorderSize borderSize() const;
0048     void setBorderSize(KDecoration2::BorderSize size);
0049 
0050     /// plugin id of theme provider
0051     /// @see KPluginMetaData::pluginId
0052     QString pluginId() const;
0053     void setPluginId(const QString &id);
0054 
0055 private:
0056     QSharedDataPointer<DecorationThemeMetaDataPrivate> d;
0057 };
0058 /**
0059  * Class to give the KWin decorationmodel access to the plugin's themes.
0060  *
0061  * @since 5.23
0062  * @author Alexander Lohnau
0063  */
0064 class KDECORATIONS2_EXPORT DecorationThemeProvider : public QObject
0065 {
0066     Q_OBJECT
0067 
0068 public:
0069     explicit DecorationThemeProvider(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
0070 
0071     /**
0072      * List containing information of supported themes
0073      */
0074     virtual QList<DecorationThemeMetaData> themes() const = 0;
0075 };
0076 }