able to receive file
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantList>
|
||||
#include <QVariantMap>
|
||||
#include "LocalSendCore/DiscoveryManager.h"
|
||||
#include "LocalSendCore/HttpServer.h"
|
||||
#include "LocalSendCore/HttpClient.h"
|
||||
@@ -16,6 +17,8 @@ class AppController : public QObject
|
||||
Q_PROPERTY(quint16 port READ port WRITE setPort NOTIFY portChanged)
|
||||
Q_PROPERTY(QVariantList devices READ devices NOTIFY devicesChanged)
|
||||
Q_PROPERTY(bool serverRunning READ serverRunning NOTIFY serverRunningChanged)
|
||||
Q_PROPERTY(QString downloadPath READ downloadPath WRITE setDownloadPath NOTIFY downloadPathChanged)
|
||||
Q_PROPERTY(bool quickSave READ quickSave WRITE setQuickSave NOTIFY quickSaveChanged)
|
||||
|
||||
public:
|
||||
explicit AppController(QObject* parent = nullptr);
|
||||
@@ -29,26 +32,50 @@ public:
|
||||
quint16 port() const;
|
||||
void setPort(quint16 port);
|
||||
|
||||
QString downloadPath() const;
|
||||
void setDownloadPath(const QString& path);
|
||||
|
||||
bool quickSave() const;
|
||||
void setQuickSave(bool enabled);
|
||||
|
||||
QVariantList devices() const;
|
||||
bool serverRunning() 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);
|
||||
|
||||
signals:
|
||||
void aliasChanged();
|
||||
void portChanged();
|
||||
void downloadPathChanged();
|
||||
void quickSaveChanged();
|
||||
void devicesChanged();
|
||||
void serverRunningChanged();
|
||||
void receiveRequest(const QString& sessionId, const QString& senderAlias, const QVariantList& files);
|
||||
void receiveRequest(const QString& sessionId, const QString& senderAlias,
|
||||
const QString& senderIp, const QVariantList& files);
|
||||
void receiveProgress(const QString& sessionId, const QString& fileId, double progress);
|
||||
void receiveCompleted(const QString& sessionId);
|
||||
void receiveError(const QString& sessionId, const QString& error);
|
||||
void sendProgress(const QString& sessionId, double progress);
|
||||
void sendCompleted(const QString& sessionId);
|
||||
|
||||
private slots:
|
||||
void onDeviceDiscovered(const LocalSend::Device& device);
|
||||
void onDeviceLost(const QString& fingerprint);
|
||||
void onPrepareUploadRequest(const LocalSend::PrepareUploadRequestDto& dto, const QHostAddress& sender);
|
||||
void onRegisterRequest(const LocalSend::RegisterDto& dto, const QHostAddress& sender);
|
||||
void onPrepareUploadRequest(const QString& httpSessionId,
|
||||
const LocalSend::PrepareUploadRequestDto& dto,
|
||||
const QHostAddress& sender);
|
||||
void onUploadRequest(const QString& sessionId, const QString& fileId,
|
||||
const QString& token, const QByteArray& data);
|
||||
void onSessionAccepted(const QString& sessionId, const QMap<QString, QString>& tokens);
|
||||
void onSessionDeclined(const QString& sessionId);
|
||||
void onReceiveProgress(const QString& sessionId, const QString& fileId, double progress);
|
||||
void onReceiveCompleted(const QString& sessionId);
|
||||
|
||||
private:
|
||||
LocalSend::Settings* m_settings = nullptr;
|
||||
@@ -60,4 +87,5 @@ private:
|
||||
QMap<QString, LocalSend::Device> m_devices;
|
||||
|
||||
LocalSend::InfoDto buildInfoDto() const;
|
||||
QString generateUniqueFilePath(const QString& baseDir, const QString& fileName) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user