1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-08 13:18:09 +03:00

refactor:add visibilitymanager to ViewPart::

This commit is contained in:
Michail Vourlakos 2018-12-09 00:29:35 +02:00
parent 57ab5f3b3f
commit b05c7d94ae
5 changed files with 16 additions and 11 deletions

View File

@ -108,9 +108,9 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassWM)
reconsiderScreen();
if (!m_visibility) {
m_visibility = new VisibilityManager(this);
m_visibility = new ViewPart::VisibilityManager(this);
connect(m_visibility, &VisibilityManager::isHiddenChanged, this, [&]() {
connect(m_visibility, &ViewPart::VisibilityManager::isHiddenChanged, this, [&]() {
if (m_visibility->isHidden()) {
deactivateApplets();
}
@ -894,7 +894,7 @@ ViewPart::Positioner *View::positioner() const
return m_positioner;
}
VisibilityManager *View::visibility() const
ViewPart::VisibilityManager *View::visibility() const
{
return m_visibility;
}

View File

@ -92,7 +92,7 @@ class View : public PlasmaQuick::ContainmentView
Q_PROPERTY(Latte::ViewPart::Effects *effects READ effects NOTIFY effectsChanged)
Q_PROPERTY(Layout *managedLayout READ managedLayout WRITE setManagedLayout NOTIFY managedLayoutChanged)
Q_PROPERTY(Latte::ViewPart::Positioner *positioner READ positioner NOTIFY positionerChanged)
Q_PROPERTY(VisibilityManager *visibility READ visibility NOTIFY visibilityChanged)
Q_PROPERTY(Latte::ViewPart::VisibilityManager *visibility READ visibility NOTIFY visibilityChanged)
Q_PROPERTY(QRect absoluteGeometry READ absGeometry NOTIFY absGeometryChanged)
Q_PROPERTY(QRect localGeometry READ localGeometry WRITE setLocalGeometry NOTIFY localGeometryChanged)
@ -157,7 +157,7 @@ public:
ViewPart::Effects *effects() const;
ViewPart::Positioner *positioner() const;
VisibilityManager *visibility() const;
ViewPart::VisibilityManager *visibility() const;
Layout *managedLayout() const;
void setManagedLayout(Layout *layout);
@ -273,7 +273,7 @@ private:
QPointer<ViewPart::ContextMenu> m_contextMenu;
QPointer<ViewPart::Effects> m_effects;
QPointer<ViewPart::Positioner> m_positioner;
QPointer<VisibilityManager> m_visibility;
QPointer<ViewPart::VisibilityManager> m_visibility;
//! Connections to release and bound for the managed layout
std::array<QMetaObject::Connection, 5> connectionsManagedLayout;

View File

@ -39,6 +39,7 @@
#include <KWayland/Client/surface.h>
namespace Latte {
namespace ViewPart {
//! BEGIN: VisiblityManagerPrivate implementation
VisibilityManagerPrivate::VisibilityManagerPrivate(PlasmaQuick::ContainmentView *view, VisibilityManager *q)
@ -1008,11 +1009,11 @@ void VisibilityManagerPrivate::updateKWinEdgesSupport()
void VisibilityManagerPrivate::createEdgeGhostWindow()
{
if (!edgeGhostWindow) {
edgeGhostWindow = new ViewPart::ScreenEdgeGhostWindow(m_latteView);
edgeGhostWindow = new ScreenEdgeGhostWindow(m_latteView);
wm->setViewExtraFlags(*edgeGhostWindow);
connect(edgeGhostWindow, &ViewPart::ScreenEdgeGhostWindow::containsMouseChanged, this, [ = ](bool contains) {
connect(edgeGhostWindow, &ScreenEdgeGhostWindow::containsMouseChanged, this, [ = ](bool contains) {
if (contains) {
emit this->q->mustBeShown(VisibilityManager::QPrivateSignal{});
}
@ -1252,3 +1253,4 @@ bool VisibilityManager::activeWindowCanBeDragged()
//! END: VisibilityManager implementation
}
}

View File

@ -35,6 +35,7 @@
#include <Plasma/Containment>
namespace Latte {
namespace ViewPart {
class VisibilityManagerPrivate;
@ -141,5 +142,6 @@ private:
friend class VisibilityManagerPrivate;
};
}
}
#endif // VISIBILITYMANAGER_H

View File

@ -22,16 +22,16 @@
#include <plasmaquick/containmentview.h>
namespace Latte {
class Corona;
class View;
class VisibilityManager;
namespace ViewPart {
class ScreenEdgeGhostWindow;
class VisibilityManager;
}
}
namespace Latte {
namespace ViewPart {
/*!
* \brief The Latte::VisibilityManagerPrivate is a class d-pointer
*/
@ -135,12 +135,13 @@ public:
//! KWin Edges
bool enableKWinEdgesFromUser{true};
std::array<QMetaObject::Connection, 1> connectionsKWinEdges;
ViewPart::ScreenEdgeGhostWindow *edgeGhostWindow{nullptr};
ScreenEdgeGhostWindow *edgeGhostWindow{nullptr};
Latte::Corona *m_corona{nullptr};
Latte::View *m_latteView{nullptr};
};
}
}
#endif // VISIBILITYMANAGERPRIVATE_H