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