Open a log N1MM wrote

Three things stopped it.

A contest is keyed by ContestNR, not by ContestID. ContestID is only the
ContestInstance table's primary key; DXLOG.ContestNR refers to ContestNR, which
is what N1MM's SQLWhereString matches on. The two agree in a fresh log and
drift apart in one that has been used for a while, so we were reading one
contest's header with another contest's contacts. In a real log of 56284
contacts, joining on ContestID disagreed with the contact's own ContestName
52029 times; joining on ContestNR disagreed 109 times.

N1MM names a contest per mode: CQWWCW, CQWWSSB, CQWWRTTY, never plain CQWW.
Our contests now use those names, and N1mmContestNames turns one back into a
contest and a mode when a log is opened. The name carries the mode, so it beats
the ModeCategory column. Plain CQWW still opens, because older versions wrote
it that way.

The log columns were sized by counting characters, which was too narrow for the
headers: those are drawn in the theme's font, not the grid's monospace. The
grid sizes them now, with the character count as a floor so a column of short
values does not collapse.

Bandmap spots now age from when they arrived rather than from the time written
in them. A node with a wrong clock, or one replaying its backlog on connect,
emptied the bandmap as fast as it filled it.

Checked by opening a real 56284-contact N1MM log under Xvfb and reading the
contest and contacts back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 16:27:35 +00:00
parent b9f0166777
commit da9884ebf5
17 changed files with 315 additions and 34 deletions

View File

@@ -13,7 +13,10 @@ namespace Nonemm.App.Windows;
public sealed partial class LogWindow : RefreshableWindow
{
/// Roughly the width of one character of the grid font, in device pixels.
private const double CharacterWidth = 8;
private const double CharacterWidth = 7.5;
/// What a cell takes either side of its text.
private const double CellPadding = 20;
private readonly AppSession session;
private string builtFor = "";
@@ -75,7 +78,8 @@ public sealed partial class LogWindow : RefreshableWindow
Rows.Columns.Add(new DataGridTextColumn
{
Header = column.Label,
Width = new DataGridLength(column.Width * CharacterWidth),
Width = DataGridLength.Auto,
MinWidth = MinimumFor(column.Width),
Binding = new Binding($"[{column.Field}]") { Mode = BindingMode.TwoWay },
});
}
@@ -84,15 +88,23 @@ public sealed partial class LogWindow : RefreshableWindow
Rows.Columns.Add(ReadOnlyColumn("Mult", nameof(LogRow.Multipliers), 5));
}
private static DataGridTextColumn ReadOnlyColumn(string header, string property, int characters) =>
private DataGridTextColumn ReadOnlyColumn(string header, string property, int characters) =>
new()
{
Header = header,
IsReadOnly = true,
Width = new DataGridLength(characters * CharacterWidth),
Width = DataGridLength.Auto,
MinWidth = MinimumFor(characters),
Binding = new Binding(property),
};
/// The grid sizes a column to the wider of its header and the values it can
/// see. The header is in the theme's own font, not the grid's monospace, so
/// counting characters gets it wrong; the count is only a floor, so a
/// column of short values does not collapse.
private static double MinimumFor(int characters) =>
(characters * CharacterWidth) + CellPadding;
/// True when the edit was taken. A refused edit puts the reason in the
/// summary line and the cell falls back to what it held before.
private bool Edit(Qso qso, QsoField field, string text)