From be343aec37d6a8d6249285cf64759e23673e85e8 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Wed, 29 May 2024 12:30:56 +0200 Subject: [PATCH] Add previous button to installer first page --- gui/src/installer/message.rs | 1 + gui/src/installer/mod.rs | 4 ++++ gui/src/installer/view.rs | 5 +++++ gui/src/main.rs | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/gui/src/installer/message.rs b/gui/src/installer/message.rs index e60fe0c0..a0be0322 100644 --- a/gui/src/installer/message.rs +++ b/gui/src/installer/message.rs @@ -20,6 +20,7 @@ pub enum Message { Next, Skip, Previous, + BackToLauncher, Install, Close, Reload, diff --git a/gui/src/installer/mod.rs b/gui/src/installer/mod.rs index e507f049..fe375207 100644 --- a/gui/src/installer/mod.rs +++ b/gui/src/installer/mod.rs @@ -73,6 +73,10 @@ impl Installer { ) } + pub fn destination_path(&self) -> PathBuf { + self.context.data_dir.clone() + } + pub fn subscription(&self) -> Subscription { if self.current > 0 { self.steps diff --git a/gui/src/installer/view.rs b/gui/src/installer/view.rs index 461092f6..6f5665c4 100644 --- a/gui/src/installer/view.rs +++ b/gui/src/installer/view.rs @@ -111,6 +111,11 @@ pub fn welcome<'a>() -> Element<'a, Message> { .padding(20), ), ) + .push( + button::secondary(Some(icon::previous_icon()), "Change network") + .width(Length::Fixed(200.0)) + .on_press(Message::BackToLauncher), + ) .push(Space::with_height(Length::Fixed(100.0))) .spacing(50) .align_items(Alignment::Center), diff --git a/gui/src/main.rs b/gui/src/main.rs index ae1ab6e5..087fd48a 100644 --- a/gui/src/main.rs +++ b/gui/src/main.rs @@ -246,6 +246,10 @@ impl Application for GUI { ); self.state = State::Loader(Box::new(loader)); command.map(|msg| Message::Load(Box::new(msg))) + } else if let installer::Message::BackToLauncher = *msg { + let launcher = Launcher::new(i.destination_path()); + self.state = State::Launcher(Box::new(launcher)); + Command::none() } else { i.update(*msg).map(|msg| Message::Install(Box::new(msg))) }