Add previous button to installer first page

This commit is contained in:
edouardparis 2024-05-29 12:30:56 +02:00
parent 9ae33408cb
commit be343aec37
4 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,7 @@ pub enum Message {
Next, Next,
Skip, Skip,
Previous, Previous,
BackToLauncher,
Install, Install,
Close, Close,
Reload, Reload,

View File

@ -73,6 +73,10 @@ impl Installer {
) )
} }
pub fn destination_path(&self) -> PathBuf {
self.context.data_dir.clone()
}
pub fn subscription(&self) -> Subscription<Message> { pub fn subscription(&self) -> Subscription<Message> {
if self.current > 0 { if self.current > 0 {
self.steps self.steps

View File

@ -111,6 +111,11 @@ pub fn welcome<'a>() -> Element<'a, Message> {
.padding(20), .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))) .push(Space::with_height(Length::Fixed(100.0)))
.spacing(50) .spacing(50)
.align_items(Alignment::Center), .align_items(Alignment::Center),

View File

@ -246,6 +246,10 @@ impl Application for GUI {
); );
self.state = State::Loader(Box::new(loader)); self.state = State::Loader(Box::new(loader));
command.map(|msg| Message::Load(Box::new(msg))) 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 { } else {
i.update(*msg).map(|msg| Message::Install(Box::new(msg))) i.update(*msg).map(|msg| Message::Install(Box::new(msg)))
} }