File indexing completed on 2024-12-08 04:58:27

0001 /*
0002     SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef WINDOWSYSTEMTRACKEDGENERALINFO_H
0007 #define WINDOWSYSTEMTRACKEDGENERALINFO_H
0008 
0009 // local
0010 #include "lastactivewindow.h"
0011 #include "../windowinfowrap.h"
0012 
0013 // Qt
0014 #include <QObject>
0015 
0016 namespace Latte {
0017 namespace WindowSystem {
0018 class SchemeColors;
0019 namespace Tracker {
0020 class Windows;
0021 }
0022 }
0023 }
0024 
0025 
0026 namespace Latte {
0027 namespace WindowSystem {
0028 namespace Tracker {
0029 
0030 class TrackedGeneralInfo : public QObject {
0031     Q_OBJECT
0032 
0033     Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *activeWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
0034 
0035 public:
0036     TrackedGeneralInfo(Tracker::Windows *tracker);
0037     ~TrackedGeneralInfo() override;
0038 
0039     bool enabled() const;
0040     void setEnabled(bool enabled);
0041 
0042     bool activeWindowMaximized() const;
0043     void setActiveWindowMaximized(bool activeMaximized);
0044 
0045     bool existsWindowActive() const;
0046     void setExistsWindowActive(bool exists);
0047 
0048     bool existsWindowMaximized() const;
0049     void setExistsWindowMaximized(bool maximized);
0050 
0051     bool isTrackingCurrentActivity() const;
0052     bool isTrackingActivity(const QString &activity);
0053 
0054     LastActiveWindow *lastActiveWindow() const;
0055 
0056     SchemeColors *activeWindowScheme() const;
0057     void setActiveWindowScheme(SchemeColors *scheme);
0058 
0059     AbstractWindowInterface *wm();
0060 
0061     void setActiveWindow(const WindowId &wid);
0062 
0063     //! windows that are not shown but are tracked should not be removed from history but give their place to other shown windows
0064     bool isShown(const WindowInfoWrap &winfo) const;
0065     //! windows that are not tracked can be removed totally from history as they are not relevant any more
0066     virtual bool isTracking(const WindowInfoWrap &winfo) const;
0067 
0068 signals:
0069     void lastActiveWindowChanged();
0070 
0071 protected:
0072     void updateTrackingCurrentActivity();
0073 
0074 protected:
0075     QStringList m_activities;
0076 
0077     LastActiveWindow *m_lastActiveWindow{nullptr};
0078     AbstractWindowInterface *m_wm{nullptr};
0079     Tracker::Windows *m_tracker{nullptr};
0080 
0081 private:
0082     bool m_enabled{false};
0083     bool m_activeWindowMaximized{false};
0084     bool m_existsWindowActive{false};
0085     bool m_existsWindowMaximized{false};
0086 
0087     bool m_isTrackingCurrentActivity{true};
0088 
0089     SchemeColors *m_activeWindowScheme{nullptr};
0090 };
0091 
0092 }
0093 }
0094 }
0095 
0096 #endif