Skip to content
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

Introduce AddWalletButton and connect it to the AddWallet flow #418

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ QML_RES_QML = \
qml/components/ThemeSettings.qml \
qml/components/TotalBytesIndicator.qml \
qml/components/Tooltip.qml \
qml/controls/AddWalletButton.qml \
qml/controls/CaretRightIcon.qml \
qml/controls/ContinueButton.qml \
qml/controls/CoreText.qml \
Expand Down
1 change: 1 addition & 0 deletions src/qml/bitcoin_qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<file>components/ThemeSettings.qml</file>
<file>components/TotalBytesIndicator.qml</file>
<file>components/Tooltip.qml</file>
<file>controls/AddWalletButton.qml</file>
<file>controls/ContinueButton.qml</file>
<file>controls/CoreText.qml</file>
<file>controls/CoreTextField.qml</file>
Expand Down
83 changes: 83 additions & 0 deletions src/qml/controls/AddWalletButton.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) 2024 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 org.bitcoincore.qt 1.0

Button {
id: root

property color bgActiveColor: Theme.color.neutral2
property color textColor: Theme.color.neutral7
property color textHoverColor: Theme.color.orange
property color textActiveColor: Theme.color.orange

hoverEnabled: AppMode.isDesktop
implicitHeight: 30
implicitWidth: 220

MouseArea {
anchors.fill: parent
enabled: false
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}

contentItem: Item {
anchors.fill: parent
RowLayout {
anchors.centerIn: parent
spacing: 3
Icon {
id: addIcon
Layout.alignment: Qt.AlignRight
source: "image://images/plus"
color: Theme.color.neutral7
size: 16
Layout.minimumWidth: 16
Layout.preferredWidth: 16
Layout.maximumWidth: 16
}
CoreText {
id: addText
Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft
text: qsTr("Add Wallet")
color: Theme.color.neutral7
font.pixelSize: 15
}
}
}

background: Rectangle {
id: bg
height: 30
width: 220
radius: 5
color: Theme.color.neutral3
visible: root.hovered || root.checked

FocusBorder {
visible: root.visualFocus
}

Behavior on color {
ColorAnimation { duration: 150 }
}
}

states: [
State {
name: "CHECKED"; when: root.checked
},
State {
name: "HOVER"; when: root.hovered
PropertyChanges { target: addText; color: textHoverColor }
PropertyChanges { target: addIcon; color: textHoverColor }
}
]
}
8 changes: 6 additions & 2 deletions src/qml/pages/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,17 @@ ApplicationWindow {

Component {
id: desktopWallets
DesktopWallets {}
DesktopWallets {
onAddWallet: {
main.push(createWalletWizard)
}
}
}

Component {
id: createWalletWizard
CreateWalletWizard {
onFinished: {
onFinished: {
main.pop()
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/qml/pages/wallet/DesktopWallets.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Page {

ButtonGroup { id: navigationTabs }

signal addWallet()

header: NavigationBar2 {
id: navBar
leftItem: WalletBadge {
Expand All @@ -40,6 +42,10 @@ Page {
closePolicy: Popup.CloseOnPressOutside
x: 0
y: parent.height

onAddWallet: {
root.addWallet()
}
}
}
centerItem: RowLayout {
Expand Down
30 changes: 9 additions & 21 deletions src/qml/pages/wallet/WalletSelect.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Popup {
id: root

property alias model: listView.model
implicitHeight: layout.height + arrow.height
implicitHeight: layout.height + arrow.height + 11
implicitWidth: 250
clip: true

signal addWallet()

background: Item {
anchors.fill: parent
Rectangle {
Expand Down Expand Up @@ -88,28 +90,14 @@ Popup {
}
}

RowLayout {
AddWalletButton {
id: addWallet
Layout.preferredWidth: addIcon.size + addText.width
Layout.preferredHeight: 45
Layout.alignment: Qt.AlignHCenter
Icon {
id: addIcon
Layout.alignment: Qt.AlignHCenter
source: "image://images/plus"
color: Theme.color.neutral8
size: 14
topPadding: 5
bottomPadding: 10
}
CoreText {
id: addText
Layout.alignment: Qt.AlignHCenter
text: qsTr("Add Wallet")
color: Theme.color.neutral9
font.pixelSize: 15
topPadding: 5
bottomPadding: 10
Layout.preferredWidth: 220
Layout.preferredHeight: 30
onClicked: {
root.addWallet()
root.close()
}
}
}
Expand Down
Loading