Skip to content

Commit dca679b

Browse files
committed
qml: introduce Block Clock display mode settings page
1 parent 041a0c7 commit dca679b

File tree

5 files changed

+75
-0
lines changed

5 files changed

+75
-0
lines changed

src/Makefile.qt.include

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ QML_QRC = qml/bitcoin_qml.qrc
341341
QML_RES_QML = \
342342
qml/components/AboutOptions.qml \
343343
qml/components/BlockClock.qml \
344+
qml/components/BlockClockDisplayMode.qml \
344345
qml/components/BlockCounter.qml \
345346
qml/components/CaretRightButton.qml \
346347
qml/components/ConnectionOptions.qml \
@@ -389,6 +390,7 @@ QML_RES_QML = \
389390
qml/pages/onboarding/OnboardingStorageLocation.qml \
390391
qml/pages/onboarding/OnboardingStrengthen.qml \
391392
qml/pages/settings/SettingsAbout.qml \
393+
qml/pages/settings/SettingsBlockClockDisplayMode.qml \
392394
qml/pages/settings/SettingsConnection.qml \
393395
qml/pages/settings/SettingsDeveloper.qml \
394396
qml/pages/settings/SettingsProxy.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<qresource prefix="/qml">
33
<file>components/AboutOptions.qml</file>
44
<file>components/BlockClock.qml</file>
5+
<file>components/BlockClockDisplayMode.qml</file>
56
<file>components/BlockCounter.qml</file>
67
<file>components/CaretRightButton.qml</file>
78
<file>components/ConnectionOptions.qml</file>
@@ -50,6 +51,7 @@
5051
<file>pages/onboarding/OnboardingStorageLocation.qml</file>
5152
<file>pages/onboarding/OnboardingStrengthen.qml</file>
5253
<file>pages/settings/SettingsAbout.qml</file>
54+
<file>pages/settings/SettingsBlockClockDisplayMode.qml</file>
5355
<file>pages/settings/SettingsConnection.qml</file>
5456
<file>pages/settings/SettingsDeveloper.qml</file>
5557
<file>pages/settings/SettingsProxy.qml</file>

src/qml/components/BlockClock.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Item {
3737
BlockClockDial {
3838
id: dial
3939
anchors.horizontalCenter: root.horizontalCenter
40+
scale: Theme.blockclocksize
4041
width: Math.min((root.parentWidth * dial.scale), (root.parentHeight * dial.scale))
4142
height: dial.width
4243
penWidth: dial.width / 50
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import Qt.labs.settings 1.0
9+
import "../controls"
10+
11+
ColumnLayout {
12+
id: root
13+
spacing: 15
14+
15+
ButtonGroup {
16+
id: group
17+
}
18+
19+
OptionButton {
20+
Layout.fillWidth: true
21+
ButtonGroup.group: group
22+
text: qsTr("Compact")
23+
description: qsTr("For personal use on a computer or smartphone.")
24+
image: "image://images/blockclock-size-compact"
25+
checked: Theme.blockclocksize == (1/3)
26+
onClicked: {
27+
Theme.blockclocksize = (1/3)
28+
}
29+
}
30+
31+
OptionButton {
32+
Layout.fillWidth: true
33+
ButtonGroup.group: group
34+
text: qsTr("Showcase")
35+
description: qsTr("A larger block clock for public display on a tablet or other large screen.")
36+
image: "image://images/blockclock-size-showcase"
37+
checked: Theme.blockclocksize == (1/2)
38+
onClicked: {
39+
Theme.blockclocksize = (1/2)
40+
}
41+
}
42+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import "../../controls"
9+
import "../../components"
10+
11+
Page {
12+
property alias navLeftDetail: navbar.leftDetail
13+
property alias navMiddleDetail: navbar.middleDetail
14+
15+
background: null
16+
implicitWidth: 450
17+
leftPadding: 20
18+
rightPadding: 20
19+
topPadding: 30
20+
21+
header: NavigationBar {
22+
id: navbar
23+
}
24+
BlockClockDisplayMode {
25+
width: Math.min(parent.width, 450)
26+
anchors.horizontalCenter: parent.horizontalCenter
27+
}
28+
}

0 commit comments

Comments
 (0)