mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-03 16:56:07 +00:00
refactor(eckhart): separate firmware components
This commit is contained in:
parent
33de234c7a
commit
a453c9de90
@ -11,7 +11,8 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::{
|
||||
use super::super::{
|
||||
component::{Button, ButtonMsg::Clicked, ButtonStyleSheet},
|
||||
constant::WIDTH,
|
||||
theme::{
|
||||
bootloader::{
|
||||
@ -20,9 +21,6 @@ use super::{
|
||||
},
|
||||
WHITE,
|
||||
},
|
||||
Button,
|
||||
ButtonMsg::Clicked,
|
||||
ButtonStyleSheet,
|
||||
};
|
||||
|
||||
const ICON_TOP: i16 = 17;
|
||||
@ -51,7 +49,7 @@ pub struct ConfirmInfo<'a> {
|
||||
pub close_button: Child<Button>,
|
||||
}
|
||||
|
||||
pub struct Confirm<'a> {
|
||||
pub struct ConfirmScreen<'a> {
|
||||
bg: Pad,
|
||||
content_pad: Pad,
|
||||
bg_color: Color,
|
||||
@ -64,7 +62,7 @@ pub struct Confirm<'a> {
|
||||
show_info: bool,
|
||||
}
|
||||
|
||||
impl<'a> Confirm<'a> {
|
||||
impl<'a> ConfirmScreen<'a> {
|
||||
pub fn new(
|
||||
bg_color: Color,
|
||||
left_button: Button,
|
||||
@ -119,7 +117,7 @@ impl<'a> Confirm<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for Confirm<'_> {
|
||||
impl Component for ConfirmScreen<'_> {
|
||||
type Msg = ConfirmMsg;
|
||||
|
||||
fn place(&mut self, bounds: Rect) -> Rect {
|
||||
@ -241,7 +239,7 @@ impl Component for Confirm<'_> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "ui_debug")]
|
||||
impl crate::trace::Trace for Confirm<'_> {
|
||||
impl crate::trace::Trace for ConfirmScreen<'_> {
|
||||
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
|
||||
t.component("BlConfirm");
|
||||
}
|
@ -11,10 +11,7 @@ use heapless::String;
|
||||
|
||||
use super::{
|
||||
bootloader::welcome::Welcome,
|
||||
component::{
|
||||
bl_confirm::{Confirm, ConfirmTitle},
|
||||
Button, ResultScreen, WelcomeScreen,
|
||||
},
|
||||
component::{Button, ResultScreen, WelcomeScreen},
|
||||
cshape::{render_loader, LoaderRange},
|
||||
fonts,
|
||||
theme::{
|
||||
@ -45,9 +42,11 @@ use super::theme::bootloader::BLD_WARN_COLOR;
|
||||
use intro::Intro;
|
||||
use menu::Menu;
|
||||
|
||||
mod confirm;
|
||||
pub mod intro;
|
||||
pub mod menu;
|
||||
pub mod welcome;
|
||||
use confirm::{Confirm, ConfirmTitle};
|
||||
|
||||
pub type BootloaderString = String<128>;
|
||||
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::theme;
|
||||
use super::super::theme;
|
||||
|
||||
pub enum ButtonMsg {
|
||||
Pressed,
|
||||
|
@ -10,8 +10,10 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
constant::WIDTH,
|
||||
theme::{FATAL_ERROR_COLOR, ICON_WARNING40, RESULT_FOOTER_START, RESULT_PADDING, WHITE},
|
||||
super::{
|
||||
constant::WIDTH,
|
||||
theme::{FATAL_ERROR_COLOR, ICON_WARNING40, RESULT_FOOTER_START, RESULT_PADDING, WHITE},
|
||||
},
|
||||
ResultFooter, ResultStyle,
|
||||
};
|
||||
|
||||
@ -22,7 +24,7 @@ const MESSAGE_AREA_START: i16 = 90;
|
||||
#[cfg(feature = "bootloader")]
|
||||
const STYLE: &ResultStyle = &crate::ui::layout_eckhart::theme::bootloader::RESULT_WIPE;
|
||||
#[cfg(not(feature = "bootloader"))]
|
||||
const STYLE: &ResultStyle = &super::theme::RESULT_ERROR;
|
||||
const STYLE: &ResultStyle = &super::super::theme::RESULT_ERROR;
|
||||
|
||||
pub struct ErrorScreen<'a> {
|
||||
bg: Pad,
|
||||
|
@ -1,43 +1,9 @@
|
||||
mod action_bar;
|
||||
pub mod bl_confirm;
|
||||
mod button;
|
||||
mod error;
|
||||
mod header;
|
||||
mod hint;
|
||||
mod hold_to_confirm;
|
||||
mod keyboard;
|
||||
mod number_input_screen;
|
||||
mod result;
|
||||
mod select_word_screen;
|
||||
mod share_words;
|
||||
mod text_screen;
|
||||
mod vertical_menu;
|
||||
mod vertical_menu_screen;
|
||||
mod welcome_screen;
|
||||
|
||||
pub use action_bar::{ActionBar, ActionBarMsg};
|
||||
pub use button::{Button, ButtonContent, ButtonMsg, ButtonStyle, ButtonStyleSheet, IconText};
|
||||
pub use error::ErrorScreen;
|
||||
pub use header::{Header, HeaderMsg};
|
||||
pub use hint::Hint;
|
||||
pub use hold_to_confirm::HoldToConfirmAnim;
|
||||
#[cfg(feature = "translations")]
|
||||
pub use keyboard::{
|
||||
bip39::Bip39Input,
|
||||
mnemonic::{MnemonicInput, MnemonicKeyboard, MnemonicKeyboardMsg},
|
||||
passphrase::{PassphraseKeyboard, PassphraseKeyboardMsg},
|
||||
pin::{PinKeyboard, PinKeyboardMsg},
|
||||
slip39::Slip39Input,
|
||||
word_count_screen::{SelectWordCountMsg, SelectWordCountScreen},
|
||||
};
|
||||
pub use number_input_screen::{NumberInputScreenMsg, NumberInputScreen};
|
||||
pub use result::{ResultFooter, ResultScreen, ResultStyle};
|
||||
pub use select_word_screen::{SelectWordMsg, SelectWordScreen};
|
||||
#[cfg(feature = "translations")]
|
||||
pub use share_words::{ShareWordsScreen, ShareWordsScreenMsg};
|
||||
pub use text_screen::{AllowedTextContent, TextScreen, TextScreenMsg};
|
||||
pub use vertical_menu::{VerticalMenu, VerticalMenuMsg, MENU_MAX_ITEMS};
|
||||
pub use vertical_menu_screen::{VerticalMenuScreen, VerticalMenuScreenMsg};
|
||||
pub use welcome_screen::WelcomeScreen;
|
||||
|
||||
use super::{constant, theme};
|
||||
|
@ -10,9 +10,9 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::{
|
||||
super::fonts,
|
||||
use super::super::{
|
||||
constant::WIDTH,
|
||||
fonts,
|
||||
theme::{FG, RESULT_FOOTER_START, RESULT_PADDING},
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@ use crate::ui::{
|
||||
shape::Renderer,
|
||||
};
|
||||
|
||||
use super::{super::fonts, theme};
|
||||
use super::super::{fonts, theme};
|
||||
|
||||
const TEXT_BOTTOM_MARGIN: i16 = 54;
|
||||
const ICON_TOP_MARGIN: i16 = 48;
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::component::{
|
||||
use super::firmware::{
|
||||
AllowedTextContent, MnemonicInput, MnemonicKeyboard, MnemonicKeyboardMsg, NumberInputScreen,
|
||||
NumberInputScreenMsg, PinKeyboard, PinKeyboardMsg, SelectWordCountMsg, SelectWordCountScreen,
|
||||
SelectWordMsg, SelectWordScreen, TextScreen, TextScreenMsg,
|
||||
|
@ -9,8 +9,8 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
button::{Button, ButtonContent, ButtonMsg},
|
||||
theme, ButtonStyleSheet, HoldToConfirmAnim,
|
||||
super::component::{Button, ButtonContent, ButtonMsg, ButtonStyleSheet},
|
||||
theme, HoldToConfirmAnim,
|
||||
};
|
||||
|
||||
/// Component for control buttons in the bottom of the screen.
|
@ -5,7 +5,6 @@ use crate::{
|
||||
component::{text::TextStyle, Component, Event, EventCtx, Label},
|
||||
display::{Color, Icon},
|
||||
geometry::{Alignment2D, Insets, Offset, Rect},
|
||||
layout_eckhart::constant,
|
||||
lerp::Lerp,
|
||||
shape::{self, Renderer},
|
||||
util::animation_disabled,
|
||||
@ -13,8 +12,8 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
button::{Button, ButtonContent, ButtonMsg},
|
||||
theme,
|
||||
super::component::{Button, ButtonContent, ButtonMsg},
|
||||
constant, theme,
|
||||
};
|
||||
|
||||
const ANIMATION_TIME_MS: u32 = 1000;
|
@ -11,7 +11,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
super::{component::Header, cshape::ScreenBorder, theme},
|
||||
super::{cshape::ScreenBorder, firmware::Header, theme},
|
||||
constant::SCREEN,
|
||||
};
|
||||
|
@ -8,14 +8,12 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::super::{
|
||||
component::{
|
||||
keyboard::{
|
||||
common::{render_pending_marker, MultiTapKeyboard},
|
||||
mnemonic::{MnemonicInput, MnemonicInputMsg, MNEMONIC_KEY_COUNT},
|
||||
},
|
||||
Button, ButtonMsg,
|
||||
},
|
||||
component::{Button, ButtonMsg},
|
||||
constant::WIDTH,
|
||||
firmware::keyboard::{
|
||||
common::{render_pending_marker, MultiTapKeyboard},
|
||||
mnemonic::{MnemonicInput, MnemonicInputMsg, MNEMONIC_KEY_COUNT},
|
||||
},
|
||||
theme,
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
|
||||
use super::{
|
||||
super::super::{
|
||||
component::button::{Button, ButtonContent, ButtonMsg, ButtonStyleSheet},
|
||||
component::{Button, ButtonContent, ButtonMsg, ButtonStyleSheet},
|
||||
constant::SCREEN,
|
||||
theme,
|
||||
},
|
@ -8,14 +8,12 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::super::{
|
||||
component::{
|
||||
button::ButtonContent,
|
||||
keyboard::{
|
||||
common::{INPUT_TOUCH_HEIGHT, KEYBOARD_INPUT_INSETS, KEYPAD_VISIBLE_HEIGHT},
|
||||
keypad::{ButtonState, Keypad, KeypadButton, KeypadMsg},
|
||||
},
|
||||
},
|
||||
component::ButtonContent,
|
||||
constant::SCREEN,
|
||||
firmware::keyboard::{
|
||||
common::{INPUT_TOUCH_HEIGHT, KEYBOARD_INPUT_INSETS, KEYPAD_VISIBLE_HEIGHT},
|
||||
keypad::{ButtonState, Keypad, KeypadButton, KeypadMsg},
|
||||
},
|
||||
theme,
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
button::{Button, ButtonContent, ButtonMsg, ButtonStyleSheet},
|
||||
super::component::{Button, ButtonContent, ButtonMsg, ButtonStyleSheet},
|
||||
constant::SCREEN,
|
||||
keyboard::{
|
||||
common::{
|
@ -16,19 +16,13 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::super::super::{
|
||||
component::{
|
||||
button::ButtonContent,
|
||||
constant::SCREEN,
|
||||
keyboard::{
|
||||
common::{
|
||||
DisplayStyle, FADING_ICON_COLORS, FADING_ICON_COUNT, INPUT_TOUCH_HEIGHT,
|
||||
KEYBOARD_INPUT_INSETS, KEYBOARD_INPUT_RADIUS, KEYPAD_VISIBLE_HEIGHT,
|
||||
},
|
||||
keypad::{ButtonState, Keypad, KeypadMsg, KeypadState},
|
||||
},
|
||||
use super::{
|
||||
super::super::{component::ButtonContent, constant::SCREEN, theme},
|
||||
common::{
|
||||
DisplayStyle, FADING_ICON_COLORS, FADING_ICON_COUNT, INPUT_TOUCH_HEIGHT,
|
||||
KEYBOARD_INPUT_INSETS, KEYBOARD_INPUT_RADIUS, KEYPAD_VISIBLE_HEIGHT,
|
||||
},
|
||||
theme,
|
||||
keypad::{ButtonState, Keypad, KeypadMsg, KeypadState},
|
||||
};
|
||||
|
||||
pub enum PinKeyboardMsg {
|
@ -14,12 +14,10 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::super::{
|
||||
component::{
|
||||
keyboard::{
|
||||
common::{render_pending_marker, MultiTapKeyboard},
|
||||
mnemonic::{MnemonicInput, MnemonicInputMsg, MNEMONIC_KEY_COUNT},
|
||||
},
|
||||
Button, ButtonMsg,
|
||||
component::{Button, ButtonMsg},
|
||||
firmware::keyboard::{
|
||||
common::{render_pending_marker, MultiTapKeyboard},
|
||||
mnemonic::{MnemonicInput, MnemonicInputMsg, MNEMONIC_KEY_COUNT},
|
||||
},
|
||||
theme,
|
||||
};
|
@ -8,8 +8,12 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
super::{super::constant::SCREEN, theme},
|
||||
Button, ButtonMsg, Header,
|
||||
super::{
|
||||
super::constant::SCREEN,
|
||||
component::{Button, ButtonMsg},
|
||||
theme,
|
||||
},
|
||||
Header,
|
||||
};
|
||||
|
||||
use heapless::Vec;
|
34
core/embed/rust/src/ui/layout_eckhart/firmware/mod.rs
Normal file
34
core/embed/rust/src/ui/layout_eckhart/firmware/mod.rs
Normal file
@ -0,0 +1,34 @@
|
||||
mod action_bar;
|
||||
mod header;
|
||||
mod hint;
|
||||
mod hold_to_confirm;
|
||||
mod keyboard;
|
||||
mod number_input_screen;
|
||||
mod select_word_screen;
|
||||
mod share_words;
|
||||
mod text_screen;
|
||||
mod vertical_menu;
|
||||
mod vertical_menu_screen;
|
||||
|
||||
pub use action_bar::{ActionBar, ActionBarMsg};
|
||||
pub use header::{Header, HeaderMsg};
|
||||
pub use hint::Hint;
|
||||
pub use hold_to_confirm::HoldToConfirmAnim;
|
||||
#[cfg(feature = "translations")]
|
||||
pub use keyboard::{
|
||||
bip39::Bip39Input,
|
||||
mnemonic::{MnemonicInput, MnemonicKeyboard, MnemonicKeyboardMsg},
|
||||
passphrase::{PassphraseKeyboard, PassphraseKeyboardMsg},
|
||||
pin::{PinKeyboard, PinKeyboardMsg},
|
||||
slip39::Slip39Input,
|
||||
word_count_screen::{SelectWordCountMsg, SelectWordCountScreen},
|
||||
};
|
||||
pub use number_input_screen::{NumberInputScreen, NumberInputScreenMsg};
|
||||
pub use select_word_screen::{SelectWordMsg, SelectWordScreen};
|
||||
#[cfg(feature = "translations")]
|
||||
pub use share_words::{ShareWordsScreen, ShareWordsScreenMsg};
|
||||
pub use text_screen::{AllowedTextContent, TextScreen, TextScreenMsg};
|
||||
pub use vertical_menu::{VerticalMenu, VerticalMenuMsg, MENU_MAX_ITEMS};
|
||||
pub use vertical_menu_screen::{VerticalMenuScreen, VerticalMenuScreenMsg};
|
||||
|
||||
use super::{constant, theme};
|
@ -9,8 +9,12 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
super::{super::constant::SCREEN, fonts, theme},
|
||||
ActionBar, ActionBarMsg, Button, ButtonMsg, Header, HeaderMsg,
|
||||
super::{
|
||||
super::constant::SCREEN,
|
||||
component::{Button, ButtonMsg},
|
||||
fonts, theme,
|
||||
},
|
||||
ActionBar, ActionBarMsg, Header, HeaderMsg,
|
||||
};
|
||||
|
||||
pub enum NumberInputScreenMsg {
|
@ -9,8 +9,9 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
component::{Button, Header, HeaderMsg, VerticalMenu, VerticalMenuMsg},
|
||||
component::Button,
|
||||
constant::SCREEN,
|
||||
firmware::{Header, HeaderMsg, VerticalMenu, VerticalMenuMsg},
|
||||
theme,
|
||||
};
|
||||
|
@ -15,8 +15,9 @@ use crate::{
|
||||
use heapless::Vec;
|
||||
|
||||
use super::super::{
|
||||
component::{button::Button, ActionBar, ActionBarMsg, Header, HeaderMsg, Hint},
|
||||
component::Button,
|
||||
constant::SCREEN,
|
||||
firmware::{ActionBar, ActionBarMsg, Header, HeaderMsg, Hint},
|
||||
fonts, theme,
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ use crate::ui::{
|
||||
util::Pager,
|
||||
};
|
||||
|
||||
pub(crate) use super::{action_bar::ActionBarMsg, ActionBar, Header, HeaderMsg, Hint};
|
||||
use super::{action_bar::ActionBarMsg, ActionBar, Header, HeaderMsg, Hint};
|
||||
|
||||
/// Full-screen component for rendering text.
|
||||
///
|
@ -4,12 +4,11 @@ use crate::ui::{
|
||||
shape::{Bar, Renderer},
|
||||
};
|
||||
|
||||
use heapless::Vec;
|
||||
|
||||
use super::super::{
|
||||
component::{Button, ButtonMsg},
|
||||
use super::{
|
||||
super::component::{Button, ButtonMsg},
|
||||
theme,
|
||||
};
|
||||
use heapless::Vec;
|
||||
|
||||
/// Number of buttons.
|
||||
/// Presently, VerticalMenu holds only fixed number of buttons.
|
@ -14,10 +14,7 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
component::{constant::SCREEN, Header, HeaderMsg, VerticalMenu, VerticalMenuMsg},
|
||||
theme,
|
||||
};
|
||||
use super::{constant::SCREEN, theme, Header, HeaderMsg, VerticalMenu, VerticalMenuMsg};
|
||||
|
||||
pub struct VerticalMenuScreen {
|
||||
header: Header,
|
@ -13,7 +13,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
component::{
|
||||
firmware::{
|
||||
ActionBar, Header, HeaderMsg, Hint, TextScreen, TextScreenMsg, VerticalMenu,
|
||||
VerticalMenuScreen, VerticalMenuScreenMsg,
|
||||
},
|
||||
|
@ -16,8 +16,9 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
component::{
|
||||
ActionBar, Button, Header, HeaderMsg, Hint, TextScreen, TextScreenMsg, VerticalMenu,
|
||||
component::Button,
|
||||
firmware::{
|
||||
ActionBar, Header, HeaderMsg, Hint, TextScreen, TextScreenMsg, VerticalMenu,
|
||||
VerticalMenuScreen, VerticalMenuScreenMsg,
|
||||
},
|
||||
theme,
|
||||
|
@ -9,16 +9,17 @@ use crate::{
|
||||
FlowController, FlowMsg, SwipeFlow,
|
||||
},
|
||||
geometry::Direction,
|
||||
layout_eckhart::{
|
||||
component::{
|
||||
ActionBar, Button, Header, PassphraseKeyboard, PassphraseKeyboardMsg, TextScreen,
|
||||
TextScreenMsg,
|
||||
},
|
||||
fonts, theme,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
use super::super::{
|
||||
component::Button,
|
||||
firmware::{
|
||||
ActionBar, Header, PassphraseKeyboard, PassphraseKeyboardMsg, TextScreen, TextScreenMsg,
|
||||
},
|
||||
fonts, theme,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
pub enum RequestPassphrase {
|
||||
Keypad,
|
||||
|
@ -18,8 +18,9 @@ use crate::{
|
||||
use heapless::Vec;
|
||||
|
||||
use super::super::{
|
||||
component::{
|
||||
ActionBar, Button, Header, ShareWordsScreen, ShareWordsScreenMsg, TextScreen, TextScreenMsg,
|
||||
component::Button,
|
||||
firmware::{
|
||||
ActionBar, Header, ShareWordsScreen, ShareWordsScreenMsg, TextScreen, TextScreenMsg,
|
||||
},
|
||||
theme,
|
||||
};
|
||||
|
@ -15,6 +15,8 @@ use crate::strutil::ShortString;
|
||||
pub mod bootloader;
|
||||
pub mod component;
|
||||
pub mod constant;
|
||||
#[cfg(feature = "micropython")]
|
||||
pub mod firmware;
|
||||
pub mod theme;
|
||||
|
||||
#[cfg(feature = "micropython")]
|
||||
@ -24,6 +26,8 @@ pub mod cshape;
|
||||
pub mod flow;
|
||||
pub mod fonts;
|
||||
pub mod screens;
|
||||
#[cfg(feature = "bootloader")]
|
||||
pub mod ui_bootloader;
|
||||
#[cfg(feature = "micropython")]
|
||||
pub mod ui_firmware;
|
||||
|
||||
|
@ -25,10 +25,10 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
component::{
|
||||
ActionBar, Bip39Input, Button, Header, HeaderMsg, Hint, MnemonicKeyboard,
|
||||
NumberInputScreen, PinKeyboard, SelectWordCountScreen, SelectWordScreen, Slip39Input,
|
||||
TextScreen,
|
||||
component::Button,
|
||||
firmware::{
|
||||
ActionBar, Bip39Input, Header, HeaderMsg, Hint, MnemonicKeyboard, NumberInputScreen,
|
||||
PinKeyboard, SelectWordCountScreen, SelectWordScreen, Slip39Input, TextScreen,
|
||||
},
|
||||
flow, fonts, theme, UIEckhart,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user