From cbc930f6402244fd4f4ed58ec50d8f2f5bfeca39 Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 18 Nov 2026 20:23:57 -0600 Subject: [PATCH] feat(receive): enlarge-QR, request-dialog clamp/HiDPI, mining-address QR warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UX audit, Receive surface (batch 2): - F051: a compact expand button beside Copy opens the full-screen QR popup (large QR + full chunked address) for a shielded address — the tab only shows a truncated address. Choice a. - F052: the QR popup warns when the address is transparent (mining) — it can't receive payments — reusing mining_addr_explainer. - F027: clamp the Request-payment dialog amount to >= 0 (and NaN), matching the Receive tab. - F026: scale the request dialog's QR and memo box by dpiScale so they aren't native-size on HiDPI. Receive surface complete (11/11). Build + tests green. Co-Authored-By: Claude Opus 4.8 --- src/ui/windows/qr_popup_dialog.cpp | 13 ++++++++++++- src/ui/windows/receive_tab.cpp | 15 +++++++++++++++ src/ui/windows/request_payment_dialog.cpp | 5 +++-- src/util/i18n.cpp | 1 + 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/ui/windows/qr_popup_dialog.cpp b/src/ui/windows/qr_popup_dialog.cpp index f6126f7..9d29821 100644 --- a/src/ui/windows/qr_popup_dialog.cpp +++ b/src/ui/windows/qr_popup_dialog.cpp @@ -5,6 +5,8 @@ #include "qr_popup_dialog.h" #include "../../app.h" #include "../../util/i18n.h" +#include "../../util/address_validation.h" // isTransparentAddress (F052) +#include "../material/colors.h" // WarningVec4 #include "../widgets/qr_code.h" #include "../widgets/copy_field.h" #include "../schema/ui_schema.h" @@ -113,7 +115,16 @@ void QRPopupDialog::render(App* app) ImGui::TextWrapped("%s", TR("qr_failed")); ImGui::EndChild(); } - + + // A transparent (mining) address can't receive payments — warn, since this popup also opens from the + // Overview for mining addresses. (F052) + if (dragonx::util::isTransparentAddress(s_address)) { + ImGui::Spacing(); + ImGui::PushTextWrapPos(0.0f); + ImGui::TextColored(material::WarningVec4(), "%s", TR("mining_addr_explainer")); + ImGui::PopTextWrapPos(); + } + ImGui::Spacing(); ImGui::Separator(); ImGui::Spacing(); diff --git a/src/ui/windows/receive_tab.cpp b/src/ui/windows/receive_tab.cpp index 414f685..c68041d 100644 --- a/src/ui/windows/receive_tab.cpp +++ b/src/ui/windows/receive_tab.cpp @@ -9,6 +9,7 @@ // - Recent received at bottom #include "receive_tab.h" +#include "qr_popup_dialog.h" // enlarge-QR / full-address popup (F051) #include "../../app.h" #include "../../config/settings.h" #include "../../util/i18n.h" @@ -315,6 +316,20 @@ static void RenderAddressDropdown(App* app, float width) { } ImGui::EndDisabled(); + // Enlarge QR / show full address (F051): for a shielded address, a compact button beside Copy opens the + // full-screen QR popup (big QR + the full chunked address) — the tab only shows a truncated address. + if (s_selected_address_idx >= 0 && s_selected_address_idx < (int)state.addresses.size() && + state.addresses[s_selected_address_idx].type == "shielded") { + ImGui::SameLine(0, Layout::spacingSm()); + const float qbs = ImGui::GetFrameHeight(); + material::IconButtonStyle qbSt; + qbSt.tooltip = TR("recv_enlarge_qr_tip"); + if (material::IconButton("##recvEnlargeQR", ICON_MD_OPEN_IN_FULL, material::Type().iconSmall(), ImVec2(qbs, qbs), qbSt)) { + const auto& a = state.addresses[s_selected_address_idx]; + QRPopupDialog::show(a.address, app->getAddressLabel(a.address)); + } + } + // New address button on same line. Lite: the backend's new-address save waits out a running scan, so the button // is unavailable until the scan ends (it used to freeze the window that long). ImGui::SameLine(0, Layout::spacingSm()); diff --git a/src/ui/windows/request_payment_dialog.cpp b/src/ui/windows/request_payment_dialog.cpp index 1344a1b..20d8533 100644 --- a/src/ui/windows/request_payment_dialog.cpp +++ b/src/ui/windows/request_payment_dialog.cpp @@ -179,6 +179,7 @@ void RequestPaymentDialog::render(App* app) ImGui::Text("%s", TR("request_amount")); ImGui::SetNextItemWidth(amountInput.width * Layout::dpiScale()); if (ImGui::InputDouble("##Amount", &s_amount, 0.1, 1.0, "%.8f")) { + if (!(s_amount >= 0.0)) s_amount = 0.0; // clamp negatives / NaN, like the Receive tab (F027) s_uri_dirty = true; } ImGui::SameLine(); @@ -197,7 +198,7 @@ void RequestPaymentDialog::render(App* app) bool is_zaddr = (s_address[0] == 'z'); if (is_zaddr) { if (material::LabeledInputMultiline(TR("request_memo"), "##Memo", s_memo, sizeof(s_memo), - ImVec2(-1, memoInput.height > 0 ? memoInput.height : 60))) { + ImVec2(-1, (memoInput.height > 0 ? memoInput.height : 60) * Layout::dpiScale()))) { s_uri_dirty = true; } } else { @@ -222,7 +223,7 @@ void RequestPaymentDialog::render(App* app) // QR Code display if (s_qr_texture != 0) { - RenderQRCode(s_qr_texture, qr.size > 0 ? qr.size : 200); + RenderQRCode(s_qr_texture, (qr.size > 0 ? qr.size : 200) * Layout::dpiScale()); // scale for HiDPI (F026) } ImGui::Spacing(); diff --git a/src/util/i18n.cpp b/src/util/i18n.cpp index cead2de..5a021d3 100644 --- a/src/util/i18n.cpp +++ b/src/util/i18n.cpp @@ -1325,6 +1325,7 @@ void I18n::loadBuiltinEnglish() strings_["recv_clear_tip"] = "Clears the amount and memo of this request."; strings_["recv_undo_tip"] = "Restore the amount and memo you just cleared."; strings_["recv_explorer_tip"] = "Opens this address on an external block explorer (a third-party website)."; + strings_["recv_enlarge_qr_tip"] = "Show the full address and a larger QR code."; strings_["copy_uri"] = "Copy URI"; strings_["qr_unavailable"] = "QR unavailable"; strings_["received_label"] = "Received";