Skip to content

Commit 4ca3b72

Browse files
committed
Merge #241: Add Setting color interaction states (Filled, Hover, Active), wire for ExternalLink and ValueInput Settings
970c66f qml: add Hover,Filled, and Active color interaction states to ValueInput (jarolrod) c9ef4b1 qml: add Hover,Filled, Active color interaction states to ExternalLink (jarolrod) aa98f35 qml: Add Hover, Filled, and Active color interaction states to Setting (jarolrod) 403d57e qml: allow to specify the header color (jarolrod) Pull request description: Introduces the Filled, Hover and Active states for Settings. Will introduce the rest of the states in follow-ups. light | Filled | Hover | Active | | ------ | ----- | ------ | | <img width="454" alt="Screen Shot 2023-02-01 at 1 42 17 AM" src="https://user-images.githubusercontent.com/23396902/215970965-c3b646dc-f70a-41dd-80e9-add8e461bad3.png"> | <img width="454" alt="Screen Shot 2023-02-01 at 1 42 26 AM" src="https://user-images.githubusercontent.com/23396902/215970984-c7a8aa8e-d23d-40a1-9e7f-aec0709c536d.png"> | <img width="454" alt="Screen Shot 2023-02-01 at 1 42 34 AM" src="https://user-images.githubusercontent.com/23396902/215971011-9cd829a5-c643-4bb0-8666-e22d25214a97.png"> | dark | Filled | Hover | Active | | ------ | ----- | ------ | | <img width="454" alt="Screen Shot 2023-02-01 at 1 41 29 AM" src="https://user-images.githubusercontent.com/23396902/215970689-bd23ca8e-7234-4a37-a9bc-20de8f72049a.png"> | <img width="454" alt="Screen Shot 2023-02-01 at 1 41 43 AM" src="https://user-images.githubusercontent.com/23396902/215970732-38806d33-a2b8-46f0-a9fa-733030a2e62a.png"> | <img width="454" alt="Screen Shot 2023-02-01 at 1 41 51 AM" src="https://user-images.githubusercontent.com/23396902/215970768-e391c2af-0c21-47e7-a541-89f1e76a0e2f.png"> | [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/<PR>) [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/<PR>) [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/<PR>) [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/<PR>) ACKs for top commit: johnny9: ACK 970c66f Tree-SHA512: e917f02c9fbedf623be4268f90fdbd3fc4314085b6cc01b2d0f747bad8c68bc94b1004a9f0256ad16e99b0cceb3efdfcddae460d760b0a06ad8f0786a256c374
2 parents a665c23 + 970c66f commit 4ca3b72

File tree

7 files changed

+124
-5
lines changed

7 files changed

+124
-5
lines changed

