diff --git a/app/visibilitymanager.h b/app/visibilitymanager.h index 6f0dd467e..20f9f0110 100644 --- a/app/visibilitymanager.h +++ b/app/visibilitymanager.h @@ -1,11 +1,11 @@ #ifndef VISIBILITYMANAGER_H #define VISIBILITYMANAGER_H -#include -#include "../liblattedock/dock.h" #include "abstractinterface.h" #include "plasmaquick/containmentview.h" +#include "../liblattedock/dock.h" +#include #include #include @@ -13,90 +13,64 @@ class VisibilityManager : public QObject { Q_OBJECT - Q_PROPERTY(bool disableHiding READ disableHiding WRITE setDisableHiding NOTIFY disableHidingChanged) - //Q_PROPERTY(bool immutable READ immutable WRITE setImmutable NOTIFY immutableChanged) - Q_PROPERTY(bool isAutoHidden READ isAutoHidden WRITE setIsAutoHidden NOTIFY isAutoHiddenChanged) - Q_PROPERTY(bool isDockWindowType READ isDockWindowType WRITE setIsDockWindowType NOTIFY isDockWindowTypeChanged) - Q_PROPERTY(bool isHovered READ isHovered NOTIFY isHoveredChanged) - Q_PROPERTY(bool windowInAttention READ windowInAttention WRITE setWindowInAttention NOTIFY windowInAttentionChanged) - - Q_PROPERTY(Latte::Dock::Visibility panelVisibility READ panelVisibility WRITE setPanelVisibility NOTIFY panelVisibilityChanged) + Q_PROPERTY(Latte::Dock::Visibility mode READ mode WRITE setMode NOTIFY modeChanged) + Q_PROPERTY(int timerShow READ timerShow WRITE setTimerShow NOTIFY timerShowChanged) + Q_PROPERTY(int timerHide READ timerHide WRITE setTimerHide NOTIFY timerHideChanged) + Q_PROPERTY(Latte::Dock::VisibilityState state READ state WRITE setState NOTIFY stateChanged) public: explicit VisibilityManager(PlasmaQuick::ContainmentView *view); - ~VisibilityManager(); - - bool disableHiding() const; - void setDisableHiding(bool state); - - bool isAutoHidden() const; - void setIsAutoHidden(bool state); - - bool isDockWindowType() const; - void setIsDockWindowType(bool state); - - bool isHovered() const; - - bool windowInAttention() const; - - Latte::Dock::Visibility panelVisibility() const; - void setContainment(Plasma::Containment *contaiment); - void setMaskArea(QRect area); - void setPanelVisibility(Latte::Dock::Visibility state); - -public slots: - Q_INVOKABLE void initialize(); - Q_INVOKABLE void showNormal(); - Q_INVOKABLE void showOnTop(); - Q_INVOKABLE void showOnTopCheck(); - Q_INVOKABLE void showOnBottom(); - bool event(QEvent *event); - void setWindowInAttention(bool state); - void updateVisibilityFlags(); - -Q_SIGNALS: - void disableHidingChanged(); - void isAutoHiddenChanged(); - void isDockWindowTypeChanged(); - void isHoveredChanged(); - void mustBeLowered(); //are used to triger the sliding animations from the qml part - void mustBeRaised(); - void mustBeRaisedImmediately(); - void panelVisibilityChanged(); - void windowInAttentionChanged(); - -private Q_SLOTS: - void activeWindowChanged(); - //void compositingChanged(); - void updateState(); - void initWindow(); - void setIsHovered(bool state); - //void screenChanged(QScreen *screen); - //void setScreenGeometry(QRect geometry); - //void updateWindowPosition(); - -private: - bool m_disableHiding; - bool m_isAutoHidden; - bool m_isDockWindowType; - bool m_isHovered; - //second pass of the initialization - bool m_secondInitPass; - bool m_windowIsInAttention; - - int m_childrenLength; - QRect m_maskArea; - - QTimer m_initTimer; - QTimer m_updateStateTimer; - - Plasma::Containment *m_containment; - PlasmaQuick::ContainmentView *m_view; - - NowDock::AbstractInterface *m_interface; - Latte::Dock::Visibility m_panelVisibility; - + virtual ~VisibilityManager(); + + Latte::Dock::Visibility mode() const; + void setMode(Latte::Dock::Visibility mode); + + int timerShow() const; + void setTimerShow(int msec); + + int timerHide() const; + void setTimerHide(int msec); + + /** + * @brief show, change state to Dock::Visible when show timer is triggered. + */ + Q_INVOKABLE void show(); + + /** + * @brief showImmediately, same that show, but without timer + */ + Q_INVOKABLE void showImmediately(); + + /** + * @brief restore, change to last state, respecting the timers. + */ + Q_INVOKABLE void restore(); + + /** + * @brief showTemporarily, same that show but restores last state automatically + * @param msec, timeout before restoring + */ + Q_INVOKABLE void showTemporarily(int msec); + + /** + * @brief updateDockGeometry, the geometry should be inside screen, not into window. + */ + void updateDockGeometry(QRect &geometry); + +signals: + /** + * @brief mouseEntered, emitted when mouse enters the dock + */ + void mouseEntered(); + + /** + * @brief mouseExited, emitted when mouse leaves the dock + */ + void mouseExited(); + + void modeChanged(); + void timerShowChanged(); + void timerHideChanged(); + void stateChanged(); }; - - -#endif +#endif // VISIBILITYMANAGER_H