forked from linuxdeepin/dde-cooperation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransferhelper_p.h
80 lines (60 loc) · 1.77 KB
/
transferhelper_p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef TRANSFERHELPER_P_H
#define TRANSFERHELPER_P_H
#include "transferhelper.h"
#include "gui/dialogs/transferdialog.h"
#include <co/rpc.h>
#include <co/co.h>
#include <QTimer>
#include <QMap>
class QDBusInterface;
class FrontendService;
namespace cooperation_core {
class TransferHelper;
class TransferHelperPrivate : public QObject
{
Q_OBJECT
friend class TransferHelper;
public:
struct TransferInfo
{
int64_t totalSize = 0; // 总量
int64_t transferSize = 0; // 当前传输量
int64_t maxTimeMs = 0; // 耗时
void clear()
{
totalSize = 0;
transferSize = 0;
maxTimeMs = 0;
}
};
explicit TransferHelperPrivate(TransferHelper *qq);
~TransferHelperPrivate();
TransferDialog *transDialog();
void handleSendFiles(const QStringList &fileList);
void handleApplyTransFiles(int type);
void handleTryConnect(const QString &ip);
void handleCancelTransfer();
void handleSearchDevice(const QString &ip);
void transferResult(bool result, const QString &msg);
void updateProgress(int value, const QString &remainTime);
void reportTransferResult(bool result);
public Q_SLOTS:
void onVerifyTimeout();
private:
TransferHelper *q;
QStringList readyToSendFiles;
QString sendToWho;
QAtomicInt status { TransferHelper::Idle };
TransferInfo transferInfo;
TransferDialog *transferDialog { nullptr };
uint recvNotifyId { 0 };
QTimer confirmTimer;
bool isTransTimeout = false;
QString recvFilesSavePath;
int jobId = 0;
};
} // namespace cooperation_core
#endif // TRANSFERHELPER_P_H