From 353f7119ccff9e70c54a41ae8441ee9744ff330b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 8 Jun 2019 18:11:02 +0300 Subject: [PATCH] move Tracker::Enabled to View::WindowsTracker --previously it was found in the consumers of View::WindowsTracker (CurrentScreenTracker and AllWindowsTracker) --- app/lattecorona.cpp | 6 ++++++ app/view/windowstracker/allscreenstracker.cpp | 11 ----------- app/view/windowstracker/allscreenstracker.h | 3 --- .../windowstracker/currentscreentracker.cpp | 16 ---------------- app/view/windowstracker/currentscreentracker.h | 5 ----- app/view/windowstracker/windowstracker.cpp | 18 ++++++++++++++++++ app/view/windowstracker/windowstracker.h | 6 ++++++ 7 files changed, 30 insertions(+), 35 deletions(-) diff --git a/app/lattecorona.cpp b/app/lattecorona.cpp index f0c885057..b44f9724a 100644 --- a/app/lattecorona.cpp +++ b/app/lattecorona.cpp @@ -38,6 +38,9 @@ #include "plasma/extended/theme.h" #include "settings/universalsettings.h" #include "view/view.h" +#include "view/windowstracker/windowstracker.h" +#include "view/windowstracker/allscreenstracker.h" +#include "view/windowstracker/currentscreentracker.h" #include "wm/abstractwindowinterface.h" #include "wm/schemecolors.h" #include "wm/waylandinterface.h" @@ -1074,6 +1077,9 @@ inline void Corona::qmlRegisterTypes() const { qmlRegisterType(); qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); } diff --git a/app/view/windowstracker/allscreenstracker.cpp b/app/view/windowstracker/allscreenstracker.cpp index f481ecdcd..d4c59f36b 100644 --- a/app/view/windowstracker/allscreenstracker.cpp +++ b/app/view/windowstracker/allscreenstracker.cpp @@ -50,12 +50,6 @@ void AllScreensTracker::init() } }); - connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChangedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) { - if (m_latteView->layout() == layout) { - emit enabledChanged(); - } - }); - connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowMaximizedChangedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) { if (m_latteView->layout() == layout) { emit activeWindowMaximizedChanged(); @@ -109,11 +103,6 @@ WindowSystem::SchemeColors *AllScreensTracker::activeWindowScheme() const return m_wm->windowsTracker()->activeWindowScheme(m_latteView->layout()); } -bool AllScreensTracker::enabled() const -{ - return m_wm->windowsTracker()->enabled(m_latteView->layout()); -} - WindowSystem::Tracker::LastActiveWindow *AllScreensTracker::lastActiveWindow() { return m_wm->windowsTracker()->lastActiveWindow(m_latteView->layout()); diff --git a/app/view/windowstracker/allscreenstracker.h b/app/view/windowstracker/allscreenstracker.h index cab5ed310..125ab1c61 100644 --- a/app/view/windowstracker/allscreenstracker.h +++ b/app/view/windowstracker/allscreenstracker.h @@ -48,7 +48,6 @@ namespace TrackerPart { class AllScreensTracker : public QObject { Q_OBJECT - Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged) Q_PROPERTY(bool activeWindowMaximized READ activeWindowMaximized NOTIFY activeWindowMaximizedChanged) Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged) Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged) @@ -60,7 +59,6 @@ public: explicit AllScreensTracker(WindowsTracker *parent); virtual ~AllScreensTracker(); - bool enabled() const; bool activeWindowMaximized() const; bool existsWindowActive() const; bool existsWindowMaximized() const; @@ -73,7 +71,6 @@ public slots: Q_INVOKABLE void requestMoveLastWindow(int localX, int localY); signals: - void enabledChanged(); void activeWindowDraggingStarted(); void activeWindowMaximizedChanged(); void existsWindowActiveChanged(); diff --git a/app/view/windowstracker/currentscreentracker.cpp b/app/view/windowstracker/currentscreentracker.cpp index ee7899131..bf93edccd 100644 --- a/app/view/windowstracker/currentscreentracker.cpp +++ b/app/view/windowstracker/currentscreentracker.cpp @@ -52,12 +52,6 @@ void CurrentScreenTracker::init() } }); - connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChanged, this, [&](const Latte::View *view) { - if (m_latteView == view) { - emit enabledChanged(); - } - }); - connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowMaximizedChanged, this, [&](const Latte::View *view) { if (m_latteView == view) { emit activeWindowMaximizedChanged(); @@ -144,16 +138,6 @@ WindowSystem::SchemeColors *CurrentScreenTracker::touchingWindowScheme() const return m_wm->windowsTracker()->touchingWindowScheme(m_latteView); } -bool CurrentScreenTracker::enabled() const -{ - return m_wm->windowsTracker()->enabled(m_latteView); -} - -void CurrentScreenTracker::setEnabled(bool active) -{ - m_wm->windowsTracker()->setEnabled(m_latteView, active); -} - WindowSystem::Tracker::LastActiveWindow *CurrentScreenTracker::lastActiveWindow() { return m_wm->windowsTracker()->lastActiveWindow(m_latteView); diff --git a/app/view/windowstracker/currentscreentracker.h b/app/view/windowstracker/currentscreentracker.h index 187ebfd93..68723b78e 100644 --- a/app/view/windowstracker/currentscreentracker.h +++ b/app/view/windowstracker/currentscreentracker.h @@ -48,7 +48,6 @@ namespace TrackerPart { class CurrentScreenTracker : public QObject { Q_OBJECT - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool activeWindowMaximized READ activeWindowMaximized NOTIFY activeWindowMaximizedChanged) Q_PROPERTY(bool activeWindowTouching READ activeWindowTouching NOTIFY activeWindowTouchingChanged) Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged) @@ -63,9 +62,6 @@ public: explicit CurrentScreenTracker(WindowsTracker *parent); virtual ~CurrentScreenTracker(); - bool enabled() const; - void setEnabled(bool active); - bool activeWindowMaximized() const; bool activeWindowTouching() const; bool existsWindowActive() const; @@ -81,7 +77,6 @@ public slots: Q_INVOKABLE void requestMoveLastWindow(int localX, int localY); signals: - void enabledChanged(); void activeWindowDraggingStarted(); void activeWindowMaximizedChanged(); void activeWindowTouchingChanged(); diff --git a/app/view/windowstracker/windowstracker.cpp b/app/view/windowstracker/windowstracker.cpp index 3c18fa2e4..731551d39 100644 --- a/app/view/windowstracker/windowstracker.cpp +++ b/app/view/windowstracker/windowstracker.cpp @@ -24,6 +24,7 @@ #include "allscreenstracker.h" #include "../view.h" #include "../../lattecorona.h" +#include "../../wm/tracker/trackerwindows.h" namespace Latte { @@ -41,6 +42,12 @@ WindowsTracker::WindowsTracker(Latte::View *parent) m_allScreensTracker = new TrackerPart::AllScreensTracker(this); m_currentScreenTracker = new TrackerPart::CurrentScreenTracker(this); + connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChanged, this, [&](const Latte::View *view) { + if (m_latteView == view) { + emit enabledChanged(); + } + }); + connect(m_allScreensTracker, &TrackerPart::AllScreensTracker::activeWindowDraggingStarted, this, &WindowsTracker::activeWindowDraggingStarted); connect(m_currentScreenTracker, &TrackerPart::CurrentScreenTracker::activeWindowDraggingStarted, @@ -73,6 +80,17 @@ WindowSystem::AbstractWindowInterface *WindowsTracker::wm() const return m_wm; } +bool WindowsTracker::enabled() const +{ + return m_wm->windowsTracker()->enabled(m_latteView); +} + +void WindowsTracker::setEnabled(bool active) +{ + m_wm->windowsTracker()->setEnabled(m_latteView, active); +} + + TrackerPart::AllScreensTracker *WindowsTracker::allScreens() const { return m_allScreensTracker; diff --git a/app/view/windowstracker/windowstracker.h b/app/view/windowstracker/windowstracker.h index 0aad92df9..5ce97b9ff 100644 --- a/app/view/windowstracker/windowstracker.h +++ b/app/view/windowstracker/windowstracker.h @@ -46,6 +46,8 @@ namespace ViewPart { class WindowsTracker : public QObject { Q_OBJECT + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + Q_PROPERTY(Latte::ViewPart::TrackerPart::CurrentScreenTracker *currentScreen READ currentScreen NOTIFY currentScreenChanged) Q_PROPERTY(Latte::ViewPart::TrackerPart::AllScreensTracker *allScreens READ allScreens NOTIFY allScreensChanged) @@ -53,6 +55,9 @@ public: explicit WindowsTracker(Latte::View *parent); virtual ~WindowsTracker(); + bool enabled() const; + void setEnabled(bool active); + TrackerPart::AllScreensTracker *allScreens() const; TrackerPart::CurrentScreenTracker *currentScreen() const; @@ -62,6 +67,7 @@ public: WindowSystem::AbstractWindowInterface *wm() const; signals: + void enabledChanged(); void activeWindowDraggingStarted(); void allScreensChanged(); void currentScreenChanged();