File indexing completed on 2022-11-29 15:04:22

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef ORIGINALVIEW_H
0007 #define ORIGINALVIEW_H
0008 
0009 // local
0010 #include <coretypes.h>
0011 #include "view.h"
0012 
0013 // Qt
0014 #include <QList>
0015 
0016 namespace Latte {
0017 
0018 class ClonedView;
0019 
0020 class OriginalView : public View
0021 {
0022     Q_OBJECT
0023     Q_PROPERTY(Latte::Types::ScreensGroup screensGroup READ screensGroup NOTIFY screensGroupChanged)
0024 
0025 public:
0026     OriginalView(Plasma::Corona *corona, QScreen *targetScreen = nullptr, bool byPassX11WM = false);
0027     ~OriginalView();
0028 
0029     bool isOriginal() const override;
0030     bool isCloned() const override;
0031     bool isSingle() const override;
0032 
0033     int clonesCount() const;
0034 
0035     int expectedScreenIdFromScreenGroup(const Latte::Types::ScreensGroup &nextScreensGroup) const;
0036 
0037     Latte::Types::ScreensGroup screensGroup() const override;
0038     void setScreensGroup(const Latte::Types::ScreensGroup &group);
0039 
0040     void addClone(Latte::ClonedView *view);
0041     void setNextLocationForClones(const QString layoutName, int edge, int alignment);
0042     void addApplet(const QString &pluginId, const int &excludecloneid);
0043     void addApplet(QObject *mimedata, const int &x, const int &y, const int &excludecloneid);
0044 
0045     void reconsiderScreen() override;
0046 
0047 public slots:
0048     void cleanClones();
0049 
0050 signals:
0051     void screensGroupChanged();    
0052 
0053 private slots:    
0054     void syncClonesToScreens();
0055 
0056     void restoreConfig();
0057     void saveConfig();
0058 
0059 private:
0060     void createClone(int screenId);
0061     void removeClone(Latte::ClonedView *view);
0062 
0063 private:
0064     Latte::Types::ScreensGroup m_screensGroup{Latte::Types::SingleScreenGroup};
0065     QList<Latte::ClonedView *> m_clones;
0066 
0067     QList<int> m_waitingCreation;
0068 };
0069 
0070 }
0071 
0072 #endif