接入下载

main
wuyize 2023-07-06 14:32:25 +08:00
parent 81624c2b5e
commit c5b7ee4a63
3 changed files with 4 additions and 9 deletions

View File

@ -193,9 +193,7 @@ FluArea {
} }
onClicked: { onClicked: {
emit: content_area.download(content_area.knowledgeFileId) emit: content_area.download(content_area.knowledgeFileId)
// FileTransferManager.download(content_area.knowledgeFileId) FileTransferManager.download(content_area.knowledgeFileId)
FileTransferManager.download(
"4973c59e-3ba1-41f2-a57e-3b53c2b5e2a4")
} }
} }
} }

View File

@ -339,11 +339,8 @@ bool httpDownload(const std::string &url, const FileItem &item)
return res == CURLE_OK; 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] { QtConcurrent::run([fileId, this] {
qDebug() << "Start Get"; qDebug() << "Start Get";
@ -364,7 +361,7 @@ void FileTransferManager::download(QString fileId)
FileTransferListModel::instance().insertItem(item); FileTransferListModel::instance().insertItem(item);
});*/ });*/
auto fileUrl = "https://curl.se/download/curl-8.1.2.zip"; auto fileUrl = "File/" + fileId.toStdString();
/* curl_slist *headers = nullptr; /* curl_slist *headers = nullptr;

View File

@ -24,7 +24,7 @@ public:
Q_INVOKABLE QString getFileMd5(const QUrl& fileUrl); 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 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 pause(const QString& fileId);
Q_INVOKABLE void resume(const QString& fileId); Q_INVOKABLE void resume(const QString& fileId);