transmission 2.83
[tomato.git] / release / src-rt-6.x.4708 / router / transmission / qt / tracker-delegate.h
blobf6578965c71ccb4330678a636ec04a86e5e1ec15
1 /*
2 * This file Copyright (C) 2009-2014 Mnemosyne LLC
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
7 * $Id: tracker-delegate.h 14241 2014-01-21 03:10:30Z jordan $
8 */
10 #ifndef QTR_TRACKER_DELEGATE_H
11 #define QTR_TRACKER_DELEGATE_H
13 #include <QItemDelegate>
14 #include <QSize>
16 class QPainter;
17 class QStyleOptionViewItem;
18 class QStyle;
19 class Session;
20 struct TrackerInfo;
22 class TrackerDelegate: public QItemDelegate
24 Q_OBJECT
26 public:
27 TrackerDelegate (QObject * parent=0): QItemDelegate(parent), myShowMore(false) {}
28 virtual ~TrackerDelegate () {}
30 public:
31 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
32 void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
34 public:
35 void setShowMore (bool b);
37 protected:
38 QString getText (const TrackerInfo&) const;
39 QSize margin (const QStyle& style) const;
40 virtual QSize sizeHint (const QStyleOptionViewItem&, const TrackerInfo&) const;
41 void drawTracker (QPainter*, const QStyleOptionViewItem&, const TrackerInfo&) const;
43 private:
44 bool myShowMore;
47 #endif