File indexing completed on 2024-04-14 15:35:16

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <kwinglobals.h>
0012 
0013 #include <KDecoration2/Private/DecorationBridge>
0014 
0015 #include <QObject>
0016 #include <QSharedPointer>
0017 
0018 class KPluginFactory;
0019 
0020 namespace KDecoration2
0021 {
0022 class DecorationSettings;
0023 }
0024 
0025 namespace KWin
0026 {
0027 
0028 class Window;
0029 
0030 namespace Decoration
0031 {
0032 
0033 class KWIN_EXPORT DecorationBridge : public KDecoration2::DecorationBridge
0034 {
0035     Q_OBJECT
0036 public:
0037     explicit DecorationBridge();
0038 
0039     static bool hasPlugin();
0040 
0041     void init();
0042     KDecoration2::Decoration *createDecoration(Window *window);
0043 
0044     std::unique_ptr<KDecoration2::DecoratedClientPrivate> createClient(KDecoration2::DecoratedClient *client, KDecoration2::Decoration *decoration) override;
0045     std::unique_ptr<KDecoration2::DecorationSettingsPrivate> settings(KDecoration2::DecorationSettings *parent) override;
0046 
0047     QString recommendedBorderSize() const
0048     {
0049         return m_recommendedBorderSize;
0050     }
0051 
0052     bool showToolTips() const
0053     {
0054         return m_showToolTips;
0055     }
0056 
0057     void reconfigure();
0058 
0059     const QSharedPointer<KDecoration2::DecorationSettings> &settings() const
0060     {
0061         return m_settings;
0062     }
0063 
0064     QString supportInformation() const;
0065 
0066 Q_SIGNALS:
0067     void metaDataLoaded();
0068 
0069 private:
0070     QString readPlugin();
0071     void loadMetaData(const QJsonObject &object);
0072     void findTheme(const QVariantMap &map);
0073     bool initPlugin();
0074     QString readTheme() const;
0075     void readDecorationOptions();
0076     std::unique_ptr<KPluginFactory> m_factory;
0077     bool m_showToolTips;
0078     QString m_recommendedBorderSize;
0079     QString m_plugin;
0080     QString m_defaultTheme;
0081     QString m_theme;
0082     QSharedPointer<KDecoration2::DecorationSettings> m_settings;
0083     bool m_noPlugin;
0084 };
0085 } // Decoration
0086 } // KWin