File indexing completed on 2024-06-16 05:07:10

0001 /*
0002     SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef VIEWWINDOWSTRACKER_H
0007 #define VIEWWINDOWSTRACKER_H
0008 
0009 // local
0010 #include "../../wm/abstractwindowinterface.h"
0011 
0012 // Qt
0013 #include <QObject>
0014 
0015 namespace Latte{
0016 class View;
0017 
0018 namespace ViewPart {
0019 namespace TrackerPart {
0020 class AllScreensTracker;
0021 class CurrentScreenTracker;
0022 }
0023 }
0024 
0025 namespace WindowSystem {
0026 class AbstractWindowInterface;
0027 }
0028 }
0029 
0030 namespace Latte {
0031 namespace ViewPart {
0032 
0033 class WindowsTracker : public QObject {
0034     Q_OBJECT
0035     Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
0036 
0037     Q_PROPERTY(Latte::ViewPart::TrackerPart::CurrentScreenTracker *currentScreen READ currentScreen NOTIFY currentScreenChanged)
0038     Q_PROPERTY(Latte::ViewPart::TrackerPart::AllScreensTracker *allScreens READ allScreens NOTIFY allScreensChanged)
0039 
0040 public:
0041     explicit WindowsTracker(Latte::View *parent);
0042     virtual ~WindowsTracker();
0043 
0044     bool enabled() const;
0045     void setEnabled(bool active);
0046 
0047     TrackerPart::AllScreensTracker *allScreens() const;
0048     TrackerPart::CurrentScreenTracker *currentScreen() const;
0049 
0050     Latte::View *view() const;
0051     WindowSystem::AbstractWindowInterface *wm() const;
0052 
0053 public slots:
0054     Q_INVOKABLE void switchToNextActivity();
0055     Q_INVOKABLE void switchToPreviousActivity();
0056     Q_INVOKABLE void switchToNextVirtualDesktop();
0057     Q_INVOKABLE void switchToPreviousVirtualDesktop();
0058 
0059 signals:
0060     void enabledChanged();
0061     void allScreensChanged();
0062     void currentScreenChanged();
0063 
0064 private:
0065     Latte::View *m_latteView{nullptr};
0066     WindowSystem::AbstractWindowInterface *m_wm{nullptr};
0067 
0068     TrackerPart::AllScreensTracker *m_allScreensTracker{nullptr};
0069     TrackerPart::CurrentScreenTracker *m_currentScreenTracker{nullptr};
0070 };
0071 
0072 }
0073 }
0074 
0075 #endif