mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-09-12 21:57:19 -04:00
Bound concurrency by the hard limit and say what the machine will do
Taking the alternative offered in review. The spinner's maximum is the flat hard limit now, the same number in both UIs and on every machine, and machine capability is applied only at the point of use. Bounding the control by capability made it lie in two directions at once. Below the stored value, a two-way spinner coerces its display down to its maximum and writes that back, so opening the panel on a smaller machine overwrote an 8 chosen on a larger one. Raising the bound to meet the stored value fixed that but left a stored 8 displaying 8 on a two-core box that will only ever run 2. The two UIs had also drifted apart: Avalonia bound Maximum and ratcheted down, WinForms set it once in the constructor, so within a session you could lower and re-raise in one and not the other. What is left is the gap between what the setting says and what runs, and that is now stated rather than hidden. Chardonnay shows "(2 on this machine)" beside the spinner, in the spare column the settings row already had. Classic's settings table is full at three columns with no width to spare, so it says the same thing in the control's tooltip.
This commit is contained in:
1 parent
84c6f6fed0
commit
1eddccbe63
3 files changed
+57
-8
No files matched your search
@@ -81,7 +81,9 @@ public class ProcessQueueViewModel : ReactiveObject
|
||||
var clamped = Math.Clamp(value, Configuration.MinConcurrentDownloads, Configuration.ConcurrentDownloadsHardLimit);
|
||||
RaiseAndSetIfChanged(ref _maxConcurrentDownloads, clamped);
|
||||
Configuration.Instance.MaxConcurrentDownloads = clamped;
|
||||
RaisePropertyChanged(nameof(MaxAllowedConcurrentDownloads));
|
||||
// The bound is constant now; what changes with the setting is whether this machine can
|
||||
// keep up with it.
|
||||
RaisePropertyChanged(nameof(ConcurrencyHint));
|
||||
}
|
||||
}
|
||||
private int _maxConcurrentDownloads;
|
||||
@@ -98,14 +100,26 @@ public class ProcessQueueViewModel : ReactiveObject
|
||||
public int MinConcurrentDownloads => Configuration.MinConcurrentDownloads;
|
||||
|
||||
/// <summary>
|
||||
/// The spinner's upper bound: what this machine can usefully manage, but never below what is
|
||||
/// already stored. A spinner whose maximum sits under the stored value coerces its displayed
|
||||
/// value down to the maximum and, being two-way, writes that back - which would overwrite an 8
|
||||
/// chosen on a larger machine with a 2 just for opening the panel on a smaller one. Raising the
|
||||
/// bound to meet the stored value leaves the setting alone; lowering it is still the user's to do.
|
||||
/// The spinner's upper bound: the flat hard limit, so both UIs agree and the bound is the same
|
||||
/// number on every machine. Bounding it by machine capability instead makes the control lie in two
|
||||
/// directions at once - a spinner whose maximum sits under the stored value coerces its display
|
||||
/// down and, being two-way, writes that back, so opening the panel on a smaller machine would
|
||||
/// overwrite an 8 chosen on a larger one; while raising the bound to meet the stored value leaves
|
||||
/// a stored 8 showing 8 on a two-core box that will only ever run 2. Capability is applied where
|
||||
/// it actually bites, in <see cref="EffectiveConcurrentDownloads"/>, and <see cref="ConcurrencyHint"/>
|
||||
/// says so on screen rather than leaving the two to disagree in silence.
|
||||
/// </summary>
|
||||
public int MaxAllowedConcurrentDownloads
|
||||
=> Math.Max(Configuration.MaxAllowedConcurrentDownloads, MaxConcurrentDownloads);
|
||||
public int MaxAllowedConcurrentDownloads => Configuration.ConcurrentDownloadsHardLimit;
|
||||
|
||||
/// <summary>
|
||||
/// Sits beside the spinner when this machine cannot deliver the number the user chose, and is
|
||||
/// null when it can. Closes the gap left by bounding the control at the hard limit: the setting
|
||||
/// keeps saying what was asked for, and this says what will happen.
|
||||
/// </summary>
|
||||
public string? ConcurrencyHint
|
||||
=> EffectiveConcurrentDownloads < MaxConcurrentDownloads
|
||||
? $"({EffectiveConcurrentDownloads} on this machine)"
|
||||
: null;
|
||||
public string? RunningTime { get => field; set => RaiseAndSetIfChanged(ref field, value); }
|
||||
public bool ProgressBarVisible { get => field; set => RaiseAndSetIfChanged(ref field, value); }
|
||||
public bool AnyCompleted => CompletedCount > 0;
|
||||
|
||||
Reference in new issue
Block a user