Skip to content

Commit fcd4345

Browse files
committed
Click on whole item + Handle projects with no right to get details..
1 parent c59c441 commit fcd4345

File tree

2 files changed

+117
-108
lines changed

2 files changed

+117
-108
lines changed

src/qml/QFieldCloudPopup.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Popup {
132132
if (cloudConnection.status !== QFieldCloudConnection.LoggedIn || !cloudProjectsModel.currentProject || cloudProjectsModel.currentProject.status !== QFieldCloudProject.Idle)
133133
return;
134134
connectionSettings.visible = !connectionSettings.visible;
135-
storageMeterBar.visible = !connectionSettings.visible;
135+
storageMeterBar.visible = Qt.binding(() => storageMeterBar.value > 0 && !connectionSettings.visible);
136136
}
137137
}
138138
}
@@ -912,6 +912,8 @@ Popup {
912912
}
913913

914914
function fetchSubscriptionInformation() {
915+
storageMeterBar.visible = false;
916+
storageMeterBar.value = 0;
915917
if (cloudConnection.status === QFieldCloudConnection.LoggedIn) {
916918
const owner = cloudProjectsModel.currentProject ? cloudProjectsModel.currentProject.owner : cloudConnection.username;
917919
cloudConnection.getSubscriptionInformation(owner);

src/qml/imports/Theme/QfMeterBar.qml

Lines changed: 114 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import org.qfield
88
/**
99
* \ingroup qml
1010
*/
11-
ColumnLayout {
11+
Item {
1212
id: meterBar
1313

1414
property alias value: progressBar.value
@@ -24,137 +24,144 @@ ColumnLayout {
2424
property int animationDuration: 1000
2525
property int barHeight: 8
2626

27-
spacing: 8
27+
implicitHeight: content.implicitHeight
28+
implicitWidth: content.implicitWidth
2829

29-
Item {
30-
id: upgradeLink
31-
Layout.fillWidth: true
32-
implicitHeight: upgradeLinkRow.implicitHeight
30+
ColumnLayout {
31+
id: content
32+
anchors.fill: parent
33+
spacing: 8
3334

34-
property string url: ""
35-
property bool isCritical: value >= meterBar.criticalThreshold
35+
Item {
36+
id: upgradeLink
37+
Layout.fillWidth: true
38+
implicitHeight: upgradeLinkRow.implicitHeight
3639

37-
Row {
38-
id: upgradeLinkRow
39-
spacing: 8
40+
property string url: ""
41+
property bool isCritical: value >= meterBar.criticalThreshold
4042

41-
Label {
42-
text: upgradeLink.isCritical ? qsTr("Tap to upgrade") : qsTr("Tap to manage")
43-
font: Theme.tipFont
44-
color: Theme.mainTextColor
45-
anchors.verticalCenter: parent.verticalCenter
46-
}
43+
Row {
44+
id: upgradeLinkRow
45+
spacing: 8
4746

48-
Shape {
49-
width: 10
50-
height: 10
51-
anchors.verticalCenter: parent.verticalCenter
52-
53-
ShapePath {
54-
strokeWidth: 1.5
55-
strokeColor: Theme.mainTextColor
56-
fillColor: "transparent"
57-
capStyle: ShapePath.RoundCap
58-
joinStyle: ShapePath.RoundJoin
59-
startX: 0
60-
startY: 5
61-
PathLine {
62-
x: 5.5
63-
y: 5
64-
}
47+
Label {
48+
text: upgradeLink.isCritical ? qsTr("Tap to upgrade") : qsTr("Tap to manage")
49+
font: Theme.tipFont
50+
color: Theme.mainTextColor
51+
anchors.verticalCenter: parent.verticalCenter
6552
}
6653

67-
ShapePath {
68-
strokeWidth: 1.5
69-
strokeColor: Theme.mainTextColor
70-
fillColor: "transparent"
71-
capStyle: ShapePath.RoundCap
72-
joinStyle: ShapePath.RoundJoin
73-
startX: 4
74-
startY: 1.5
75-
PathLine {
76-
x: 8
77-
y: 5
54+
Shape {
55+
width: 10
56+
height: 10
57+
anchors.verticalCenter: parent.verticalCenter
58+
59+
ShapePath {
60+
strokeWidth: 1.5
61+
strokeColor: Theme.mainTextColor
62+
fillColor: "transparent"
63+
capStyle: ShapePath.RoundCap
64+
joinStyle: ShapePath.RoundJoin
65+
startX: 0
66+
startY: 5
67+
PathLine {
68+
x: 5.5
69+
y: 5
70+
}
7871
}
79-
PathLine {
80-
x: 4
81-
y: 8.5
72+
73+
ShapePath {
74+
strokeWidth: 1.5
75+
strokeColor: Theme.mainTextColor
76+
fillColor: "transparent"
77+
capStyle: ShapePath.RoundCap
78+
joinStyle: ShapePath.RoundJoin
79+
startX: 4
80+
startY: 1.5
81+
PathLine {
82+
x: 8
83+
y: 5
84+
}
85+
PathLine {
86+
x: 4
87+
y: 8.5
88+
}
8289
}
8390
}
8491
}
8592
}
8693

87-
MouseArea {
88-
anchors.fill: parent
89-
cursorShape: Qt.PointingHandCursor
90-
onClicked: Qt.openUrlExternally(upgradeLink.url)
91-
}
92-
}
93-
94-
ProgressBar {
95-
id: progressBar
96-
Layout.fillWidth: true
97-
from: 0
98-
to: 1
99-
100-
property color barColor: {
101-
if (meterBar.value < meterBar.warningThreshold) {
102-
return meterBar.normalColor;
103-
} else if (meterBar.value < meterBar.criticalThreshold) {
104-
return meterBar.warningColor;
105-
} else {
106-
return meterBar.criticalColor;
94+
ProgressBar {
95+
id: progressBar
96+
Layout.fillWidth: true
97+
from: 0
98+
to: 1
99+
100+
property color barColor: {
101+
if (meterBar.value < meterBar.warningThreshold) {
102+
return meterBar.normalColor;
103+
} else if (meterBar.value < meterBar.criticalThreshold) {
104+
return meterBar.warningColor;
105+
} else {
106+
return meterBar.criticalColor;
107+
}
107108
}
108-
}
109109

110-
background: Rectangle {
111-
implicitHeight: meterBar.barHeight
112-
radius: height / 2
113-
color: Theme.controlBackgroundAlternateColor
114-
}
115-
116-
contentItem: Item {
117-
implicitHeight: meterBar.barHeight
118-
119-
Rectangle {
120-
width: progressBar.visualPosition * parent.width
121-
height: parent.height
110+
background: Rectangle {
111+
implicitHeight: meterBar.barHeight
122112
radius: height / 2
123-
gradient: Gradient {
124-
orientation: Gradient.Horizontal
125-
GradientStop {
126-
position: 0.0
127-
color: progressBar.barColor
128-
}
129-
GradientStop {
130-
position: 1.0
131-
color: Qt.lighter(progressBar.barColor, 1.4)
113+
color: Theme.controlBackgroundAlternateColor
114+
}
115+
116+
contentItem: Item {
117+
implicitHeight: meterBar.barHeight
118+
119+
Rectangle {
120+
width: progressBar.visualPosition * parent.width
121+
height: parent.height
122+
radius: height / 2
123+
gradient: Gradient {
124+
orientation: Gradient.Horizontal
125+
GradientStop {
126+
position: 0.0
127+
color: progressBar.barColor
128+
}
129+
GradientStop {
130+
position: 1.0
131+
color: Qt.lighter(progressBar.barColor, 1.4)
132+
}
132133
}
133134
}
134135
}
135-
}
136136

137-
Behavior on value {
138-
NumberAnimation {
139-
duration: meterBar.animationDuration
137+
Behavior on value {
138+
NumberAnimation {
139+
duration: meterBar.animationDuration
140+
}
140141
}
141142
}
142-
}
143143

144-
RowLayout {
145-
Layout.fillWidth: true
146-
147-
Label {
148-
id: usedLabel
144+
RowLayout {
149145
Layout.fillWidth: true
150-
font: Theme.tipFont
151-
color: Theme.mainTextColor
152-
}
153146

154-
Label {
155-
id: totalLabel
156-
font: Theme.tipFont
157-
color: Theme.secondaryTextColor
147+
Label {
148+
id: usedLabel
149+
Layout.fillWidth: true
150+
font: Theme.tipFont
151+
color: Theme.mainTextColor
152+
}
153+
154+
Label {
155+
id: totalLabel
156+
font: Theme.tipFont
157+
color: Theme.secondaryTextColor
158+
}
158159
}
159160
}
161+
162+
MouseArea {
163+
anchors.fill: parent
164+
cursorShape: Qt.PointingHandCursor
165+
onClicked: Qt.openUrlExternally(upgradeLink.url)
166+
}
160167
}

0 commit comments

Comments
 (0)