1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-01 02:10:56 +00:00

refactor(core): consistent naming of UI layouts

- follow-up on 862c987779
- layout_bolt stays the same
- layout_samson -> layout_caesar
- layout_quicksilver -> layout_delizia

[no changelog]
This commit is contained in:
obrusvit 2025-01-17 13:04:11 +01:00
parent 30e88f4641
commit bc931718b8
344 changed files with 881 additions and 876 deletions

View File

@ -40,7 +40,7 @@ message DebugLinkDecision {
}
/**
* Structure representing button presses of UI samson
* Structure representing button presses of UI Caesar
*/
// TODO: probably delete the middle_btn as it is not a physical one
enum DebugPhysicalButton {

View File

@ -57,15 +57,15 @@ LAYOUT_FEATURE = layout_bolt
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T2B1))
MCU = STM32F4
OPENOCD_TARGET = target/stm32f4x.cfg
LAYOUT_FEATURE = layout_samson
LAYOUT_FEATURE = layout_caesar
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3T1))
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
LAYOUT_FEATURE = layout_quicksilver
LAYOUT_FEATURE = layout_delizia
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3B1))
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
LAYOUT_FEATURE = layout_samson
LAYOUT_FEATURE = layout_caesar
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3W1))
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg

View File

@ -9,8 +9,8 @@ build = "build.rs"
default = ["layout_bolt"]
crypto = ["zeroize"]
layout_bolt = ["jpeg"]
layout_samson = []
layout_quicksilver = ["jpeg", "dma2d"]
layout_caesar = []
layout_delizia = ["jpeg", "dma2d"]
micropython = []
protobuf = ["micropython"]
ui = []

View File

