#ifndef SELECTIONTOGGLE_H
#define SELECTIONTOGGLE_H
+#include <kurl.h>
+
#include <QAbstractButton>
#include <QPixmap>
-#include <QTimer>
+
+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
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);
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