kget
bttransfer.cpp
Go to the documentation of this file.
65 setCapabilities(Transfer::Cap_Moving | Transfer::Cap_Renaming | Transfer::Cap_Resuming | Transfer::Cap_SpeedLimit);
79 if (torrent && (options & Transfer::DeleteFiles)) {//FIXME: Also delete when torrent does not exist
106 return (status() == Job::Running) && (downloadSpeed() == 0) && torrent && torrent->getStats().status == bt::STALLED;
114 return (stats.status != bt::ERROR) && (stats.status != bt::STALLED) && (stats.status != bt::NO_SPACE_LEFT) && (stats.status != bt::INVALID_STATUS);
136 connect(download, SIGNAL(finishedSuccessfully(KUrl,QByteArray)), SLOT(btTransferInit(KUrl,QByteArray)));
154 connect(torrent, SIGNAL(aboutToBeStarted(bt::TorrentInterface*,bool&)), this, SLOT(newDestResult()));
160 setStatus(Job::Stopped, i18nc("changing the destination of the file", "Changing destination"), SmallIcon("media-playback-pause"));
171 disconnect(torrent, SIGNAL(aboutToBeStarted(bt::TorrentInterface*,bool&)), this, SLOT(newDestResult()));
174 setStatus(Job::Running, i18nc("transfer state: downloading", "Downloading...."), SmallIcon("media-playback-start"));
270 setSpeedLimits(uploadLimit(Transfer::InvisibleSpeedLimit), downloadLimit(Transfer::InvisibleSpeedLimit));//Set traffic-limits before starting
277 setStatus(Job::Running, i18nc("transfer state: downloading", "Downloading...."), SmallIcon("media-playback-start"));
298 setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"), SmallIcon("process-stop"));
417 setStatus(Job::Stopped, i18n("Analyzing torrent...."), SmallIcon("document-preview")); // jpetso says: you should probably use the "process-working" icon here (from the animations category), but that's a multi-frame PNG so it's hard for me to test
420 bt::InitLog(KStandardDirs::locateLocal("appdata", "torrentlog.log"), false, false);//initialize the torrent-log
422 bt::SetClientInfo("KGet", 2, KDE_VERSION_MINOR, KDE_VERSION_RELEASE, bt::NORMAL, "KG");//Set client info to KGet
434 while (!bt::Globals::instance().initUTPServer(BittorrentSettings::port() + i) && i < 10) //We don't care if it fails for now as UTP is experimental...
455 torrent->init(0, file.readAll(), m_tmp + m_source.fileName().remove(".torrent"), KUrl(m_dest.directory()).toLocalFile());
458 if (!torrent->getStats().multi_file_torrent && (m_dest.fileName() != torrent->getStats().torrent_name))//TODO check if this is needed, so if that case is true at some point
467 connect(torrent, SIGNAL(stoppedByError(bt::TorrentInterface*,QString)), SLOT(slotStoppedByError(bt::TorrentInterface*,QString)));
468 connect(torrent, SIGNAL(finished(bt::TorrentInterface*)), this, SLOT(slotDownloadFinished(bt::TorrentInterface*)));
469 //FIXME connect(tc,SIGNAL(corruptedDataFound(bt::TorrentInterface*)), this, SLOT(emitCorruptedData(bt::TorrentInterface*)));//TODO: Fix it
484 void BTTransfer::slotStoppedByError(const bt::TorrentInterface* &error, const QString &errormsg)
494 kDebug(5001) << "Start seeding *********************************************************************";
498 setStatus(Job::FinishedKeepAlive, i18nc("Transfer status: seeding", "Seeding...."), SmallIcon("media-playback-start"));
641 setTransferChange(Tc_SeedsConnected | Tc_SeedsDisconnected | Tc_LeechesConnected | Tc_LeechesDisconnected, true);
649 setTransferChange(Tc_SeedsConnected | Tc_SeedsDisconnected | Tc_LeechesConnected | Tc_LeechesDisconnected, true);
686 if (m_dest.fileName() != torrent->getStats().torrent_name)//TODO check if the body is ever entered!
786 if (m_dest.fileName() != torrent->getStats().torrent_name)//TODO check if the body is ever entered!
Definition: filemodel.h:45
void load(const QDomElement *element)
Loads the transfer's info from the QDomElement.
Definition: bttransfer.cpp:210
Definition: bttransfer.h:45
Definition: transfer.h:59
Definition: transfer.h:52
The job is stopped, but this also indicates that it stopped because an error occurred.
Definition: job.h:47
Definition: download.h:23
const Key key(const T &value) const
Definition: bttransfer.h:50
virtual bool isStalled() const
Reimplemented functions from Transfer-Class.
Definition: bttransfer.cpp:104
bool remove()
Definition: transfer.h:75
BTTransfer(TransferGroup *parent, TransferFactory *factory, Scheduler *scheduler, const KUrl &src, const KUrl &dest, const QDomElement *e=0)
Definition: bttransfer.cpp:51
Definition: transfer.h:74
Definition: job.h:71
bool remove(const QString &fileName)
Definition: bttransfer.h:44
Definition: bttransfer.h:41
QModelIndexList fileIndexes(int column) const
Returns a list of pointers to all files of this model.
Definition: filemodel.cpp:475
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
void setSpeedLimits(int ulLimit, int dlLimit)
Function used to set the SpeedLimits to the transfer.
Definition: bttransfer.cpp:238
Definition: transfer.h:53
void append(const T &value)
Definition: job.h:43
bool rmdir(const QString &dirName) const
virtual void load(const QDomElement *element)
Loads the transfer's info from the QDomElement.
Definition: transfer.cpp:244
const_iterator constEnd() const
Definition: bttransfer.h:30
bool cd(const QString &dirName)
bool isEmpty() const
Definition: bttransfer.h:46
Definition: transfer.h:96
Definition: bttransfer.h:42
Definition: transfer.h:76
Definition: transfer.h:91
bool cdUp()
QList< Key > keys() const
virtual bool setDirectory(const KUrl &newDirectory)
Move the download to the new destination.
Definition: bttransfer.cpp:145
void stop()
Definition: transfer.h:56
virtual void setTransferChange(ChangesFlags change, bool postEvent=false)
Makes the TransferHandler associated with this transfer know that a change in this transfer has occur...
Definition: transfer.cpp:338
const_iterator constBegin() const
QVariant data(int role) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: filemodel.cpp:390
Definition: bttransfer.h:43
QStringList entryList(QFlags< QDir::Filter > filters, QFlags< QDir::SortFlag > sort) const
Definition: filemodel.h:46
Definition: transfer.h:72
void setStatus(Job::Status jobStatus, const QString &text=QString(), const QPixmap &pix=QPixmap())
Sets the Job status to jobStatus, the status text to text and the status pixmap to pix...
Definition: transfer.cpp:292
Definition: transfer.h:54
bool toBool() const
void start(int msec)
Definition: transfer.h:55
Definition: transfer.h:63
Definition: transfer.h:97
Definition: filemodel.h:47
KUrl getUrl(const QModelIndex &index)
The url on the filesystem (no check if the file exists yet!) of index, it can be a folder or file...
Definition: filemodel.cpp:544
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setCapabilities(Capabilities capabilities)
Sets the capabilities and automatically emits capabilitiesChanged.
Definition: transfer.cpp:68
void setError(const QString &text, const QPixmap &pixmap, ErrorType type=AutomaticRetry, int errorId=-1)
Definition: job.cpp:65
void destroyed(QObject *obj)
Definition: bttransferhandler.h:29
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: filemodel.cpp:436
Definition: transfer.h:36
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.