split trackedinfo to general and view

pull/6/head
Michail Vourlakos 6 years ago
parent c05204ab7b
commit a0226e1de9

@ -3,6 +3,7 @@ set(lattedock-app_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/lastactivewindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/lastactivewindow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/windows.cpp ${CMAKE_CURRENT_SOURCE_DIR}/windows.cpp
${CMAKE_CURRENT_SOURCE_DIR}/schemes.cpp ${CMAKE_CURRENT_SOURCE_DIR}/schemes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/trackedinfo.cpp ${CMAKE_CURRENT_SOURCE_DIR}/trackedgeneralinfo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/trackedviewinfo.cpp
PARENT_SCOPE PARENT_SCOPE
) )

@ -20,7 +20,7 @@
#include "lastactivewindow.h" #include "lastactivewindow.h"
// local // local
#include "trackedinfo.h" #include "trackedgeneralinfo.h"
#include "windows.h" #include "windows.h"
#include "../abstractwindowinterface.h" #include "../abstractwindowinterface.h"
#include "../tasktools.h" #include "../tasktools.h"
@ -37,7 +37,7 @@ namespace Latte {
namespace WindowSystem { namespace WindowSystem {
namespace Tracker { namespace Tracker {
LastActiveWindow::LastActiveWindow(TrackedInfo *trackedInfo) LastActiveWindow::LastActiveWindow(TrackedGeneralInfo *trackedInfo)
: QObject(trackedInfo), : QObject(trackedInfo),
m_trackedInfo(trackedInfo), m_trackedInfo(trackedInfo),
m_windowsTracker(trackedInfo->wm()->windowsTracker()), m_windowsTracker(trackedInfo->wm()->windowsTracker()),

@ -33,7 +33,7 @@ class View;
namespace WindowSystem { namespace WindowSystem {
class AbstractWindowInterface; class AbstractWindowInterface;
namespace Tracker { namespace Tracker {
class TrackedInfo; class TrackedGeneralInfo;
class Windows; class Windows;
} }
} }
@ -63,7 +63,7 @@ class LastActiveWindow : public QObject {
Q_PROPERTY(QVariant winId READ winId NOTIFY winIdChanged) Q_PROPERTY(QVariant winId READ winId NOTIFY winIdChanged)
public: public:
LastActiveWindow(TrackedInfo *trackedInfo); LastActiveWindow(TrackedGeneralInfo *trackedInfo);
~LastActiveWindow() override; ~LastActiveWindow() override;
bool isActive() const; bool isActive() const;
@ -151,7 +151,7 @@ private:
QVariant m_winId; QVariant m_winId;
TrackedInfo *m_trackedInfo{nullptr}; TrackedGeneralInfo *m_trackedInfo{nullptr};
AbstractWindowInterface *m_wm{nullptr}; AbstractWindowInterface *m_wm{nullptr};
Tracker::Windows *m_windowsTracker{nullptr}; Tracker::Windows *m_windowsTracker{nullptr};
}; };

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "trackedinfo.h" #include "trackedgeneralinfo.h"
//local //local
#include "windows.h" #include "windows.h"
@ -29,7 +29,7 @@ namespace WindowSystem {
namespace Tracker { namespace Tracker {
TrackedInfo::TrackedInfo(Tracker::Windows *tracker, Latte::View *view) TrackedGeneralInfo::TrackedGeneralInfo(Tracker::Windows *tracker, Latte::View *view)
: QObject(tracker) , : QObject(tracker) ,
m_wm(tracker->wm()), m_wm(tracker->wm()),
m_view(view) m_view(view)
@ -39,7 +39,7 @@ TrackedInfo::TrackedInfo(Tracker::Windows *tracker, Latte::View *view)
emit lastActiveWindowChanged(); emit lastActiveWindowChanged();
} }
TrackedInfo::~TrackedInfo() TrackedGeneralInfo::~TrackedGeneralInfo()
{ {
if (m_lastActiveWindow) { if (m_lastActiveWindow) {
auto law = m_lastActiveWindow; auto law = m_lastActiveWindow;
@ -50,12 +50,12 @@ TrackedInfo::~TrackedInfo()
} }
} }
bool TrackedInfo::enabled() const bool TrackedGeneralInfo::enabled() const
{ {
return m_enabled; return m_enabled;
} }
void TrackedInfo::setEnabled(bool enabled) void TrackedGeneralInfo::setEnabled(bool enabled)
{ {
if (m_enabled == enabled) { if (m_enabled == enabled) {
return; return;
@ -64,12 +64,12 @@ void TrackedInfo::setEnabled(bool enabled)
m_enabled = enabled; m_enabled = enabled;
} }
bool TrackedInfo::activeWindowMaximized() const bool TrackedGeneralInfo::activeWindowMaximized() const
{ {
return m_activeWindowMaximized; return m_activeWindowMaximized;
} }
void TrackedInfo::setActiveWindowMaximized(bool activeMaximized) void TrackedGeneralInfo::setActiveWindowMaximized(bool activeMaximized)
{ {
if (m_activeWindowMaximized == activeMaximized) { if (m_activeWindowMaximized == activeMaximized) {
return; return;
@ -78,26 +78,12 @@ void TrackedInfo::setActiveWindowMaximized(bool activeMaximized)
m_activeWindowMaximized = activeMaximized; m_activeWindowMaximized = activeMaximized;
} }
bool TrackedInfo::activeWindowTouching() const bool TrackedGeneralInfo::existsWindowActive() const
{
return m_activeWindowTouching;
}
void TrackedInfo::setActiveWindowTouching(bool touching)
{
if (m_activeWindowTouching == touching) {
return;
}
m_activeWindowTouching = touching;
}
bool TrackedInfo::existsWindowActive() const
{ {
return m_existsWindowActive; return m_existsWindowActive;
} }
void TrackedInfo::setExistsWindowActive(bool exists) void TrackedGeneralInfo::setExistsWindowActive(bool exists)
{ {
if (m_existsWindowActive == exists) { if (m_existsWindowActive == exists) {
return; return;
@ -106,12 +92,12 @@ void TrackedInfo::setExistsWindowActive(bool exists)
m_existsWindowActive = exists; m_existsWindowActive = exists;
} }
bool TrackedInfo::existsWindowMaximized() const bool TrackedGeneralInfo::existsWindowMaximized() const
{ {
return m_existsWindowMaximized; return m_existsWindowMaximized;
} }
void TrackedInfo::setExistsWindowMaximized(bool maximized) void TrackedGeneralInfo::setExistsWindowMaximized(bool maximized)
{ {
if (m_existsWindowMaximized == maximized) { if (m_existsWindowMaximized == maximized) {
return; return;
@ -120,45 +106,17 @@ void TrackedInfo::setExistsWindowMaximized(bool maximized)
m_existsWindowMaximized = maximized; m_existsWindowMaximized = maximized;
} }
bool TrackedInfo::existsWindowTouching() const LastActiveWindow *TrackedGeneralInfo::lastActiveWindow() const
{
return m_existsWindowTouching;
}
void TrackedInfo::setExistsWindowTouching(bool touching)
{
if (m_existsWindowTouching == touching) {
return;
}
m_existsWindowTouching = touching;
}
QRect TrackedInfo::availableScreenGeometry() const
{
return m_availableScreenGeometry;
}
void TrackedInfo::setAvailableScreenGeometry(QRect geometry)
{
if (m_availableScreenGeometry == geometry) {
return;
}
m_availableScreenGeometry = geometry;
}
LastActiveWindow *TrackedInfo::lastActiveWindow() const
{ {
return m_lastActiveWindow; return m_lastActiveWindow;
} }
SchemeColors *TrackedInfo::activeWindowScheme() const SchemeColors *TrackedGeneralInfo::activeWindowScheme() const
{ {
return m_activeWindowScheme; return m_activeWindowScheme;
} }
void TrackedInfo::setActiveWindowScheme(SchemeColors *scheme) void TrackedGeneralInfo::setActiveWindowScheme(SchemeColors *scheme)
{ {
if (m_activeWindowScheme == scheme) { if (m_activeWindowScheme == scheme) {
return; return;
@ -167,26 +125,12 @@ void TrackedInfo::setActiveWindowScheme(SchemeColors *scheme)
m_activeWindowScheme = scheme; m_activeWindowScheme = scheme;
} }
SchemeColors *TrackedInfo::touchingWindowScheme() const Latte::View *TrackedGeneralInfo::view()
{
return m_touchingWindowScheme;
}
void TrackedInfo::setTouchingWindowScheme(SchemeColors *scheme)
{
if (m_touchingWindowScheme == scheme) {
return;
}
m_touchingWindowScheme = scheme;
}
Latte::View *TrackedInfo::view()
{ {
return m_view; return m_view;
} }
AbstractWindowInterface *TrackedInfo::wm() AbstractWindowInterface *TrackedGeneralInfo::wm()
{ {
return m_wm; return m_wm;
} }

@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef WINDOWSYSTEMTRACKEDINFO_H #ifndef WINDOWSYSTEMTRACKEDGENERALINFO_H
#define WINDOWSYSTEMTRACKEDINFO_H #define WINDOWSYSTEMTRACKEDGENERALINFO_H
// local // local
#include "lastactivewindow.h" #include "lastactivewindow.h"
@ -26,7 +26,6 @@
// Qt // Qt
#include <QObject> #include <QObject>
#include <QRect>
namespace Latte { namespace Latte {
class View; class View;
@ -43,14 +42,14 @@ namespace Latte {
namespace WindowSystem { namespace WindowSystem {
namespace Tracker { namespace Tracker {
class TrackedInfo : public QObject { class TrackedGeneralInfo : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *activeWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged) Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *activeWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
public: public:
TrackedInfo(Tracker::Windows *tracker, Latte::View *view); TrackedGeneralInfo(Tracker::Windows *tracker, Latte::View *view);
~TrackedInfo() override; ~TrackedGeneralInfo() override;
bool enabled() const; bool enabled() const;
void setEnabled(bool enabled); void setEnabled(bool enabled);
@ -58,18 +57,12 @@ public:
bool activeWindowMaximized() const; bool activeWindowMaximized() const;
void setActiveWindowMaximized(bool activeMaximized); void setActiveWindowMaximized(bool activeMaximized);
bool activeWindowTouching() const;
void setActiveWindowTouching(bool touching);
bool existsWindowActive() const; bool existsWindowActive() const;
void setExistsWindowActive(bool exists); void setExistsWindowActive(bool exists);
bool existsWindowMaximized() const; bool existsWindowMaximized() const;
void setExistsWindowMaximized(bool maximized); void setExistsWindowMaximized(bool maximized);
bool existsWindowTouching() const;
void setExistsWindowTouching(bool touching);
QRect availableScreenGeometry() const; QRect availableScreenGeometry() const;
void setAvailableScreenGeometry(QRect geometry); void setAvailableScreenGeometry(QRect geometry);
@ -78,9 +71,6 @@ public:
SchemeColors *activeWindowScheme() const; SchemeColors *activeWindowScheme() const;
void setActiveWindowScheme(SchemeColors *scheme); void setActiveWindowScheme(SchemeColors *scheme);
SchemeColors *touchingWindowScheme() const;
void setTouchingWindowScheme(SchemeColors *scheme);
Latte::View *view(); Latte::View *view();
AbstractWindowInterface *wm(); AbstractWindowInterface *wm();
@ -90,18 +80,13 @@ signals:
private: private:
bool m_enabled; bool m_enabled;
bool m_activeWindowMaximized; bool m_activeWindowMaximized;
bool m_activeWindowTouching;
bool m_existsWindowActive; bool m_existsWindowActive;
bool m_existsWindowMaximized; bool m_existsWindowMaximized;
bool m_existsWindowTouching;
QRect m_availableScreenGeometry;
Latte::View *m_view{nullptr}; Latte::View *m_view{nullptr};
LastActiveWindow *m_lastActiveWindow{nullptr}; LastActiveWindow *m_lastActiveWindow{nullptr};
SchemeColors *m_activeWindowScheme{nullptr}; SchemeColors *m_activeWindowScheme{nullptr};
SchemeColors *m_touchingWindowScheme{nullptr};
AbstractWindowInterface *m_wm{nullptr}; AbstractWindowInterface *m_wm{nullptr};
}; };

@ -0,0 +1,100 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "trackedviewinfo.h"
//local
#include "windows.h"
#include "../schemecolors.h"
#include "../../view/view.h"
namespace Latte {
namespace WindowSystem {
namespace Tracker {
TrackedViewInfo::TrackedViewInfo(Tracker::Windows *tracker, Latte::View *view)
: TrackedGeneralInfo(tracker, view)
{
}
TrackedViewInfo::~TrackedViewInfo()
{
}
bool TrackedViewInfo::activeWindowTouching() const
{
return m_activeWindowTouching;
}
void TrackedViewInfo::setActiveWindowTouching(bool touching)
{
if (m_activeWindowTouching == touching) {
return;
}
m_activeWindowTouching = touching;
}
bool TrackedViewInfo::existsWindowTouching() const
{
return m_existsWindowTouching;
}
void TrackedViewInfo::setExistsWindowTouching(bool touching)
{
if (m_existsWindowTouching == touching) {
return;
}
m_existsWindowTouching = touching;
}
QRect TrackedViewInfo::availableScreenGeometry() const
{
return m_availableScreenGeometry;
}
void TrackedViewInfo::setAvailableScreenGeometry(QRect geometry)
{
if (m_availableScreenGeometry == geometry) {
return;
}
m_availableScreenGeometry = geometry;
}
SchemeColors *TrackedViewInfo::touchingWindowScheme() const
{
return m_touchingWindowScheme;
}
void TrackedViewInfo::setTouchingWindowScheme(SchemeColors *scheme)
{
if (m_touchingWindowScheme == scheme) {
return;
}
m_touchingWindowScheme = scheme;
}
}
}
}

@ -0,0 +1,78 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WINDOWSYSTEMTRACKEDVIEWINFO_H
#define WINDOWSYSTEMTRACKEDVIEWINFO_H
// local
#include "trackedgeneralinfo.h"
#include "../windowinfowrap.h"
// Qt
#include <QObject>
#include <QRect>
namespace Latte {
class View;
namespace WindowSystem {
class SchemeColors;
namespace Tracker {
class Windows;
}
}
}
namespace Latte {
namespace WindowSystem {
namespace Tracker {
class TrackedViewInfo : public TrackedGeneralInfo {
Q_OBJECT
public:
TrackedViewInfo(Tracker::Windows *tracker, Latte::View *view);
~TrackedViewInfo() override;
bool activeWindowTouching() const;
void setActiveWindowTouching(bool touching);
bool existsWindowTouching() const;
void setExistsWindowTouching(bool touching);
QRect availableScreenGeometry() const;
void setAvailableScreenGeometry(QRect geometry);
SchemeColors *touchingWindowScheme() const;
void setTouchingWindowScheme(SchemeColors *scheme);
private:
bool m_activeWindowTouching;
bool m_existsWindowTouching;
QRect m_availableScreenGeometry;
SchemeColors *m_touchingWindowScheme{nullptr};
};
}
}
}
#endif

@ -22,7 +22,7 @@
// local // local
#include "lastactivewindow.h" #include "lastactivewindow.h"
#include "schemes.h" #include "schemes.h"
#include "trackedinfo.h" #include "trackedviewinfo.h"
#include "../abstractwindowinterface.h" #include "../abstractwindowinterface.h"
#include "../schemecolors.h" #include "../schemecolors.h"
#include "../../lattecorona.h" #include "../../lattecorona.h"
@ -46,7 +46,7 @@ Windows::Windows(AbstractWindowInterface *parent)
Windows::~Windows() Windows::~Windows()
{ {
//! clear all the m_views tracking information //! clear all the m_views tracking information
for (QHash<Latte::View *, TrackedInfo *>::iterator i=m_views.begin(); i!=m_views.end(); ++i) { for (QHash<Latte::View *, TrackedViewInfo *>::iterator i=m_views.begin(); i!=m_views.end(); ++i) {
i.value()->deleteLater(); i.value()->deleteLater();
m_views[i.key()] = nullptr; m_views[i.key()] = nullptr;
} }
@ -138,7 +138,7 @@ void Windows::addView(Latte::View *view)
return; return;
} }
m_views[view] = new TrackedInfo(this, view); m_views[view] = new TrackedViewInfo(this, view);
updateAvailableScreenGeometries(); updateAvailableScreenGeometries();
updateHints(view); updateHints(view);

@ -36,7 +36,7 @@ class AbstractWindowInterface;
class SchemeColors; class SchemeColors;
namespace Tracker { namespace Tracker {
class LastActiveWindow; class LastActiveWindow;
class TrackedInfo; class TrackedViewInfo;
} }
} }
} }
@ -114,7 +114,7 @@ private:
private: private:
AbstractWindowInterface *m_wm; AbstractWindowInterface *m_wm;
QHash<Latte::View *, TrackedInfo *> m_views; QHash<Latte::View *, TrackedViewInfo *> m_views;
QMap<WindowId, WindowInfoWrap > m_windows; QMap<WindowId, WindowInfoWrap > m_windows;
}; };

Loading…
Cancel
Save