add settings: am/pm clock, opaque background, hide username
This commit is contained in:
@@ -7,6 +7,7 @@ use wgui::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
settings,
|
||||
tab::{Tab, TabParams, TabType},
|
||||
various,
|
||||
};
|
||||
@@ -22,7 +23,7 @@ impl Tab for TabHome {
|
||||
}
|
||||
}
|
||||
|
||||
fn configure_label_hello(label_hello: &mut WidgetLabel, i18n: &mut wgui::i18n::I18n) {
|
||||
fn configure_label_hello(label_hello: &mut WidgetLabel, i18n: &mut wgui::i18n::I18n, settings: &settings::Settings) {
|
||||
let mut username = various::get_username();
|
||||
// first character as uppercase
|
||||
if let Some(first) = username.chars().next() {
|
||||
@@ -30,7 +31,12 @@ fn configure_label_hello(label_hello: &mut WidgetLabel, i18n: &mut wgui::i18n::I
|
||||
username.replace_range(0..1, &first);
|
||||
}
|
||||
|
||||
let translated = i18n.translate_and_replace("HELLO_USER", ("{USER}", &username));
|
||||
let translated = if !settings.home_screen.hide_username {
|
||||
i18n.translate_and_replace("HELLO_USER", ("{USER}", &username))
|
||||
} else {
|
||||
i18n.translate("HELLO").to_string()
|
||||
};
|
||||
|
||||
label_hello.set_text_simple(i18n, Translation::from_raw_text(&translated));
|
||||
}
|
||||
|
||||
@@ -47,7 +53,7 @@ impl TabHome {
|
||||
)?;
|
||||
|
||||
let mut label_hello = state.fetch_widget_as::<WidgetLabel>(¶ms.layout.state, "label_hello")?;
|
||||
configure_label_hello(&mut label_hello, &mut params.globals.i18n());
|
||||
configure_label_hello(&mut label_hello, &mut params.globals.i18n(), params.settings);
|
||||
|
||||
let btn_apps = state.fetch_component_as::<ComponentButton>("btn_apps")?;
|
||||
let btn_games = state.fetch_component_as::<ComponentButton>("btn_games")?;
|
||||
|
||||
Reference in New Issue
Block a user