Put the QTC window's settings on its right-click menu

N1MM keeps them on a Setup tab inside the window; here they are a dialog behind
a right-click, which suits a window this size better. Four of them, with N1MM's
own defaults: how many QTCs a series carries, whether the RX Ready and Cfm steps
are stopped at on the way through, and whether Hdr Agn and Agn clear what they
are asking for again.

Each one changes what the window does. The series count is passed to the search
for contacts worth reporting, the two skip settings are the focus order, and the
two clear settings are what the Agn buttons do. The Cfm buttons also disappear
when a RTTY station is reading its own log out, which is what N1MM does with
them.

N1MM's remaining QTC settings are all about putting traffic on the air — the CW
messages for Agn and TU, the field spacing, the four SSB recordings, the RTTY
templates — and nothing here transmits, so they are left out rather than shown
as settings that do nothing. The dialog says so where the operator will look.

The right-click menu needed a background on the panel to come up anywhere but
over a control: a panel with no background is not hit-tested.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-28 00:10:39 +00:00
parent 9ae5078c84
commit 648da1918a
8 changed files with 146 additions and 17 deletions

View File

@@ -2,6 +2,8 @@ using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
using Nonemm.App.Configuration;
using Nonemm.App.Dialogs;
using Nonemm.Contests.Rules;
using Nonemm.Core;
using Nonemm.Session;
@@ -53,9 +55,12 @@ public sealed partial class QtcWindow : Window
Opened += (_, _) => FirstBox().Focus();
}
/// Where the cursor goes: the header when it has to be typed, the first
/// line when it is already filled in.
private TextBox FirstBox() => isSending ? rows[0].Time : HeaderBox;
/// Where the cursor goes: RX Ready when the operator wants that step, the
/// header when it has to be typed, the first line when it is filled in.
private Control FirstBox() =>
isSending ? rows[0].Time
: session.Settings.QtcSkipReady ? HeaderBox
: ReadyButton;
private void SetDirection(bool sending)
{
@@ -105,6 +110,8 @@ public sealed partial class QtcWindow : Window
int line = at;
again.Click += (_, _) => OnLineAgain(line);
confirm.Click += (_, _) => OnLineConfirm(line);
// nothing to confirm when a RTTY station is reading its own log out
confirm.IsVisible = !(isSending && position.Contest.Modes.Contains(ModeCategory.Digital));
Grid.SetRow(again, at);
Grid.SetColumn(again, 3);
Grid.SetRow(confirm, at);
@@ -145,7 +152,7 @@ public sealed partial class QtcWindow : Window
Paint();
return;
}
ready.AddRange(traffic.ToSend(station));
ready.AddRange(traffic.ToSend(station, session.Settings.QtcLinesPerSeries));
// the contest is what makes it RTTY, not whatever the radio is on now
bool rtty = position.Contest.Modes.Contains(ModeCategory.Digital);
HeaderBox.Text = ready.Count == 0
@@ -225,7 +232,17 @@ public sealed partial class QtcWindow : Window
private void MoveOn()
{
List<TextBox> order = [HeaderBox, .. rows.SelectMany(r => new[] { r.Time, r.Call, r.Number })];
List<Control> order = [HeaderBox];
foreach (Row row in rows)
{
order.Add(row.Time);
order.Add(row.Call);
order.Add(row.Number);
if (!session.Settings.QtcSkipConfirm && row.Confirm.IsVisible)
{
order.Add(row.Confirm);
}
}
int at = order.FindIndex(b => b.IsFocused);
if (at < 0)
{
@@ -248,7 +265,10 @@ public sealed partial class QtcWindow : Window
private void OnHeaderAgain(object? sender, RoutedEventArgs e)
{
HeaderBox.Text = "";
if (session.Settings.QtcHeaderAgainClears)
{
HeaderBox.Text = "";
}
HeaderBox.Focus();
}
@@ -263,7 +283,10 @@ public sealed partial class QtcWindow : Window
rows[at].Time.Focus();
return;
}
rows[at].Clear();
if (session.Settings.QtcAgainClearsLine)
{
rows[at].Clear();
}
rows[at].Time.Focus();
Paint();
}
@@ -307,6 +330,17 @@ public sealed partial class QtcWindow : Window
private void OnCancel(object? sender, RoutedEventArgs e) => Close(false);
private async void OnSetup(object? sender, RoutedEventArgs e)
{
QtcSetupDialog dialog = new(session.Settings);
if (await dialog.ShowDialog<Settings?>(this) is { } updated)
{
session.Save(updated);
Reset();
FirstBox().Focus();
}
}
/// One row per line, a second apart, so they keep their order in the log.
/// That is what N1MM does with them too.
private void Save(IReadOnlyList<WaeQtc> lines)