Merge pull request #2100

171e1fc Fix checking for gui updates (mmbyday)
This commit is contained in:
luigi1111 2019-05-03 12:46:42 -05:00
commit 34e46eda64
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 29 additions and 14 deletions

View file

@ -29,13 +29,14 @@
import QtQuick 2.9
import QtQuick.Controls 1.4
import moneroComponents.Wallet 1.0
import "." as MoneroComponents
Item {
id: item
property string message: ""
property bool active: false
height: 120
width: 240
height: 180
width: 320
property int margin: 15
x: parent.width - width - margin
y: parent.height - height * scale.yScale - margin * scale.yScale
@ -51,11 +52,12 @@ Item {
backgroundVisible: false
textFormat: TextEdit.AutoText
anchors.fill: parent
font.family: "Arial"
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 12
textMargin: 20
textColor: "white"
text: item.message
wrapMode: Text.WrapAnywhere
}
}
@ -70,7 +72,7 @@ Item {
Timer {
id: hider
interval: 12000; running: false; repeat: false
interval: 30000; running: false; repeat: false
onTriggered: { item.active = false }
}

View file

@ -78,9 +78,10 @@
bool isIOS = false;
bool isAndroid = false;
bool isWindows = false;
bool isMac = false;
bool isLinux = false;
bool isDesktop = false;
bool isOpenGL = true;
bool isLinux = false;
int main(int argc, char *argv[])
{
@ -98,6 +99,8 @@ int main(int argc, char *argv[])
bool isWindows = true;
#elif defined(Q_OS_LINUX)
bool isLinux = true;
#elif defined(Q_OS_MAC)
bool isMac = true;
#endif
// detect low graphics mode (start-low-graphics-mode.bat)
@ -316,6 +319,8 @@ int main(int argc, char *argv[])
#endif
engine.rootContext()->setContextProperty("isWindows", isWindows);
engine.rootContext()->setContextProperty("isMac", isMac);
engine.rootContext()->setContextProperty("isLinux", isLinux);
engine.rootContext()->setContextProperty("isIOS", isIOS);
engine.rootContext()->setContextProperty("isAndroid", isAndroid);
engine.rootContext()->setContextProperty("isOpenGL", isOpenGL);

View file

@ -2001,15 +2001,23 @@ 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 auto_url = parts[3]
var msg = qsTr("New version of monero-wallet-gui is available: %1<br>%2").arg(version).arg(user_url) + translationManager.emptyString
notifier.show(msg)
}
else {
print("Failed to parse update spec")
var version = parts[0]
var hash = parts[1]
//var user_url = parts[2]
//var auto_url = parts[3]
var osBuildTag = isMac ? "mac-x64" : isWindows ? "win-x64" : isLinux ? "linux-x64" : "unknownBuildTag"
var extension = isMac || isLinux ? ".tar.bz2" : isWindows ? ".zip" : ".unknownExtension"
var base_url = "https://downloads.getmonero.org/gui/monero-gui-"
var download_url = base_url + osBuildTag + "-v" + version + extension
var msg = ""
if (osBuildTag !== "unknownBuildTag") {
msg = qsTr("New version of Monero v.%1 is available.<br><br>Download:<br>%2<br><br>SHA256 Hash:<br>%3").arg(version).arg(download_url).arg(hash) + translationManager.emptyString
} else {
msg = qsTr("New version of Monero is available. Check out getmonero.org") + translationManager.emptyString
}
notifier.show(msg)
} else {
print("Failed to parse update spec")
}
}