File indexing completed on 2024-07-14 04:50:18

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
0004 
0005    This program is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 */
0010 
0011 #include "transferdatasource.h"
0012 
0013 #include "kget_debug.h"
0014 #include <QDebug>
0015 
0016 TransferDataSource::TransferDataSource(const QUrl &srcUrl, QObject *parent)
0017     : QObject(parent)
0018     , m_sourceUrl(srcUrl)
0019     , m_speed(0)
0020     , m_supposedSize(0)
0021     , m_parallelSegments(1)
0022     , m_currentSegments(0)
0023     , m_capabilities()
0024 {
0025     qCDebug(KGET_DEBUG);
0026 }
0027 
0028 TransferDataSource::~TransferDataSource()
0029 {
0030     qCDebug(KGET_DEBUG);
0031 }
0032 
0033 Transfer::Capabilities TransferDataSource::capabilities() const
0034 {
0035     return m_capabilities;
0036 }
0037 
0038 void TransferDataSource::setCapabilities(Transfer::Capabilities capabilities)
0039 {
0040     m_capabilities = capabilities;
0041     Q_EMIT capabilitiesChanged();
0042 }
0043 
0044 void TransferDataSource::findFileSize(KIO::fileoffset_t segmentSize)
0045 {
0046     Q_UNUSED(segmentSize);
0047 }
0048 
0049 QPair<int, int> TransferDataSource::removeConnection()
0050 {
0051     return QPair<int, int>(-1, -1);
0052 }
0053 
0054 QList<QPair<int, int>> TransferDataSource::assignedSegments() const
0055 {
0056     return QList<QPair<int, int>>();
0057 }
0058 
0059 int TransferDataSource::countUnfinishedSegments() const
0060 {
0061     return 0;
0062 }
0063 
0064 QPair<int, int> TransferDataSource::split()
0065 {
0066     return QPair<int, int>(-1, -1);
0067 }
0068 
0069 int TransferDataSource::parallelSegments() const
0070 {
0071     return m_parallelSegments;
0072 }
0073 
0074 void TransferDataSource::setParallelSegments(int parallelSegments)
0075 {
0076     m_parallelSegments = parallelSegments;
0077 }
0078 
0079 int TransferDataSource::currentSegments() const
0080 {
0081     return m_currentSegments;
0082 }
0083 
0084 int TransferDataSource::changeNeeded() const
0085 {
0086     return parallelSegments() - currentSegments();
0087 }
0088 
0089 #include "moc_transferdatasource.cpp"