kget
btdatasource.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 00003 Copyright (C) 2008 Lukas Appelhans <l.appelhans@gmx.de> 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 */ 00010 00011 #ifndef BTDATASOURCE_H 00012 #define BTDATASOURCE_H 00013 00014 #include "core/transferdatasource.h" 00015 00016 #include <kio/job.h> 00017 #include <KUrl> 00018 #include <QTimer> 00019 00020 namespace bt 00021 { 00022 class TorrentControl; 00023 } 00024 00025 class BTChunkSelectorFactory; 00026 class BTChunkSelector; 00027 class BTCacheFactory; 00028 class BTCache; 00029 00030 class BTDataSource : public TransferDataSource 00031 { 00032 Q_OBJECT 00033 public: 00034 BTDataSource(); 00035 ~BTDataSource(); 00036 00037 void start(); 00038 void stop(); 00039 void addSegment(const KUrl &srcUrl, const KIO::fileoffset_t offset, const KIO::fileoffset_t bytes); 00040 void getData(const KIO::fileoffset_t &off, const QByteArray &dataArray); 00041 00042 private slots: 00043 void init(const KUrl &torrentSource, const QByteArray &data); 00044 void cacheAdded(BTCache *cache); 00045 void selectorAdded(BTChunkSelector *selector); 00046 void update(); 00047 00048 private: 00049 bt::TorrentControl *tc; 00050 BTChunkSelectorFactory *csf; 00051 BTChunkSelector *cs; 00052 BTCacheFactory *cf; 00053 00054 KIO::fileoffset_t m_offset; 00055 KIO::fileoffset_t m_bytes; 00056 KUrl m_source; 00057 KUrl m_torrentSource; 00058 QTimer timer; 00059 }; 00060 00061 #endif
KDE 4.2 API Reference