Skip to content

Commit

Permalink
Add progress bar to Windows UI
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Feb 2, 2025
1 parent 800a643 commit 2d897ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions installer-downloader/src/winapi_impl/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ impl AppDelegate for AppWindow {
}

fn show_download_progress(&mut self) {
// TODO
self.progress_bar.set_visible(true);
}

fn hide_download_progress(&mut self) {
// TODO
self.progress_bar.set_visible(false);
}

fn set_download_progress(&mut self, complete: u32) {
// TODO
self.progress_bar.set_pos(complete);
}

fn show_download_button(&mut self) {
Expand Down
8 changes: 8 additions & 0 deletions installer-downloader/src/winapi_impl/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub struct AppWindow {
pub banner_image: nwg::ImageFrame,
// TODO: add progress bar
pub download_button: nwg::Button,

pub progress_bar: nwg::ProgressBar,
}

impl AppWindow {
Expand Down Expand Up @@ -70,6 +72,12 @@ impl AppWindow {
.text("Download && install")
.build(&mut self.download_button)?;

nwg::ProgressBar::builder()
.parent(&self.window)
.size((WINDOW_WIDTH - 2*12, 16))
.position((12, 300))
.build(&mut self.progress_bar)?;

nwg::GridLayout::builder()
.parent(&self.window)
.margin([0, 0, 0, 0])
Expand Down

0 comments on commit 2d897ad

Please sign in to comment.