1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 *
10 * $Id: tracker-delegate.h 11522 2010-12-12 16:43:19Z charles $
11 */
12
13#ifndef QTR_TORRENT_DELEGATE_H
14#define QTR_TORRENT_DELEGATE_H
15
16#include <QItemDelegate>
17#include <QSize>
18
19class QPainter;
20class QStyleOptionViewItem;
21class QStyle;
22class Session;
23class TrackerInfo;
24
25class TrackerDelegate: public QItemDelegate
26{
27        Q_OBJECT
28
29    public:
30        TrackerDelegate( QObject * parent=0 ): QItemDelegate(parent), myShowMore(false) { }
31        virtual ~TrackerDelegate( ) { }
32
33    public:
34        QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
35        void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
36
37    public:
38        void setShowMore( bool b );
39
40    protected:
41        QString getText( const TrackerInfo& ) const;
42        QSize margin( const QStyle& style ) const;
43        virtual QSize sizeHint( const QStyleOptionViewItem&, const TrackerInfo& ) const;
44        void drawTracker( QPainter*, const QStyleOptionViewItem&, const TrackerInfo& ) const;
45
46    private:
47        bool myShowMore;
48};
49
50#endif
51