File indexing completed on 2024-12-08 04:58:23
0001 /* 0002 SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef CLONEDVIEW_H 0007 #define CLONEDVIEW_H 0008 0009 // local 0010 #include <coretypes.h> 0011 #include "originalview.h" 0012 #include "indicator/indicator.h" 0013 #include "view.h" 0014 0015 namespace Latte { 0016 0017 class ClonedView : public View 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 static const int ERRORAPPLETID = -999; 0023 0024 ClonedView(Plasma::Corona *corona, Latte::OriginalView *originalView, QScreen *targetScreen = nullptr, bool byPassX11WM = false); 0025 ~ClonedView(); 0026 0027 bool isOriginal() const override; 0028 bool isCloned() const override; 0029 bool isSingle() const override; 0030 0031 bool isPreferredForShortcuts() const override; 0032 int groupId() const override; 0033 0034 Latte::Types::ScreensGroup screensGroup() const override; 0035 0036 ViewPart::Indicator *indicator() const override; 0037 Latte::Data::View data() const override; 0038 0039 protected: 0040 void showConfigurationInterface(Plasma::Applet *applet) override; 0041 0042 private slots: 0043 void initSync(); 0044 void onOriginalAppletConfigPropertyChanged(const int &id, const QString &key, const QVariant &value); 0045 void onOriginalAppletInScheduledDestructionChanged(const int &id, const bool &enabled); 0046 void onOriginalAppletRemoved(const int &id); 0047 void onOriginalAppletsOrderChanged(); 0048 void onOriginalAppletsInLockedZoomChanged(const QList<int> &originalapplets); 0049 void onOriginalAppletsDisabledColoringChanged(const QList<int> &originalapplets); 0050 0051 void updateContainmentConfigProperty(const QString &key, const QVariant &value); 0052 void updateOriginalAppletConfigProperty(const int &clonedid, const QString &key, const QVariant &value); 0053 0054 void updateAppletIdsHash(); 0055 private: 0056 bool isTranslatableToClonesOrder(const QList<int> &originalOrder); 0057 0058 bool hasOriginalAppletId(const int &clonedid); 0059 int originalAppletId(const int &clonedid); 0060 0061 QList<int> translateToClonesOrder(const QList<int> &originalIds); 0062 0063 private: 0064 static QStringList CONTAINMENTMANUALSYNCEDPROPERTIES; 0065 0066 QPointer<Latte::OriginalView> m_originalView; 0067 QHash<int, int> m_currentAppletIds; 0068 }; 0069 0070 } 0071 0072 #endif