This commit is contained in:
朱子楚\zhuzi 2024-01-05 20:00:28 +08:00
parent ae2d517ad0
commit d397b88892
5 changed files with 20 additions and 8 deletions

View File

@ -407,7 +407,7 @@ FluContentPage{
text: "Download File" text: "Download File"
onClicked: { onClicked: {
folder_dialog.showDialog(function(path){ 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) .toDownload(path)
.bind(root) .bind(root)
.go(callable_download_file) .go(callable_download_file)
@ -421,7 +421,7 @@ FluContentPage{
text: "Breakpoint Download File" text: "Breakpoint Download File"
onClicked: { onClicked: {
folder_dialog.showDialog(function(path){ 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) .toDownload(path,true)
.bind(root) .bind(root)
.go(callable_breakpoint_download_file) .go(callable_breakpoint_download_file)
@ -521,7 +521,7 @@ FluContentPage{
property var onSelectListener property var onSelectListener
id: folder_dialog id: folder_dialog
folder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] 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 fileMode: FileDialog.SaveFile
onAccepted: { onAccepted: {
folder_dialog.onSelectListener(FluTools.toLocalPath(folder_dialog.currentFile)) folder_dialog.onSelectListener(FluTools.toLocalPath(folder_dialog.currentFile))

View File

@ -408,7 +408,7 @@ FluContentPage{
text: "Download File" text: "Download File"
onClicked: { onClicked: {
folder_dialog.showDialog(function(path){ 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) .toDownload(path)
.bind(root) .bind(root)
.go(callable_download_file) .go(callable_download_file)
@ -422,7 +422,7 @@ FluContentPage{
text: "Breakpoint Download File" text: "Breakpoint Download File"
onClicked: { onClicked: {
folder_dialog.showDialog(function(path){ 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) .toDownload(path,true)
.bind(root) .bind(root)
.go(callable_breakpoint_download_file) .go(callable_breakpoint_download_file)
@ -522,7 +522,7 @@ FluContentPage{
property var onSelectListener property var onSelectListener
id: folder_dialog id: folder_dialog
folder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] 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 fileMode: FileDialog.SaveFile
onAccepted: { onAccepted: {
folder_dialog.onSelectListener(FluTools.toLocalPath(folder_dialog.currentFile)) folder_dialog.onSelectListener(FluTools.toLocalPath(folder_dialog.currentFile))

View File

@ -364,6 +364,18 @@ void FluNetwork::handleDownload(NetworkParams* params,NetworkCallable* c){
} }
}); });
loop.exec(); 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){ if(conn_destoryed){
disconnect(conn_destoryed); disconnect(conn_destoryed);
} }

View File

@ -70,7 +70,7 @@ Button {
color: FluTheme.primaryColor color: FluTheme.primaryColor
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Behavior on height{ Behavior on height{
enabled: control.progress === 1 enabled: control.progress !== 0
SequentialAnimation { SequentialAnimation {
PauseAnimation { PauseAnimation {
duration: FluTheme.enableAnimation ? 167 : 0 duration: FluTheme.enableAnimation ? 167 : 0

View File

@ -71,7 +71,7 @@ Button {
color: FluTheme.primaryColor color: FluTheme.primaryColor
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Behavior on height{ Behavior on height{
enabled: control.progress === 1 enabled: control.progress !== 0
SequentialAnimation { SequentialAnimation {
PauseAnimation { PauseAnimation {
duration: FluTheme.enableAnimation ? 167 : 0 duration: FluTheme.enableAnimation ? 167 : 0