morpheus_bootloader::tui::distro_downloader::ui

Struct DistroDownloader

Source
pub struct DistroDownloader {
    ui_state: UiState,
    download_state: DownloadState,
    current_distros: Vec<&'static DistroEntry>,
    boot_services: *const BootServices,
    image_handle: *mut (),
    needs_full_redraw: bool,
    iso_storage: IsoStorageManager,
    iso_names: [[u8; 64]; 8],
    iso_name_lens: [usize; 8],
    iso_sizes_mb: [u64; 8],
    iso_complete: [bool; 8],
}
Expand description

Main distro downloader UI controller

Fields§

§ui_state: UiState

UI navigation state

§download_state: DownloadState

Download progress state

§current_distros: Vec<&'static DistroEntry>

Cached list of distros for current category

§boot_services: *const BootServices

Boot services reference (for file operations)

§image_handle: *mut ()

Image handle

§needs_full_redraw: bool

Track if we need full redraw (mode change, category change)

§iso_storage: IsoStorageManager

ISO storage manager (for downloaded ISOs)

§iso_names: [[u8; 64]; 8]

Cached ISO names for display

§iso_name_lens: [usize; 8]

Cached ISO name lengths

§iso_sizes_mb: [u64; 8]

Cached ISO sizes (MB)

§iso_complete: [bool; 8]

Cached ISO completion status

Implementations§

Source§

impl DistroDownloader

Source

pub fn new( boot_services: *const BootServices, image_handle: *mut (), esp_start_lba: u64, disk_size_lba: u64, ) -> Self

Create a new distro downloader

§Arguments
  • boot_services - UEFI boot services
  • image_handle - Current image handle
  • esp_start_lba - Start LBA of ESP partition (for ISO storage)
  • disk_size_lba - Total disk size in LBAs
Source

fn refresh_iso_cache(&mut self)

Refresh ISO cache from storage manager

Source

pub fn storage(&self) -> &IsoStorageManager

Get ISO storage manager reference

Source

pub fn storage_mut(&mut self) -> &mut IsoStorageManager

Get mutable ISO storage manager reference

Source

fn refresh_distro_list(&mut self)

Refresh the distro list for current category

Source

pub fn selected_distro(&self) -> Option<&'static DistroEntry>

Get currently selected distro

Source

fn handle_input(&mut self, key: &InputKey, screen: &mut Screen) -> ManageAction

Handle input and return action

Source

fn handle_browse_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction

Source

fn handle_confirm_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction

Source

fn handle_download_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction

Source

fn handle_result_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction

Source

fn handle_manage_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction

Source

fn handle_confirm_delete_input( &mut self, key: &InputKey, screen: &mut Screen, ) -> ManageAction

Source

fn start_download(&mut self, distro: &'static DistroEntry, screen: &mut Screen)

Start downloading a distribution

This triggers the commit flow that exits UEFI boot services and downloads in bare-metal mode. This function will NEVER RETURN on success - the system will reboot after download completes.

Source

pub fn execute_download_with_client<D: NetworkDevice>( &mut self, distro: &'static DistroEntry, client: &mut NativeHttpClient<D>, screen: &mut Screen, )

Execute the full ISO download flow with an HTTP client

  1. Check network connectivity (assumes bootstrap already initialized network)
  2. Check disk space and find free regions
  3. Create chunk partitions
  4. Download with streaming to chunk writer
  5. Finalize and register ISO
§Arguments
  • distro - The distro to download
  • client - HTTP client from core network init
  • screen - Display screen
Source

fn allocate_chunk_partitions( &self, free_regions: &[Option<FreeRegion>; 16], chunks_needed: usize, total_size: u64, block_size: usize, ) -> Option<[(u64, u64); 16]>

Allocate chunk partitions from free space regions

Source

fn download_with_chunk_writer<D: NetworkDevice>( &mut self, url: &str, expected_size: u64, client: &mut NativeHttpClient<D>, chunk_writer: &mut ChunkWriter, block_io_protocol: *mut BlockIoProtocol, screen: &mut Screen, ) -> Result<usize, &'static str>

Download URL and write to chunks via ChunkWriter. Assumes network client is already initialized with DHCP complete and IP assigned.

Source

fn show_download_error(&mut self, screen: &mut Screen, msg: &str)

Show download error and return to result mode

Source

fn get_first_disk_block_io( boot_services: &BootServices, ) -> Option<*mut BlockIoProtocol>

Get BlockIoProtocol pointer for first physical disk

Source

fn render_full(&mut self, screen: &mut Screen)

Full render - clears screen if needed and draws everything

Source

fn render_list_and_details(&self, screen: &mut Screen)

Render only the list and details (for navigation - no clear needed)

Source

fn render_header(&self, screen: &mut Screen)

Source

fn render_categories(&self, screen: &mut Screen)

Source

fn render_list(&self, screen: &mut Screen)

Source

fn render_details(&self, screen: &mut Screen)

Source

fn render_confirm_dialog(&self, screen: &mut Screen)

Source

fn render_progress_only(&self, screen: &mut Screen)

Source

fn render_result(&self, screen: &mut Screen)

Source

fn pad_or_truncate(s: &str, len: usize) -> String

Helper: pad or truncate string to exact length

Source

pub fn run(&mut self, screen: &mut Screen, keyboard: &mut Keyboard)

Main event loop - follows same pattern as main_menu/distro_launcher

Source

fn render_manage_header(&self, screen: &mut Screen)

Source

fn render_iso_list(&self, screen: &mut Screen)

Source

fn render_manage_confirm_dialog(&self, screen: &mut Screen, message: &str)

Source

fn format_size_mb(mb: u64) -> String

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.