Skip to content

Commit d138d1c

Browse files
committed
qml: set BlockClock size values as a ratio of the parent width & height
1 parent 6eeb002 commit d138d1c

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

src/qml/components/BlockClock.qml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import "../controls"
1212

1313
Item {
1414
id: root
15+
property real parentWidth: 600
16+
property real parentHeight: 600
1517

16-
implicitWidth: 200
17-
implicitHeight: 200 + networkIndicator.height + networkIndicator.anchors.topMargin
18+
width: dial.width
19+
height: dial.height + networkIndicator.height + networkIndicator.anchors.topMargin
1820

1921
property alias header: mainText.text
2022
property alias headerSize: mainText.font.pixelSize
@@ -28,8 +30,10 @@ Item {
2830

2931
BlockClockDial {
3032
id: dial
31-
width: 200
32-
height: 200
33+
anchors.horizontalCenter: root.horizontalCenter
34+
width: Math.min((root.parentWidth * (5/12)), (root.parentHeight * (5/12)))
35+
height: dial.width
36+
penWidth: dial.width / 50
3337
timeRatioList: chainModel.timeRatioList
3438
verificationProgress: nodeModel.verificationProgress
3539
paused: root.paused
@@ -57,8 +61,8 @@ Item {
5761
background: null
5862
icon.source: "image://images/bitcoin-circle"
5963
icon.color: Theme.color.neutral9
60-
icon.width: 40
61-
icon.height: 40
64+
icon.width: Math.max(dial.width / 5, 1)
65+
icon.height: Math.max(dial.width / 5, 1)
6266
anchors.bottom: mainText.top
6367
anchors.horizontalCenter: root.horizontalCenter
6468

@@ -72,7 +76,7 @@ Item {
7276
anchors.centerIn: dial
7377
font.family: "Inter"
7478
font.styleName: "Semi Bold"
75-
font.pixelSize: 32
79+
font.pixelSize: dial.width * (4/25)
7680
color: Theme.color.neutral9
7781

7882
Behavior on color {
@@ -86,7 +90,7 @@ Item {
8690
anchors.horizontalCenter: root.horizontalCenter
8791
font.family: "Inter"
8892
font.styleName: "Semi Bold"
89-
font.pixelSize: 18
93+
font.pixelSize: dial.width * (9/100)
9094
color: Theme.color.neutral4
9195

9296
Behavior on color {
@@ -96,10 +100,12 @@ Item {
96100

97101
PeersIndicator {
98102
anchors.top: subText.bottom
99-
anchors.topMargin: 20
103+
anchors.topMargin: dial.width / 10
100104
anchors.horizontalCenter: root.horizontalCenter
101105
numOutboundPeers: nodeModel.numOutboundPeers
102106
maxNumOutboundPeers: nodeModel.maxNumOutboundPeers
107+
indicatorDimensions: dial.width * (3/200)
108+
indicatorSpacing: dial.width / 40
103109
paused: root.paused
104110
}
105111

@@ -146,16 +152,16 @@ Item {
146152
PropertyChanges {
147153
target: root
148154
header: "Paused"
149-
headerSize: 24
155+
headerSize: dial.width * (3/25)
150156
subText: "Tap to resume"
151157
}
152158
PropertyChanges {
153159
target: bitcoinIcon
154-
anchors.bottomMargin: 5
160+
anchors.bottomMargin: dial.width / 40
155161
}
156162
PropertyChanges {
157163
target: subText
158-
anchors.topMargin: 4
164+
anchors.topMargin: dial.width / 50
159165
}
160166
},
161167

@@ -164,16 +170,16 @@ Item {
164170
PropertyChanges {
165171
target: root
166172
header: "Connecting"
167-
headerSize: 24
173+
headerSize: dial.width * (3/25)
168174
subText: "Please wait"
169175
}
170176
PropertyChanges {
171177
target: bitcoinIcon
172-
anchors.bottomMargin: 5
178+
anchors.bottomMargin: dial.width / 40
173179
}
174180
PropertyChanges {
175181
target: subText
176-
anchors.topMargin: 4
182+
anchors.topMargin: dial.width / 50
177183
}
178184
}
179185
]

src/qml/pages/node/NodeRunner.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Page {
1919
Component.onCompleted: nodeModel.startNodeInitializionThread();
2020

2121
BlockClock {
22+
parentWidth: parent.width - 40
23+
parentHeight: parent.height
2224
anchors.centerIn: parent
2325
}
2426
}

0 commit comments

Comments
 (0)