]> git.sur5r.net Git - minitube/blob - src/playlist/PrettyItemDelegate.h
Initial import
[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
10 namespace Playlist {
11
12     class PrettyItemDelegate : public QStyledItemDelegate {
13
14         Q_OBJECT
15
16     public:
17         PrettyItemDelegate( QObject* parent = 0 );
18         ~PrettyItemDelegate();
19
20         QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const;
21         void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
22
23     private:
24         void paintBody( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
25
26         QPointF centerImage( const QPixmap&, const QRectF& ) const;
27
28         /**
29              * Paints a marker indicating the track is active
30              */
31         void paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const;
32         /**
33           * Paints the video duration
34           */
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 MARGIN;
40         static const qreal MARGINH;
41         static const qreal MARGINBODY;
42         static const qreal PADDING;
43
44     };
45 }
46
47 #endif
48