File indexing completed on 2024-05-12 05:31:25

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 "kwin_export.h"
0012 #include <KDecoration2/Private/DecorationBridge>
0013 #include <QObject>
0014 
0015 class KPluginFactory;
0016 namespace KDecoration2
0017 {
0018 class DecorationSettings;
0019 }
0020 
0021 namespace KWin
0022 {
0023 
0024 class Window;
0025 
0026 namespace Decoration
0027 {
0028 
0029 class KWIN_EXPORT DecorationBridge : public KDecoration2::DecorationBridge
0030 {
0031     Q_OBJECT
0032 public:
0033     explicit DecorationBridge();
0034 
0035     static bool hasPlugin();
0036 
0037     void init();
0038     KDecoration2::Decoration *createDecoration(Window *window);
0039 
0040     std::unique_ptr<KDecoration2::DecoratedClientPrivate> createClient(KDecoration2::DecoratedClient *client, KDecoration2::Decoration *decoration) override;
0041     std::unique_ptr<KDecoration2::DecorationSettingsPrivate> settings(KDecoration2::DecorationSettings *parent) override;
0042 
0043     QString recommendedBorderSize() const
0044     {
0045         return m_recommendedBorderSize;
0046     }
0047 
0048     bool showToolTips() const
0049     {
0050         return m_showToolTips;
0051     }
0052 
0053     void reconfigure();
0054 
0055     const std::shared_ptr<KDecoration2::DecorationSettings> &settings() const
0056     {
0057         return m_settings;
0058     }
0059 
0060     QString supportInformation() const;
0061 
0062 Q_SIGNALS:
0063     void metaDataLoaded();
0064 
0065 private:
0066     QString readPlugin();
0067     void loadMetaData(const QJsonObject &object);
0068     void findTheme(const QVariantMap &map);
0069     bool initPlugin();
0070     QString readTheme() const;
0071     void readDecorationOptions();
0072     std::unique_ptr<KPluginFactory> m_factory;
0073     bool m_showToolTips;
0074     QString m_recommendedBorderSize;
0075     QString m_plugin;
0076     QString m_defaultTheme;
0077     QString m_theme;
0078     std::shared_ptr<KDecoration2::DecorationSettings> m_settings;
0079     bool m_noPlugin;
0080 };
0081 } // Decoration
0082 } // KWin