mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-01 23:51:48 +08:00
update
This commit is contained in:
@ -133,16 +133,53 @@ FluContentPage{
|
||||
}
|
||||
}
|
||||
FluProgressButton{
|
||||
property bool downloading: false
|
||||
property string saveFilePath: FluTools.getApplicationDirPath()+ "/download/big_buck_bunny.mp4"
|
||||
property string resourcePath: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
||||
id:btn_breakpoint_download
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 36
|
||||
text: progress === 1 ? "打开文件" : "断点下载文件"
|
||||
text: {
|
||||
if(downloading){
|
||||
return "暂停下载"
|
||||
}
|
||||
if(progress === 0){
|
||||
return "断点下载文件"
|
||||
}else if(progress === 1){
|
||||
return "打开文件"
|
||||
}else{
|
||||
return "继续下载"
|
||||
}
|
||||
}
|
||||
HttpCallable{
|
||||
id:callable_breakpoint_download
|
||||
onStart: {
|
||||
btn_breakpoint_download.downloading = true
|
||||
}
|
||||
onFinish: {
|
||||
btn_breakpoint_download.downloading = false
|
||||
}
|
||||
onError:
|
||||
(status,errorString,result)=>{
|
||||
console.debug(status+";"+errorString+";"+result)
|
||||
}
|
||||
onSuccess:
|
||||
(result)=>{
|
||||
showSuccess(result)
|
||||
}
|
||||
onDownloadProgress:
|
||||
(recv,total)=>{
|
||||
btn_breakpoint_download.progress = recv/total
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
progress = http_breakpoint_download.breakPointDownloadProgress(resourcePath,saveFilePath)
|
||||
}
|
||||
onClicked: {
|
||||
if(downloading){
|
||||
http_breakpoint_download.cancel()
|
||||
return
|
||||
}
|
||||
if(progress === 1){
|
||||
FluTools.showFileInFolder(saveFilePath)
|
||||
}else{
|
||||
@ -261,7 +298,6 @@ FluContentPage{
|
||||
btn_upload.progress = sent/total
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: file_dialog
|
||||
onAccepted: {
|
||||
@ -276,30 +312,6 @@ FluContentPage{
|
||||
}
|
||||
}
|
||||
|
||||
HttpCallable{
|
||||
id:callable_breakpoint_download
|
||||
onStart: {
|
||||
btn_breakpoint_download.disabled = true
|
||||
}
|
||||
onFinish: {
|
||||
btn_breakpoint_download.disabled = false
|
||||
}
|
||||
onError:
|
||||
(status,errorString,result)=>{
|
||||
btn_breakpoint_download.progress = 0
|
||||
showError(errorString)
|
||||
console.debug(status+";"+errorString+";"+result)
|
||||
}
|
||||
onSuccess:
|
||||
(result)=>{
|
||||
showSuccess(result)
|
||||
}
|
||||
onDownloadProgress:
|
||||
(recv,total)=>{
|
||||
btn_breakpoint_download.progress = recv/total
|
||||
}
|
||||
}
|
||||
|
||||
HttpCallable{
|
||||
id:callable_download
|
||||
onStart: {
|
||||
@ -324,7 +336,6 @@ FluContentPage{
|
||||
btn_download.progress = recv/total
|
||||
}
|
||||
}
|
||||
|
||||
FolderDialog {
|
||||
id: folder_dialog
|
||||
currentFolder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]
|
||||
|
Reference in New Issue
Block a user