mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-20 09:06:45 +00:00
[GODT-274] GUI changes for autoupdates
[GODT-275] Add enable/disable auto updates GUI option Refactor Updater module GODT-805 Changed manual update information bar layout GODT-806, GODT-875 Change update dialogs Refactor InformationBar
This commit is contained in:
committed by
James Houlahan
parent
b7b2297635
commit
98ab794f13
@ -25,16 +25,17 @@ import ProtonUI 1.0
|
||||
Dialog {
|
||||
id: root
|
||||
|
||||
title: "Bridge update "+go.newversion
|
||||
|
||||
property alias introductionText : introduction.text
|
||||
property bool hasError : false
|
||||
property bool forceUpdate : false
|
||||
|
||||
signal cancel()
|
||||
signal okay()
|
||||
|
||||
title: forceUpdate ?
|
||||
qsTr("Update %1 now", "title of force update dialog").arg(go.programTitle):
|
||||
qsTr("Update to %1 %2", "title of normal update dialog").arg(go.programTitle).arg(go.updateVersion)
|
||||
|
||||
isDialogBusy: currentIndex==1
|
||||
isDialogBusy: currentIndex==1 || forceUpdate
|
||||
|
||||
Rectangle { // 0: Release notes and confirm
|
||||
width: parent.width
|
||||
@ -51,18 +52,45 @@ Dialog {
|
||||
color: Style.dialog.text
|
||||
linkColor: Style.dialog.textBlue
|
||||
font {
|
||||
pointSize: 0.8 * Style.dialog.fontSize * Style.pt
|
||||
pointSize: Style.dialog.fontSize * Style.pt
|
||||
}
|
||||
width: 2*root.width/3
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
// customize message per application
|
||||
text: ' <a href="%1">Release notes</a><br> New version %2<br> <br><br> <a href="%3">%3</a>'
|
||||
text: {
|
||||
if (forceUpdate) {
|
||||
if (go.updateCanInstall) {
|
||||
return qsTr('You need to update this app to continue using it.<br>
|
||||
Update now or manually download the most recent version here:<br>
|
||||
<a href="%1">%1</a><br>
|
||||
<a href="https://protonmail.com/support/knowledge-base/update-required/">Learn why</a> you need to update',
|
||||
"Message for force-update").arg(go.updateLandingPage)
|
||||
} else {
|
||||
return qsTr('You need to update this app to continue using it.<br>
|
||||
Download the most recent version here:<br>
|
||||
<a href="%1">%1</a><br>
|
||||
<a href="https://protonmail.com/support/knowledge-base/update-required/">Learn why</a> you need to update',
|
||||
"Message for force-update").arg(go.updateLandingPage)
|
||||
}
|
||||
}
|
||||
|
||||
if (go.updateCanInstall) {
|
||||
return qsTr('Update to the newest version or download it from:<br>
|
||||
<a href="%1">%1</a><br>
|
||||
<a href="%2">View release notes</a>',
|
||||
"Message for manual update").arg(go.updateLandingPage).arg(go.updateReleaseNotesLink)
|
||||
} else {
|
||||
return qsTr('Update to the newest version from:<br>
|
||||
<a href="%1">%1</a><br>
|
||||
<a href="%2">View release notes</a>',
|
||||
"Message for manual update").arg(go.updateLandingPage).arg(go.updateReleaseNotesLink)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onLinkActivated : {
|
||||
console.log("clicked link:", link)
|
||||
root.hide()
|
||||
Qt.openUrlExternally(link)
|
||||
}
|
||||
|
||||
@ -73,21 +101,30 @@ Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
CheckBoxLabel {
|
||||
id: autoUpdate
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Automatically update in the future", "Checkbox label for using autoupdates later on")
|
||||
checked: go.isAutoUpdate
|
||||
onToggled: go.toggleAutoUpdate()
|
||||
visible: !root.forceUpdate
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Style.dialog.spacing
|
||||
|
||||
ButtonRounded {
|
||||
fa_icon: Style.fa.times
|
||||
text: (go.goos=="linux" ? qsTr("Okay") : qsTr("Cancel"))
|
||||
text: root.forceUpdate ? qsTr("Quit") : qsTr("Cancel")
|
||||
color_main: Style.dialog.text
|
||||
onClicked: root.cancel()
|
||||
onClicked: root.forceUpdate ? Qt.quit() : root.cancel()
|
||||
}
|
||||
|
||||
ButtonRounded {
|
||||
fa_icon: Style.fa.check
|
||||
text: qsTr("Update")
|
||||
visible: go.goos!="linux"
|
||||
visible: go.updateCanInstall
|
||||
color_main: Style.dialog.text
|
||||
color_minor: Style.main.textBlue
|
||||
isOpaque: true
|
||||
@ -97,7 +134,7 @@ Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { // 0: Check / download / unpack / prepare
|
||||
Rectangle { // 1: Installing update
|
||||
id: updateStatus
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@ -116,35 +153,29 @@ Dialog {
|
||||
width: 2*root.width/3
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: {
|
||||
switch (go.progressDescription) {
|
||||
case "1": return qsTr("Checking the current version.")
|
||||
case "2": return qsTr("Downloading the update files.")
|
||||
case "3": return qsTr("Verifying the update files.")
|
||||
case "4": return qsTr("Unpacking the update files.")
|
||||
case "5": return qsTr("Starting the update.")
|
||||
case "6": return qsTr("Quitting the application.")
|
||||
default: return ""
|
||||
}
|
||||
}
|
||||
text: qsTr("Updating...")
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
id: progressbar
|
||||
implicitWidth : 2*updateStatus.width/3
|
||||
implicitHeight : Style.exporting.rowHeight
|
||||
visible: go.progress!=0 // hack hide animation when clearing out progress bar
|
||||
value: go.progress
|
||||
property int current: go.total * go.progress
|
||||
property bool isFinished: finishedPartBar.width == progressbar.width
|
||||
id: updateProgressBar
|
||||
width: 2*updateStatus.width/3
|
||||
height: Style.exporting.rowHeight
|
||||
//implicitWidth : 2*updateStatus.width/3
|
||||
//implicitHeight : Style.exporting.rowHeight
|
||||
indeterminate: true
|
||||
//value: 0.5
|
||||
//property int current: go.total * go.progress
|
||||
//property bool isFinished: finishedPartBar.width == progressbar.width
|
||||
background: Rectangle {
|
||||
radius : Style.exporting.boxRadius
|
||||
color : Style.exporting.progressBackground
|
||||
}
|
||||
|
||||
contentItem: Item {
|
||||
clip: true
|
||||
Rectangle {
|
||||
id: finishedPartBar
|
||||
width : parent.width * progressbar.visualPosition
|
||||
id: progressIndicator
|
||||
width : updateProgressBar.indeterminate ? 50 : parent.width * updateProgressBar.visualPosition
|
||||
height : parent.height
|
||||
radius : Style.exporting.boxRadius
|
||||
gradient : Gradient {
|
||||
@ -156,6 +187,27 @@ Dialog {
|
||||
Behavior on width {
|
||||
NumberAnimation { duration:300; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
running: updateProgressBar.visible && updateProgressBar.indeterminate
|
||||
loops: Animation.Infinite
|
||||
|
||||
SmoothedAnimation {
|
||||
target: progressIndicator
|
||||
property: "x"
|
||||
from: 0
|
||||
to: updateProgressBar.width - progressIndicator.width
|
||||
duration: 2000
|
||||
}
|
||||
|
||||
SmoothedAnimation {
|
||||
target: progressIndicator
|
||||
property: "x"
|
||||
from: updateProgressBar.width - progressIndicator.width
|
||||
to: 0
|
||||
duration: 2000
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
@ -170,7 +222,7 @@ Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { // 1: Something went wrong / All ok, closing bridge
|
||||
Rectangle { // 2: Something went wrong / All ok, closing bridge
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
color: Style.transparent
|
||||
@ -188,8 +240,8 @@ Dialog {
|
||||
width: 2*root.width/3
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: !root.hasError ? qsTr('Application will quit now to finish the update.', "message after successful update") :
|
||||
qsTr('<b>The update procedure was not successful!</b><br>Please follow the download link and update manually. <br><br><a href="%1">%1</a>').arg(go.downloadLink)
|
||||
text: !root.hasError ? qsTr('%1 will restart now to finish the update.', "message after successful update").arg(go.programTitle) :
|
||||
qsTr('<b>The update procedure was not successful!</b><br>Please follow the download link and update manually. <br><br><a href="%1">%1</a>').arg(go.updateLandingPage)
|
||||
|
||||
onLinkActivated : {
|
||||
console.log("clicked link:", link)
|
||||
@ -220,7 +272,7 @@ Dialog {
|
||||
|
||||
function finished(hasError) {
|
||||
root.hasError = hasError
|
||||
root.incrementCurrentIndex()
|
||||
root.currentIndex = 2
|
||||
}
|
||||
|
||||
onShow: {
|
||||
@ -234,9 +286,10 @@ Dialog {
|
||||
onOkay: {
|
||||
switch (root.currentIndex) {
|
||||
case 0:
|
||||
go.startUpdate()
|
||||
go.startManualUpdate()
|
||||
root.currentIndex = 1
|
||||
break
|
||||
}
|
||||
root.incrementCurrentIndex()
|
||||
}
|
||||
|
||||
onCancel: {
|
||||
|
||||
@ -53,6 +53,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Row {
|
||||
id: messageRow
|
||||
anchors.centerIn: root
|
||||
visible: root.isVisible
|
||||
spacing: Style.main.leftMarginButton
|
||||
@ -63,80 +64,74 @@ Rectangle {
|
||||
}
|
||||
|
||||
ClickIconText {
|
||||
id: linkText
|
||||
anchors.verticalCenter : message.verticalCenter
|
||||
text : "("+go.newversion+" " + qsTr("release notes", "display the release notes from the new version")+")"
|
||||
visible : root.state=="oldVersion"
|
||||
iconText : ""
|
||||
onClicked : {
|
||||
Qt.openUrlExternally(go.releaseNotesLink)
|
||||
}
|
||||
fontSize : root.fontSize
|
||||
}
|
||||
|
||||
ClickIconText {
|
||||
id: actionText
|
||||
anchors.verticalCenter : message.verticalCenter
|
||||
text : root.state=="oldVersion" || root.state == "forceUpdate" ?
|
||||
qsTr("Update", "click to update to a new version when one is available") :
|
||||
qsTr("Retry now", "click to try to connect to the internet when the app is disconnected from the internet")
|
||||
visible : root.state!="internetCheck"
|
||||
iconText : ""
|
||||
onClicked : {
|
||||
if (root.state=="oldVersion" || root.state=="forceUpdate" ) {
|
||||
winMain.dialogUpdate.show()
|
||||
} else {
|
||||
go.checkInternet()
|
||||
}
|
||||
}
|
||||
fontSize : root.fontSize
|
||||
textUnderline: true
|
||||
}
|
||||
Text {
|
||||
id: separatorText
|
||||
anchors.baseline : message.baseline
|
||||
color: Style.main.text
|
||||
font {
|
||||
pointSize : root.fontSize * Style.pt
|
||||
bold : true
|
||||
}
|
||||
visible: root.state=="oldVersion" || root.state=="noInternet"
|
||||
text : "|"
|
||||
}
|
||||
ClickIconText {
|
||||
id: action2Text
|
||||
anchors.verticalCenter : message.verticalCenter
|
||||
iconText : ""
|
||||
text : root.state == "noInternet" ?
|
||||
qsTr("Troubleshoot", "Show modal screen with additional tips for troubleshooting connection issues") :
|
||||
qsTr("Remind me later", "Do not install new version and dismiss a notification")
|
||||
visible : root.state=="oldVersion" || root.state=="noInternet"
|
||||
onClicked : {
|
||||
if (root.state == "oldVersion") {
|
||||
root.state = "upToDate"
|
||||
}
|
||||
if (root.state == "noInternet") {
|
||||
dialogConnectionTroubleshoot.show()
|
||||
}
|
||||
}
|
||||
fontSize : root.fontSize
|
||||
textUnderline: true
|
||||
}
|
||||
}
|
||||
|
||||
ClickIconText {
|
||||
id: closeSign
|
||||
anchors.verticalCenter : messageRow.verticalCenter
|
||||
anchors.right: root.right
|
||||
iconText : Style.fa.close
|
||||
fontSize : root.fontSize
|
||||
textUnderline: true
|
||||
}
|
||||
|
||||
onStateChanged : {
|
||||
switch (root.state) {
|
||||
case "forceUpdate" :
|
||||
gui.warningFlags |= Style.errorInfoBar
|
||||
break;
|
||||
case "upToDate" :
|
||||
gui.warningFlags &= ~Style.warnInfoBar
|
||||
iTry = 0
|
||||
secLeft=checkInterval[iTry]
|
||||
break;
|
||||
case "internetCheck":
|
||||
break;
|
||||
case "noInternet" :
|
||||
gui.warningFlags |= Style.warnInfoBar
|
||||
retryInternet.start()
|
||||
secLeft=checkInterval[iTry]
|
||||
break;
|
||||
gui.warningFlags |= Style.warnInfoBar
|
||||
retryInternet.start()
|
||||
secLeft=checkInterval[iTry]
|
||||
break;
|
||||
case "oldVersion":
|
||||
gui.warningFlags |= Style.warnInfoBar
|
||||
break;
|
||||
case "forceUpdate":
|
||||
gui.warningFlags |= Style.errorInfoBar
|
||||
break;
|
||||
case "upToDate":
|
||||
gui.warningFlags &= ~Style.warnInfoBar
|
||||
iTry = 0
|
||||
secLeft=checkInterval[iTry]
|
||||
break;
|
||||
case "updateRestart":
|
||||
gui.warningFlags |= Style.warnInfoBar
|
||||
break;
|
||||
case "updateError":
|
||||
gui.warningFlags |= Style.errorInfoBar
|
||||
break;
|
||||
default :
|
||||
gui.warningFlags |= Style.warnInfoBar
|
||||
break;
|
||||
}
|
||||
|
||||
if (root.state!="noInternet") {
|
||||
@ -172,6 +167,26 @@ Rectangle {
|
||||
color: Style.main.background
|
||||
text: qsTr("Checking connection. Please wait...", "displayed after user retries internet connection")
|
||||
}
|
||||
PropertyChanges {
|
||||
target: linkText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: actionText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separatorText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: action2Text
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: closeSign
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "noInternet"
|
||||
@ -186,6 +201,35 @@ Rectangle {
|
||||
color: Style.main.line
|
||||
text: qsTr("Cannot contact server. Retrying in ", "displayed when the app is disconnected from the internet or server has problems")+timeToRetry()+"."
|
||||
}
|
||||
PropertyChanges {
|
||||
target: linkText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: actionText
|
||||
visible: true
|
||||
text: qsTr("Retry now", "click to try to connect to the internet when the app is disconnected from the internet")
|
||||
onClicked: {
|
||||
go.checkInternet()
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separatorText
|
||||
visible: true
|
||||
text: "|"
|
||||
}
|
||||
PropertyChanges {
|
||||
target: action2Text
|
||||
visible: true
|
||||
text: qsTr("Troubleshoot", "Show modal screen with additional tips for troubleshooting connection issues")
|
||||
onClicked: {
|
||||
dialogConnectionTroubleshoot.show()
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: closeSign
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "oldVersion"
|
||||
@ -198,7 +242,38 @@ Rectangle {
|
||||
PropertyChanges {
|
||||
target: message
|
||||
color: Style.main.background
|
||||
text: qsTr("An update is available.", "displayed in a notification when an app update is available")
|
||||
text: qsTr("Update available", "displayed in a notification when an app update is available")
|
||||
}
|
||||
PropertyChanges {
|
||||
target: linkText
|
||||
visible: true
|
||||
text: "(" + qsTr("view release notes", "display the release notes from the new version") + ")"
|
||||
onClicked: {
|
||||
Qt.openUrlExternally(go.updateReleaseNotesLink)
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: actionText
|
||||
visible: true
|
||||
text: qsTr("Update", "click to update to a new version when one is available")
|
||||
onClicked: {
|
||||
winMain.dialogUpdate.show()
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separatorText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: action2Text
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: closeSign
|
||||
visible: true
|
||||
onClicked: {
|
||||
root.state = "upToDate"
|
||||
}
|
||||
}
|
||||
},
|
||||
State {
|
||||
@ -214,6 +289,30 @@ Rectangle {
|
||||
color: Style.main.line
|
||||
text: qsTr("%1 is outdated.", "displayed in a notification when app is outdated").arg(go.programTitle)
|
||||
}
|
||||
PropertyChanges {
|
||||
target: linkText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: actionText
|
||||
visible: true
|
||||
text: qsTr("Update", "click to update to a new version when one is available")
|
||||
onClicked: {
|
||||
winMain.dialogUpdate.show()
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separatorText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: action2Text
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: closeSign
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "upToDate"
|
||||
@ -228,6 +327,103 @@ Rectangle {
|
||||
color: Style.main.background
|
||||
text: ""
|
||||
}
|
||||
PropertyChanges {
|
||||
target: linkText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: actionText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separatorText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: action2Text
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: closeSign
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "updateRestart"
|
||||
PropertyChanges {
|
||||
target: root
|
||||
height: 2* Style.main.fontSize
|
||||
isVisible: true
|
||||
color: Style.main.textBlue
|
||||
}
|
||||
PropertyChanges {
|
||||
target: message
|
||||
color: Style.main.background
|
||||
text: qsTr("%1 update is ready", "displayed in a notification when an app update is installed and restart is needed").arg(go.programTitle)
|
||||
}
|
||||
PropertyChanges {
|
||||
target: linkText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: actionText
|
||||
visible: true
|
||||
text: qsTr("Restart now", "click to restart application as new version was installed")
|
||||
onClicked: {
|
||||
go.setToRestart()
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separatorText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: action2Text
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: closeSign
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "updateError"
|
||||
PropertyChanges {
|
||||
target: root
|
||||
height: 2* Style.main.fontSize
|
||||
isVisible: true
|
||||
color: Style.main.textRed
|
||||
}
|
||||
PropertyChanges {
|
||||
target: message
|
||||
color: Style.main.line
|
||||
text: qsTr("Sorry, %1 couldn't update.", "displayed in a notification when app failed to autoupdate").arg(go.programTitle)
|
||||
}
|
||||
PropertyChanges {
|
||||
target: linkText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: actionText
|
||||
visible: true
|
||||
text: qsTr("Please update manually", "click to open download page to update manally")
|
||||
onClicked: {
|
||||
Qt.openUrlExternally(go.updateLandingPage)
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separatorText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: action2Text
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: closeSign
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -59,7 +59,6 @@ QtObject {
|
||||
property real fontSize : 12 * px
|
||||
property real iconSize : 15 * px
|
||||
property real leftMarginButton : 9 * px
|
||||
property real verCheckRepeatTime : 15*60*60*1000 // milliseconds
|
||||
property real topMargin : fontSize
|
||||
property real bottomMargin : fontSize
|
||||
property real border : 1 * px
|
||||
|
||||
Reference in New Issue
Block a user