src/qml/components/AboutOptions.qml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,47 @@ import "../controls"
1010
ColumnLayout {
1111
spacing: 20
1212
Setting {
13+
id: websiteLink
1314
Layout.fillWidth: true
1415
header: qsTr("Website")
1516
actionItem: ExternalLink {
17+
parentState: websiteLink.state
1618
description: "bitcoincore.org"
1719
link: "https://bitcoincore.org"
1820
iconSource: "image://images/caret-right"
1921
}
2022
onClicked: loadedItem.clicked()
2123
}
2224
Setting {
25+
id: sourceLink
2326
Layout.fillWidth: true
2427
header: qsTr("Source code")
2528
actionItem: ExternalLink {
29+
parentState: sourceLink.state
2630
description: "github.com/bitcoin/bitcoin"
2731
link: "https://github.com/bitcoin/bitcoin"
2832
iconSource: "image://images/caret-right"
2933
}
3034
onClicked: loadedItem.clicked()
3135
}
3236
Setting {
37+
id: licenseLink
3338
Layout.fillWidth: true
3439
header: qsTr("License")
3540
actionItem: ExternalLink {
41+
parentState: licenseLink.state
3642
description: "MIT"
3743
link: "https://opensource.org/licenses/MIT"
3844
iconSource: "image://images/caret-right"
3945
}
4046
onClicked: loadedItem.clicked()
4147
}
4248
Setting {
49+
id: versionLink
4350
Layout.fillWidth: true
4451
header: qsTr("Version")
4552
actionItem: ExternalLink {
53+
parentState: versionLink.state
4654
description: "v22.99.0-1e7564eca8a6"
4755
link: "https://bitcoin.org/en/download"
4856
iconSource: "image://images/caret-right"

src/qml/components/DeveloperOptions.qml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import "../controls"
1010
ColumnLayout {
1111
spacing: 20
1212
Setting {
13+
id: devDocsLink
1314
Layout.fillWidth: true
1415
header: qsTr("Developer documentation")
1516
actionItem: ExternalLink {
17+
parentState: devDocsLink.state
1618
iconSource: "qrc:/icons/export"
1719
iconWidth: 30
1820
iconHeight: 30
@@ -21,17 +23,21 @@ ColumnLayout {
2123
onClicked: loadedItem.clicked()
2224
}
2325
Setting {
26+
id: dbcacheSetting
2427
Layout.fillWidth: true
2528
header: qsTr("Database cache size")
2629
actionItem: ValueInput {
30+
parentState: dbcacheSetting.state
2731
description: ("450 MiB")
2832
}
2933
onClicked: loadedItem.forceActiveFocus()
3034
}
3135
Setting {
36+
id: parSetting
3237
Layout.fillWidth: true
3338
header: qsTr("Script verification threads")
3439
actionItem: ValueInput {
40+
parentState: parSetting.state
3541
description: ("0")
3642
}
3743
onClicked: loadedItem.forceActiveFocus()

src/qml/components/StorageSettings.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ ColumnLayout {
2222
}
2323
}
2424
Setting {
25+
id: pruneTargetSetting
2526
Layout.fillWidth: true
2627
header: qsTr("Storage limit (GB)")
2728
actionItem: ValueInput {
29+
parentState: pruneTargetSetting.state
2830
description: optionsModel.pruneSizeGB
2931
onEditingFinished: optionsModel.pruneSizeGB = parseInt(text)
3032
}

src/qml/controls/ExternalLink.qml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,43 @@ import QtQuick.Layouts 1.15
88

99
AbstractButton {
1010
id: root
11+
required property string parentState
1112
required property string link
1213
property string description: ""
1314
property int descriptionSize: 18
1415
property url iconSource: ""
1516
property int iconWidth: 18
1617
property int iconHeight: 18
18+
property color iconColor
19+
property color textColor
20+
state: root.parentState
21+
22+
states: [
23+
State {
24+
name: "FILLED"
25+
PropertyChanges {
26+
target: root
27+
iconColor: Theme.color.neutral9
28+
textColor: Theme.color.neutral7
29+
}
30+
},
31+
State {
32+
name: "HOVER"
33+
PropertyChanges {
34+
target: root
35+
iconColor: Theme.color.orangeLight1
36+
textColor: Theme.color.orangeLight1
37+
}
38+
},
39+
State {
40+
name: "ACTIVE"
41+
PropertyChanges {
42+
target: root
43+
iconColor: Theme.color.orange
44+
textColor: Theme.color.orange
45+
}
46+
}
47+
]
1748

1849
contentItem: RowLayout {
1950
spacing: 0
@@ -26,9 +57,13 @@ AbstractButton {
2657
font.family: "Inter"
2758
font.styleName: "Regular"
2859
font.pixelSize: root.descriptionSize
29-
color: Theme.color.neutral7
60+
color: root.textColor
3061
textFormat: Text.RichText
31-
text: "<style>a:link { color: " + Theme.color.neutral7 + "; text-decoration: none;}</style>" + "<a href=\"" + link + "\">" + root.description + "</a>"
62+
text: root.description
63+
64+
Behavior on color {
65+
ColorAnimation { duration: 150 }
66+
}
3267
}
3368
}
3469
Loader {
@@ -37,11 +72,15 @@ AbstractButton {
3772
visible: active
3873
sourceComponent: Button {
3974
icon.source: root.iconSource
40-
icon.color: Theme.color.neutral9
75+
icon.color: root.iconColor
4176
icon.height: root.iconHeight
4277
icon.width: root.iconWidth
4378
background: null
4479
onClicked: root.clicked()
80+
81+
Behavior on icon.color {
82+
ColorAnimation { duration: 150 }
83+
}
4584
}
4685
}
4786
}

src/qml/controls/Header.qml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ColumnLayout {
1313
property int headerMargin
1414
property int headerSize: 28
1515
property bool headerBold: false
16+
property color headerColor: Theme.color.neutral9
1617
property string description: ""
1718
property int descriptionMargin: 10
1819
property int descriptionSize: 18
@@ -30,10 +31,14 @@ ColumnLayout {
3031
font.family: "Inter"
3132
font.styleName: root.headerBold ? "Semi Bold" : "Regular"
3233
font.pixelSize: root.headerSize
33-
color: Theme.color.neutral9
34+
color: root.headerColor
3435
text: root.header
3536
horizontalAlignment: center ? Text.AlignHCenter : Text.AlignLeft
3637
wrapMode: wrap ? Text.WordWrap : Text.NoWrap
38+
39+
Behavior on color {
40+
ColorAnimation { duration: 150 }
41+
}
3742
}
3843
Loader {
3944
Layout.fillWidth: true

src/qml/controls/Setting.qml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,42 @@ AbstractButton {
1313
property alias actionItem: action_loader.sourceComponent
1414
property alias loadedItem: action_loader.item
1515
property string description
16+
property color stateColor
17+
state: "FILLED"
18+
19+
states: [
20+
State {
21+
name: "FILLED"
22+
PropertyChanges { target: root; stateColor: Theme.color.neutral9 }
23+
},
24+
State {
25+
name: "HOVER"
26+
PropertyChanges { target: root; stateColor: Theme.color.orangeLight1 }
27+
},
28+
State {
29+
name: "ACTIVE"
30+
PropertyChanges { target: root; stateColor: Theme.color.orange }
31+
}
32+
]
33+
34+
MouseArea {
35+
id: mouseArea
36+
anchors.fill: root
37+
hoverEnabled: true
38+
onEntered: {
39+
root.state = "HOVER"
40+
}
41+
onExited: {
42+
root.state = "FILLED"
43+
}
44+
onPressed: {
45+
root.state = "ACTIVE"
46+
}
47+
onReleased: {
48+
root.state = "HOVER"
49+
root.clicked()
50+
}
51+
}
1652

1753
contentItem: ColumnLayout {
1854
spacing: 20
@@ -23,6 +59,7 @@ AbstractButton {
2359
center: false
2460
header: root.header
2561
headerSize: 18
62+
headerColor: root.stateColor
2663
description: root.description
2764
descriptionSize: 15
2865
descriptionMargin: 0

src/qml/controls/ValueInput.qml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,36 @@ import QtQuick.Controls 2.15
77

88
TextEdit {
99
id: root
10+
required property string parentState
1011
property string description: ""
1112
property int descriptionSize: 18
13+
property color textColor
14+
state: root.parentState
15+
16+
states: [
17+
State {
18+
name: "FILLED"
19+
PropertyChanges { target: root; textColor: Theme.color.neutral9 }
20+
},
21+
State {
22+
name: "HOVER"
23+
PropertyChanges { target: root; textColor: Theme.color.orangeLight1 }
24+
},
25+
State {
26+
name: "ACTIVE"
27+
PropertyChanges { target: root; textColor: Theme.color.orange }
28+
}
29+
]
1230

1331
font.family: "Inter"
1432
font.styleName: "Regular"
1533
font.pixelSize: root.descriptionSize
16-
color: Theme.color.neutral8
34+
color: root.textColor
1735
text: description
1836
horizontalAlignment: Text.AlignRight
1937
wrapMode: Text.WordWrap
38+
39+
Behavior on color {
40+
ColorAnimation { duration: 150 }
41+
}
2042
}

0 commit comments

Comments
 (0)