diff --git a/src/app_sweep.cpp b/src/app_sweep.cpp index ae211b6..2472d6a 100644 --- a/src/app_sweep.cpp +++ b/src/app_sweep.cpp @@ -24,6 +24,10 @@ #include "ui/windows/bootstrap_download_dialog.h" #include "ui/windows/daemon_download_dialog.h" #include "ui/windows/xmrig_download_dialog.h" +#include "ui/windows/qr_popup_dialog.h" +#include "ui/windows/request_payment_dialog.h" +#include "ui/windows/validate_address_dialog.h" +#include "ui/windows/address_label_dialog.h" #include "ui/pages/settings_page.h" #include "util/platform.h" #include "wallet/wallet_capabilities.h" @@ -325,6 +329,25 @@ void App::buildSweepCatalog() a.show_pin_remove_ = false; a.pin_status_.clear(); memset(a.pin_old_buf_, 0, sizeof(a.pin_old_buf_)); }); + // Wave-1 standalone dialogs (rendered globally from App::render, so any page works). + add("modal-qr-popup", ui::NavPage::Receive, + [](App&) { ui::QRPopupDialog::show(kDemoZAddr, "Savings"); }, + [](App&) { ui::QRPopupDialog::close(); }); + add("modal-request-payment", ui::NavPage::Receive, + [](App&) { ui::RequestPaymentDialog::show(kDemoZAddr); }, + [](App&) { ui::RequestPaymentDialog::hide(); }); + add("modal-validate-address", ui::NavPage::Receive, + [](App&) { ui::ValidateAddressDialog::show(); }, + [](App&) { ui::ValidateAddressDialog::hide(); }); + add("modal-address-label", ui::NavPage::Overview, + [](App& a) { ui::AddressLabelDialog::show(&a, kDemoZAddr, true); }, + [](App&) { ui::AddressLabelDialog::hide(); }); + add("modal-daemon-prompt", ui::NavPage::Settings, + [](App& a) { a.daemon_update_bundled_size_ = 12345678ull; a.show_daemon_update_prompt_ = true; }, + [](App& a) { a.show_daemon_update_prompt_ = false; }); + add("modal-antivirus", ui::NavPage::Mining, + [](App& a) { a.pending_antivirus_dialog_ = true; }, + [](App& a) { a.pending_antivirus_dialog_ = false; }); add("modal-about", ui::NavPage::Overview, [](App& a) { a.show_about_ = true; }, [](App& a) { a.show_about_ = false; }); add("modal-settings", ui::NavPage::Settings, diff --git a/src/ui/windows/address_label_dialog.h b/src/ui/windows/address_label_dialog.h index 9d49f76..9e56bb5 100644 --- a/src/ui/windows/address_label_dialog.h +++ b/src/ui/windows/address_label_dialog.h @@ -251,6 +251,9 @@ public: static bool isOpen() { return s_open; } + // Close the dialog (used by the UI sweep teardown). + static void hide() { s_open = false; } + private: static inline bool s_open = false; static inline App* s_app = nullptr; diff --git a/src/ui/windows/request_payment_dialog.cpp b/src/ui/windows/request_payment_dialog.cpp index 59d4859..d61bbbe 100644 --- a/src/ui/windows/request_payment_dialog.cpp +++ b/src/ui/windows/request_payment_dialog.cpp @@ -59,6 +59,15 @@ void RequestPaymentDialog::show(const std::string& address) } } +void RequestPaymentDialog::hide() +{ + s_open = false; + if (s_qr_texture != 0) { + FreeQRTexture(s_qr_texture); + s_qr_texture = 0; + } +} + void RequestPaymentDialog::render(App* app) { if (!s_open) return; diff --git a/src/ui/windows/request_payment_dialog.h b/src/ui/windows/request_payment_dialog.h index a71edc7..03b7978 100644 --- a/src/ui/windows/request_payment_dialog.h +++ b/src/ui/windows/request_payment_dialog.h @@ -26,6 +26,11 @@ public: * @brief Render the dialog (call each frame) */ static void render(App* app); + + /** + * @brief Close the dialog + free its QR texture (used by the UI sweep teardown) + */ + static void hide(); }; } // namespace ui diff --git a/src/ui/windows/validate_address_dialog.cpp b/src/ui/windows/validate_address_dialog.cpp index 3b42087..3d8432b 100644 --- a/src/ui/windows/validate_address_dialog.cpp +++ b/src/ui/windows/validate_address_dialog.cpp @@ -42,6 +42,11 @@ bool ValidateAddressDialog::isOpen() return s_open; } +void ValidateAddressDialog::hide() +{ + s_open = false; +} + void ValidateAddressDialog::render(App* app) { if (!s_open) return; diff --git a/src/ui/windows/validate_address_dialog.h b/src/ui/windows/validate_address_dialog.h index 78b0db3..6edfe1c 100644 --- a/src/ui/windows/validate_address_dialog.h +++ b/src/ui/windows/validate_address_dialog.h @@ -33,6 +33,11 @@ public: */ static bool isOpen(); + /** + * @brief Close the dialog (used by the UI sweep teardown) + */ + static void hide(); + private: static bool s_open; static bool s_validated;