From 07ad41230d663816e9894b59b110fa2f7075ca18 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Mon, 29 Nov 2021 21:10:26 +0100 Subject: [ui] style help links --- gui/components/Help.qml | 28 ++++++++++++++++++++++++++-- gui/components/Splash.qml | 35 ++++++++++++++++++++--------------- pkg/config/version/checknewer.go | 3 +++ 3 files changed, 49 insertions(+), 17 deletions(-) diff --git a/gui/components/Help.qml b/gui/components/Help.qml index 6148ece..ed6f543 100644 --- a/gui/components/Help.qml +++ b/gui/components/Help.qml @@ -1,9 +1,12 @@ -import QtQuick 2.9 +import QtQuick 2.15 import QtQuick.Controls 2.2 +import "../themes/themes.js" as Theme + ThemedPage { title: qsTr("Help") property var issueTracker: "https://0xacab.org/leap/bitmask-vpn/issues" + property var uninstall: "https://0xacab.org/leap/bitmask-vpn/-/blob/main/docs/uninstall.md" Column { anchors.centerIn: parent @@ -11,15 +14,36 @@ ThemedPage { Text { font.pixelSize: 14 + textFormat: Text.RichText + color: Theme.green anchors.horizontalCenter: parent.horizontalCenter text: getDummyLink(qsTr("Troubleshooting and support")) onLinkActivated: Qt.openUrlExternally(ctx.helpURL) + HoverHandler { + cursorShape: Qt.PointingHandCursor + } } Text { font.pixelSize: 14 + textFormat: Text.RichText + color: Theme.green anchors.horizontalCenter: parent.horizontalCenter text: getDummyLink(qsTr("Report a bug")) onLinkActivated: Qt.openUrlExternally(issueTracker) + HoverHandler { + cursorShape: Qt.PointingHandCursor + } + } + Text { + font.pixelSize: 14 + textFormat: Text.RichText + color: Theme.green + anchors.horizontalCenter: parent.horizontalCenter + text: getDummyLink(qsTr("How to uninstall")) + onLinkActivated: Qt.openUrlExternally(uninstall) + HoverHandler { + cursorShape: Qt.PointingHandCursor + } } /* XXX needs implementation in the backend Button { @@ -30,6 +54,6 @@ ThemedPage { } function getDummyLink(text) { - return "" + text + "" + return "" + text + "" } } diff --git a/gui/components/Splash.qml b/gui/components/Splash.qml index 0d49474..8c3c310 100644 --- a/gui/components/Splash.qml +++ b/gui/components/Splash.qml @@ -5,7 +5,7 @@ import "../themes/themes.js" as Theme Page { id: splash - property int timeoutInterval: qmlDebug ? 200 : 1600 + property int timeoutInterval: qmlDebug ? 600 : 1600 property alias errors: splashErrorBox ToolButton { @@ -93,22 +93,11 @@ Page { } function hasMotd() { - if (ctx) { - if (isTrue(ctx.canUpgrade)) { - return true - } - return !isEmpty(ctx.motd) - } - return false + return needsUpgrade() || (ctx && !isEmpty(ctx.motd)) } function getUpgradeText() { - let t = "" - let platform = Qt.platform.os - if (platform == "windows" || platform == "osx" || platform == "linux") { - t = qsTr("There is a newer version available.") - } - return t + return qsTr("There is a newer version available. ") + qsTr("Make sure to uninstall the previous one before running the new installer.") } function getUpgradeLink() { @@ -119,6 +108,21 @@ Page { return "https://downloads.leap.se/RiseupVPN/" + Qt.platform.os + "/" } + function needsUpgrade() { + if (ctx && isTrue(ctx.canUpgrade)) { + if (qmlDebug) { + return true + } + let platform = Qt.platform.os + //DEBUG -- + //if (platform == "windows" || platform == "osx" || platform == "linux" ) { + if (platform == "windows" || platform == "osx") { + return true + } + } + return false + } + function showMotd() { // XXX this is not picking locales configured by LANG or LC_ALL let isUpgrade = false @@ -129,7 +133,7 @@ Page { let textLocale = "" let link = "" - if (ctx && isTrue(ctx.canUpgrade)) { + if (needsUpgrade()) { isUpgrade = true; textLocale = getUpgradeText(); link = getUpgradeLink(); @@ -186,6 +190,7 @@ Page { if (ctx && isTrue(ctx.isReady) || qmlDebug) { splashTimer.stop() if (hasMotd()) { + console.debug("show motd"); showMotd(); } else { loader.source = "MainView.qml" diff --git a/pkg/config/version/checknewer.go b/pkg/config/version/checknewer.go index 115696a..f253877 100644 --- a/pkg/config/version/checknewer.go +++ b/pkg/config/version/checknewer.go @@ -17,6 +17,9 @@ const verURI = "https://downloads.leap.se/RiseupVPN/" // at the moment, we hardcode RiseupVPN in the path, assuming that all clients // stay in sync. func CanUpgrade() bool { + if os.Getenv("SKIP_VERSION_CHECK") == "1" { + return false + } log.Println("Checking for updates...") uri := verURI switch runtime.GOOS { -- cgit v1.2.3