libktorrent  2.1.1
job.h
1 /***************************************************************************
2  * Copyright (C) 2009 by *
3  * Joris Guisson <joris.guisson@gmail.com> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef BT_JOB_H
22 #define BT_JOB_H
23 
24 #include <KIO/Job>
25 #include <ktorrent_export.h>
26 #include "torrentstats.h"
27 
28 class KJobTrackerInterface;
29 
30 namespace bt
31 {
32  class TorrentControl;
33 
37  class KTORRENT_EXPORT Job : public KIO::Job
38  {
39  Q_OBJECT
40  public:
41  Job(bool stop_torrent,TorrentControl* tc);
42  ~Job() override;
43 
45  bool stopTorrent() const {return stop_torrent;}
46 
47  void start() override;
48  virtual void kill(bool quietly=true);
49 
51  virtual TorrentStatus torrentStatus() const;
52 
54  TorrentControl* torrent() {return tc;}
55 
57  void setTorrent(TorrentControl* t) {tc = t;}
58 
60  static void setJobTracker(KJobTrackerInterface* trk);
61 
62  protected:
65 
66  private:
67  TorrentControl* tc;
68  bool stop_torrent;
69 
70  static KJobTrackerInterface* tracker;
71  };
72 
73 }
74 
75 #endif // BT_JOB_H
bt::Job::torrent
TorrentControl * torrent()
Get the torrent associated with this job.
Definition: job.h:54
bt::Job::torrentStatus
virtual TorrentStatus torrentStatus() const
Return the status of the torrent during the job (default implementation returns INVALID_STATUS)
bt::Job
Definition: job.h:38
bt::Job::stopTorrent
bool stopTorrent() const
Do we need to stop the torrent when the job is running.
Definition: job.h:45
bt::Job::setTorrent
void setTorrent(TorrentControl *t)
Set the torrent associated with this job.
Definition: job.h:57
bt::Job::setJobTracker
static void setJobTracker(KJobTrackerInterface *trk)
Set the job tracker.
bt::TorrentControl
Controls just about everything.
Definition: torrentcontrol.h:69
bt::Job::registerWithTracker
void registerWithTracker()
Register the job with the tracker.