Add a developer tab with the state of the vehicle database

This commit is contained in:
maj00r
2026-10-04 12:18:36 +02:00
parent 93463ae7f2
commit 9d981cb093
13 changed files with 289 additions and 2 deletions

View File

@@ -34,9 +34,15 @@ public partial class Settings : UserControl, ISettingsCapture
/// </summary>
public event Action? ThumbnailSizeChanged;
/// <summary>Raised when the developer tab is switched on or off, so the top bar can follow.</summary>
public event Action? DeveloperToolsChanged;
/// <summary>Thumbnail size the other tabs were last drawn at.</summary>
private bool _drawnThumbs = AppServices.Current.Settings.LargeThumbnails;
/// <summary>Whether the top bar was last drawn with the developer tab on it.</summary>
private bool _shownDeveloperTools = AppServices.Current.Settings.DeveloperTools;
public Settings()
{
InitializeComponent();
@@ -199,6 +205,7 @@ public partial class Settings : UserControl, ISettingsCapture
DebugModeCb.IsChecked = s.DebugMode;
VirtualShuntingCb.IsChecked = s.VirtualShunting;
LogMissingVehicleFilesCb.IsChecked = s.LogMissingVehicleFiles;
DeveloperToolsCb.IsChecked = s.DeveloperTools;
RenderEngineCb.SelectedIndex = s.RenderEngine;
SelectResolution(s.Width, s.Height);
@@ -297,6 +304,7 @@ public partial class Settings : UserControl, ISettingsCapture
s.DebugMode = IsChecked(DebugModeCb);
s.VirtualShunting = IsChecked(VirtualShuntingCb);
s.LogMissingVehicleFiles = IsChecked(LogMissingVehicleFilesCb);
s.DeveloperTools = IsChecked(DeveloperToolsCb);
s.RenderEngine = Math.Max(0, RenderEngineCb.SelectedIndex);
ReadResolution(s);
@@ -373,12 +381,23 @@ public partial class Settings : UserControl, ISettingsCapture
AppServices.Current.SettingsStore.Save();
KeyboardConfig.Instance.Save();
RedrawThumbnailsIfNeeded();
RedrawNavIfNeeded();
_dirty = false;
UpdateSaveState();
if (SaveStatus is not null)
SaveStatus.Text = App.Loc["SettingsSaved"];
}
private void RedrawNavIfNeeded()
{
bool developer = AppServices.Current.Settings.DeveloperTools;
if (developer == _shownDeveloperTools)
return;
_shownDeveloperTools = developer;
DeveloperToolsChanged?.Invoke();
}
private void RedrawThumbnailsIfNeeded()
{
bool large = AppServices.Current.Settings.LargeThumbnails;