~ubuntu-branches/ubuntu/precise/transmission/precise

« back to all changes in this revision

Viewing changes to qt/torrent-delegate.h

  • Committer: Bazaar Package Importer
  • Author(s): Leo Costela
  • Date: 2009-05-17 19:39:51 UTC
  • mto: (1.3.4 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20090517193951-k8x15sqoxzf7cuyx
ImportĀ upstreamĀ versionĀ 1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file Copyright (C) 2009 Charles Kerr <charles@transmissionbt.com>
 
3
 *
 
4
 * This file is licensed by the GPL version 2.  Works owned by the
 
5
 * Transmission project are granted a special exemption to clause 2(b)
 
6
 * so that the bulk of its code can remain under the MIT license.
 
7
 * This exemption does not extend to derived works not owned by
 
8
 * the Transmission project.
 
9
 *
 
10
 * $Id:$
 
11
 */
 
12
 
 
13
#ifndef QTR_TORRENT_DELEGATE_H
 
14
#define QTR_TORRENT_DELEGATE_H
 
15
 
 
16
#include <QItemDelegate>
 
17
#include <QSize>
 
18
 
 
19
class QStyleOptionProgressBarV2;
 
20
class QStyleOptionViewItem;
 
21
class QStyle;
 
22
class Session;
 
23
class Torrent;
 
24
 
 
25
class TorrentDelegate: public QItemDelegate
 
26
{
 
27
        Q_OBJECT
 
28
 
 
29
    protected:
 
30
        QStyleOptionProgressBarV2 * myProgressBarStyle;
 
31
 
 
32
    protected:
 
33
        QString statusString( const Torrent& tor ) const;
 
34
        QString progressString( const Torrent& tor ) const;
 
35
        QString shortStatusString( const Torrent& tor ) const;
 
36
        QString shortTransferString( const Torrent& tor ) const;
 
37
 
 
38
    protected:
 
39
        QSize margin( const QStyle& style ) const;
 
40
        virtual QSize sizeHint( const QStyleOptionViewItem&, const Torrent& ) const;
 
41
        virtual void drawTorrent( QPainter* painter, const QStyleOptionViewItem& option, const Torrent& ) const;
 
42
 
 
43
    public:
 
44
        explicit TorrentDelegate( QObject * parent=0 );
 
45
        virtual ~TorrentDelegate( );
 
46
 
 
47
        QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
 
48
        void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
 
49
};
 
50
 
 
51
#endif