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}/windows.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
)

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

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

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

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

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

Loading…
Cancel
Save