send progress dialog
This commit is contained in:
@@ -21,9 +21,18 @@ class AppController : public QObject
|
||||
Q_PROPERTY(bool quickSave READ quickSave WRITE setQuickSave NOTIFY quickSaveChanged)
|
||||
Q_PROPERTY(bool sending READ sending NOTIFY sendingChanged)
|
||||
Q_PROPERTY(double sendProgress READ sendProgress NOTIFY sendProgressChanged)
|
||||
Q_PROPERTY(QString currentSendFileName READ currentSendFileName NOTIFY sendProgressChanged)
|
||||
Q_PROPERTY(int currentSendFileIndex READ currentSendFileIndex NOTIFY sendProgressChanged)
|
||||
Q_PROPERTY(int totalSendFiles READ totalSendFiles NOTIFY sendingChanged)
|
||||
Q_PROPERTY(QVariantList pendingFiles READ pendingFiles NOTIFY pendingFilesChanged)
|
||||
Q_PROPERTY(bool hasPendingFiles READ hasPendingFiles NOTIFY pendingFilesChanged)
|
||||
Q_PROPERTY(QString receivePin READ receivePin WRITE setReceivePin NOTIFY receivePinChanged)
|
||||
Q_PROPERTY(bool receiving READ receiving NOTIFY receivingChanged)
|
||||
Q_PROPERTY(double receiveProgress READ receiveProgress NOTIFY receiveProgressChanged)
|
||||
Q_PROPERTY(QString currentReceiveFileName READ currentReceiveFileName NOTIFY receiveProgressChanged)
|
||||
Q_PROPERTY(int currentReceiveFileIndex READ currentReceiveFileIndex NOTIFY receiveProgressChanged)
|
||||
Q_PROPERTY(int totalReceiveFiles READ totalReceiveFiles NOTIFY receivingChanged)
|
||||
Q_PROPERTY(QString currentReceiveSenderAlias READ currentReceiveSenderAlias NOTIFY receivingChanged)
|
||||
|
||||
public:
|
||||
explicit AppController(QObject* parent = nullptr);
|
||||
@@ -48,17 +57,28 @@ public:
|
||||
|
||||
bool sending() const;
|
||||
double sendProgress() const;
|
||||
QString currentSendFileName() const;
|
||||
int currentSendFileIndex() const;
|
||||
int totalSendFiles() const;
|
||||
QVariantList pendingFiles() const;
|
||||
bool hasPendingFiles() const;
|
||||
QString receivePin() const;
|
||||
void setReceivePin(const QString& pin);
|
||||
|
||||
bool receiving() const;
|
||||
double receiveProgress() const;
|
||||
QString currentReceiveFileName() const;
|
||||
int currentReceiveFileIndex() const;
|
||||
int totalReceiveFiles() const;
|
||||
QString currentReceiveSenderAlias() const;
|
||||
|
||||
Q_INVOKABLE void startDiscovery();
|
||||
Q_INVOKABLE void stopDiscovery();
|
||||
Q_INVOKABLE void refreshDevices();
|
||||
|
||||
Q_INVOKABLE void acceptReceive(const QString& sessionId);
|
||||
Q_INVOKABLE void declineReceive(const QString& sessionId);
|
||||
Q_INVOKABLE void cancelReceive();
|
||||
|
||||
Q_INVOKABLE void sendFiles(const QString& deviceFingerprint, const QStringList& filePaths);
|
||||
Q_INVOKABLE void sendTo(const QString& deviceFingerprint);
|
||||
@@ -85,8 +105,11 @@ signals:
|
||||
void receiveError(const QString& sessionId, const QString& error);
|
||||
void sendCompleted(const QString& sessionId);
|
||||
void sendError(const QString& error);
|
||||
void sendCanceled();
|
||||
void pinRequired(bool firstAttempt);
|
||||
void receivePinChanged();
|
||||
void receivingChanged();
|
||||
void receiveProgressChanged();
|
||||
|
||||
private slots:
|
||||
void onDeviceDiscovered(const LocalSend::Device& device);
|
||||
@@ -110,6 +133,8 @@ private slots:
|
||||
void onUploadCompleted();
|
||||
void onUploadError(const QString& error);
|
||||
|
||||
void onCancelRequest(const QString& sessionId);
|
||||
|
||||
private:
|
||||
LocalSend::Settings* m_settings = nullptr;
|
||||
LocalSend::SecurityContext* m_security = nullptr;
|
||||
@@ -129,8 +154,20 @@ private:
|
||||
double m_sendProgress = 0.0;
|
||||
bool m_pinFirstAttempt = true;
|
||||
|
||||
QString m_currentReceiveSessionId;
|
||||
double m_receiveProgressValue = 0.0;
|
||||
QString m_currentReceiveFileName;
|
||||
int m_currentReceiveFileIndex = 0;
|
||||
int m_totalReceiveFiles = 0;
|
||||
qint64 m_totalReceiveSize = 0;
|
||||
qint64 m_receivedSize = 0;
|
||||
QString m_currentReceiveSenderAlias;
|
||||
QMap<QString, QString> m_receiveFileNames;
|
||||
|
||||
LocalSend::InfoDto buildInfoDto() const;
|
||||
QString generateUniqueFilePath(const QString& baseDir, const QString& fileName) const;
|
||||
void sendNextFile();
|
||||
LocalSend::RegisterDto buildRegisterDto() const;
|
||||
void resetSendState();
|
||||
void resetReceiveState();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user