Move the bandmap settings to a Configure Bandmap window

The spot timeouts, the QSY spot and CQ frequency distances and the
recent contact minutes leave the telnet Filters tab for a window under
Config. Each is a numeric box with a range.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 12:31:34 +00:00
co-authored by Claude Sonnet 5.5
parent 9d0de3b129
commit f31ee5bc03
6 changed files with 87 additions and 22 deletions
@@ -0,0 +1,36 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Nonemm.App.Dialogs.BandmapDialog"
Title="Configure Bandmap" Width="460" SizeToContent="Height"
WindowStartupLocation="CenterOwner" CanResize="False">
<StackPanel Margin="14" Spacing="6">
<TextBlock Text="Spots stay on the bandmap for" FontWeight="SemiBold" />
<Grid ColumnDefinitions="*,8,130" RowDefinitions="Auto,Auto" RowSpacing="6">
<TextBlock Text="CW and digital" VerticalAlignment="Center" />
<NumericUpDown Name="CwDigitalTimeoutBox" Grid.Column="2" Minimum="1" Maximum="600"
Increment="1" FormatString="0 &quot;min&quot;" />
<TextBlock Grid.Row="1" Text="Phone" VerticalAlignment="Center" />
<NumericUpDown Name="PhoneTimeoutBox" Grid.Row="1" Grid.Column="2" Minimum="1" Maximum="600"
Increment="1" FormatString="0 &quot;min&quot;" />
</Grid>
<TextBlock Text="Local spots" FontWeight="SemiBold" Margin="0,8,0,0" />
<Grid ColumnDefinitions="*,8,130" RowDefinitions="Auto,Auto,Auto" RowSpacing="6">
<TextBlock Text="Spot the call in the entry window when the radio moves more than"
TextWrapping="Wrap" VerticalAlignment="Center" />
<NumericUpDown Name="QsySpotBox" Grid.Column="2" Minimum="100" Maximum="50000"
Increment="100" FormatString="0 &quot;Hz&quot;" />
<TextBlock Grid.Row="1" Text="Go back to search and pounce when the radio moves off the CQ frequency by more than"
TextWrapping="Wrap" VerticalAlignment="Center" />
<NumericUpDown Name="CqLeaveBox" Grid.Row="1" Grid.Column="2" Minimum="100" Maximum="50000"
Increment="100" FormatString="0 &quot;Hz&quot;" />
<TextBlock Grid.Row="2" Text="On opening and resync, spot the contacts logged in the last (0 for none)"
TextWrapping="Wrap" VerticalAlignment="Center" />
<NumericUpDown Name="RecentSpotBox" Grid.Row="2" Grid.Column="2" Minimum="0" Maximum="600"
Increment="1" FormatString="0 &quot;min&quot;" />
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="6" Margin="0,8,0,0">
<Button Content="Cancel" Click="OnCancel" />
<Button Content="Save" Click="OnSave" IsDefault="True" />
</StackPanel>
</StackPanel>
</Window>
@@ -0,0 +1,39 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Nonemm.App.Configuration;
namespace Nonemm.App.Dialogs;
/// How long spots stay on the bandmap, and when the program puts a station on
/// it by itself.
public sealed partial class BandmapDialog : Window
{
private readonly Settings settings;
public BandmapDialog(Settings settings)
{
this.settings = settings;
InitializeComponent();
CwDigitalTimeoutBox.Value = settings.CwDigitalSpotTimeoutMinutes;
PhoneTimeoutBox.Value = settings.PhoneSpotTimeoutMinutes;
QsySpotBox.Value = settings.QsySpotHertz;
CqLeaveBox.Value = settings.CqLeaveHertz;
RecentSpotBox.Value = settings.RecentContactSpotMinutes;
}
private void OnSave(object? sender, RoutedEventArgs e) =>
Close(settings with
{
CwDigitalSpotTimeoutMinutes = Read(CwDigitalTimeoutBox, settings.CwDigitalSpotTimeoutMinutes),
PhoneSpotTimeoutMinutes = Read(PhoneTimeoutBox, settings.PhoneSpotTimeoutMinutes),
QsySpotHertz = Read(QsySpotBox, settings.QsySpotHertz),
CqLeaveHertz = Read(CqLeaveBox, settings.CqLeaveHertz),
RecentContactSpotMinutes = Read(RecentSpotBox, settings.RecentContactSpotMinutes),
});
/// A box the operator emptied keeps the setting it had.
private static int Read(NumericUpDown box, int fallback) =>
box.Value is { } value ? (int)value : fallback;
private void OnCancel(object? sender, RoutedEventArgs e) => Close(null);
}
@@ -572,6 +572,17 @@ public sealed partial class EntryWindow
}
}
private async void OnBandmapSettings(object? sender, RoutedEventArgs e)
{
BandmapDialog dialog = new(session.Settings);
Settings? updated = await dialog.ShowDialog<Settings?>(this);
if (updated is not null)
{
session.Save(updated);
Status("bandmap settings saved");
}
}
private async void OnBroadcastSettings(object? sender, RoutedEventArgs e)
{
BroadcastDataDialog dialog = new(session.Settings);
+1
View File
@@ -101,6 +101,7 @@
<MenuItem Header="Configure Ports, Mode Control, Winkey, etc…" Click="OnKeyerSettings" />
<MenuItem Header="Configure Radios…" Click="OnRadioSettings" />
<MenuItem Header="Configure Cluster…" Click="OnClusterSettings" />
<MenuItem Header="Configure Bandmap…" Click="OnBandmapSettings" />
<MenuItem Header="Change Your Station Data…" Click="OnStationSettings" />
<MenuItem Header="Change Operator…" Click="OnChangeOperator" InputGesture="Ctrl+O" />
<Separator />
@@ -48,11 +48,6 @@ public sealed partial class TelnetWindow
CallAreasBox.Text = string.Join(' ', filter.CallAreas);
BlockedSpottersBox.Text = string.Join(' ', filter.BlockedSpotters);
BlockedCallsBox.Text = string.Join(' ', filter.BlockedCalls);
TimeoutBox.Text = session.Settings.CwDigitalSpotTimeoutMinutes.ToString(CultureInfo.InvariantCulture);
PhoneTimeoutBox.Text = session.Settings.PhoneSpotTimeoutMinutes.ToString(CultureInfo.InvariantCulture);
QsySpotBox.Text = session.Settings.QsySpotHertz.ToString(CultureInfo.InvariantCulture);
RecentSpotBox.Text = session.Settings.RecentContactSpotMinutes.ToString(CultureInfo.InvariantCulture);
CqLeaveBox.Text = session.Settings.CqLeaveHertz.ToString(CultureInfo.InvariantCulture);
SpotCommentBox.Text = session.Settings.SpotComment;
}
@@ -75,13 +70,6 @@ public sealed partial class TelnetWindow
PreferredSpotters = Words(PreferredSpottersBox.Text),
},
RandomizeSpots = RandomizeBox.IsChecked == true,
CwDigitalSpotTimeoutMinutes = Minutes(TimeoutBox.Text, session.Settings.CwDigitalSpotTimeoutMinutes),
PhoneSpotTimeoutMinutes = Minutes(PhoneTimeoutBox.Text, session.Settings.PhoneSpotTimeoutMinutes),
QsySpotHertz = Minutes(QsySpotBox.Text, session.Settings.QsySpotHertz),
RecentContactSpotMinutes = int.TryParse(RecentSpotBox.Text, out int recent) && recent >= 0
? recent
: session.Settings.RecentContactSpotMinutes,
CqLeaveHertz = Minutes(CqLeaveBox.Text, session.Settings.CqLeaveHertz),
});
Show("*** filters applied — they hold for the spots that arrive from now on", NoticeColour);
}
-10
View File
@@ -120,16 +120,6 @@
<TextBox Name="BlockedSpottersBox" />
<TextBlock Classes="label" Text="Blacklisted calls" />
<TextBox Name="BlockedCallsBox" />
<TextBlock Classes="label" Text="Bandmap spot timeout for CW and digital (minutes)" />
<TextBox Name="TimeoutBox" Width="60" HorizontalAlignment="Left" />
<TextBlock Classes="label" Text="Bandmap spot timeout for phone (minutes)" />
<TextBox Name="PhoneTimeoutBox" Width="60" HorizontalAlignment="Left" />
<TextBlock Classes="label" Text="Spot a call locally when the radio moves more than (Hz)" />
<TextBox Name="QsySpotBox" Width="60" HorizontalAlignment="Left" />
<TextBlock Classes="label" Text="Go back to search and pounce when the radio moves off the CQ frequency by more than (Hz)" TextWrapping="Wrap" />
<TextBox Name="CqLeaveBox" Width="60" HorizontalAlignment="Left" />
<TextBlock Classes="label" Text="Spot the contacts logged in the last (minutes) on opening and resync, 0 for none" TextWrapping="Wrap" />
<TextBox Name="RecentSpotBox" Width="60" HorizontalAlignment="Left" />
<Button Content="Apply" Click="OnApplyFilters" Margin="0,10,0,0" />
</StackPanel>
</ScrollViewer>