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

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 WINDOWSYSTEMTRACKEDGENERALINFO_H
0021 #define WINDOWSYSTEMTRACKEDGENERALINFO_H
0022 
0023 // local
0024 #include "lastactivewindow.h"
0025 #include "../windowinfowrap.h"
0026 
0027 // Qt
0028 #include <QObject>
0029 
0030 namespace Latte {
0031 namespace WindowSystem {
0032 class SchemeColors;
0033 namespace Tracker {
0034 class Windows;
0035 }
0036 }
0037 }
0038 
0039 
0040 namespace Latte {
0041 namespace WindowSystem {
0042 namespace Tracker {
0043 
0044 class TrackedGeneralInfo : public QObject {
0045     Q_OBJECT
0046 
0047     Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *activeWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
0048 
0049 public:
0050     TrackedGeneralInfo(Tracker::Windows *tracker);
0051     ~TrackedGeneralInfo() override;
0052 
0053     bool enabled() const;
0054     void setEnabled(bool enabled);
0055 
0056     bool activeWindowMaximized() const;
0057     void setActiveWindowMaximized(bool activeMaximized);
0058 
0059     bool existsWindowActive() const;
0060     void setExistsWindowActive(bool exists);
0061 
0062     bool existsWindowMaximized() const;
0063     void setExistsWindowMaximized(bool maximized);
0064 
0065     bool isTrackingCurrentActivity() const;
0066 
0067     LastActiveWindow *lastActiveWindow() const;
0068 
0069     SchemeColors *activeWindowScheme() const;
0070     void setActiveWindowScheme(SchemeColors *scheme);
0071 
0072     AbstractWindowInterface *wm();
0073 
0074     void setActiveWindow(const WindowId &wid);
0075 
0076     virtual bool isTracking(const WindowInfoWrap &winfo) const;
0077 
0078 signals:
0079     void lastActiveWindowChanged();
0080 
0081 protected:
0082     void updateTrackingCurrentActivity();
0083 
0084 protected:
0085     QStringList m_activities;
0086 
0087     LastActiveWindow *m_lastActiveWindow{nullptr};
0088     AbstractWindowInterface *m_wm{nullptr};
0089     Tracker::Windows *m_tracker{nullptr};
0090 
0091 private:
0092     bool m_enabled;
0093     bool m_activeWindowMaximized;
0094     bool m_existsWindowActive;
0095     bool m_existsWindowMaximized;
0096 
0097     bool m_isTrackingCurrentActivity{true};
0098 
0099     SchemeColors *m_activeWindowScheme{nullptr};
0100 };
0101 
0102 }
0103 }
0104 }
0105 
0106 #endif