File indexing completed on 2025-01-05 04:37:09

0001 /*
0002     SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #ifndef BTDATACHECKERTHREAD_H
0007 #define BTDATACHECKERTHREAD_H
0008 
0009 #include <ktorrent_export.h>
0010 #include <qthread.h>
0011 #include <util/bitset.h>
0012 
0013 namespace bt
0014 {
0015 class Torrent;
0016 class DataChecker;
0017 
0018 /**
0019     @author Joris Guisson <joris.guisson@gmail.com>
0020 
0021     Thread which runs the data check.
0022 */
0023 class KTORRENT_EXPORT DataCheckerThread : public QThread
0024 {
0025     DataChecker *dc;
0026     QString path;
0027     const Torrent &tor;
0028     QString dnddir;
0029     bool running;
0030     QString error;
0031     BitSet status;
0032 
0033 public:
0034     DataCheckerThread(DataChecker *dc, const BitSet &status, const QString &path, const Torrent &tor, const QString &dnddir);
0035     ~DataCheckerThread() override;
0036 
0037     void run() override;
0038 
0039     /// Get the data checker
0040     DataChecker *getDataChecker()
0041     {
0042         return dc;
0043     }
0044 
0045     /// Are we still running
0046     bool isRunning() const
0047     {
0048         return running;
0049     }
0050 
0051     /// Get the error (if any occurred)
0052     QString getError() const
0053     {
0054         return error;
0055     }
0056 };
0057 
0058 }
0059 
0060 #endif