1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| | // SPDX-License-Identifier: EUPL-1.2+
// SPDX-FileCopyrightText: 2025 Johannes Süllner <johannes.suellner@mailbox.org>
use super::{BUTTON_TEXT_SIZE, Event, MARGIN_VERTICAL, Page, TITLE_TEXT_SIZE, UpdateResult};
use crate::{center_horizontal_in_container, center_in_container};
use iced::{
Element, Length, Task,
widget::{Space, column, image, text},
};
const LOGO_PATH_GLOBAL: &str = "/usr/share/icons/hicolor/400x400/apps/spectrum-installer.png";
const LOGO_WIDTH: f32 = 400.0;
pub struct PageWelcome {}
impl PageWelcome {
pub fn new() -> Self {
Self {}
}
}
#[derive(Clone, Debug)]
pub enum PageWelcomeEvent {
Continue,
}
impl Page for PageWelcome {
fn update(&mut self, event: Event) -> UpdateResult {
if let Event::PageWelcome(page_welcome_event) = event {
match page_welcome_event {
PageWelcomeEvent::Continue => {
return (
Some(Box::new(super::disk_selection::PageDiskSelection::new())),
Task::none(),
);
}
}
}
(None, Task::none())
}
fn view(&self) -> Element<'_, Event> {
let button_content = text("Next").size(BUTTON_TEXT_SIZE);
let main_content = column![
Space::with_height(MARGIN_VERTICAL),
center_horizontal_in_container!(
text("Welcome to the installation of Spectrum!").size(TITLE_TEXT_SIZE)
),
Space::with_height(MARGIN_VERTICAL),
center_in_container!(image(LOGO_PATH_GLOBAL).width(Length::Fixed(LOGO_WIDTH)))
];
super::layout::bottom_buttons_layout(
[[(
button_content.into(),
Some(Event::PageWelcome(PageWelcomeEvent::Continue)),
)]],
main_content.into(),
)
}
}
|