Skip to content

Commit 608066f

Browse files
committed
qml: introduce blockclocksize settings page
1 parent fa3f507 commit 608066f

File tree

5 files changed

+104
-0
lines changed

5 files changed

+104
-0
lines changed

src/Makefile.qt.include

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ QML_QRC = qml/bitcoin_qml.qrc
339339
QML_RES_QML = \
340340
qml/components/AboutOptions.qml \
341341
qml/components/BlockClock.qml \
342+
qml/components/BlockClockSizeSettings.qml \
342343
qml/components/BlockCounter.qml \
343344
qml/components/CaretRightButton.qml \
344345
qml/components/ConnectionOptions.qml \
@@ -387,6 +388,7 @@ QML_RES_QML = \
387388
qml/pages/onboarding/OnboardingStorageLocation.qml \
388389
qml/pages/onboarding/OnboardingStrengthen.qml \
389390
qml/pages/settings/SettingsAbout.qml \
391+
qml/pages/settings/SettingsBlockClockSize.qml \
390392
qml/pages/settings/SettingsConnection.qml \
391393
qml/pages/settings/SettingsDeveloper.qml \
392394
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/BlockClockSizeSettings.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/SettingsBlockClockSize.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: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright (c) 2022 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: 4
14+
15+
Settings {
16+
id: settings
17+
}
18+
19+
Setting {
20+
Layout.fillWidth: true
21+
header: qsTr("Default")
22+
actionItem: Button {
23+
anchors.centerIn: parent
24+
visible: Theme.blockclocksize == (5/12)
25+
icon.source: "image://images/check"
26+
icon.color: Theme.color.neutral9
27+
icon.height: 24
28+
icon.width: 24
29+
background: null
30+
31+
Behavior on icon.color {
32+
ColorAnimation { duration: 150 }
33+
}
34+
}
35+
onClicked: {
36+
Theme.blockclocksize = (5/12)
37+
}
38+
}
39+
Separator { Layout.fillWidth: true }
40+
Setting {
41+
Layout.fillWidth: true
42+
header: qsTr("Large")
43+
actionItem: Button {
44+
anchors.centerIn: parent
45+
visible: Theme.blockclocksize == (1/2)
46+
icon.source: "image://images/check"
47+
icon.color: Theme.color.neutral9
48+
icon.height: 24
49+
icon.width: 24
50+
background: null
51+
52+
Behavior on icon.color {
53+
ColorAnimation { duration: 150 }
54+
}
55+
}
56+
onClicked: {
57+
Theme.blockclocksize = (1/2)
58+
}
59+
}
60+
Separator { Layout.fillWidth: true }
61+
Setting {
62+
Layout.fillWidth: true
63+
header: qsTr("Max")
64+
actionItem: Button {
65+
anchors.centerIn: parent
66+
visible: Theme.blockclocksize == (4/5)
67+
icon.source: "image://images/check"
68+
icon.color: Theme.color.neutral9
69+
icon.height: 24
70+
icon.width: 24
71+
background: null
72+
73+
Behavior on icon.color {
74+
ColorAnimation { duration: 150 }
75+
}
76+
}
77+
onClicked: {
78+
Theme.blockclocksize = (4/5)
79+
}
80+
}
81+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
InformationPage {
12+
bannerActive: false
13+
bold: true
14+
headerText: qsTr("Block Clock Size")
15+
headerMargin: 0
16+
detailActive: true
17+
detailItem: BlockClockSizeSettings {}
18+
}

0 commit comments

Comments
 (0)