From c8bb271d82abf1626dc20a7b894730f2d9c7db72 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Wed, 22 Apr 2026 23:11:29 -0500 Subject: [PATCH] Added downloads dialog for seeing progress and for pausing or cancelling operation --- lib/dialogs/downloads.rb | 38 ++++++++++++++++++++++++++++++++++++++ lib/states/interface.rb | 19 ++++++++++++++++--- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 lib/dialogs/downloads.rb diff --git a/lib/dialogs/downloads.rb b/lib/dialogs/downloads.rb new file mode 100644 index 0000000..d6b2ab7 --- /dev/null +++ b/lib/dialogs/downloads.rb @@ -0,0 +1,38 @@ +module W3DHubLauncher + class Dialog + class Downloads < W3DHubLauncher::Dialog + def setup + super + + stack(width: 1.0, max_width: 600, height: 1.0, max_height: 600, h_align: :center, v_align: :center, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK) do + flow(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY) do + banner "Downloads", width: 1.0, text_align: :center + end + + stack(width: 1.0, fill: true, scroll: true, padding_left: PADDING, padding_right: PADDING) do + 50.times do + stack(width: 1.0, margin_top: HALF_PADDING, margin_bottom: HALF_PADDING) do + flow(width: 1.0) do + para "PACKAGE_NAME.mix" + flow(fill: true) + para ["Downloading...", "Pending...", "Done.", "Patching...", "Unpacking..."].sample + end + progress(width: 1.0, fraction: rand) + end + end + end + + flow(width: 1.0, padding: PADDING, background_nine_slice: NINE_SLICE_ROUNDED_BOTTOM, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY) do + flow(fill: true) + + button "Close" do + pop_state + end + + flow(fill: true) + end + end + end + end + end +end diff --git a/lib/states/interface.rb b/lib/states/interface.rb index 6a66cd1..787e766 100644 --- a/lib/states/interface.rb +++ b/lib/states/interface.rb @@ -25,16 +25,29 @@ module W3DHubLauncher end.show end + # navigation bar container stack(fill: true, height: 1.0) do - stack(fill: true) + # stack(fill: true) + + # navigation container flow(width: 1.0) do link("GAMES", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::Games) } link("SERVERS", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::ServerBrowser) } stack(fill: true) - image safe_get_image("#{ROOT_PATH}/media/icons/import.png"), height: 40, color: 0xff_bbbbbb, tip: "Downloads" + image safe_get_image("#{ROOT_PATH}/media/icons/import.png"), height: 40, color: 0xff_bbbbbb, tip: "Downloads" do |img| + dialog(Dialog::Downloads) + end image safe_get_image("#{ROOT_PATH}/media/icons/information.png"), height: 40, color: 0xff_bbbbbb, tip: "Notifications" end - stack(fill: true) + # application task status bar container + stack(width: 1.0, fill: true, margin_left: PADDING) do + flow(width: 1.0) do + para "Updating Red Alert: A Path Beyond (Release)" + stack(fill: true) + para "Fetching manifests..." + end + progress(width: 1.0, fraction: 0.75) + end end # self account container