X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f6c7b90edf05a52fba6e2a06caa0247e909b43e8..b1c9b5126d:/src/selectiontoggle.h diff --git a/src/selectiontoggle.h b/src/selectiontoggle.h index 5815c5dae..e8f808562 100644 --- a/src/selectiontoggle.h +++ b/src/selectiontoggle.h @@ -20,12 +20,19 @@ #ifndef SELECTIONTOGGLE_H #define SELECTIONTOGGLE_H +#include + #include #include -#include + +class QTimeLine; /** * @brief Toggle button for changing the selection of an hovered item. + * + * The toggle button is visually invisible until it is displayed at least + * for one second. + * * @see SelectionManager */ class SelectionToggle : public QAbstractButton @@ -37,6 +44,15 @@ public: virtual ~SelectionToggle(); virtual QSize sizeHint() const; + /** + * Resets the selection toggle so that it is hidden and stays + * visually invisible for at least one second after it is shown again. + */ + void reset(); + + void setUrl(const KUrl& url); + KUrl url() const; + public slots: virtual void setVisible(bool visible); @@ -47,13 +63,25 @@ protected: virtual void paintEvent(QPaintEvent* event); private slots: - void showIcon(); + /** + * Sets the alpha value for the fading animation and is + * connected with m_fadingTimeLine. + */ + void setFadingValue(int value); + + void setIconOverlay(bool checked); + void refreshIcon(); + +private: + void startFading(); + void stopFading(); private: - bool m_showIcon; bool m_isHovered; + int m_fadingValue; QPixmap m_icon; - QTimer* m_timer; + QTimeLine* m_fadingTimeLine; + KUrl m_url; }; #endif