From f4aa66638676d8aad206436fc5d639f76f57d5ee Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Mon, 27 Dec 2021 22:15:17 -0600 Subject: [PATCH] Removed settings and download manager icon buttons and moved to proper navigation 'links', Cache.install_path checks settings for games install path before defaulting --- lib/cache.rb | 15 ++++++++++--- lib/states/interface.rb | 49 +++++++++-------------------------------- locales/en.yml | 2 ++ 3 files changed, 25 insertions(+), 41 deletions(-) diff --git a/lib/cache.rb b/lib/cache.rb index 1d57b63..d84e5ce 100644 --- a/lib/cache.rb +++ b/lib/cache.rb @@ -38,9 +38,11 @@ class W3DHub end def self.install_path(application, channel) - app_install_dir = Store.settings[:app_install_dir] + game_data = Store.settings[:games]&.dig(:"#{application.id}_#{channel.id}") - "#{app_install_dir}/#{application.category}/#{application.id}/#{channel.id}" + return game_data[:install_directory] if game_data && game_data[:install_directory] + + "#{Store.settings[:app_install_dir]}/#{application.category}/#{application.id}/#{channel.id}" end # Download a W3D Hub package @@ -83,7 +85,14 @@ class W3DHub if response.success? chunk = response.read - written = file.pwrite(chunk, part.min) + written = 0 + if W3DHub.unix? + written = file.pwrite(chunk, part.min) + else + # probably not "thread safe" + file.pos = part.min + written = file.write(chunk) + end amount_written += written remaining_bytes = package.size - amount_written diff --git a/lib/states/interface.rb b/lib/states/interface.rb index c355679..b20d8e8 100644 --- a/lib/states/interface.rb +++ b/lib/states/interface.rb @@ -37,38 +37,10 @@ class W3DHub stack(width: 0.75, height: 1.0) do title "#{I18n.t(:"app_name")}", height: 0.5 flow(width: 1.0, height: 0.5) do - flow(width: 0.18, height: 1.0) do - button( - get_image("#{GAME_ROOT_PATH}/media/ui_icons/gear.png"), - tip: I18n.t(:"interface.app_settings_tip"), - image_height: 1.0, - padding_left: 4, - padding_top: 4, - padding_right: 4, - padding_bottom: 4, - margin_left: 32 - ) do - page(W3DHub::Pages::Settings) - end - - button( - get_image("#{GAME_ROOT_PATH}/media/ui_icons/import.png"), - tip: I18n.t(:"interface.download_manager"), - image_height: 1.0, - padding_left: 4, - padding_top: 4, - padding_right: 4, - padding_bottom: 4, - margin_left: 4 - ) do - page(W3DHub::Pages::DownloadManager) - end - end - - @application_taskbar_container = stack(width: 0.77, height: 1.0, margin_left: 16) do + @application_taskbar_container = stack(width: 1.0, height: 1.0, margin_left: 16) do flow(width: 1.0, height: 0.65) do - @application_taskbar_label = inscription "", width: 0.65, text_wrap: :none - @application_taskbar_status_label = inscription "", width: 0.35, text_align: :right, text_wrap: :none + @application_taskbar_label = inscription "", width: 0.60, text_wrap: :none + @application_taskbar_status_label = inscription "", width: 0.40, text_align: :right, text_wrap: :none end @application_taskbar_progressbar = progress fraction: 0.0, height: 2, width: 1.0 @@ -93,11 +65,7 @@ class W3DHub @navigation_container = flow(width: 1.0, height: 0.35) do # background 0xff_666666 - - flow(width: 0.20, height: 1.0) do - end - - flow(width: 0.55, height: 1.0) do + flow(width: 1.0, height: 1.0, padding_left: 75) do link I18n.t(:"interface.games") do page(W3DHub::Pages::Games) end @@ -109,9 +77,14 @@ class W3DHub link I18n.t(:"interface.community"), margin_left: 18 do page(W3DHub::Pages::Community) end - end - flow(width: 0.20, height: 1.0) do + link I18n.t(:"interface.downloads"), margin_left: 18 do + page(W3DHub::Pages::DownloadManager) + end + + link I18n.t(:"interface.settings"), margin_left: 18 do + page(W3DHub::Pages::Settings) + end end end end diff --git a/locales/en.yml b/locales/en.yml index b40ac11..546a188 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -14,12 +14,14 @@ en: server_browser: Server Browser community: Community download_manager: Download Manager + downloads: Downloads play_now: Play Now install_update: Install Update single_player: Single Player import: Import install: Install app_settings_tip: W3D Hub Launcher Settings + settings: Settings games: game_settings: Game Settings wine_configuration: Wine Configuration