diff --git a/CursorLang/Models/AppSettings.cs b/CursorLang/Models/AppSettings.cs index 03a1031..a06ab92 100644 --- a/CursorLang/Models/AppSettings.cs +++ b/CursorLang/Models/AppSettings.cs @@ -19,12 +19,14 @@ public sealed partial class AppSettings : ObservableObject [ObservableProperty] private AppTheme _theme = AppTheme.System; + /// Where the popup is shown: at the cursor, at the caret or at a fixed point. [ObservableProperty] private PopupPlacementMode _placementMode = PopupPlacementMode.AtCursor; // The side and the offset are stored per mode: the cursor and the caret call for // different settings, and switching the mode does not reset them + /// The side of the cursor the popup is put on. [ObservableProperty] private AnchorSide _cursorSide = AnchorSide.BottomRight; @@ -32,6 +34,7 @@ public sealed partial class AppSettings : ObservableObject [ObservableProperty] private double _cursorOffset = 16; + /// The side of the caret the popup is put on. [ObservableProperty] private AnchorSide _caretSide = AnchorSide.BottomRight; @@ -39,6 +42,9 @@ public sealed partial class AppSettings : ObservableObject [ObservableProperty] private double _caretOffset = 16; + /// + /// The place on the monitor for the mode. + /// [ObservableProperty] private ScreenPosition _screenPosition = ScreenPosition.BottomRight; @@ -46,6 +52,7 @@ public sealed partial class AppSettings : ObservableObject [ObservableProperty] private double _screenMargin = 24; + /// The size of the layout name in the popup, in WPF units. [ObservableProperty] private double _fontSize = 20; @@ -71,15 +78,33 @@ public sealed partial class AppSettings : ObservableObject [ObservableProperty] private double _capsLockHoldMilliseconds = 300; + /// + /// Ask the repository about new versions on startup. A check can always be + /// started by hand — this setting turns off only the automatic one. + /// + [ObservableProperty] + private bool _checkForUpdates = true; + + /// + /// When the application last asked about new versions successfully. + /// Stored so as not to go to the network on every startup. + /// + [ObservableProperty] + private DateTimeOffset? _lastUpdateCheck; + + /// The fill of the popup. The opacity is set by . [ObservableProperty] private Color _backgroundColor = Color.FromRgb(0x20, 0x20, 0x20); + /// The colour of the layout name in the popup. [ObservableProperty] private Color _foregroundColor = Color.FromRgb(0xFF, 0xFF, 0xFF); + /// as a . [JsonIgnore] public TimeSpan Duration => TimeSpan.FromMilliseconds(DurationMilliseconds); + /// as a . [JsonIgnore] public TimeSpan CapsLockHoldDelay => TimeSpan.FromMilliseconds(CapsLockHoldMilliseconds); } diff --git a/CursorLang/Models/ReleaseInfo.cs b/CursorLang/Models/ReleaseInfo.cs new file mode 100644 index 0000000..7249519 --- /dev/null +++ b/CursorLang/Models/ReleaseInfo.cs @@ -0,0 +1,18 @@ +namespace CursorLang.Models; + +/// +/// A file attached to a release. +/// +/// The name the file is saved to disk under. +/// A direct link to the content. +/// The size in bytes; zero when the hosting did not report it. +public sealed record ReleaseAsset(string FileName, Uri Url, long Size); + +/// +/// A release found in the repository. +/// +/// The version parsed from the tag. +/// The tag as is — that is what the interface shows. +/// The release page: the release notes live there too. +/// The MSIX package the application updates itself with. +public sealed record ReleaseInfo(Version Version, string Tag, Uri? PageUrl, ReleaseAsset Package); diff --git a/CursorLang/Models/StartupState.cs b/CursorLang/Models/StartupState.cs new file mode 100644 index 0000000..d25641a --- /dev/null +++ b/CursorLang/Models/StartupState.cs @@ -0,0 +1,30 @@ +namespace CursorLang.Models; + +/// +/// The state of startup. Follows StartupTaskState of Windows: the user and +/// the administrator each have their own way of forbidding startup, and the app has +/// to tell them apart so as not to promise what it cannot do. +/// +public enum StartupState +{ + /// Windows will not answer about startup — the setting is not shown. + Unavailable, + + /// Off, and the app can switch it on. + Disabled, + + /// On. + Enabled, + + /// + /// Switched off by the user in the settings of Windows. It goes back on only + /// there: a ban by the user is not for the app to overrule. + /// + DisabledByUser, + + /// Forbidden by the policy of the organisation. + DisabledByPolicy, + + /// Switched on by the policy of the organisation and not to be switched off. + EnabledByPolicy, +} diff --git a/CursorLang/Models/UpdateStatus.cs b/CursorLang/Models/UpdateStatus.cs new file mode 100644 index 0000000..5d59e8d --- /dev/null +++ b/CursorLang/Models/UpdateStatus.cs @@ -0,0 +1,29 @@ +namespace CursorLang.Models; + +/// +/// Which step the update is at. One value — one state of the interface: +/// the caption, the button and the progress bar are shown from it. +/// +public enum UpdateStatus +{ + /// There have been no checks yet. + Idle, + + /// A request to the repository is in flight. + Checking, + + /// The latest version is installed. + UpToDate, + + /// There is a newer version — it can be downloaded. + Available, + + /// The package is downloading. + Downloading, + + /// The package is downloaded and ready to install. + Ready, + + /// The check or the download failed. + Failed, +}