Update window.rs

This commit is contained in:
Will Ahlswede 2026-03-30 23:44:33 -07:00
parent 98a330238e
commit 407d49b4ce

View File

@ -70,6 +70,7 @@ struct AppState {
dragging: bool,
drag_start_mouse_x: i32,
drag_start_offset: i32,
show_decimals: bool,
}
#[derive(Clone, Debug)]
@ -102,6 +103,7 @@ const IDM_LANG_SPANISH: u16 = 42;
const IDM_LANG_FRENCH: u16 = 43;
const IDM_LANG_GERMAN: u16 = 44;
const IDM_LANG_JAPANESE: u16 = 45;
const IDM_SHOW_DECIMALS: u16 = 50;
const DIVIDER_HIT_ZONE: i32 = 13; // LEFT_DIVIDER_W + DIVIDER_RIGHT_MARGIN
@ -159,6 +161,8 @@ struct SettingsFile {
language: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
last_update_check_unix: Option<u64>,
#[serde(default)]
show_decimals: bool,
}
impl Default for SettingsFile {
@ -168,6 +172,7 @@ impl Default for SettingsFile {
poll_interval_ms: default_poll_interval(),
language: None,
last_update_check_unix: None,
show_decimals: true,
}
}
}
@ -204,6 +209,7 @@ fn save_state_settings() {
.language_override
.map(|language| language.code().to_string()),
last_update_check_unix: s.last_update_check_unix,
show_decimals: s.show_decimals,
});
}
}
@ -259,8 +265,8 @@ fn refresh_usage_texts(state: &mut AppState) {
let strings = state.language.strings();
let Some((session_text, weekly_text)) = state.data.as_ref().map(|data| {
(
poller::format_line(&data.session, strings),
poller::format_line(&data.weekly, strings),
poller::format_line(&data.session, strings, state.show_decimals),
poller::format_line(&data.weekly, strings, state.show_decimals),
)
}) else {
return;
@ -651,7 +657,7 @@ const DIVIDER_RIGHT_MARGIN: i32 = 10;
const LABEL_WIDTH: i32 = 18;
const LABEL_RIGHT_MARGIN: i32 = 10;
const BAR_RIGHT_MARGIN: i32 = 4;
const TEXT_WIDTH: i32 = 62;
const TEXT_WIDTH: i32 = 80;
const RIGHT_MARGIN: i32 = 1;
const WIDGET_HEIGHT: i32 = 46;