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-model.h 11092 2010-08-01 20:36:13Z charles $
11 */
12
13#ifndef QTR_TRACKER_MODEL_H
14#define QTR_TRACKER_MODEL_H
15
16#include <QAbstractListModel>
17#include <QSet>
18#include <QVector>
19
20#include "torrent.h"
21#include "torrent-model.h"
22
23struct TrackerInfo
24{
25    TrackerStat st;
26    int torrentId;
27};
28Q_DECLARE_METATYPE(TrackerInfo)
29
30class TrackerModel: public QAbstractListModel
31{
32        Q_OBJECT
33
34        typedef QVector<TrackerInfo> rows_t;
35        rows_t myRows;
36
37    public:
38        void refresh( const TorrentModel&, const QSet<int>& ids );
39        int find( int torrentId, const QString& url ) const;
40
41    public:
42        virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
43        virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
44        enum Role { TrackerRole = Qt::UserRole };
45
46    public:
47        TrackerModel( ) { }
48        virtual ~TrackerModel( ) { }
49};
50
51#endif
52