UpdateDialog: implement update download functionality

This commit is contained in:
xiphon
2020-04-04 13:22:25 +00:00
parent df54439972
commit 6ed7fcec67
13 changed files with 671 additions and 121 deletions

View File

@@ -1135,7 +1135,7 @@ ApplicationWindow {
triggeredOnStart: false
}
function fiatApiParseTicker(url, resp, currency){
function fiatApiParseTicker(url, resp, currency){
// parse & validate incoming JSON
if(url.startsWith("https://api.kraken.com/0/")){
if(resp.hasOwnProperty("error") && resp.error.length > 0 || !resp.hasOwnProperty("result")){
@@ -1181,7 +1181,7 @@ ApplicationWindow {
}
function fiatApiJsonReceived(url, resp, error) {
if (error) {
if (error) {
appWindow.fiatApiError(error);
return;
}
@@ -1436,6 +1436,14 @@ ApplicationWindow {
}
}
MoneroComponents.UpdateDialog {
id: updateDialog
allowed: !passwordDialog.visible && !inputDialog.visible && !splash.visible
x: (parent.width - width) / 2
y: (parent.height - height) / 2
}
// Choose blockchain folder
FileDialog {
id: blockchainFileDialog
@@ -1691,7 +1699,7 @@ ApplicationWindow {
anchors.fill: blurredArea
source: blurredArea
radius: 64
visible: passwordDialog.visible || inputDialog.visible || splash.visible
visible: passwordDialog.visible || inputDialog.visible || splash.visible || updateDialog.visible
}
@@ -1798,11 +1806,6 @@ ApplicationWindow {
color: "#FFFFFF"
}
}
Notifier {
visible:false
id: notifier
}
}
function toggleLanguageView(){
@@ -1981,16 +1984,7 @@ ApplicationWindow {
print("Update found: " + update)
var parts = update.split("|")
if (parts.length == 4) {
var version = parts[0]
var hash = parts[1]
var user_url = parts[2]
var msg = qsTr("New version of Monero v%1 is available.").arg(version)
if (isMac || isWindows || isLinux) {
msg += "<br><br>%1:<br>%2<br><br>%3:<br>%4".arg(qsTr("Download")).arg(user_url).arg(qsTr("SHA256 Hash")).arg(hash) + translationManager.emptyString
} else {
msg += " " + qsTr("Check out getmonero.org") + translationManager.emptyString
}
notifier.show(msg)
updateDialog.show(parts[0], isMac || isWindows || isLinux ? parts[3] : "");
} else {
print("Failed to parse update spec")
}
@@ -2102,6 +2096,11 @@ ApplicationWindow {
blackColor: "black"
whiteColor: "white"
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
}
}
// borders on white theme + linux