@ -68,7 +68,7 @@ const DEFAULT_BINDGEN_MACROS_T2T1: &[&str] = &[
#[cfg(not(feature = "layout_bolt"))]
const DEFAULT_BINDGEN_MACROS_T2T1: &[&str] = &[];
#[cfg(feature = "layout_samson")]
#[cfg(feature = "layout_caesar")]
const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[
"-DSTM32F427",
"-DTREZOR_MODEL_T2B1",
@ -78,10 +78,10 @@ const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[
"-DDISPLAY_RESY=64",
"-DTREZOR_BOARD=\"T2B1/boards/t2b1-unix.h\"",
];
#[cfg(not(feature = "layout_samson"))]
#[cfg(not(feature = "layout_caesar"))]
const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[];
#[cfg(feature = "layout_quicksilver")]
#[cfg(feature = "layout_delizia")]
const DEFAULT_BINDGEN_MACROS_T3T1: &[&str] = &[
"-DSTM32U5",
"-DTREZOR_MODEL_T3T1",
@ -91,7 +91,7 @@ const DEFAULT_BINDGEN_MACROS_T3T1: &[&str] = &[
"-DDISPLAY_RESY=240",
"-DTREZOR_BOARD=\"T3T1/boards/t3t1-unix.h\"",
];
#[cfg(not(feature = "layout_quicksilver"))]
#[cfg(not(feature = "layout_delizia"))]
const DEFAULT_BINDGEN_MACROS_T3T1: &[&str] = &[];
fn add_bindgen_macros<'a>(clang_args: &mut Vec<&'a str>, envvar: Option<&'a str>) {

View File

@ -649,7 +649,7 @@ static void _librust_qstrs(void) {
MP_QSTR_show_progress_coinjoin;
MP_QSTR_show_remaining_shares;
MP_QSTR_show_share_words;
MP_QSTR_show_share_words_quicksilver;
MP_QSTR_show_share_words_delizia;
MP_QSTR_show_simple;
MP_QSTR_show_success;
MP_QSTR_show_wait_text;

View File

@ -927,7 +927,7 @@ extern "C" fn new_show_share_words(n_args: usize, args: *const Obj, kwargs: *mut
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_share_words_quicksilver(
extern "C" fn new_show_share_words_delizia(
n_args: usize,
args: *const Obj,
kwargs: *mut Map,
@ -947,7 +947,7 @@ extern "C" fn new_show_share_words_quicksilver(
let words: Vec<TString, 33> = util::iter_into_vec(words)?;
let layout = ModelUI::show_share_words_quicksilver(
let layout = ModelUI::show_share_words_delizia(
words,
subtitle,
instructions,
@ -1280,7 +1280,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// items: Iterable[tuple[int, str | bytes]],
/// ) -> LayoutObj[UiResult]:
/// """Confirm long content with the possibility to go back from any page.
/// Meant to be used with confirm_with_info on UI bolt and samson."""
/// Meant to be used with confirm_with_info on UI Bolt and Caesar."""
Qstr::MP_QSTR_confirm_more => obj_fn_kw!(0, new_confirm_more).as_obj(),
/// def confirm_properties(
@ -1338,7 +1338,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// items: Iterable[tuple[int, str | bytes]],
/// ) -> LayoutObj[UiResult]:
/// """Confirm given items but with third button. Always single page
/// without scrolling. In Quicksilver, the button is placed in
/// without scrolling. In Delizia, the button is placed in
/// context menu."""
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),
@ -1378,7 +1378,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// """Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""
Qstr::MP_QSTR_flow_confirm_output => obj_fn_kw!(0, new_flow_confirm_output).as_obj(),
// TODO: supply more arguments for Wipe code setting (quicksilver)
// TODO: supply more arguments for Wipe code setting (delizia)
///
/// def flow_confirm_set_new_pin(
/// *,
@ -1625,7 +1625,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// """Show mnemonic for backup."""
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),
/// def show_share_words_quicksilver(
/// def show_share_words_delizia(
/// *,
/// words: Iterable[str],
/// subtitle: str | None,
@ -1635,7 +1635,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// ) -> LayoutObj[UiResult]:
/// """Show mnemonic for wallet backup preceded by an instruction screen and followed by a
/// confirmation screen."""
Qstr::MP_QSTR_show_share_words_quicksilver => obj_fn_kw!(0, new_show_share_words_quicksilver).as_obj(),
Qstr::MP_QSTR_show_share_words_delizia => obj_fn_kw!(0, new_show_share_words_delizia).as_obj(),
/// def show_simple(
/// *,
@ -1670,7 +1670,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// allow_cancel: bool = True,
/// danger: bool = False, # unused on bolt
/// ) -> LayoutObj[UiResult]:
/// """Warning modal. bolt: No buttons shown when `button` is empty string. samson: middle button and centered text."""
/// """Warning modal. Bolt: No buttons shown when `button` is empty string. Caesar: middle button and centered text."""
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
/// def tutorial() -> LayoutObj[UiResult]:

View File

@ -3,11 +3,11 @@
#[cfg(all(
feature = "layout_bolt",
not(feature = "layout_quicksilver"),
not(feature = "layout_samson")
not(feature = "layout_delizia"),
not(feature = "layout_caesar")
))]
pub use super::layout_bolt::constant::*;
#[cfg(all(feature = "layout_quicksilver", not(feature = "layout_bolt")))]
pub use super::layout_quicksilver::constant::*;
#[cfg(feature = "layout_samson")]
pub use super::layout_samson::constant::*;
#[cfg(all(feature = "layout_caesar", not(feature = "layout_delizia")))]
pub use super::layout_caesar::constant::*;
#[cfg(feature = "layout_delizia")]
pub use super::layout_delizia::constant::*;

View File

@ -1024,7 +1024,7 @@ impl FirmwareUI for UIBolt {
Ok(layout)
}
fn show_share_words_quicksilver(
fn show_share_words_delizia(
_words: heapless::Vec<TString<'static>, 33>,
_subtitle: Option<TString<'static>>,
_instructions: Obj,

View File

@ -17,17 +17,15 @@ use super::{
bl_confirm::{Confirm, ConfirmMsg},
ResultScreen, WelcomeScreen,
},
cshape,
theme::{
bootloader::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, ICON_SUCCESS},
ICON_ARM_LEFT, ICON_ARM_RIGHT, TEXT_BOLD, TEXT_NORMAL,
},
UISamson,
UICaesar,
};
use crate::ui::{
display::toif::Toif, geometry::Alignment, layout_samson::cshape, shape,
shape::render_on_display,
};
use crate::ui::{display::toif::Toif, geometry::Alignment, shape, shape::render_on_display};
use ufmt::uwrite;
@ -48,7 +46,7 @@ impl ReturnToC for ConfirmMsg {
}
}
impl UISamson {
impl UICaesar {
fn screen_progress(
text: &str,
text2: &str,
@ -93,7 +91,7 @@ impl UISamson {
}
}
impl BootloaderUI for UISamson {
impl BootloaderUI for UICaesar {
fn screen_welcome() {
let mut frame = Welcome::new();
show(&mut frame, true);

View File

@ -11,14 +11,13 @@ use crate::{
},
display::Font,
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
layout_samson::cshape,
shape,
shape::Renderer,
util::animation_disabled,
},
};
use super::theme;
use super::super::{cshape, theme};
const FOOTER_TEXT_MARGIN: i16 = 8;
const LOADER_OFFSET: i16 = -15;

View File

@ -4,14 +4,13 @@ use crate::{
component::{Child, Component, Event, EventCtx, Label, Never, Pad},
constant::{screen, WIDTH},
geometry::{Alignment2D, Offset, Point, Rect},
layout_samson::cshape,
shape,
shape::Renderer,
},
};
use super::super::{
theme,
cshape, theme,
theme::{BG, FG, TITLE_AREA_HEIGHT},
};

View File

@ -11,14 +11,13 @@ use crate::{
constant,
display::{Font, Icon, LOADER_MAX},
geometry::{Alignment2D, Offset, Rect},
layout_samson::cshape,
shape,
shape::Renderer,
util::animation_disabled,
},
};
use super::super::theme;
use super::super::{cshape, theme};
const BOTTOM_DESCRIPTION_MARGIN: i16 = 10;
const LOADER_Y_OFFSET_TITLE: i16 = -10;

View File

@ -11,12 +11,12 @@ pub mod cshape;
mod screens;
pub mod theme;
pub struct UISamson {}
pub struct UICaesar {}
#[cfg(feature = "micropython")]
pub mod ui_firmware;
impl CommonUI for UISamson {
impl CommonUI for UICaesar {
const SCREEN: Rect = constant::SCREEN;
fn screen_fatal_error(title: &str, msg: &str, footer: &str) {

View File

@ -1,10 +1,11 @@
use crate::ui::{
component::base::Component, constant::screen, display, layout_samson::component::WelcomeScreen,
};
use crate::ui::{component::base::Component, constant::screen, display};
use crate::ui::{display::Color, shape::render_on_display};
use super::{component::ErrorScreen, constant};
use super::{
component::{ErrorScreen, WelcomeScreen},
constant,
};
pub fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());

View File

@ -9,12 +9,12 @@ pub use super::super::theme::{BLACK, WHITE};
pub const BLD_BG: Color = BLACK;
pub const BLD_FG: Color = WHITE;
include_icon!(ICON_TRASH, "layout_samson/res/trash.toif");
include_icon!(ICON_ALERT, "layout_samson/res/alert.toif");
include_icon!(ICON_SPINNER, "layout_samson/res/spinner.toif");
include_icon!(ICON_SUCCESS, "layout_samson/res/success.toif");
include_icon!(ICON_REDO, "layout_samson/res/redo.toif");
include_icon!(ICON_EXIT, "layout_samson/res/exit.toif");
include_icon!(ICON_TRASH, "layout_caesar/res/trash.toif");
include_icon!(ICON_ALERT, "layout_caesar/res/alert.toif");
include_icon!(ICON_SPINNER, "layout_caesar/res/spinner.toif");
include_icon!(ICON_SUCCESS, "layout_caesar/res/success.toif");
include_icon!(ICON_REDO, "layout_caesar/res/redo.toif");
include_icon!(ICON_EXIT, "layout_caesar/res/exit.toif");
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);

View File

@ -65,35 +65,35 @@ pub fn textstyle_number(num: i32) -> &'static TextStyle {
}
// Firmware icons
include_icon!(ICON_ARM_LEFT, "layout_samson/res/arm_left.toif"); // 10*6
include_icon!(ICON_ARM_RIGHT, "layout_samson/res/arm_right.toif"); // 10*6
include_icon!(ICON_ARROW_LEFT, "layout_samson/res/arrow_left.toif"); // 4*7
include_icon!(ICON_ARROW_LEFT_BIG, "layout_samson/res/arrow_left_big.toif"); // 8*7
include_icon!(ICON_ARROW_RIGHT, "layout_samson/res/arrow_right.toif"); // 4*7
include_icon!(ICON_ARM_LEFT, "layout_caesar/res/arm_left.toif"); // 10*6
include_icon!(ICON_ARM_RIGHT, "layout_caesar/res/arm_right.toif"); // 10*6
include_icon!(ICON_ARROW_LEFT, "layout_caesar/res/arrow_left.toif"); // 4*7
include_icon!(ICON_ARROW_LEFT_BIG, "layout_caesar/res/arrow_left_big.toif"); // 8*7
include_icon!(ICON_ARROW_RIGHT, "layout_caesar/res/arrow_right.toif"); // 4*7
include_icon!(
ICON_ARROW_RIGHT_FAT,
"layout_samson/res/arrow_right_fat.toif"
"layout_caesar/res/arrow_right_fat.toif"
); // 4*8
include_icon!(ICON_ARROW_UP, "layout_samson/res/arrow_up.toif"); // 8*4
include_icon!(ICON_ARROW_DOWN, "layout_samson/res/arrow_down.toif"); // 7*4
include_icon!(ICON_ARROW_BACK_UP, "layout_samson/res/arrow_back_up.toif"); // 8*8
include_icon!(ICON_BIN, "layout_samson/res/bin.toif"); // 10*10
include_icon!(ICON_CANCEL, "layout_samson/res/cancel.toif"); // 7*7
include_icon!(ICON_COINJOIN, "layout_samson/res/coinjoin.toif"); // 12*12
include_icon!(ICON_DELETE, "layout_samson/res/delete.toif"); // 9*7
include_icon!(ICON_DEVICE_NAME, "layout_samson/res/device_name.toif"); // 116*18
include_icon!(ICON_EYE, "layout_samson/res/eye_round.toif"); // 12*7
include_icon!(ICON_LOCK, "layout_samson/res/lock.toif"); // 10*10
include_icon!(ICON_LOCK_SMALL, "layout_samson/res/lock_small.toif"); // 6*7
include_icon!(ICON_LOGO, "layout_samson/res/logo_22_33.toif"); // 22*33
include_icon!(ICON_LOGO_EMPTY, "layout_samson/res/logo_22_33_empty.toif");
include_icon!(ICON_NEXT_PAGE, "layout_samson/res/next_page.toif"); // 9*8
include_icon!(ICON_PREV_PAGE, "layout_samson/res/prev_page.toif"); // 8*10
include_icon!(ICON_SPACE, "layout_samson/res/space.toif"); // 12*3
include_icon!(ICON_TICK, "layout_samson/res/tick.toif"); // 8*6
include_icon!(ICON_TICK_FAT, "layout_samson/res/tick_fat.toif"); // 8*6
include_icon!(ICON_WARNING, "layout_samson/res/warning.toif"); // 11*12
include_icon!(ICON_WARN_TITLE, "layout_samson/res/bld_header_warn.toif");
include_icon!(ICON_ARROW_UP, "layout_caesar/res/arrow_up.toif"); // 8*4
include_icon!(ICON_ARROW_DOWN, "layout_caesar/res/arrow_down.toif"); // 7*4
include_icon!(ICON_ARROW_BACK_UP, "layout_caesar/res/arrow_back_up.toif"); // 8*8
include_icon!(ICON_BIN, "layout_caesar/res/bin.toif"); // 10*10
include_icon!(ICON_CANCEL, "layout_caesar/res/cancel.toif"); // 7*7
include_icon!(ICON_COINJOIN, "layout_caesar/res/coinjoin.toif"); // 12*12
include_icon!(ICON_DELETE, "layout_caesar/res/delete.toif"); // 9*7
include_icon!(ICON_DEVICE_NAME, "layout_caesar/res/device_name.toif"); // 116*18
include_icon!(ICON_EYE, "layout_caesar/res/eye_round.toif"); // 12*7
include_icon!(ICON_LOCK, "layout_caesar/res/lock.toif"); // 10*10
include_icon!(ICON_LOCK_SMALL, "layout_caesar/res/lock_small.toif"); // 6*7
include_icon!(ICON_LOGO, "layout_caesar/res/logo_22_33.toif"); // 22*33
include_icon!(ICON_LOGO_EMPTY, "layout_caesar/res/logo_22_33_empty.toif");
include_icon!(ICON_NEXT_PAGE, "layout_caesar/res/next_page.toif"); // 9*8
include_icon!(ICON_PREV_PAGE, "layout_caesar/res/prev_page.toif"); // 8*10
include_icon!(ICON_SPACE, "layout_caesar/res/space.toif"); // 12*3
include_icon!(ICON_TICK, "layout_caesar/res/tick.toif"); // 8*6
include_icon!(ICON_TICK_FAT, "layout_caesar/res/tick_fat.toif"); // 8*6
include_icon!(ICON_WARNING, "layout_caesar/res/warning.toif"); // 11*12
include_icon!(ICON_WARN_TITLE, "layout_caesar/res/bld_header_warn.toif");
// checklist settings
pub const CHECKLIST_SPACING: i16 = 5;

View File

@ -26,10 +26,6 @@ use crate::{
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
util::{ConfirmBlob, RecoveryType},
},
layout_samson::{
component::{ButtonActions, ButtonLayout, Page},
constant,
},
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
},
@ -39,16 +35,17 @@ use crate::{
use super::{
component::{
AddressDetails, ButtonDetails, ButtonPage, CoinJoinProgress, ConfirmHomescreen, Flow,
FlowPages, Frame, Homescreen, Lockscreen, NumberInput, PassphraseEntry, PinEntry, Progress,
ScrollableFrame, ShareWords, ShowMore, SimpleChoice, WordlistEntry, WordlistType,
AddressDetails, ButtonActions, ButtonDetails, ButtonLayout, ButtonPage, CoinJoinProgress,
ConfirmHomescreen, Flow, FlowPages, Frame, Homescreen, Lockscreen, NumberInput, Page,
PassphraseEntry, PinEntry, Progress, ScrollableFrame, ShareWords, ShowMore, SimpleChoice,
WordlistEntry, WordlistType,
},
theme, UISamson,
constant, theme, UICaesar,
};
use heapless::Vec;
impl FirmwareUI for UISamson {
impl FirmwareUI for UICaesar {
fn confirm_action(
title: TString<'static>,
action: Option<TString<'static>>,
@ -1158,7 +1155,7 @@ impl FirmwareUI for UISamson {
Ok(layout)
}
fn show_share_words_quicksilver(
fn show_share_words_delizia(
_words: heapless::Vec<TString<'static>, 33>,
_subtitle: Option<TString<'static>>,
_instructions: Obj,

Some files were not shown because too many files have changed in this diff Show More