1 /* This file is part of the KDE project
3 Copyright (C) 2008 Lukas Appelhans <l.appelhans@gmx.de>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 #ifndef DATASOURCEFACTORY_H
11 #define DATASOURCEFACTORY_H
13 #include "kget_export.h"
20 class TransferDataSource
;
28 This class manages multiple DataSources and saves the data to the file
30 class KGET_EXPORT DataSourceFactory
: public QObject
34 DataSourceFactory(const KUrl
&dest
, const KIO::fileoffset_t
&size
, const KIO::fileoffset_t
&segSize
, QObject
*parent
);
40 void addDataSource(TransferDataSource
*source
, const KUrl
&url
);
41 void removeDataSource(TransferDataSource
*source
);
44 void assignSegment(TransferDataSource
*source
= 0);
45 void writeData(const KIO::fileoffset_t
&offset
, const QByteArray
&data
);
49 KIO::fileoffset_t m_size
;
50 KIO::fileoffset_t m_segSize
;
51 QMap
< TransferDataSource
*, KUrl
> m_dataSources
;//The QPair is <offset, bytes>
53 KIO::FileJob
* m_putJob
;