File indexing completed on 2024-04-28 16:49:28

0001 /*
0002 *  Copyright 2019  Michail Vourlakos <mvourlakos@gmail.com>
0003 *
0004 *  This file is part of Latte-Dock
0005 *
0006 *  Latte-Dock is free software; you can redistribute it and/or
0007 *  modify it under the terms of the GNU General Public License as
0008 *  published by the Free Software Foundation; either version 2 of
0009 *  the License, or (at your option) any later version.
0010 *
0011 *  Latte-Dock is distributed in the hope that it will be useful,
0012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 *  GNU General Public License for more details.
0015 *
0016 *  You should have received a copy of the GNU General Public License
0017 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 #ifndef VIEWWINDOWSTRACKER_H
0021 #define VIEWWINDOWSTRACKER_H
0022 
0023 // local
0024 #include "../../wm/abstractwindowinterface.h"
0025 
0026 // Qt
0027 #include <QObject>
0028 
0029 namespace Latte{
0030 class View;
0031 
0032 namespace ViewPart {
0033 namespace TrackerPart {
0034 class AllScreensTracker;
0035 class CurrentScreenTracker;
0036 }
0037 }
0038 
0039 namespace WindowSystem {
0040 class AbstractWindowInterface;
0041 }
0042 }
0043 
0044 namespace Latte {
0045 namespace ViewPart {
0046 
0047 class WindowsTracker : public QObject {
0048     Q_OBJECT
0049     Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
0050 
0051     Q_PROPERTY(Latte::ViewPart::TrackerPart::CurrentScreenTracker *currentScreen READ currentScreen NOTIFY currentScreenChanged)
0052     Q_PROPERTY(Latte::ViewPart::TrackerPart::AllScreensTracker *allScreens READ allScreens NOTIFY allScreensChanged)
0053 
0054 public:
0055     explicit WindowsTracker(Latte::View *parent);
0056     virtual ~WindowsTracker();
0057 
0058     bool enabled() const;
0059     void setEnabled(bool active);
0060 
0061     TrackerPart::AllScreensTracker *allScreens() const;
0062     TrackerPart::CurrentScreenTracker *currentScreen() const;
0063 
0064     void setWindowOnActivities(QWindow &window, const QStringList &activities);
0065 
0066     Latte::View *view() const;
0067     WindowSystem::AbstractWindowInterface *wm() const;
0068 
0069 public slots:
0070     Q_INVOKABLE void switchToNextActivity();
0071     Q_INVOKABLE void switchToPreviousActivity();
0072     Q_INVOKABLE void switchToNextVirtualDesktop();
0073     Q_INVOKABLE void switchToPreviousVirtualDesktop();
0074 
0075 signals:
0076     void enabledChanged();
0077     void allScreensChanged();
0078     void currentScreenChanged();
0079 
0080 private:
0081     Latte::View *m_latteView{nullptr};
0082     WindowSystem::AbstractWindowInterface *m_wm{nullptr};
0083 
0084     TrackerPart::AllScreensTracker *m_allScreensTracker{nullptr};
0085     TrackerPart::CurrentScreenTracker *m_currentScreenTracker{nullptr};
0086 };
0087 
0088 }
0089 }
0090 
0091 #endif