| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- import Felgo
- import QtQuick
- import QtQuick.Layouts
- import QtQuick.Controls
- import "../controls"
- import "../common"
- AppPage {
- id: notificationPage
- backgroundColor: Qt.rgba(0,0,0, 0.75) // page background is translucent, we can see other items beneath the page
- useSafeArea: false // do not consider safe area insets of screen
- Connections{
- target: ymodem
- onDownloadStart: {
- progressBar.value = 0.0
- notificationtext.text = mtype
- notificationPage.visible = true
- }
- onProgress: {
- console.log("更新进度条:",val,tval)
- progressBar.value = val/tval*100.0
- process_text.text = progressBar.value.toFixed(2) + "%";
- }
- onModem_result: {
- if(r===0){
- progressBar.value = 100.0
- notificationtext.text += "成功"
- }else{
- notificationtext.text += "失败:" + r.toString();
- }
- }
- }
- Connections{
- target: curl
- onSglProgress:{
- //console.log("更新进度条:",val,timeLeft)
- progressBar.value = val
- process_text.text = val.toFixed(2) + "%";
- }
- onDownloadStart:{
- notificationtext.text = mtype
- notificationPage.visible = true
- }
- onDownloadFinished :{
- //notificationPage.visible = false
- if(result){
- notificationtext.text += "成功"
- notificationtext.color = "green"
- }else{
- notificationtext.text += "失败"
- notificationtext.color = "red"
- }
- }
- }
- // login form background
- Rectangle {
- id: loginForm
- anchors.centerIn: parent
- color: "white"
- width: content.width + dp(48)
- height: content.height + dp(16)
- radius: dp(4)
- }
- // login form content
- GridLayout {
- id: content
- anchors.centerIn: loginForm
- columnSpacing: dp(20)
- rowSpacing: dp(10)
- columns: 2
- // headline
- AppText {
- id: notificationtext
- Layout.topMargin: dp(8)
- Layout.bottomMargin: dp(12)
- Layout.columnSpan: 2
- Layout.alignment: Qt.AlignHCenter
- text: "通知"
- }
- AppText {
- id: process_text
- Layout.bottomMargin: dp(5)
- Layout.columnSpan: 2
- Layout.alignment: Qt.AlignHCenter
- text: ""
- }
- ProgressBar {
- id: progressBar
- implicitWidth: dp(300)
- from: 0.0000
- to: 100.0000
- value: 0.0
- }
- AppButton {
- Layout.topMargin: dp(5)
- text: qsTr("关闭")
- flat: false
- Layout.alignment: Qt.AlignHCenter
- onClicked: {
- progressBar.value = 0.0;
- notificationPage.visible = false;
- }
- }
- }
- }
|