Skip to content
Snippets Groups Projects
Unverified Commit 07ad4123 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[ui] style help links

parent b25ec7c9
No related branches found
No related tags found
No related merge requests found
import QtQuick 2.9 import QtQuick 2.15
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import "../themes/themes.js" as Theme
ThemedPage { ThemedPage {
title: qsTr("Help") title: qsTr("Help")
property var issueTracker: "https://0xacab.org/leap/bitmask-vpn/issues" 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 { Column {
anchors.centerIn: parent anchors.centerIn: parent
...@@ -11,15 +14,36 @@ ThemedPage { ...@@ -11,15 +14,36 @@ ThemedPage {
Text { Text {
font.pixelSize: 14 font.pixelSize: 14
textFormat: Text.RichText
color: Theme.green
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: getDummyLink(qsTr("Troubleshooting and support")) text: getDummyLink(qsTr("Troubleshooting and support"))
onLinkActivated: Qt.openUrlExternally(ctx.helpURL) onLinkActivated: Qt.openUrlExternally(ctx.helpURL)
HoverHandler {
cursorShape: Qt.PointingHandCursor
}
} }
Text { Text {
font.pixelSize: 14 font.pixelSize: 14
textFormat: Text.RichText
color: Theme.green
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: getDummyLink(qsTr("Report a bug")) text: getDummyLink(qsTr("Report a bug"))
onLinkActivated: Qt.openUrlExternally(issueTracker) 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 /* XXX needs implementation in the backend
Button { Button {
...@@ -30,6 +54,6 @@ ThemedPage { ...@@ -30,6 +54,6 @@ ThemedPage {
} }
function getDummyLink(text) { function getDummyLink(text) {
return "<a href='#'>" + text + "</a>" return "<style>a:link {color: '" + Theme.green + "';}</style><a href=\"#\">" + text + "</a>"
} }
} }
...@@ -5,7 +5,7 @@ import "../themes/themes.js" as Theme ...@@ -5,7 +5,7 @@ import "../themes/themes.js" as Theme
Page { Page {
id: splash id: splash
property int timeoutInterval: qmlDebug ? 200 : 1600 property int timeoutInterval: qmlDebug ? 600 : 1600
property alias errors: splashErrorBox property alias errors: splashErrorBox
ToolButton { ToolButton {
...@@ -93,22 +93,11 @@ Page { ...@@ -93,22 +93,11 @@ Page {
} }
function hasMotd() { function hasMotd() {
if (ctx) { return needsUpgrade() || (ctx && !isEmpty(ctx.motd))
if (isTrue(ctx.canUpgrade)) {
return true
}
return !isEmpty(ctx.motd)
}
return false
} }
function getUpgradeText() { function getUpgradeText() {
let t = "" return qsTr("There is a newer version available. ") + qsTr("Make sure to uninstall the previous one before running the new installer.")
let platform = Qt.platform.os
if (platform == "windows" || platform == "osx" || platform == "linux") {
t = qsTr("There is a newer version available.")
}
return t
} }
function getUpgradeLink() { function getUpgradeLink() {
...@@ -119,6 +108,21 @@ Page { ...@@ -119,6 +108,21 @@ Page {
return "https://downloads.leap.se/RiseupVPN/" + Qt.platform.os + "/" 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() { function showMotd() {
// XXX this is not picking locales configured by LANG or LC_ALL // XXX this is not picking locales configured by LANG or LC_ALL
let isUpgrade = false let isUpgrade = false
...@@ -129,7 +133,7 @@ Page { ...@@ -129,7 +133,7 @@ Page {
let textLocale = "" let textLocale = ""
let link = "" let link = ""
if (ctx && isTrue(ctx.canUpgrade)) { if (needsUpgrade()) {
isUpgrade = true; isUpgrade = true;
textLocale = getUpgradeText(); textLocale = getUpgradeText();
link = getUpgradeLink(); link = getUpgradeLink();
...@@ -186,6 +190,7 @@ Page { ...@@ -186,6 +190,7 @@ Page {
if (ctx && isTrue(ctx.isReady) || qmlDebug) { if (ctx && isTrue(ctx.isReady) || qmlDebug) {
splashTimer.stop() splashTimer.stop()
if (hasMotd()) { if (hasMotd()) {
console.debug("show motd");
showMotd(); showMotd();
} else { } else {
loader.source = "MainView.qml" loader.source = "MainView.qml"
......
...@@ -17,6 +17,9 @@ const verURI = "https://downloads.leap.se/RiseupVPN/" ...@@ -17,6 +17,9 @@ const verURI = "https://downloads.leap.se/RiseupVPN/"
// at the moment, we hardcode RiseupVPN in the path, assuming that all clients // at the moment, we hardcode RiseupVPN in the path, assuming that all clients
// stay in sync. // stay in sync.
func CanUpgrade() bool { func CanUpgrade() bool {
if os.Getenv("SKIP_VERSION_CHECK") == "1" {
return false
}
log.Println("Checking for updates...") log.Println("Checking for updates...")
uri := verURI uri := verURI
switch runtime.GOOS { switch runtime.GOOS {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment