]> git.sur5r.net Git - minitube/blob - src/playlist/PrettyItemDelegate.h
6fc547b894f8a230428dec88929ed506b2f416c8
[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
9 class PrettyItemDelegate : public QStyledItemDelegate {
10
11     Q_OBJECT
12
13 public:
14     PrettyItemDelegate( QObject* parent = 0 );
15     ~PrettyItemDelegate();
16
17     QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const;
18     void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
19
20 private:
21     void createPlayIcon();
22     void paintBody( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
23     QPointF centerImage( const QPixmap&, const QRectF& ) const;
24
25     // active track painting
26     void paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const;
27     void paintPlayIcon(QPainter *painter) const;
28
29     //  Paints the video duration
30     void drawTime(QPainter *painter, QString time, QRectF line) const;
31
32     static const qreal THUMB_WIDTH;
33     static const qreal THUMB_HEIGHT;
34     static const qreal PADDING;
35
36     QPixmap playIcon;
37     QFont boldFont;
38     QFont smallerFont;
39     QFont smallerBoldFont;
40 };
41
42 #endif