Skip to content

Commit f10fc27

Browse files
committed
Generalize meter bar link and set subscription URL for official QFC only
1 parent fcd4345 commit f10fc27

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

src/qml/QFieldCloudPopup.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ Popup {
924924
storageMeterBar.value = usedStorage / totalStorage;
925925
storageMeterBar.usedText = qsTr("%1 GB used").arg(usedStorage);
926926
storageMeterBar.totalText = qsTr("of %1 GB").arg(totalStorage);
927-
storageMeterBar.upgradeUrl = "https://app.qfield.cloud/";
927+
storageMeterBar.relatedUrl = cloudConnection.url === cloudConnection.defaultUrl ? "https://app.qfield.cloud/settings/" + cloudConnection.username + "/subscriptions" : "";
928928
storageMeterBar.visible = true;
929929
}
930930
}

src/qml/imports/Theme/QfMeterBar.qml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Item {
1414
property alias value: progressBar.value
1515
property alias usedText: usedLabel.text
1616
property alias totalText: totalLabel.text
17-
property alias upgradeUrl: upgradeLink.url
17+
property alias relatedUrl: linkItem.url
1818

1919
property color normalColor: Theme.qfieldcloudBlue
2020
property color warningColor: Theme.warningColor
@@ -33,19 +33,25 @@ Item {
3333
spacing: 8
3434

3535
Item {
36-
id: upgradeLink
36+
id: linkItem
3737
Layout.fillWidth: true
38-
implicitHeight: upgradeLinkRow.implicitHeight
38+
implicitHeight: linkRow.implicitHeight
3939

4040
property string url: ""
4141
property bool isCritical: value >= meterBar.criticalThreshold
42+
property bool hasUrl: url !== ""
4243

4344
Row {
44-
id: upgradeLinkRow
45+
id: linkRow
4546
spacing: 8
4647

4748
Label {
48-
text: upgradeLink.isCritical ? qsTr("Tap to upgrade") : qsTr("Tap to manage")
49+
text: {
50+
if (!linkItem.hasUrl) {
51+
return qsTr("Storage");
52+
}
53+
return linkItem.isCritical ? qsTr("Tap to upgrade storage") : qsTr("Tap to manage storage");
54+
}
4955
font: Theme.tipFont
5056
color: Theme.mainTextColor
5157
anchors.verticalCenter: parent.verticalCenter
@@ -55,6 +61,7 @@ Item {
5561
width: 10
5662
height: 10
5763
anchors.verticalCenter: parent.verticalCenter
64+
visible: linkItem.hasUrl
5865

5966
ShapePath {
6067
strokeWidth: 1.5
@@ -161,7 +168,11 @@ Item {
161168

162169
MouseArea {
163170
anchors.fill: parent
164-
cursorShape: Qt.PointingHandCursor
165-
onClicked: Qt.openUrlExternally(upgradeLink.url)
171+
cursorShape: linkItem.hasUrl ? Qt.PointingHandCursor : Qt.ArrowCursor
172+
onClicked: {
173+
if (linkItem.hasUrl) {
174+
Qt.openUrlExternally(linkItem.url);
175+
}
176+
}
166177
}
167178
}

0 commit comments

Comments
 (0)