kget
multisegkiodatasource.cpp
Go to the documentation of this file.
72 void MultiSegKioDataSource::addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
78 connect(segment, SIGNAL(totalSize(KIO::filesize_t,QPair<int,int>)), this, SLOT(slotTotalSize(KIO::filesize_t,QPair<int,int>)));
79 connect(segment, SIGNAL(data(KIO::fileoffset_t,QByteArray,bool&)), this, SIGNAL(data(KIO::fileoffset_t,QByteArray,bool&)));
80 connect(segment, SIGNAL(finishedSegment(Segment*,int,bool)), this, SLOT(slotFinishedSegment(Segment*,int,bool)));
81 connect(segment, SIGNAL(error(Segment*,QString,Transfer::LogLevel)), this, SLOT(slotError(Segment*,QString,Transfer::LogLevel)));
82 connect(segment, SIGNAL(finishedDownload(KIO::filesize_t)), this, SLOT(slotFinishedDownload(KIO::filesize_t)));
111 void MultiSegKioDataSource::slotFinishedSegment(Segment *segment, int segmentNum, bool connectionFinished)
215 bool MultiSegKioDataSource::tryMerge(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
226 void MultiSegKioDataSource::slotError(Segment *segment, const QString &errorText, Transfer::LogLevel logLevel)
240 //decrease the number of maximum paralell downloads, maybe the server does not support so many connections
244 kDebug(5001) << this << "reducing connections to" << m_paralellSegments << "and freeing range of semgents" << range;
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
int countUnfinishedSegments() const
Returns the number of unfinished Segments of the connection with the most unfinished segments Each Tr...
Definition: multisegkiodatasource.cpp:183
void broken(TransferDataSource *source, TransferDataSource::Error error)
Alert that datasource is no able to send any data.
void finishedSegment(TransferDataSource *source, int segmentNumber, bool connectionFinished=true)
emitted when an assigned segment finishes
KIO::filesize_t m_supposedSize
Definition: transferdatasource.h:244
~MultiSegKioDataSource()
Definition: multisegkiodatasource.cpp:28
Definition: transfer.h:74
void urlChanged(const KUrl &old, const KUrl &newUrl)
Emitted when the filename of a url changes, e.g.
Definition: transfer.h:77
This Class is an interface for inter-plugins data change.
Definition: transferdatasource.h:26
int currentSegments() const
Definition: multisegkiodatasource.cpp:157
QPair< int, int > removeConnection()
Removes one connection, useful when setMaximumParalellDownloads was called with a lower number...
Definition: multisegkiodatasource.cpp:202
int count(const T &value) const
void append(const T &value)
bool isEmpty() const
int removeAll(const T &value)
void data(KIO::fileoffset_t offset, const QByteArray &data, bool &worked)
Returns data in the forms of chucks.
void deleteLater()
void setCapabilities(Transfer::Capabilities capabilities)
Sets the capabilities and automatically emits capabilitiesChanged.
Definition: transferdatasource.cpp:37
void freeSegments(TransferDataSource *source, QPair< int, int > segmentRange)
Emitted when a Datasource itself decides to not download a specific segmentRange, e...
MultiSegKioDataSource(const KUrl &srcUrl, QObject *parent)
Definition: multisegkiodatasource.cpp:18
void setSupposedSize(KIO::filesize_t supposedSize)
Set the size the server used for downloading should report.
Definition: multisegkiodatasource.cpp:120
bool merge(const QPair< KIO::fileoffset_t, KIO::fileoffset_t > &segmentSize, const QPair< int, int > &segmentRange)
Definition: segment.cpp:364
QList< QPair< int, int > > assignedSegments() const
Returns the assignedSegments to this TransferDataSource Each connection is represented by a QPair...
Definition: multisegkiodatasource.cpp:61
void foundFileSize(TransferDataSource *source, KIO::filesize_t fileSize, const QPair< int, int > &segmentRange)
Emitted after findFileSize is called successfully.
T & last()
Transfer::Capabilities capabilities() const
Returns the capabilities this TransferDataSource supports.
Definition: transferdatasource.cpp:32
void finishedDownload(TransferDataSource *source, KIO::filesize_t fileSize)
Emitted when the TransferDataSource finished the download on its own, e.g.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void brokenSegments(TransferDataSource *source, QPair< int, int > segmentRange)
emitted when an assigned segment is broken
void log(const QString &message, Transfer::LogLevel logLevel)
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
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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:28:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:28:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.