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