From d397b88892ecee300548721340a258fc70c47f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 5 Jan 2024 20:00:28 +0800 Subject: [PATCH] update --- example/qml-Qt6/page/T_Network.qml | 6 +++--- example/qml/page/T_Network.qml | 6 +++--- src/FluNetwork.cpp | 12 ++++++++++++ .../imports/FluentUI/Controls/FluProgressButton.qml | 2 +- .../imports/FluentUI/Controls/FluProgressButton.qml | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/example/qml-Qt6/page/T_Network.qml b/example/qml-Qt6/page/T_Network.qml index e1f1acac..a915b533 100644 --- a/example/qml-Qt6/page/T_Network.qml +++ b/example/qml-Qt6/page/T_Network.qml @@ -407,7 +407,7 @@ FluContentPage{ text: "Download File" onClicked: { folder_dialog.showDialog(function(path){ - FluNetwork.get("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") + FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4") .toDownload(path) .bind(root) .go(callable_download_file) @@ -421,7 +421,7 @@ FluContentPage{ text: "Breakpoint Download File" onClicked: { folder_dialog.showDialog(function(path){ - FluNetwork.get("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") + FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4") .toDownload(path,true) .bind(root) .go(callable_breakpoint_download_file) @@ -521,7 +521,7 @@ FluContentPage{ property var onSelectListener id: folder_dialog folder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] - currentFile: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]+"/big_buck_bunny.mp4" + currentFile: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]+"/oceans.mp4" fileMode: FileDialog.SaveFile onAccepted: { folder_dialog.onSelectListener(FluTools.toLocalPath(folder_dialog.currentFile)) diff --git a/example/qml/page/T_Network.qml b/example/qml/page/T_Network.qml index f3e87548..597e00e2 100644 --- a/example/qml/page/T_Network.qml +++ b/example/qml/page/T_Network.qml @@ -408,7 +408,7 @@ FluContentPage{ text: "Download File" onClicked: { folder_dialog.showDialog(function(path){ - FluNetwork.get("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") + FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4") .toDownload(path) .bind(root) .go(callable_download_file) @@ -422,7 +422,7 @@ FluContentPage{ text: "Breakpoint Download File" onClicked: { folder_dialog.showDialog(function(path){ - FluNetwork.get("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") + FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4") .toDownload(path,true) .bind(root) .go(callable_breakpoint_download_file) @@ -522,7 +522,7 @@ FluContentPage{ property var onSelectListener id: folder_dialog folder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] - currentFile: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]+"/big_buck_bunny.mp4" + currentFile: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]+"/oceans.mp4" fileMode: FileDialog.SaveFile onAccepted: { folder_dialog.onSelectListener(FluTools.toLocalPath(folder_dialog.currentFile)) diff --git a/src/FluNetwork.cpp b/src/FluNetwork.cpp index 9875ca58..59f19214 100644 --- a/src/FluNetwork.cpp +++ b/src/FluNetwork.cpp @@ -364,6 +364,18 @@ void FluNetwork::handleDownload(NetworkParams* params,NetworkCallable* c){ } }); loop.exec(); + int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if(httpStatus == 200){ + if(!callable.isNull()){ + callable->success(destPath); + } + printRequestEndLog(request,params,reply,destPath); + }else{ + if(!callable.isNull()){ + callable->error(httpStatus,reply->errorString(),destPath); + } + printRequestEndLog(request,params,reply,destPath); + } if(conn_destoryed){ disconnect(conn_destoryed); } diff --git a/src/Qt5/imports/FluentUI/Controls/FluProgressButton.qml b/src/Qt5/imports/FluentUI/Controls/FluProgressButton.qml index dfd89632..1d9e9f9b 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluProgressButton.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluProgressButton.qml @@ -70,7 +70,7 @@ Button { color: FluTheme.primaryColor anchors.bottom: parent.bottom Behavior on height{ - enabled: control.progress === 1 + enabled: control.progress !== 0 SequentialAnimation { PauseAnimation { duration: FluTheme.enableAnimation ? 167 : 0 diff --git a/src/Qt6/imports/FluentUI/Controls/FluProgressButton.qml b/src/Qt6/imports/FluentUI/Controls/FluProgressButton.qml index 37ee248b..1c21c78e 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluProgressButton.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluProgressButton.qml @@ -71,7 +71,7 @@ Button { color: FluTheme.primaryColor anchors.bottom: parent.bottom Behavior on height{ - enabled: control.progress === 1 + enabled: control.progress !== 0 SequentialAnimation { PauseAnimation { duration: FluTheme.enableAnimation ? 167 : 0