• 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
torrentfilemodel.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 KTTORRENTFILEMODEL_HH
22 #define KTTORRENTFILEMODEL_HH
23 
24 #include <QByteArray>
25 #include <QAbstractItemModel>
26 #include <util/constants.h>
27 
28 class QTreeView;
29 class QSortFilterProxyModel;
30 
31 namespace bt
32 {
33  class TorrentInterface;
34  class TorrentFileInterface;
35 }
36 
37 namespace kt
38 {
39  class TorrentFileModel : public QAbstractItemModel
40  {
41  Q_OBJECT
42  public:
43  enum DeselectMode
44  {
45  KEEP_FILES,DELETE_FILES
46  };
47  TorrentFileModel(bt::TorrentInterface* tc,DeselectMode mode,QObject* parent);
48  virtual ~TorrentFileModel();
49 
50 
54  virtual void checkAll() = 0;
55 
59  virtual void uncheckAll() = 0;
60 
64  virtual void invertCheck() = 0;
65 
70  virtual bt::Uint64 bytesToDownload() = 0;
71 
78  virtual QByteArray saveExpandedState(QSortFilterProxyModel* pm,QTreeView* tv);
79 
86  virtual void loadExpandedState(QSortFilterProxyModel* pm,QTreeView* tv,const QByteArray & state);
87 
93  virtual bt::TorrentFileInterface* indexToFile(const QModelIndex & idx) = 0;
94 
100  virtual QString dirPath(const QModelIndex & idx) = 0;
101 
107  virtual void changePriority(const QModelIndexList & indexes,bt::Priority newpriority) = 0;
108 
112  virtual void missingFilesMarkedDND();
113 
117  virtual void update();
118 
122  virtual void onCodecChange();
123 
125  void setFileNamesEditable(bool on) {file_names_editable = on;}
126 
128  bool fileNamesEditable() const {return file_names_editable;}
129 
130  virtual Qt::ItemFlags flags(const QModelIndex & index) const;
131 
132  virtual void filePercentageChanged(bt::TorrentFileInterface* file,float percentage);
133  virtual void filePreviewChanged(bt::TorrentFileInterface* file,bool preview);
134 signals:
138  void checkStateChanged();
139 
140  protected:
141  bt::TorrentInterface* tc;
142  DeselectMode mode;
143  bool file_names_editable;
144  };
145 }
146 
147 #endif
kt::TorrentFileModel::mode
DeselectMode mode
Definition: torrentfilemodel.h:142
kt::TorrentFileModel::filePercentageChanged
virtual void filePercentageChanged(bt::TorrentFileInterface *file, float percentage)
Definition: torrentfilemodel.cpp:71
kt::TorrentFileModel::setFileNamesEditable
void setFileNamesEditable(bool on)
Set the file names editable.
Definition: torrentfilemodel.h:125
kt::TorrentFileModel::tc
bt::TorrentInterface * tc
Definition: torrentfilemodel.h:141
kt::TorrentFileModel::DELETE_FILES
Definition: torrentfilemodel.h:45
kt::TorrentFileModel::~TorrentFileModel
virtual ~TorrentFileModel()
Definition: torrentfilemodel.cpp:32
kt::TorrentFileModel::missingFilesMarkedDND
virtual void missingFilesMarkedDND()
Missing files have been marked DND, update the preview and selection information. ...
Definition: torrentfilemodel.cpp:43
kt::TorrentFileModel::onCodecChange
virtual void onCodecChange()
Codec has changed, so update the model.
Definition: torrentfilemodel.cpp:51
QObject
kt::TorrentFileModel::dirPath
virtual QString dirPath(const QModelIndex &idx)=0
Get the path of a directory (root directory not included)
QTreeView
kt::TorrentFileModel::KEEP_FILES
Definition: torrentfilemodel.h:45
kt::TorrentFileModel::file_names_editable
bool file_names_editable
Definition: torrentfilemodel.h:143
kt::TorrentFileModel::DeselectMode
DeselectMode
Definition: torrentfilemodel.h:43
kt::TorrentFileModel::loadExpandedState
virtual void loadExpandedState(QSortFilterProxyModel *pm, QTreeView *tv, const QByteArray &state)
Retore the expanded state of the tree.in a QTreeView.
Definition: torrentfilemodel.cpp:40
kt::TorrentFileModel::uncheckAll
virtual void uncheckAll()=0
Uncheck all files in the torrent.
QAbstractItemModel
kt::TorrentFileModel::invertCheck
virtual void invertCheck()=0
Invert the check of each file of the torrent.
QSortFilterProxyModel
kt::TorrentFileModel::update
virtual void update()
Update gui if necessary.
Definition: torrentfilemodel.cpp:48
kt::TorrentFileModel::bytesToDownload
virtual bt::Uint64 bytesToDownload()=0
Calculate the number of bytes to download.
kt::TorrentFileModel::fileNamesEditable
bool fileNamesEditable() const
Are the file names editable.
Definition: torrentfilemodel.h:128
kt::TorrentFileModel::checkStateChanged
void checkStateChanged()
Emitted whenever one or more items changes check state.
kt::TorrentFileModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: torrentfilemodel.cpp:56
kt::TorrentFileModel::filePreviewChanged
virtual void filePreviewChanged(bt::TorrentFileInterface *file, bool preview)
Definition: torrentfilemodel.cpp:77
kt::TorrentFileModel::changePriority
virtual void changePriority(const QModelIndexList &indexes, bt::Priority newpriority)=0
Change the priority of a bunch of items.
kt::TorrentFileModel::saveExpandedState
virtual QByteArray saveExpandedState(QSortFilterProxyModel *pm, QTreeView *tv)
Save which items are expanded.
Definition: torrentfilemodel.cpp:35
kt::TorrentFileModel::checkAll
virtual void checkAll()=0
Check all the files in the torrent.
kt::TorrentFileModel
Definition: torrentfilemodel.h:39
kt::TorrentFileModel::TorrentFileModel
TorrentFileModel(bt::TorrentInterface *tc, DeselectMode mode, QObject *parent)
Definition: torrentfilemodel.cpp:28
kt::TorrentFileModel::indexToFile
virtual bt::TorrentFileInterface * indexToFile(const QModelIndex &idx)=0
Convert a model index to a file.
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