libktorrent  2.2.0
decompressfilejob.h
1 /***************************************************************************
2  * Copyright (C) 2009 by Joris Guisson *
3  * 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 DECOMPRESSFILEJOB_H
22 #define DECOMPRESSFILEJOB_H
23 
24 #include <QThread>
25 #include <kio/job.h>
26 #include <ktorrent_export.h>
27 
28 namespace bt
29 {
30 
34  class KTORRENT_EXPORT DecompressThread : public QThread
35  {
36  public:
37  DecompressThread(const QString & file,const QString & dest_file);
38  ~DecompressThread() override;
39 
41  void run() override;
42 
44  void cancel();
45 
47  int error() const {return err;}
48 
49  private:
50  QString file;
51  QString dest_file;
52  bool canceled;
53  int err;
54  };
55 
59  class KTORRENT_EXPORT DecompressFileJob : public KIO::Job
60  {
61  Q_OBJECT
62  public:
63  DecompressFileJob(const QString & file,const QString & dest);
64  ~DecompressFileJob() override;
65 
66  void start() override;
67  virtual void kill(bool quietly=true);
68 
69  private Q_SLOTS:
70  void decompressThreadFinished();
71 
72  private:
73  QString file;
74  QString dest;
75  DecompressThread* decompress_thread;
76  };
77 }
78 
79 #endif // DECOMPRESSFILEJOB_H
bt::DecompressThread::run
void run() override
Run the decompression thread.
bt::DecompressThread::error
int error() const
Get the error which happened (0 means no error)
Definition: decompressfilejob.h:47
bt::DecompressThread
Definition: decompressfilejob.h:35
bt::DecompressThread::cancel
void cancel()
Cancel the thread, things should be cleaned up properly.
bt::DecompressFileJob
Definition: decompressfilejob.h:60