mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-09-13 06:07:30 -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
@@ -41,6 +41,9 @@ internal partial class ProcessQueueControl : UserControl
|
||||
autoScrollChk.CheckedChanged += (s, e) => ViewModel.AutoScrollQueue = autoScrollChk.Checked;
|
||||
|
||||
concurrencyNum.Minimum = ViewModel.MinConcurrentDownloads;
|
||||
// The flat hard limit, not this machine's capability - the same bound Chardonnay uses. A
|
||||
// maximum below the stored value would coerce the display down and write it back, losing an 8
|
||||
// chosen elsewhere just for opening the panel here.
|
||||
concurrencyNum.Maximum = ViewModel.MaxAllowedConcurrentDownloads;
|
||||
concurrencyNum.ValueChanged += (s, e) => ViewModel.MaxConcurrentDownloads = (int)concurrencyNum.Value;
|
||||
ProcessQueue_PropertyChanged(this, new PropertyChangedEventArgs(null));
|
||||
@@ -141,8 +144,28 @@ internal partial class ProcessQueueControl : UserControl
|
||||
autoScrollChk.Checked = ViewModel.AutoScrollQueue;
|
||||
if (e.PropertyName is null or nameof(ViewModel.MaxConcurrentDownloads))
|
||||
concurrencyNum.Value = ViewModel.MaxConcurrentDownloads;
|
||||
if (e.PropertyName is null or nameof(ViewModel.ConcurrencyHint))
|
||||
setConcurrencyHint();
|
||||
|
||||
// The settings table is full at three columns and the panel has no width to spare, so this
|
||||
// says what Chardonnay says in its spare column, in a tooltip instead of another label.
|
||||
void setConcurrencyHint()
|
||||
{
|
||||
const string what = "How many books download and decrypt at the same time. 1 downloads one at a time.";
|
||||
concurrencyHintToolTip.SetToolTip(
|
||||
concurrencyNum,
|
||||
ViewModel.ConcurrencyHint is string hint
|
||||
? $"{what}\r\nOnly {hint.Trim('(', ')')} - this machine has fewer processors to decrypt them."
|
||||
: what);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carries <see cref="ProcessQueueViewModel.ConcurrencyHint"/>. Built here rather than in the
|
||||
/// designer to keep the generated file out of the diff.
|
||||
/// </summary>
|
||||
private readonly ToolTip concurrencyHintToolTip = new();
|
||||
|
||||
/// <summary>
|
||||
/// View notified the model that a button was clicked
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user