2019-06-02 15:02:21 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
2019-06-02 15:02:21 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2019-06-02 15:02:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COMPOSITEFILETRANSFERJOB_H
|
|
|
|
#define COMPOSITEFILETRANSFERJOB_H
|
|
|
|
|
|
|
|
#include "kdeconnectcore_export.h"
|
|
|
|
#include <KCompositeJob>
|
|
|
|
#include <QElapsedTimer>
|
|
|
|
|
|
|
|
class FileTransferJob;
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
class KDECONNECTCORE_EXPORT CompositeFileTransferJob : public KCompositeJob
|
2019-06-02 15:02:21 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-09-10 22:23:52 +01:00
|
|
|
explicit CompositeFileTransferJob(const QString &deviceId);
|
2019-06-02 15:02:21 +01:00
|
|
|
|
|
|
|
void start() override;
|
|
|
|
bool isRunning() const;
|
2022-09-10 22:23:52 +01:00
|
|
|
bool addSubjob(KJob *job) override;
|
2019-06-02 15:02:21 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool doKill() override;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount);
|
|
|
|
void slotResult(KJob *job) override;
|
|
|
|
void startNextSubJob();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_deviceId;
|
|
|
|
bool m_running;
|
|
|
|
int m_currentJobNum;
|
|
|
|
int m_totalJobs;
|
2021-01-31 22:05:22 +00:00
|
|
|
quint64 m_currentJobSentPayloadSize;
|
|
|
|
quint64 m_totalSentPayloadSize;
|
|
|
|
quint64 m_oldTotalSentPayloadSize; // for speed calculation
|
2019-06-02 15:02:21 +01:00
|
|
|
quint64 m_totalPayloadSize;
|
|
|
|
FileTransferJob *m_currentJob;
|
2021-01-31 22:05:22 +00:00
|
|
|
QElapsedTimer m_reportTimer;
|
|
|
|
QElapsedTimer m_speedTimer;
|
2019-06-02 15:02:21 +01:00
|
|
|
};
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
#endif // COMPOSITEFILETRANSFERJOB_H
|