• 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.cpp
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 #include "torrentfilemodel.h"
22 
23 #include <interfaces/torrentinterface.h>
24 #include <interfaces/torrentfileinterface.h>
25 
26 namespace kt
27 {
28  TorrentFileModel::TorrentFileModel(bt::TorrentInterface* tc,DeselectMode mode,QObject* parent)
29  : QAbstractItemModel(parent),tc(tc),mode(mode),file_names_editable(false)
30  {}
31 
32  TorrentFileModel::~TorrentFileModel()
33  {}
34 
35  QByteArray TorrentFileModel::saveExpandedState(QSortFilterProxyModel*, QTreeView* )
36  {
37  return QByteArray();
38  }
39 
40  void TorrentFileModel::loadExpandedState(QSortFilterProxyModel* ,QTreeView* ,const QByteArray &)
41  {}
42 
43  void TorrentFileModel::missingFilesMarkedDND()
44  {
45  reset();
46  }
47 
48  void TorrentFileModel::update()
49  {}
50 
51  void TorrentFileModel::onCodecChange()
52  {
53  reset();
54  }
55 
56  Qt::ItemFlags TorrentFileModel::flags(const QModelIndex & index) const
57  {
58  if (!index.isValid())
59  return 0;
60 
61  Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
62  if (tc->getStats().multi_file_torrent)
63  flags |= Qt::ItemIsUserCheckable;
64 
65  if (fileNamesEditable() && index.column() == 0)
66  flags |= Qt::ItemIsEditable;
67 
68  return flags;
69  }
70 
71  void TorrentFileModel::filePercentageChanged(bt::TorrentFileInterface* file,float percentage)
72  {
73  Q_UNUSED(file)
74  Q_UNUSED(percentage)
75  }
76 
77  void TorrentFileModel::filePreviewChanged(bt::TorrentFileInterface* file,bool preview)
78  {
79  Q_UNUSED(file)
80  Q_UNUSED(preview)
81  }
82 }
83 
84 #include "torrentfilemodel.moc"
kt::TorrentFileModel::filePercentageChanged
virtual void filePercentageChanged(bt::TorrentFileInterface *file, float percentage)
Definition: torrentfilemodel.cpp:71
kt::TorrentFileModel::tc
bt::TorrentInterface * tc
Definition: torrentfilemodel.h:141
torrentfilemodel.h
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
QTreeView
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
QAbstractItemModel
QSortFilterProxyModel
kt::TorrentFileModel::update
virtual void update()
Update gui if necessary.
Definition: torrentfilemodel.cpp:48
kt::TorrentFileModel::fileNamesEditable
bool fileNamesEditable() const
Are the file names editable.
Definition: torrentfilemodel.h:128
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::saveExpandedState
virtual QByteArray saveExpandedState(QSortFilterProxyModel *pm, QTreeView *tv)
Save which items are expanded.
Definition: torrentfilemodel.cpp:35
kt::TorrentFileModel::TorrentFileModel
TorrentFileModel(bt::TorrentInterface *tc, DeselectMode mode, QObject *parent)
Definition: torrentfilemodel.cpp:28
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