pin the max number of calls for the call history to 200; fix bad handling of dark mode for call history window; move channel background color state further down to catch late entry calls;

pull/2/head
Bryan Biedenkapp 11 months ago
parent 000e0cfbbb
commit 55883a07e9

@ -14,13 +14,14 @@
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="{Binding BackgroundColor}" />
<Setter Property="Foreground" Value="{Binding ForegroundColor}" />
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Channel" Binding="{Binding Channel}" Width="*" />
<DataGridTextColumn Header="Channel" Binding="{Binding Channel}" Width="150" />
<DataGridTextColumn Header="Radio ID" Binding="{Binding SrcId}" Width="*" />
<DataGridTextColumn Header="Talkgroup" Binding="{Binding DstId}" Width="*" />
<DataGridTextColumn Header="Timestamp" Binding="{Binding Timestamp}" Width="*" />
<DataGridTextColumn Header="Timestamp" Binding="{Binding Timestamp}" Width="150" />
</DataGrid.Columns>
</DataGrid>
</Grid>

@ -8,6 +8,7 @@
* @license AGPLv3 License (https://opensource.org/licenses/AGPL-3.0)
*
* Copyright (C) 2025 Caleb, K4PHP
* Copyright (C) 2025 Bryan Biedenkapp, N2PLL
*
*/
@ -24,6 +25,8 @@ namespace dvmconsole
{
public static readonly DependencyProperty BackgroundColorProperty =
DependencyProperty.Register(nameof(BackgroundColor), typeof(Brush), typeof(CallEntry), new PropertyMetadata(Brushes.Transparent));
public static readonly DependencyProperty ForegroundColorProperty =
DependencyProperty.Register(nameof(ForegroundColor), typeof(Brush), typeof(CallEntry), new PropertyMetadata(Brushes.White));
/*
** Properties
@ -55,6 +58,15 @@ namespace dvmconsole
get { return (Brush)GetValue(BackgroundColorProperty); }
set { SetValue(BackgroundColorProperty, value); }
}
/// <summary>
/// Foreground color for call entry.
/// </summary>
public Brush ForegroundColor
{
get { return (Brush)GetValue(ForegroundColorProperty); }
set { SetValue(ForegroundColorProperty, value); }
}
} // public class CallEntry : DependencyObject
/// <summary>
@ -89,6 +101,9 @@ namespace dvmconsole
/// </summary>
public partial class CallHistoryWindow : Window
{
private const int MAX_CALL_HISTORY = 200;
private SettingsManager settingsManager;
/*
** Properties
*/
@ -105,9 +120,10 @@ namespace dvmconsole
/// <summary>
/// Initializes a new instance of the <see cref="CallHistoryWindow"/> class.
/// </summary>
public CallHistoryWindow()
public CallHistoryWindow(SettingsManager settingsManager)
{
InitializeComponent();
this.settingsManager = settingsManager;
ViewModel = new CallHistoryViewModel();
DataContext = ViewModel;
}
@ -132,6 +148,9 @@ namespace dvmconsole
{
Dispatcher.Invoke(() =>
{
if (ViewModel.CallHistory.Count == MAX_CALL_HISTORY)
ViewModel.CallHistory.RemoveAt(MAX_CALL_HISTORY - 1);
ViewModel.CallHistory.Insert(0, new CallEntry
{
Channel = channel,
@ -155,6 +174,8 @@ namespace dvmconsole
{
foreach (var entry in ViewModel.CallHistory.Where(c => c.Channel == channel && c.SrcId == srcId))
{
entry.ForegroundColor = Brushes.Black;
if (!encrypted)
entry.BackgroundColor = Brushes.LightGreen;
else
@ -174,6 +195,10 @@ namespace dvmconsole
{
foreach (var entry in ViewModel.CallHistory.Where(c => c.Channel == channel && c.SrcId == srcId))
{
if (settingsManager.DarkMode)
entry.ForegroundColor = Brushes.White;
else
entry.ForegroundColor = Brushes.Black;
entry.BackgroundColor = Brushes.Transparent;
}
});

@ -514,13 +514,8 @@ namespace dvmconsole
channel.LastSrcId = "Last: " + alias;
if (channel.algId != P25Defines.P25_ALGO_UNENCRYPT)
{
channel.Background = ChannelBox.ORANGE_GRADIENT;
Log.WriteLine($"({system.Name}) P25D: Traffic *CALL ENC PARMS * PEER {e.PeerId} SRC_ID {e.SrcId} TGID {e.DstId} ALGID {channel.algId} KID {channel.kId} [STREAM ID {e.StreamId}]");
}
else
channel.Background = ChannelBox.GREEN_GRADIENT;
}
// is the call over?
if (((e.DUID == P25DUID.TDU) || (e.DUID == P25DUID.TDULC)) && (slot.RxType != fnecore.FrameType.TERMINATOR))
@ -534,6 +529,12 @@ namespace dvmconsole
return;
}
// do background updates here -- this catches late entry
if (channel.algId != P25Defines.P25_ALGO_UNENCRYPT)
channel.Background = ChannelBox.ORANGE_GRADIENT;
else
channel.Background = ChannelBox.GREEN_GRADIENT;
byte[] newMI = new byte[P25Defines.P25_MI_LENGTH];
int count = 0;

@ -108,7 +108,7 @@ namespace dvmconsole
private ChannelBox playbackChannelBox;
CallHistoryWindow callHistoryWindow = new CallHistoryWindow();
CallHistoryWindow callHistoryWindow;
public static string PLAYBACKTG = "LOCPLAYBACK";
public static string PLAYBACKSYS = "Local Playback";
@ -150,6 +150,7 @@ namespace dvmconsole
DisableControls();
settingsManager.LoadSettings();
callHistoryWindow = new CallHistoryWindow(settingsManager);
selectedChannelsManager = new SelectedChannelsManager();
flashingManager = new FlashingBackgroundManager(null, channelsCanvas, null, this);

Loading…
Cancel
Save

Powered by TurnKey Linux.