Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 3 additions & 16 deletions crates/moon-core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub use layout::{
pub use news_tags::NewsTagSettings;
pub use orders::{LineStyle, OrdersStyle, OrdersStyleSet};
pub use quiet::{QuietCfg, QuietWarnBypass};
pub use schema::{TelegramConfig, UiDensity, UiThemeMode};
pub use schema::{TelegramConfig, UiThemeMode};
pub use secrets::Secret;
pub use servers::{
ChartBucket, CoreSortMode, FeedFlags, MANUAL_STRAT_SLOTS, ManualStratState, ServerConfig,
Expand All @@ -120,12 +120,11 @@ use crate::market::MarketDataMode;
/// Interface preferences readable WITHOUT any key, for a window shown before the config is open.
///
/// The login window has to be painted before `servers.enc` can be decrypted, and everything it
/// needs is in plaintext `settings.toml` anyway. Exposing these four values keeps that window from
/// needs is in plaintext `settings.toml` anyway. Exposing these three values keeps that window from
/// either flashing default colours or reaching into the config internals.
#[derive(Clone, Copy, Debug)]
pub struct PresentationPrefs {
pub ui_theme_mode: UiThemeMode,
pub ui_density: UiDensity,
pub ui_scale: f32,
pub language: Language,
}
Expand Down Expand Up @@ -216,7 +215,6 @@ pub fn presentation_prefs() -> PresentationPrefs {
let (settings, load) = store::read_settings();
PresentationPrefs {
ui_theme_mode: schema::resolve_ui_theme_mode(settings.ui_theme_mode, load, profile_age()),
ui_density: settings.resolved_ui_density(),
ui_scale: schema::repair_ui_scale(settings.ui_scale),
language: settings.language,
}
Expand Down Expand Up @@ -293,11 +291,9 @@ pub struct AppConfig {
pub log_to_file: bool,
/// Log-file retention in days; 0 keeps everything (settings.toml). Defaults to 14.
pub log_retention_days: u32,
/// Interface density; Standard retains the historical +3 text adjustment in the UI crate.
pub ui_density: UiDensity,
/// Interface theme mode (plaintext settings.toml); Graphite shares the dark colour set.
pub ui_theme_mode: UiThemeMode,
/// Overall UI geometry scale. Defaults to 1.0.
/// Window content zoom applied to every window. Defaults to 1.0.
pub ui_scale: f32,
/// Startup retained-history depth percentage passed to MoonProto.
///
Expand Down Expand Up @@ -367,7 +363,6 @@ impl AppConfig {
main_idle_close_secs: Default::default(),
log_to_file: Default::default(),
log_retention_days: Default::default(),
ui_density: Default::default(),
ui_theme_mode: Default::default(),
ui_scale: Default::default(),
chart_memory_percent: Default::default(),
Expand Down Expand Up @@ -467,7 +462,6 @@ impl AppConfig {
main_idle_close_secs: merged.main_idle_close_secs,
log_to_file: merged.log_to_file,
log_retention_days: merged.log_retention_days,
ui_density: merged.ui_density,
ui_theme_mode: merged.ui_theme_mode,
ui_scale: merged.ui_scale,
chart_memory_percent: merged.chart_memory_percent,
Expand Down Expand Up @@ -521,7 +515,6 @@ impl AppConfig {
cfg.chart_stack_height = schema::default_chart_stack_height();
cfg.log_to_file = true;
cfg.log_retention_days = 14;
cfg.ui_density = UiDensity::default();
cfg.ui_theme_mode = UiThemeMode::default();
cfg.ui_scale = schema::default_ui_scale();
// The serde default is `true` while the field's `Default` is `false`; `save()` below
Expand Down Expand Up @@ -549,7 +542,6 @@ impl AppConfig {
cfg.chart_stack_height = schema::default_chart_stack_height();
cfg.log_to_file = true;
cfg.log_retention_days = 14;
cfg.ui_density = UiDensity::default();
cfg.ui_theme_mode = UiThemeMode::default();
cfg.ui_scale = schema::default_ui_scale();
// The serde default is `true` while the field's `Default` is `false`; `save()` below
Expand Down Expand Up @@ -579,7 +571,6 @@ impl AppConfig {
chart_stack_height: schema::default_chart_stack_height(),
log_to_file: true,
log_retention_days: 14,
ui_density: meta.resolved_ui_density(),
// A brand-new profile opens LIGHT; anyone else keeps exactly what they had. Reaching
// this branch already proves `servers.enc` and both legacy configs are absent, but NOT
// that `settings.toml` and `layout.toml` are — so the shared fact is asked rather than
Expand Down Expand Up @@ -773,7 +764,6 @@ impl AppConfig {
workspace_membership: WorkspaceMembership::default(),
})
.collect();
let ui_density = settings.resolved_ui_density();
let mut config = Self {
servers,
groups: Vec::new(),
Expand All @@ -790,7 +780,6 @@ impl AppConfig {
main_idle_close_secs: 0,
log_to_file: settings.log_to_file,
log_retention_days: settings.log_retention_days,
ui_density,
ui_theme_mode: settings.ui_theme_mode,
ui_scale: settings.ui_scale,
chart_memory_percent: settings.chart_memory_percent,
Expand Down Expand Up @@ -896,7 +885,6 @@ impl AppConfig {
self.main_idle_close_secs,
self.log_to_file,
self.log_retention_days,
self.ui_density,
self.ui_theme_mode,
self.ui_scale,
self.chart_memory_percent,
Expand Down Expand Up @@ -1037,7 +1025,6 @@ impl AppConfig {
0, // main_idle_close_secs is behavioral.
true, // Log settings are non-structural.
14,
UiDensity::default(),
UiThemeMode::default(),
schema::default_ui_scale(),
schema::default_chart_memory_percent(),
Expand Down
15 changes: 4 additions & 11 deletions crates/moon-core/src/config/reconcile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::hotkeys::HotkeysConfig;
use super::lang::Language;
use super::schema::{
COREID_UID_VERSION, SCHEMA_VERSION, ServerEntry, ServerMeta, ServersFile, SettingsFile,
TelegramConfig, UiDensity, UiThemeMode, clamp_chart_memory_percent, clamp_chart_stack_height,
TelegramConfig, UiThemeMode, clamp_chart_memory_percent, clamp_chart_stack_height,
repair_ui_scale,
};
use super::servers::{self, CoreSortMode};
Expand Down Expand Up @@ -44,8 +44,6 @@ pub struct Merged {
pub log_to_file: bool,
/// Log-file retention period in days (0 = keep everything).
pub log_retention_days: u32,
/// Explicit interface density, or Standard when the key is absent.
pub ui_density: UiDensity,
/// Dark/light MoonUI theme.
pub ui_theme_mode: UiThemeMode,
/// Overall UI geometry scale.
Expand Down Expand Up @@ -87,9 +85,7 @@ pub fn merge(sf: ServersFile, meta: SettingsFile, uid_floor: Option<u64>) -> Mer
let mut next_uid = next_free_uid(&sf, &meta, uid_floor);
// A counter that had to be raised is written back, so the repair survives a later boot on
// which the stores cannot be read.
let mut dirty = meta.version < SCHEMA_VERSION
|| next_uid.get() > meta.next_uid
|| meta.ui_density.is_none();
let mut dirty = meta.version < SCHEMA_VERSION || next_uid.get() > meta.next_uid;
// Before v11, runtime CoreId was positional, so charts.json contains positional ids.
let chart_core_remap_needed = meta.version < COREID_UID_VERSION;
let language = meta.language;
Expand All @@ -102,7 +98,6 @@ pub fn merge(sf: ServersFile, meta: SettingsFile, uid_floor: Option<u64>) -> Mer
let main_idle_close_secs = meta.main_idle_close_secs;
let log_to_file = meta.log_to_file;
let log_retention_days = meta.log_retention_days;
let ui_density = meta.resolved_ui_density();
let ui_theme_mode = meta.ui_theme_mode;
let ui_scale = repair_ui_scale(meta.ui_scale);
let chart_memory_percent = clamp_chart_memory_percent(meta.chart_memory_percent);
Expand Down Expand Up @@ -217,7 +212,6 @@ pub fn merge(sf: ServersFile, meta: SettingsFile, uid_floor: Option<u64>) -> Mer
main_idle_close_secs,
log_to_file,
log_retention_days,
ui_density,
ui_theme_mode,
ui_scale,
chart_memory_percent,
Expand All @@ -236,7 +230,8 @@ pub fn merge(sf: ServersFile, meta: SettingsFile, uid_floor: Option<u64>) -> Mer
/// Server connection keys go to `ServersFile`; server metadata, server-group settings, saved core
/// groups, and presentation preferences go to `SettingsFile`. Saved core groups are copied as
/// supplied because the caller owns sanitizing the runtime list before persistence.
/// Density is always written explicitly; the retired font adjustment is never written.
/// The retired `ui_density` and `ui_font_delta` keys are never written: a file that still carries
/// them loses them on its next save.
#[allow(clippy::too_many_arguments)]
pub fn split(
servers: &[ServerConfig],
Expand All @@ -252,7 +247,6 @@ pub fn split(
main_idle_close_secs: u32,
log_to_file: bool,
log_retention_days: u32,
ui_density: UiDensity,
ui_theme_mode: UiThemeMode,
ui_scale: f32,
chart_memory_percent: u16,
Expand Down Expand Up @@ -284,7 +278,6 @@ pub fn split(
main_idle_close_secs,
log_to_file,
log_retention_days,
ui_density: Some(ui_density),
ui_theme_mode,
ui_scale,
chart_memory_percent: clamp_chart_memory_percent(chart_memory_percent),
Expand Down
Loading
Loading