Skip to content

Commit 84c9296

Browse files
committed
qml: introduce ThemeSettings page
1 parent 0e336d7 commit 84c9296

File tree

4 files changed

+93
-1
lines changed

4 files changed

+93
-1
lines changed

src/Makefile.qt.include

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ QML_RES_QML = \
352352
qml/components/StorageLocations.qml \
353353
qml/components/StorageOptions.qml \
354354
qml/components/StorageSettings.qml \
355+
qml/components/ThemeSettings.qml \
355356
qml/components/TotalBytesIndicator.qml \
356357
qml/controls/ContinueButton.qml \
357358
qml/controls/CoreText.qml \
@@ -389,7 +390,8 @@ QML_RES_QML = \
389390
qml/pages/settings/SettingsConnection.qml \
390391
qml/pages/settings/SettingsDeveloper.qml \
391392
qml/pages/settings/SettingsProxy.qml \
392-
qml/pages/settings/SettingsStorage.qml
393+
qml/pages/settings/SettingsStorage.qml \
394+
qml/pages/settings/SettingsTheme.qml
393395

394396
BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
395397
if TARGET_WINDOWS

src/qml/bitcoin_qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<file>components/Separator.qml</file>
1616
<file>components/StorageOptions.qml</file>
1717
<file>components/StorageSettings.qml</file>
18+
<file>components/ThemeSettings.qml</file>
1819
<file>components/TotalBytesIndicator.qml</file>
1920
<file>controls/ContinueButton.qml</file>
2021
<file>controls/CoreText.qml</file>
@@ -53,6 +54,7 @@
5354
<file>pages/settings/SettingsDeveloper.qml</file>
5455
<file>pages/settings/SettingsProxy.qml</file>
5556
<file>pages/settings/SettingsStorage.qml</file>
57+
<file>pages/settings/SettingsTheme.qml</file>
5658
</qresource>
5759
<qresource prefix="/icons">
5860
<file alias="arrow-down">res/icons/arrow-down.png</file>

src/qml/components/ThemeSettings.qml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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: 4
14+
15+
Settings {
16+
id: settings
17+
}
18+
19+
Setting {
20+
Layout.fillWidth: true
21+
header: qsTr("Light")
22+
actionItem: Button {
23+
anchors.centerIn: parent
24+
visible: !Theme.dark
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.dark = false
37+
}
38+
}
39+
Separator { Layout.fillWidth: true }
40+
Setting {
41+
Layout.fillWidth: true
42+
header: qsTr("Dark")
43+
actionItem: Button {
44+
anchors.centerIn: parent
45+
visible: Theme.dark
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.dark = true;
58+
}
59+
}
60+
}
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+
ThemeSettings {
25+
width: Math.min(parent.width, 450)
26+
anchors.horizontalCenter: parent.horizontalCenter
27+
}
28+
}

0 commit comments

Comments
 (0)