patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob fb91fd1852c66acc623181d6d96289c9d418051f 1884 bytes (raw)
name: tools/spectrum-installer/src/pages/welcome.rs 	 # note: path name is non-authoritative(*)

 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(),
        )
    }
}

debug log:

solving fb91fd1 ...
found fb91fd1 in https://inbox.spectrum-os.org/spectrum-devel/20260104140102.106960-5-johannes.suellner@mailbox.org/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20260104140102.106960-5-johannes.suellner@mailbox.org/
diff --git a/tools/spectrum-installer/src/pages/welcome.rs b/tools/spectrum-installer/src/pages/welcome.rs
new file mode 100644
index 0000000..fb91fd1

Checking patch tools/spectrum-installer/src/pages/welcome.rs...
Applied patch tools/spectrum-installer/src/pages/welcome.rs cleanly.

index at:
100644 fb91fd1852c66acc623181d6d96289c9d418051f	tools/spectrum-installer/src/pages/welcome.rs

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).