source: trunk/qt/TorrentDelegate.h @ 14539

Last change on this file since 14539 was 14539, checked in by mikedld, 6 years ago

Unify/prettify Qt client headers style

  • Property svn:keywords set to Date Rev Author Id
File size: 1.6 KB
Line 
1/*
2 * This file Copyright (C) 2009-2015 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: TorrentDelegate.h 14539 2015-06-12 22:12:12Z mikedld $
8 */
9
10#ifndef QTR_TORRENT_DELEGATE_H
11#define QTR_TORRENT_DELEGATE_H
12
13#include <QStyledItemDelegate>
14
15class QStyle;
16class QStyleOptionProgressBar;
17
18class Torrent;
19
20class TorrentDelegate: public QStyledItemDelegate
21{
22    Q_OBJECT
23
24  public:
25    explicit TorrentDelegate (QObject * parent = nullptr);
26    virtual ~TorrentDelegate ();
27
28    // QAbstractItemDelegate
29    virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
30    virtual void paint(QPainter * painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
31
32  protected:
33    QSize margin (const QStyle& style) const;
34    void setProgressBarPercentDone (const QStyleOptionViewItem& option, const Torrent&) const;
35
36    // Our own overridables
37    virtual QSize sizeHint (const QStyleOptionViewItem&, const Torrent&) const;
38    virtual void drawTorrent (QPainter * painter, const QStyleOptionViewItem& option, const Torrent&) const;
39
40    static QString statusString (const Torrent& tor);
41    static QString progressString (const Torrent& tor);
42    static QString shortStatusString (const Torrent& tor);
43    static QString shortTransferString (const Torrent& tor);
44
45  protected:
46    QStyleOptionProgressBar * myProgressBarStyle;
47
48    static QColor blueBrush;
49    static QColor greenBrush;
50    static QColor silverBrush;
51    static QColor blueBack;
52    static QColor greenBack;
53    static QColor silverBack;
54};
55
56#endif // QTR_TORRENT_DELEGATE_H
Note: See TracBrowser for help on using the repository browser.