File indexing completed on 2024-03-24 04:59:41
0001 /** 0002 * SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef COMPOSITEFILETRANSFERJOB_H 0008 #define COMPOSITEFILETRANSFERJOB_H 0009 0010 #include "kdeconnectcore_export.h" 0011 #include <KCompositeJob> 0012 #include <QElapsedTimer> 0013 0014 class FileTransferJob; 0015 0016 class KDECONNECTCORE_EXPORT CompositeFileTransferJob : public KCompositeJob 0017 { 0018 Q_OBJECT 0019 0020 public: 0021 explicit CompositeFileTransferJob(const QString &deviceId); 0022 0023 void start() override; 0024 bool isRunning() const; 0025 bool addSubjob(KJob *job) override; 0026 0027 protected: 0028 bool doKill() override; 0029 0030 private Q_SLOTS: 0031 void slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount); 0032 void slotResult(KJob *job) override; 0033 void startNextSubJob(); 0034 0035 private: 0036 QString m_deviceId; 0037 bool m_running; 0038 int m_currentJobNum; 0039 int m_totalJobs; 0040 quint64 m_currentJobSentPayloadSize; 0041 quint64 m_totalSentPayloadSize; 0042 quint64 m_oldTotalSentPayloadSize; // for speed calculation 0043 quint64 m_totalPayloadSize; 0044 FileTransferJob *m_currentJob; 0045 QElapsedTimer m_reportTimer; 0046 QElapsedTimer m_speedTimer; 0047 }; 0048 0049 #endif // COMPOSITEFILETRANSFERJOB_H