mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-12 14:16:06 +00:00
feat(eckhart): implement WelcomeScreen
This commit is contained in:
parent
aa965a8144
commit
b6f27f3087
@ -1,17 +1,18 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Never},
|
component::{Component, Event, EventCtx, Never},
|
||||||
geometry::{Alignment, Alignment2D, Offset, Rect},
|
geometry::{Alignment, Offset, Rect},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::{fonts, theme};
|
use super::super::{
|
||||||
|
fonts,
|
||||||
|
theme::{GREY_LIGHT, TEXT_VERTICAL_SPACING},
|
||||||
|
};
|
||||||
|
|
||||||
const TEXT_BOTTOM_MARGIN: i16 = 54;
|
const TEXT_OFFSET: Offset = Offset::new(30, 40);
|
||||||
const ICON_TOP_MARGIN: i16 = 48;
|
|
||||||
|
|
||||||
use crate::trezorhal::model;
|
|
||||||
|
|
||||||
|
/// Firmware welcome screen
|
||||||
pub struct WelcomeScreen {
|
pub struct WelcomeScreen {
|
||||||
area: Rect,
|
area: Rect,
|
||||||
}
|
}
|
||||||
@ -35,26 +36,26 @@ impl Component for WelcomeScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
shape::ToifImage::new(
|
// TODO: should we use `model::FULL_NAME`?
|
||||||
self.area.top_center() + Offset::y(ICON_TOP_MARGIN),
|
|
||||||
theme::ICON_LOGO.toif,
|
|
||||||
)
|
|
||||||
.with_align(Alignment2D::TOP_CENTER)
|
|
||||||
.with_fg(theme::FG)
|
|
||||||
.with_bg(theme::BG)
|
|
||||||
.render(target);
|
|
||||||
|
|
||||||
shape::Text::new(
|
const NAME_PARTS: [&str; 3] = ["Trezor", "Safe", "5"];
|
||||||
self.area.bottom_center() - Offset::y(TEXT_BOTTOM_MARGIN),
|
|
||||||
model::FULL_NAME,
|
let font = fonts::FONT_SATOSHI_REGULAR_38;
|
||||||
fonts::FONT_SATOSHI_REGULAR_38,
|
let mut cursor = self.area.top_left() + TEXT_OFFSET;
|
||||||
)
|
let row_height = font.text_height() + TEXT_VERTICAL_SPACING;
|
||||||
.with_align(Alignment::Center)
|
|
||||||
.with_fg(theme::FG)
|
for part in &NAME_PARTS {
|
||||||
.render(target);
|
shape::Text::new(cursor, part, font)
|
||||||
|
.with_align(Alignment::Start)
|
||||||
|
.with_fg(GREY_LIGHT)
|
||||||
|
.render(target);
|
||||||
|
cursor = cursor + Offset::y(row_height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "bootloader"))]
|
||||||
|
use crate::trezorhal::model;
|
||||||
#[cfg(feature = "ui_debug")]
|
#[cfg(feature = "ui_debug")]
|
||||||
impl crate::trace::Trace for WelcomeScreen {
|
impl crate::trace::Trace for WelcomeScreen {
|
||||||
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
|
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user