Add a select all players button to the logs UI
This commit is contained in:
@@ -10,7 +10,6 @@ public class AdminLogPlayerButton : Button
|
|||||||
Id = id;
|
Id = id;
|
||||||
ClipText = true;
|
ClipText = true;
|
||||||
ToggleMode = true;
|
ToggleMode = true;
|
||||||
Pressed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ public class AdminLogTypeButton : Button
|
|||||||
Type = type;
|
Type = type;
|
||||||
ClipText = true;
|
ClipText = true;
|
||||||
ToggleMode = true;
|
ToggleMode = true;
|
||||||
Pressed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LogType Type { get; }
|
public LogType Type { get; }
|
||||||
|
|||||||
@@ -30,8 +30,12 @@
|
|||||||
<BoxContainer Orientation="Vertical" MinWidth="200">
|
<BoxContainer Orientation="Vertical" MinWidth="200">
|
||||||
<LineEdit Name="PlayerSearch" Access="Public" StyleClasses="actionSearchBox"
|
<LineEdit Name="PlayerSearch" Access="Public" StyleClasses="actionSearchBox"
|
||||||
HorizontalExpand="true" PlaceHolder="{Loc admin-logs-search-players-placeholder}"/>
|
HorizontalExpand="true" PlaceHolder="{Loc admin-logs-search-players-placeholder}"/>
|
||||||
|
<BoxContainer Orientation="Horizontal">
|
||||||
|
<Button Name="SelectAllPlayersButton" Text="{Loc admin-logs-select-all}"
|
||||||
|
MinWidth="100" StyleClasses="ButtonSquare"></Button>
|
||||||
<Button Name="SelectNoPlayersButton" Text="{Loc admin-logs-select-none}"
|
<Button Name="SelectNoPlayersButton" Text="{Loc admin-logs-select-none}"
|
||||||
StyleClasses="ButtonSquare"/>
|
MinWidth="100" StyleClasses="ButtonSquare"/>
|
||||||
|
</BoxContainer>
|
||||||
<ScrollContainer VerticalExpand="True">
|
<ScrollContainer VerticalExpand="True">
|
||||||
<BoxContainer Name="PlayersContainer" Access="Public" Orientation="Vertical"/>
|
<BoxContainer Name="PlayersContainer" Access="Public" Orientation="Vertical"/>
|
||||||
</ScrollContainer>
|
</ScrollContainer>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
SelectAllTypesButton.OnPressed += SelectAllTypes;
|
SelectAllTypesButton.OnPressed += SelectAllTypes;
|
||||||
SelectNoTypesButton.OnPressed += SelectNoTypes;
|
SelectNoTypesButton.OnPressed += SelectNoTypes;
|
||||||
|
|
||||||
|
SelectAllPlayersButton.OnPressed += SelectAllPlayers;
|
||||||
SelectNoPlayersButton.OnPressed += SelectNoPlayers;
|
SelectNoPlayersButton.OnPressed += SelectNoPlayers;
|
||||||
|
|
||||||
RoundSpinBox.IsValid = i => i > 0 && i <= CurrentRound;
|
RoundSpinBox.IsValid = i => i > 0 && i <= CurrentRound;
|
||||||
@@ -90,7 +91,7 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
UpdateTypes();
|
UpdateTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayerSearchChanged(LineEditEventArgs obj)
|
private void PlayerSearchChanged(LineEditEventArgs args)
|
||||||
{
|
{
|
||||||
UpdatePlayers();
|
UpdatePlayers();
|
||||||
}
|
}
|
||||||
@@ -100,7 +101,7 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
UpdateLogs();
|
UpdateLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectAllTypes(ButtonEventArgs obj)
|
private void SelectAllTypes(ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
SelectedTypes.Clear();
|
SelectedTypes.Clear();
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
UpdateLogs();
|
UpdateLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectNoTypes(ButtonEventArgs obj)
|
private void SelectNoTypes(ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
SelectedTypes.Clear();
|
SelectedTypes.Clear();
|
||||||
|
|
||||||
@@ -136,7 +137,25 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
UpdateLogs();
|
UpdateLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectNoPlayers(ButtonEventArgs obj)
|
private void SelectAllPlayers(ButtonEventArgs args)
|
||||||
|
{
|
||||||
|
SelectedPlayers.Clear();
|
||||||
|
|
||||||
|
foreach (var control in PlayersContainer.Children)
|
||||||
|
{
|
||||||
|
if (control is not AdminLogPlayerButton player)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.Pressed = true;
|
||||||
|
SelectedPlayers.Add(player.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateLogs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectNoPlayers(ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
SelectedPlayers.Clear();
|
SelectedPlayers.Clear();
|
||||||
|
|
||||||
@@ -311,7 +330,8 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
{
|
{
|
||||||
var button = new AdminLogTypeButton(type)
|
var button = new AdminLogTypeButton(type)
|
||||||
{
|
{
|
||||||
Text = type.ToString()
|
Text = type.ToString(),
|
||||||
|
Pressed = true
|
||||||
};
|
};
|
||||||
|
|
||||||
SelectedTypes.Add(type);
|
SelectedTypes.Add(type);
|
||||||
@@ -349,7 +369,8 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
{
|
{
|
||||||
var button = new AdminLogPlayerButton(id)
|
var button = new AdminLogPlayerButton(id)
|
||||||
{
|
{
|
||||||
Text = name
|
Text = name,
|
||||||
|
Pressed = true
|
||||||
};
|
};
|
||||||
|
|
||||||
SelectedPlayers.Add(id);
|
SelectedPlayers.Add(id);
|
||||||
@@ -397,8 +418,9 @@ public partial class AdminLogsWindow : SS14Window
|
|||||||
LogSearch.OnTextChanged -= LogSearchChanged;
|
LogSearch.OnTextChanged -= LogSearchChanged;
|
||||||
|
|
||||||
SelectAllTypesButton.OnPressed -= SelectAllTypes;
|
SelectAllTypesButton.OnPressed -= SelectAllTypes;
|
||||||
|
|
||||||
SelectNoTypesButton.OnPressed -= SelectNoTypes;
|
SelectNoTypesButton.OnPressed -= SelectNoTypes;
|
||||||
|
|
||||||
|
SelectAllPlayersButton.OnPressed -= SelectAllPlayers;
|
||||||
SelectNoPlayersButton.OnPressed -= SelectNoPlayers;
|
SelectNoPlayersButton.OnPressed -= SelectNoPlayers;
|
||||||
|
|
||||||
RoundSpinBox.IsValid = null;
|
RoundSpinBox.IsValid = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user