• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • transfer-plugins
  • bittorrent
  • advanceddetails
trackermodel.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2008 by Joris Guisson and Ivan Vasic *
3  * joris.guisson@gmail.com *
4  * ivasic@gmail.com *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20  ***************************************************************************/
21 #ifndef KTTRACKERMODEL_H
22 #define KTTRACKERMODEL_H
23 
24 #include <QList>
25 #include <KUrl>
26 #include <QAbstractTableModel>
27 #include <interfaces/trackerinterface.h>
28 
29 namespace bt
30 {
31  class TorrentInterface;
32 }
33 
34 namespace kt
35 {
36 
40  class TrackerModel : public QAbstractTableModel
41  {
42  Q_OBJECT
43  public:
44  TrackerModel(QObject* parent);
45  virtual ~TrackerModel();
46 
47  void changeTC(bt::TorrentInterface* tc);
48  void update();
49 
50  virtual int rowCount(const QModelIndex &parent) const;
51  virtual int columnCount(const QModelIndex &parent) const;
52  virtual QVariant data(const QModelIndex &index, int role) const;
53  virtual bool setData(const QModelIndex & index,const QVariant & value,int role);
54  virtual QVariant headerData(int section, Qt::Orientation orientation,int role) const;
55  virtual bool insertRows(int row,int count,const QModelIndex & parent);
56  virtual bool removeRows(int row,int count,const QModelIndex & parent);
57  virtual Qt::ItemFlags flags(const QModelIndex & index) const;
58  virtual QModelIndex index(int row,int column,const QModelIndex & parent = QModelIndex()) const;
59 
61  KUrl trackerUrl(const QModelIndex & idx);
62 
64  bt::TrackerInterface* tracker(const QModelIndex & idx);
65 
66  private:
67  struct Item
68  {
69  bt::TrackerInterface* trk;
70  bt::TrackerStatus status;
71  int seeders;
72  int leechers;
73  int times_downloaded;
74  int time_to_next_update;
75 
76  Item(bt::TrackerInterface* tracker);
77  bool update();
78  QVariant displayData(int column) const;
79  QVariant sortData(int column) const;
80  };
81 
82  bt::TorrentInterface* tc;
83  QList<Item*> trackers;
84  bool running;
85  };
86 
87 }
88 
89 #endif
kt::TrackerModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: trackermodel.cpp:208
kt::TrackerModel::columnCount
virtual int columnCount(const QModelIndex &parent) const
Definition: trackermodel.cpp:84
QObject
kt::TrackerModel
Definition: trackermodel.h:40
kt::TrackerModel::~TrackerModel
virtual ~TrackerModel()
Definition: trackermodel.cpp:37
kt::TrackerModel::update
void update()
Definition: trackermodel.cpp:59
kt::TrackerModel::rowCount
virtual int rowCount(const QModelIndex &parent) const
Definition: trackermodel.cpp:76
kt::TrackerModel::tracker
bt::TrackerInterface * tracker(const QModelIndex &idx)
Get a tracker given a model index.
Definition: trackermodel.cpp:225
kt::TrackerModel::data
virtual QVariant data(const QModelIndex &index, int role) const
Definition: trackermodel.cpp:93
kt::TrackerModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: trackermodel.cpp:200
kt::TrackerModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
Definition: trackermodel.cpp:124
kt::TrackerModel::headerData
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: trackermodel.cpp:138
kt::TrackerModel::trackerUrl
KUrl trackerUrl(const QModelIndex &idx)
Get a tracker url given a model index.
Definition: trackermodel.cpp:217
kt::TrackerModel::removeRows
virtual bool removeRows(int row, int count, const QModelIndex &parent)
Definition: trackermodel.cpp:182
kt::TrackerModel::changeTC
void changeTC(bt::TorrentInterface *tc)
Definition: trackermodel.cpp:42
kt::TrackerModel::TrackerModel
TrackerModel(QObject *parent)
Definition: trackermodel.cpp:30
kt::TrackerModel::insertRows
virtual bool insertRows(int row, int count, const QModelIndex &parent)
Definition: trackermodel.cpp:158
QAbstractTableModel
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal