-
Notifications
You must be signed in to change notification settings - Fork 51
Introduce standard fee selection to Send #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b4ade11
qml: Add caret down icon
johnny9 0ff0688
qml: Add targetBlocks property to WalletQmlModel
johnny9 f4f9b79
qml: Introduce FeeSelection to Send
johnny9 cb1f3d9
qml: Cleanup QML properties in FeeSelection
johnny9 854e265
qml: Remove unnecessary Layout property in Send
johnny9 16187ac
qml: Cleanup QML in FeeSelection
johnny9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| // Copyright (c) 2025 The Bitcoin Core developers | ||
| // Distributed under the MIT software license, see the accompanying | ||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| import QtQuick 2.15 | ||
| import QtQuick.Controls 2.15 | ||
| import QtQuick.Layouts 1.15 | ||
|
|
||
| import "../controls" | ||
| import "../components" | ||
|
|
||
| RowLayout { | ||
| id: root | ||
|
|
||
| property int selectedIndex: 1 | ||
| property string selectedLabel: feeModel.get(root.selectedIndex).feeLabel | ||
|
|
||
| signal feeChanged(int target) | ||
|
|
||
| height: 40 | ||
|
|
||
| CoreText { | ||
| Layout.fillWidth: true | ||
| horizontalAlignment: Text.AlignLeft | ||
| font.pixelSize: 15 | ||
| text: qsTr("Fee") | ||
| } | ||
|
|
||
| Button { | ||
| id: dropDownButton | ||
| text: root.selectedLabel | ||
| font.pixelSize: 15 | ||
|
|
||
| hoverEnabled: true | ||
|
|
||
| HoverHandler { | ||
| cursorShape: Qt.PointingHandCursor | ||
| } | ||
|
|
||
| onPressed: feePopup.open() | ||
|
|
||
| contentItem: RowLayout { | ||
| spacing: 5 | ||
|
|
||
| CoreText { | ||
| id: value | ||
| text: root.selectedLabel | ||
| font.pixelSize: 15 | ||
|
|
||
| Behavior on color { | ||
| ColorAnimation { duration: 150 } | ||
| } | ||
| } | ||
|
|
||
| Icon { | ||
| id: caret | ||
| source: "image://images/caret-down-medium-filled" | ||
| Layout.preferredWidth: 30 | ||
| size: 30 | ||
| color: dropDownButton.enabled ? Theme.color.orange : Theme.color.neutral4 | ||
|
|
||
| Behavior on color { | ||
| ColorAnimation { duration: 150 } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| background: Rectangle { | ||
| id: dropDownButtonBg | ||
| color: Theme.color.background | ||
| radius: 6 | ||
| Behavior on color { | ||
| ColorAnimation { duration: 150 } | ||
| } | ||
| } | ||
|
|
||
| states: [ | ||
| State { | ||
| name: "CHECKED"; when: dropDownButton.checked | ||
| PropertyChanges { target: icon; color: activeColor } | ||
| }, | ||
| State { | ||
| name: "HOVER"; when: dropDownButton.hovered | ||
| PropertyChanges { target: dropDownButtonBg; color: Theme.color.neutral2 } | ||
| }, | ||
| State { | ||
| name: "DISABLED"; when: !dropDownButton.enabled | ||
| PropertyChanges { target: dropDownButtonBg; color: Theme.color.background } | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| Popup { | ||
| id: feePopup | ||
| modal: true | ||
| dim: false | ||
|
|
||
| background: Rectangle { | ||
| color: Theme.color.background | ||
| radius: 6 | ||
| border.color: Theme.color.neutral3 | ||
| } | ||
|
|
||
| width: 260 | ||
| height: Math.min(feeModel.count * 40 + 20, 300) | ||
| x: feePopup.parent.width - feePopup.width | ||
| y: feePopup.parent.height | ||
|
|
||
| contentItem: ListView { | ||
| id: feeList | ||
| model: feeModel | ||
| interactive: false | ||
| width: 260 | ||
| height: contentHeight | ||
| delegate: ItemDelegate { | ||
johnny9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| id: delegate | ||
| required property string feeLabel | ||
| required property int index | ||
| required property int target | ||
|
|
||
| width: ListView.view.width | ||
| height: 40 | ||
|
|
||
| background: Item { | ||
| Rectangle { | ||
| anchors.fill: parent | ||
| radius: 6 | ||
| color: Theme.color.neutral3 | ||
| visible: delegate.hovered | ||
| } | ||
| Separator { | ||
| width: parent.width | ||
| anchors.top: parent.top | ||
| color: Theme.color.neutral2 | ||
| visible: delegate.index > 0 | ||
| } | ||
| } | ||
|
|
||
| contentItem: RowLayout { | ||
| spacing: 10 | ||
|
|
||
| CoreText { | ||
| text: feeLabel | ||
| horizontalAlignment: Text.AlignLeft | ||
| Layout.fillWidth: true | ||
| font.pixelSize: 15 | ||
| } | ||
|
|
||
| Icon { | ||
| visible: delegate.index === root.selectedIndex | ||
| source: "image://images/check" | ||
| color: Theme.color.orange | ||
| size: 20 | ||
| } | ||
| } | ||
|
|
||
| HoverHandler { | ||
| cursorShape: Qt.PointingHandCursor | ||
| } | ||
|
|
||
| onClicked: { | ||
| root.selectedIndex = delegate.index | ||
| root.selectedLabel = feeLabel | ||
| root.feeChanged(target) | ||
| feePopup.close() | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ListModel { | ||
| id: feeModel | ||
| ListElement { feeLabel: qsTr("High (~10 mins)"); target: 1 } | ||
| ListElement { feeLabel: qsTr("Default (~60 mins)"); target: 6 } | ||
| ListElement { feeLabel: qsTr("Low (~24 hrs)"); target: 144 } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.