]> git.sur5r.net Git - minitube/blob - src/playlist/PrettyItemDelegate.h
Imported Upstream version 1.4.1
[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 paintSelectedOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const;
31     void paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const;
32     void paintPlayIcon(QPainter *painter) const;
33
34     //  Paints the video duration
35     void drawTime(QPainter *painter, QString time, QRectF line) const;
36
37     static const qreal THUMB_WIDTH;
38     static const qreal THUMB_HEIGHT;
39     static const qreal PADDING;
40
41     QPixmap playIcon;
42     QFont boldFont;
43     QFont smallerFont;
44     QFont smallerBoldFont;
45
46     bool downloadInfo;
47     QProgressBar *progressBar;
48 };
49
50 #endif