source: trunk/qt/TrackerModel.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.0 KB
Line 
1/*
2 * This file Copyright (C) 2010-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: TrackerModel.h 14539 2015-06-12 22:12:12Z mikedld $
8 */
9
10#ifndef QTR_TRACKER_MODEL_H
11#define QTR_TRACKER_MODEL_H
12
13#include <QAbstractListModel>
14#include <QSet>
15#include <QVector>
16
17#include "Torrent.h"
18
19class TorrentModel;
20
21struct TrackerInfo
22{
23  TrackerStat st;
24  int torrentId;
25};
26
27Q_DECLARE_METATYPE(TrackerInfo)
28
29class TrackerModel: public QAbstractListModel
30{
31    Q_OBJECT
32
33  public:
34    enum Role
35    {
36      TrackerRole = Qt::UserRole
37    };
38
39  public:
40    TrackerModel () {}
41    virtual ~TrackerModel () {}
42
43    void refresh (const TorrentModel&, const QSet<int>& ids);
44    int find (int torrentId, const QString& url) const;
45
46    // QAbstractItemModel
47    virtual int rowCount (const QModelIndex& parent = QModelIndex ()) const;
48    virtual QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const;
49
50  private:
51    typedef QVector<TrackerInfo> rows_t;
52
53  private:
54    rows_t myRows;
55};
56
57#endif // QTR_TRACKER_MODEL_H
Note: See TracBrowser for help on using the repository browser.