]> git.sur5r.net Git - minitube/blob - src/playlistitemdelegate.h
Imported Upstream version 2.0
[minitube] / src / playlistitemdelegate.h
1 #ifndef PLAYLISTITEMDELEGATE_H
2 #define PLAYLISTITEMDELEGATE_H
3
4 #include <QtGui>
5
6 class PlaylistItemDelegate : public QStyledItemDelegate {
7
8     Q_OBJECT
9
10 public:
11     PlaylistItemDelegate(QObject* parent, bool downloadInfo = false);
12     ~PlaylistItemDelegate();
13
14     QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const;
15     void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
16     QRect downloadButtonRect(QRect line) const;
17     QRect authorRect(const QModelIndex& index) const;
18
19 private:
20     void createPlayIcon();
21     void paintBody( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
22     void paintDownloadInfo( QPainter* painter,
23                                         const QStyleOptionViewItem& option,
24                                         const QModelIndex& index ) const;
25
26     // active track painting
27     void paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const;
28     void paintPlayIcon(QPainter *painter) const;
29
30     //  Paints the video duration
31     void drawTime(QPainter *painter, QString time, QRectF line) const;
32
33     static const qreal THUMB_WIDTH;
34     static const qreal THUMB_HEIGHT;
35     static const qreal PADDING;
36
37     QPixmap playIcon;
38     QFont boldFont;
39     QFont smallerFont;
40     QFont smallerBoldFont;
41
42     bool downloadInfo;
43     QProgressBar *progressBar;
44
45 };
46
47 #endif