2010-07-27 19:43:32 +00:00
|
|
|
/*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This file Copyright (C) Mnemosyne LLC
|
2010-07-27 19:43:32 +00:00
|
|
|
*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
2010-07-27 19:43:32 +00:00
|
|
|
*
|
|
|
|
* $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
|
2010-07-27 19:43:32 +00:00
|
|
|
|
2013-09-14 22:45:04 +00:00
|
|
|
typedef QVector<TrackerInfo> rows_t;
|
|
|
|
rows_t myRows;
|
2010-07-27 19:43:32 +00:00
|
|
|
|
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;
|
2010-07-27 19:43:32 +00:00
|
|
|
|
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 };
|
2010-07-27 19:43:32 +00:00
|
|
|
|
2013-09-14 22:45:04 +00:00
|
|
|
public:
|
|
|
|
TrackerModel () {}
|
|
|
|
virtual ~TrackerModel () {}
|
2010-07-27 19:43:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|