1
0
mirror of https://github.com/chylex/Discord-History-Tracker.git synced 2024-10-17 17:42:51 +02:00

Compare commits

..

No commits in common. "15e8b9da63fc14d8e2cfb5fa2977f576994dd5d0" and "bff86b09c77f993ae0e4121e826163140d208f4a" have entirely different histories.

11 changed files with 20 additions and 20 deletions

View File

@ -8,7 +8,7 @@
<entry key="Desktop/Dialogs/Message/MessageDialog.axaml" value="Desktop/Desktop.csproj" />
<entry key="Desktop/Dialogs/Progress/ProgressDialog.axaml" value="Desktop/Desktop.csproj" />
<entry key="Desktop/Main/AboutWindow.axaml" value="Desktop/Desktop.csproj" />
<entry key="Desktop/Main/Controls/MessageFilterPanel.axaml" value="Desktop/Desktop.csproj" />
<entry key="Desktop/Main/Controls/FilterPanel.axaml" value="Desktop/Desktop.csproj" />
<entry key="Desktop/Main/Controls/ServerConfigurationPanel.axaml" value="Desktop/Desktop.csproj" />
<entry key="Desktop/Main/Controls/StatusBar.axaml" value="Desktop/Desktop.csproj" />
<entry key="Desktop/Main/MainWindow.axaml" value="Desktop/Desktop.csproj" />

View File

@ -4,10 +4,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:DHT.Desktop.Main.Controls"
mc:Ignorable="d"
x:Class="DHT.Desktop.Main.Controls.MessageFilterPanel">
x:Class="DHT.Desktop.Main.Controls.FilterPanel">
<Design.DataContext>
<controls:MessageFilterPanelModel />
<controls:FilterPanelModel />
</Design.DataContext>
<UserControl.Styles>

View File

