transmission/qt/tracker-model.h

49 lines
1008 B
C
Raw Normal View History

/*
* This file Copyright (C) 2010-2014 Mnemosyne LLC
*
* It may be used under the GNU Public License v2 or v3 licenses,
* or any future license endorsed by Mnemosyne LLC.
*
* $Id$
*/
#ifndef QTR_TRACKER_MODEL_H
#define QTR_TRACKER_MODEL_H
#include <QAbstractListModel>
#include <QSet>
#include <QVector>
#include "torrent.h"
#include "torrent-model.h"
struct TrackerInfo
{
TrackerStat st;
int torrentId;
};
Q_DECLARE_METATYPE(TrackerInfo)
class TrackerModel: public QAbstractListModel
{
2013-09-14 22:45:04 +00:00
Q_OBJECT
2013-09-14 22:45:04 +00:00
typedef QVector<TrackerInfo> rows_t;
rows_t myRows;
2013-09-14 22:45:04 +00:00
public:
void refresh (const TorrentModel&, const QSet<int>& ids);
int find (int torrentId, const QString& url) const;
2013-09-14 22:45:04 +00:00
public:
virtual int rowCount (const QModelIndex& parent = QModelIndex()) const;
virtual QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const;
enum Role { TrackerRole = Qt::UserRole };
2013-09-14 22:45:04 +00:00
public:
TrackerModel () {}
virtual ~TrackerModel () {}
};
#endif