• 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
chunkdownloadmodel.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007 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 KTCHUNKDOWNLOADMODEL_H
22 #define KTCHUNKDOWNLOADMODEL_H
23 
24 #include <QAbstractTableModel>
25 #include <interfaces/chunkdownloadinterface.h>
26 
27 
28 namespace bt
29 {
30  class TorrentInterface;
31 }
32 
33 namespace kt
34 {
35 
39  class ChunkDownloadModel : public QAbstractTableModel
40  {
41  Q_OBJECT
42  public:
43  ChunkDownloadModel(QObject* parent);
44  virtual ~ChunkDownloadModel();
45 
47  void downloadAdded(bt::ChunkDownloadInterface* cd);
48 
50  void downloadRemoved(bt::ChunkDownloadInterface* cd);
51 
53  void changeTC(bt::TorrentInterface* tc);
54 
58  void update();
59 
60  void clear();
61 
62  virtual int rowCount(const QModelIndex & parent) const;
63  virtual int columnCount(const QModelIndex & parent) const;
64  virtual QVariant headerData(int section, Qt::Orientation orientation,int role) const;
65  virtual QVariant data(const QModelIndex & index,int role) const;
66  virtual bool removeRows(int row,int count,const QModelIndex & parent);
67  virtual bool insertRows(int row,int count,const QModelIndex & parent);
68  virtual QModelIndex index(int row,int column,const QModelIndex & parent = QModelIndex()) const;
69 
70  public slots:
71  void sort(int col, Qt::SortOrder order);
72 
73  public:
74  struct Item
75  {
76  mutable bt::ChunkDownloadInterface::Stats stats;
77  bt::ChunkDownloadInterface* cd;
78  QString files;
79 
80  Item(bt::ChunkDownloadInterface* cd,const QString & files);
81 
82  bool changed(int col,bool & modified) const;
83  QVariant data(int col) const;
84  bool lessThan(int col,const Item* other) const;
85  };
86  private:
87  QList<Item*> items;
88  bt::TorrentInterface* tc;
89  int sort_column;
90  Qt::SortOrder sort_order;
91  };
92 
93 }
94 
95 #endif
kt::ChunkDownloadModel
Definition: chunkdownloadmodel.h:39
kt::ChunkDownloadModel::Item
Definition: chunkdownloadmodel.h:74
QObject
kt::ChunkDownloadModel::rowCount
virtual int rowCount(const QModelIndex &parent) const
Definition: chunkdownloadmodel.cpp:185
kt::ChunkDownloadModel::removeRows
virtual bool removeRows(int row, int count, const QModelIndex &parent)
Definition: chunkdownloadmodel.cpp:253
kt::ChunkDownloadModel::columnCount
virtual int columnCount(const QModelIndex &parent) const
Definition: chunkdownloadmodel.cpp:193
kt::ChunkDownloadModel::changeTC
void changeTC(bt::TorrentInterface *tc)
change the current torrent
Definition: chunkdownloadmodel.cpp:151
kt::ChunkDownloadModel::Item::Item
Item(bt::ChunkDownloadInterface *cd, const QString &files)
Definition: chunkdownloadmodel.cpp:34
kt::ChunkDownloadModel::update
void update()
Update the model.
Definition: chunkdownloadmodel.cpp:166
kt::ChunkDownloadModel::Item::cd
bt::ChunkDownloadInterface * cd
Definition: chunkdownloadmodel.h:77
kt::ChunkDownloadModel::downloadAdded
void downloadAdded(bt::ChunkDownloadInterface *cd)
A peer has been added.
Definition: chunkdownloadmodel.cpp:101
kt::ChunkDownloadModel::~ChunkDownloadModel
virtual ~ChunkDownloadModel()
Definition: chunkdownloadmodel.cpp:96
kt::ChunkDownloadModel::Item::changed
bool changed(int col, bool &modified) const
Definition: chunkdownloadmodel.cpp:39
kt::ChunkDownloadModel::downloadRemoved
void downloadRemoved(bt::ChunkDownloadInterface *cd)
A download has been removed.
Definition: chunkdownloadmodel.cpp:134
kt::ChunkDownloadModel::data
virtual QVariant data(const QModelIndex &index, int role) const
Definition: chunkdownloadmodel.cpp:242
kt::ChunkDownloadModel::ChunkDownloadModel
ChunkDownloadModel(QObject *parent)
Definition: chunkdownloadmodel.cpp:88
kt::ChunkDownloadModel::Item::files
QString files
Definition: chunkdownloadmodel.h:78
kt::ChunkDownloadModel::Item::lessThan
bool lessThan(int col, const Item *other) const
Definition: chunkdownloadmodel.cpp:73
kt::ChunkDownloadModel::Item::data
QVariant data(int col) const
Definition: chunkdownloadmodel.cpp:60
kt::ChunkDownloadModel::insertRows
virtual bool insertRows(int row, int count, const QModelIndex &parent)
Definition: chunkdownloadmodel.cpp:260
kt::ChunkDownloadModel::sort
void sort(int col, Qt::SortOrder order)
Definition: chunkdownloadmodel.cpp:285
kt::ChunkDownloadModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: chunkdownloadmodel.cpp:234
kt::ChunkDownloadModel::clear
void clear()
Definition: chunkdownloadmodel.cpp:159
kt::ChunkDownloadModel::Item::stats
bt::ChunkDownloadInterface::Stats stats
Definition: chunkdownloadmodel.h:76
QAbstractTableModel
kt::ChunkDownloadModel::headerData
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: chunkdownloadmodel.cpp:201
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