From c5b7ee4a63cfb8b8c09b9a0b179e5441c44bca80 Mon Sep 17 00:00:00 2001 From: wuyize Date: Thu, 6 Jul 2023 14:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase/qml/page/ContentPage.qml | 4 +--- AicsKnowledgeBase/src/FileTransferManager.cpp | 7 ++----- AicsKnowledgeBase/src/FileTransferManager.h | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/AicsKnowledgeBase/qml/page/ContentPage.qml b/AicsKnowledgeBase/qml/page/ContentPage.qml index fccba38..5e248c2 100644 --- a/AicsKnowledgeBase/qml/page/ContentPage.qml +++ b/AicsKnowledgeBase/qml/page/ContentPage.qml @@ -193,9 +193,7 @@ FluArea { } onClicked: { emit: content_area.download(content_area.knowledgeFileId) - // FileTransferManager.download(content_area.knowledgeFileId) - FileTransferManager.download( - "4973c59e-3ba1-41f2-a57e-3b53c2b5e2a4") + FileTransferManager.download(content_area.knowledgeFileId) } } } diff --git a/AicsKnowledgeBase/src/FileTransferManager.cpp b/AicsKnowledgeBase/src/FileTransferManager.cpp index 592df5c..35888fc 100644 --- a/AicsKnowledgeBase/src/FileTransferManager.cpp +++ b/AicsKnowledgeBase/src/FileTransferManager.cpp @@ -339,11 +339,8 @@ bool httpDownload(const std::string &url, const FileItem &item) return res == CURLE_OK; } -void FileTransferManager::download(QString fileId) +void FileTransferManager::download(const QString& fileId) { - static int _fileId = 0; - //fileId = QString::number(_fileId++); - QtConcurrent::run([fileId, this] { qDebug() << "Start Get"; @@ -364,7 +361,7 @@ void FileTransferManager::download(QString fileId) FileTransferListModel::instance().insertItem(item); });*/ - auto fileUrl = "https://curl.se/download/curl-8.1.2.zip"; + auto fileUrl = "File/" + fileId.toStdString(); /* curl_slist *headers = nullptr; diff --git a/AicsKnowledgeBase/src/FileTransferManager.h b/AicsKnowledgeBase/src/FileTransferManager.h index 256aec0..2f2406a 100644 --- a/AicsKnowledgeBase/src/FileTransferManager.h +++ b/AicsKnowledgeBase/src/FileTransferManager.h @@ -24,7 +24,7 @@ public: Q_INVOKABLE QString getFileMd5(const QUrl& fileUrl); Q_INVOKABLE void upload(const QUrl& fileUrl, const QString& fileId, const QString& ticket, const QString &fileName); - Q_INVOKABLE void download(QString fileId); + Q_INVOKABLE void download(const QString& fileId); Q_INVOKABLE void pause(const QString& fileId); Q_INVOKABLE void resume(const QString& fileId);