1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-12 01:17:55 +03:00

move Tracker::Enabled to View::WindowsTracker

--previously it was found in the consumers of
View::WindowsTracker (CurrentScreenTracker and
AllWindowsTracker)
This commit is contained in:
Michail Vourlakos 2019-06-08 18:11:02 +03:00
parent 4cc4bfd6de
commit 353f7119cc
7 changed files with 30 additions and 35 deletions

View File

@ -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<QScreen>();
qmlRegisterType<Latte::View>();
qmlRegisterType<Latte::ViewPart::WindowsTracker>();
qmlRegisterType<Latte::ViewPart::TrackerPart::CurrentScreenTracker>();
qmlRegisterType<Latte::ViewPart::TrackerPart::AllScreensTracker>();
qmlRegisterType<Latte::WindowSystem::SchemeColors>();
qmlRegisterType<Latte::WindowSystem::Tracker::LastActiveWindow>();
}

View File

@ -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());

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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();