• 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
  • multisegmentkio
multisegkiodatasource.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
4  Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 */
11 
12 #ifndef KGET_MULTISEGKIODATASOURCE_H
13 #define KGET_MULTISEGKIODATASOURCE_H
14 
15 #include "core/transferdatasource.h"
16 
17 class Segment;
18 
19 class MultiSegKioDataSource : public TransferDataSource
20 {
21  Q_OBJECT
22 
23  public:
24  MultiSegKioDataSource(const KUrl &srcUrl, QObject *parent);
25  ~MultiSegKioDataSource();
26 
27  void start();
28  void stop();
29 
30  void findFileSize(KIO::fileoffset_t segmentSize);
31  void addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange);
32  QPair<int, int> removeConnection();
33  QList<QPair<int, int> > assignedSegments() const;
34  int countUnfinishedSegments() const;
35  QPair<int, int> split();
36 
37  void setSupposedSize(KIO::filesize_t supposedSize);
38  int currentSegments() const;
39 
40  private Q_SLOTS:
41  void slotSpeed(ulong speed);
42  void slotFinishedSegment(Segment *segment, int segmentNum, bool connectionFinished);
43  void slotRestartBrokenSegment();
44 
49  void slotError(Segment *segment, const QString &errorText, Transfer::LogLevel logLevel);
50 
54  void slotTotalSize(KIO::filesize_t size, const QPair<int, int> &range = qMakePair(-1, -1));
55 
56  void slotCanResume();
57 
58  void slotFinishedDownload(KIO::filesize_t size);
59 
60  void slotUrlChanged(const KUrl &url);
61 
62  private:
63  Segment *mostUnfinishedSegments(int *unfinished = 0) const;
64  bool tryMerge(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int,int> &segmentRange);
65 
66  private:
67  QList<Segment*> m_segments;
68  KIO::filesize_t m_size;
69  bool m_canResume;
70  bool m_started;
71 };
72 
73 #endif
MultiSegKioDataSource::split
QPair< int, int > split()
If a connection of this TransferDataSource is assigned multiple (continuous) segments, then this method will split them (the unfinished ones) in half, it returns the beginning and the end of the now unassigned segments; (-1, -1) if there are none.
Definition: multisegkiodatasource.cpp:191
MultiSegKioDataSource::countUnfinishedSegments
int countUnfinishedSegments() const
Returns the number of unfinished Segments of the connection with the most unfinished segments Each Tr...
Definition: multisegkiodatasource.cpp:183
Transfer::LogLevel
LogLevel
Definition: transfer.h:81
MultiSegKioDataSource::~MultiSegKioDataSource
~MultiSegKioDataSource()
Definition: multisegkiodatasource.cpp:28
TransferDataSource
This Class is an interface for inter-plugins data change.
Definition: transferdatasource.h:26
MultiSegKioDataSource::currentSegments
int currentSegments() const
Definition: multisegkiodatasource.cpp:157
QObject
MultiSegKioDataSource::removeConnection
QPair< int, int > removeConnection()
Removes one connection, useful when setMaximumParalellDownloads was called with a lower number...
Definition: multisegkiodatasource.cpp:202
MultiSegKioDataSource
Definition: multisegkiodatasource.h:19
MultiSegKioDataSource::MultiSegKioDataSource
MultiSegKioDataSource(const KUrl &srcUrl, QObject *parent)
Definition: multisegkiodatasource.cpp:18
MultiSegKioDataSource::setSupposedSize
void setSupposedSize(KIO::filesize_t supposedSize)
Set the size the server used for downloading should report.
Definition: multisegkiodatasource.cpp:120
transferdatasource.h
Segment
class Segment
Definition: segment.h:26
MultiSegKioDataSource::assignedSegments
QList< QPair< int, int > > assignedSegments() const
Returns the assignedSegments to this TransferDataSource Each connection is represented by a QPair...
Definition: multisegkiodatasource.cpp:61
TransferDataSource::speed
void speed(ulong speed)
The speed of the download.
MultiSegKioDataSource::start
void start()
Definition: multisegkiodatasource.cpp:33
MultiSegKioDataSource::stop
void stop()
Definition: multisegkiodatasource.cpp:44
MultiSegKioDataSource::addSegments
void addSegments(const QPair< KIO::fileoffset_t, KIO::fileoffset_t > &segmentSize, const QPair< int, int > &segmentRange)
Adds multiple continuous segments that should be downloaded by this TransferDataSource.
Definition: multisegkiodatasource.cpp:72
MultiSegKioDataSource::findFileSize
void findFileSize(KIO::fileoffset_t segmentSize)
Tries to find the filesize if this capability is supported, if successfull it emits foundFileSize(Tra...
Definition: multisegkiodatasource.cpp:98
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