@ -4,11 +4,11 @@ using Avalonia.Markup.Xaml;
namespace DHT.Desktop.Main.Controls {
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
public sealed class MessageFilterPanel : UserControl {
public sealed class FilterPanel : UserControl {
private CalendarDatePicker StartDatePicker => this.FindControl<CalendarDatePicker>("StartDatePicker");
private CalendarDatePicker EndDatePicker => this.FindControl<CalendarDatePicker>("EndDatePicker");
public MessageFilterPanel() {
public FilterPanel() {
InitializeComponent();
}
@ -25,7 +25,7 @@ namespace DHT.Desktop.Main.Controls {
}
public void CalendarDatePicker_OnSelectedDateChanged(object? sender, SelectionChangedEventArgs e) {
if (DataContext is MessageFilterPanelModel model) {
if (DataContext is FilterPanelModel model) {
model.StartDate = StartDatePicker.SelectedDate;
model.EndDate = EndDatePicker.SelectedDate;
}

View File

@ -15,7 +15,7 @@ using DHT.Utils.Models;
using DHT.Utils.Tasks;
namespace DHT.Desktop.Main.Controls {
sealed class MessageFilterPanelModel : BaseModel, IDisposable {
sealed class FilterPanelModel : BaseModel, IDisposable {
private static readonly HashSet<string> FilterProperties = new () {
nameof(FilterByDate),
nameof(StartDate),
@ -97,9 +97,9 @@ namespace DHT.Desktop.Main.Controls {
private long? totalMessageCount;
[Obsolete("Designer")]
public MessageFilterPanelModel() : this(null!, DummyDatabaseFile.Instance) {}
public FilterPanelModel() : this(null!, DummyDatabaseFile.Instance) {}
public MessageFilterPanelModel(Window window, IDatabaseFile db) {
public FilterPanelModel(Window window, IDatabaseFile db) {
this.window = window;
this.db = db;

View File

@ -24,7 +24,7 @@
<StackPanel>
<Button Command="{Binding OnClickToggleServerButton}" Content="{Binding ToggleServerButtonText}" IsEnabled="{Binding IsToggleServerButtonEnabled}" />
<TextBlock TextWrapping="Wrap" Margin="0 15">
The following settings determine how the tracking script communicates with this application. If you change them, you will have to copy/paste the tracking script again.
The following settings determine how the tracking script communicates with this application. If you change them, you will have to copy and apply the tracking script again.
</TextBlock>
<WrapPanel>
<StackPanel>

View File

@ -22,7 +22,7 @@
<Button Command="{Binding OnClickOpenViewer}" Margin="0 0 5 0">Open Viewer</Button>
<Button Command="{Binding OnClickSaveViewer}" Margin="5 0 0 0">Save Viewer</Button>
</StackPanel>
<controls:MessageFilterPanel DataContext="{Binding FilterModel}" Margin="0 20 0 0" />
<controls:FilterPanel DataContext="{Binding FilterModel}" Margin="0 20 0 0" />
<Expander Header="Database Tools">
<StackPanel Orientation="Vertical" Spacing="10">
<StackPanel Orientation="Vertical" Spacing="4">

View File

@ -31,7 +31,7 @@ namespace DHT.Desktop.Main.Pages {
set => Change(ref hasFilters, value);
}
private MessageFilterPanelModel FilterModel { get; }
private FilterPanelModel FilterModel { get; }
private readonly Window window;
private readonly IDatabaseFile db;
@ -43,7 +43,7 @@ namespace DHT.Desktop.Main.Pages {
this.window = window;
this.db = db;
FilterModel = new MessageFilterPanelModel(window, db);
FilterModel = new FilterPanelModel(window, db);
FilterModel.FilterPropertyChanged += OnFilterPropertyChanged;
}
@ -135,12 +135,12 @@ namespace DHT.Desktop.Main.Pages {
if (DatabaseToolFilterModeKeep) {
if (DialogResult.YesNo.Yes == await Dialog.ShowYesNo(window, "Keep Matching Messages in This Database", db.CountMessages(filter).Pluralize("message") + " will be kept, and the rest will be removed from this database. This action cannot be undone. Proceed?")) {
db.RemoveMessages(filter, FilterRemovalMode.KeepMatching);
db.RemoveMessages(filter, MessageFilterRemovalMode.KeepMatching);
}
}
else if (DatabaseToolFilterModeRemove) {
if (DialogResult.YesNo.Yes == await Dialog.ShowYesNo(window, "Remove Matching Messages in This Database", db.CountMessages(filter).Pluralize("message") + " will be removed from this database. This action cannot be undone. Proceed?")) {
db.RemoveMessages(filter, FilterRemovalMode.RemoveMatching);
db.RemoveMessages(filter, MessageFilterRemovalMode.RemoveMatching);
}
}
}

View File

@ -1,5 +1,5 @@
namespace DHT.Server.Data.Filters {
public enum FilterRemovalMode {
public enum MessageFilterRemovalMode {
KeepMatching,
RemoveMatching
}

View File

@ -39,7 +39,7 @@ namespace DHT.Server.Database {
return new();
}
public void RemoveMessages(MessageFilter filter, FilterRemovalMode mode) {}
public void RemoveMessages(MessageFilter filter, MessageFilterRemovalMode mode) {}
public void Vacuum() {}

View File

@ -20,7 +20,7 @@ namespace DHT.Server.Database {
void AddMessages(Message[] messages);
int CountMessages(MessageFilter? filter = null);
List<Message> GetMessages(MessageFilter? filter = null);
void RemoveMessages(MessageFilter filter, FilterRemovalMode mode);
void RemoveMessages(MessageFilter filter, MessageFilterRemovalMode mode);
void Vacuum();
}

View File

@ -356,8 +356,8 @@ LEFT JOIN replied_to rt ON m.message_id = rt.message_id" + filter.GenerateWhereC
return list;
}
public void RemoveMessages(MessageFilter filter, FilterRemovalMode mode) {
var whereClause = filter.GenerateWhereClause(invert: mode == FilterRemovalMode.KeepMatching);
public void RemoveMessages(MessageFilter filter, MessageFilterRemovalMode mode) {
var whereClause = filter.GenerateWhereClause(invert: mode == MessageFilterRemovalMode.KeepMatching);
if (string.IsNullOrEmpty(whereClause)) {
return;
}