-
Notifications
You must be signed in to change notification settings - Fork 50
Get new address from selected wallet in receive tab #496
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
base: qt6
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Copyright (c) 2024-present The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or https://opensource.org/license/mit/. | ||
|
||
#[=======================================================================[ | ||
FindQRencode | ||
------------ | ||
Finds the QRencode header and library. | ||
This is a wrapper around find_package()/pkg_check_modules() commands that: | ||
- facilitates searching in various build environments | ||
- prints a standard log message | ||
#]=======================================================================] | ||
|
||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(PC_QRencode QUIET libqrencode) | ||
endif() | ||
|
||
find_path(QRencode_INCLUDE_DIR | ||
NAMES qrencode.h | ||
HINTS ${PC_QRencode_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(QRencode_LIBRARY_RELEASE | ||
NAMES qrencode | ||
HINTS ${PC_QRencode_LIBRARY_DIRS} | ||
) | ||
find_library(QRencode_LIBRARY_DEBUG | ||
NAMES qrencoded qrencode | ||
HINTS ${PC_QRencode_LIBRARY_DIRS} | ||
) | ||
include(SelectLibraryConfigurations) | ||
select_library_configurations(QRencode) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(QRencode | ||
REQUIRED_VARS QRencode_LIBRARY QRencode_INCLUDE_DIR | ||
VERSION_VAR PC_QRencode_VERSION | ||
) | ||
|
||
if(QRencode_FOUND) | ||
if(NOT TARGET QRencode::QRencode) | ||
add_library(QRencode::QRencode UNKNOWN IMPORTED) | ||
endif() | ||
if(QRencode_LIBRARY_RELEASE) | ||
set_property(TARGET QRencode::QRencode APPEND PROPERTY | ||
IMPORTED_CONFIGURATIONS RELEASE | ||
) | ||
set_target_properties(QRencode::QRencode PROPERTIES | ||
IMPORTED_LOCATION_RELEASE "${QRencode_LIBRARY_RELEASE}" | ||
) | ||
endif() | ||
if(QRencode_LIBRARY_DEBUG) | ||
set_property(TARGET QRencode::QRencode APPEND PROPERTY | ||
IMPORTED_CONFIGURATIONS DEBUG | ||
) | ||
set_target_properties(QRencode::QRencode PROPERTIES | ||
IMPORTED_LOCATION_DEBUG "${QRencode_LIBRARY_DEBUG}" | ||
) | ||
endif() | ||
set_target_properties(QRencode::QRencode PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${QRencode_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|
||
mark_as_advanced( | ||
QRencode_INCLUDE_DIR | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ Page { | |
background: null | ||
|
||
property int requestCounter: 0 | ||
property WalletQmlModel wallet: walletController.selectedWallet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make RequestPayment {
wallet: walletController.selectedWallet
} |
||
|
||
ScrollView { | ||
clip: true | ||
|
@@ -198,13 +199,23 @@ Page { | |
requestCounter = requestCounter + 1 | ||
clearRequest.visible = true | ||
title.text = qsTr("Payment request #" + requestCounter) | ||
address.text = "bc1q f5xe y2tf 89k9 zy6k gnru wszy 5fsa truy 9te1 bu" | ||
qrImage.code = "bc1qf5xey2tf89k9zy6kgnruwszy5fsatruy9te1bu" | ||
var newAddress = root.wallet.newAddress(label.text) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const address = root.wallet.getNewAddress(label.text)
qrImage.code = address
address.text = address.replace(/(.{4})/g, "$1 ").trim() |
||
var groupedAddress = newAddress.replace(/(.{4})/g, "$1 ").trim() | ||
address.text = groupedAddress | ||
qrImage.code = newAddress | ||
continueButton.text = qsTr("Copy payment request") | ||
} | ||
} | ||
} | ||
|
||
function clear() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to the root? It is a reasonable function at the component level. |
||
clearRequest.visible = false | ||
title.text = qsTr("Request a payment") | ||
address.text = "" | ||
qrImage.code = "" | ||
continueButton.text = qsTr("Create bitcoin address") | ||
} | ||
|
||
ContinueButton { | ||
id: clearRequest | ||
Layout.fillWidth: true | ||
|
@@ -218,11 +229,14 @@ Page { | |
backgroundPressedColor: "transparent" | ||
text: qsTr("Clear") | ||
onClicked: { | ||
clearRequest.visible = false | ||
title.text = qsTr("Request a payment") | ||
address.text = "" | ||
qrImage.code = "" | ||
continueButton.text = qsTr("Create bitcoin address") | ||
columnLayout.clear() | ||
} | ||
} | ||
|
||
Connections { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to not rely on |
||
target: walletController | ||
function onSelectedWalletChanged() { | ||
columnLayout.clear() | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename to
getNewAddress
.