mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2024-11-25 14:42:44 +01:00
Compare commits
No commits in common. "15e8b9da63fc14d8e2cfb5fa2977f576994dd5d0" and "bff86b09c77f993ae0e4121e826163140d208f4a" have entirely different histories.
15e8b9da63
...
bff86b09c7
@ -8,7 +8,7 @@
|
|||||||
<entry key="Desktop/Dialogs/Message/MessageDialog.axaml" value="Desktop/Desktop.csproj" />
|
<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/Dialogs/Progress/ProgressDialog.axaml" value="Desktop/Desktop.csproj" />
|
||||||
<entry key="Desktop/Main/AboutWindow.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/ServerConfigurationPanel.axaml" value="Desktop/Desktop.csproj" />
|
||||||
<entry key="Desktop/Main/Controls/StatusBar.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" />
|
<entry key="Desktop/Main/MainWindow.axaml" value="Desktop/Desktop.csproj" />
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:controls="clr-namespace:DHT.Desktop.Main.Controls"
|
xmlns:controls="clr-namespace:DHT.Desktop.Main.Controls"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
x:Class="DHT.Desktop.Main.Controls.MessageFilterPanel">
|
x:Class="DHT.Desktop.Main.Controls.FilterPanel">
|
||||||
|
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<controls:MessageFilterPanelModel />
|
<controls:FilterPanelModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
|
|
||||||
<UserControl.Styles>
|
<UserControl.Styles>
|
@ -4,11 +4,11 @@ using Avalonia.Markup.Xaml;
|
|||||||
|
|
||||||
namespace DHT.Desktop.Main.Controls {
|
namespace DHT.Desktop.Main.Controls {
|
||||||
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||||
public sealed class MessageFilterPanel : UserControl {
|
public sealed class FilterPanel : UserControl {
|
||||||
private CalendarDatePicker StartDatePicker => this.FindControl<CalendarDatePicker>("StartDatePicker");
|
private CalendarDatePicker StartDatePicker => this.FindControl<CalendarDatePicker>("StartDatePicker");
|
||||||
private CalendarDatePicker EndDatePicker => this.FindControl<CalendarDatePicker>("EndDatePicker");
|
private CalendarDatePicker EndDatePicker => this.FindControl<CalendarDatePicker>("EndDatePicker");
|
||||||
|
|
||||||
public MessageFilterPanel() {
|
public FilterPanel() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ namespace DHT.Desktop.Main.Controls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void CalendarDatePicker_OnSelectedDateChanged(object? sender, SelectionChangedEventArgs e) {
|
public void CalendarDatePicker_OnSelectedDateChanged(object? sender, SelectionChangedEventArgs e) {
|
||||||
if (DataContext is MessageFilterPanelModel model) {
|
if (DataContext is FilterPanelModel model) {
|
||||||
model.StartDate = StartDatePicker.SelectedDate;
|
model.StartDate = StartDatePicker.SelectedDate;
|
||||||
model.EndDate = EndDatePicker.SelectedDate;
|
model.EndDate = EndDatePicker.SelectedDate;
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ using DHT.Utils.Models;
|
|||||||
using DHT.Utils.Tasks;
|
using DHT.Utils.Tasks;
|
||||||
|
|
||||||
namespace DHT.Desktop.Main.Controls {
|
namespace DHT.Desktop.Main.Controls {
|
||||||
sealed class MessageFilterPanelModel : BaseModel, IDisposable {
|
sealed class FilterPanelModel : BaseModel, IDisposable {
|
||||||
private static readonly HashSet<string> FilterProperties = new () {
|
private static readonly HashSet<string> FilterProperties = new () {
|
||||||
nameof(FilterByDate),
|
nameof(FilterByDate),
|
||||||
nameof(StartDate),
|
nameof(StartDate),
|
||||||
@ -97,9 +97,9 @@ namespace DHT.Desktop.Main.Controls {
|
|||||||
private long? totalMessageCount;
|
private long? totalMessageCount;
|
||||||
|
|
||||||
[Obsolete("Designer")]
|
[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.window = window;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
|
|
@ -24,7 +24,7 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Command="{Binding OnClickToggleServerButton}" Content="{Binding ToggleServerButtonText}" IsEnabled="{Binding IsToggleServerButtonEnabled}" />
|
<Button Command="{Binding OnClickToggleServerButton}" Content="{Binding ToggleServerButtonText}" IsEnabled="{Binding IsToggleServerButtonEnabled}" />
|
||||||
<TextBlock TextWrapping="Wrap" Margin="0 15">
|
<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>
|
</TextBlock>
|
||||||
<WrapPanel>
|
<WrapPanel>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<Button Command="{Binding OnClickOpenViewer}" Margin="0 0 5 0">Open Viewer</Button>
|
<Button Command="{Binding OnClickOpenViewer}" Margin="0 0 5 0">Open Viewer</Button>
|
||||||
<Button Command="{Binding OnClickSaveViewer}" Margin="5 0 0 0">Save Viewer</Button>
|
<Button Command="{Binding OnClickSaveViewer}" Margin="5 0 0 0">Save Viewer</Button>
|
||||||
</StackPanel>
|
</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">
|
<Expander Header="Database Tools">
|
||||||
<StackPanel Orientation="Vertical" Spacing="10">
|
<StackPanel Orientation="Vertical" Spacing="10">
|
||||||
<StackPanel Orientation="Vertical" Spacing="4">
|
<StackPanel Orientation="Vertical" Spacing="4">
|
||||||
|
@ -31,7 +31,7 @@ namespace DHT.Desktop.Main.Pages {
|
|||||||
set => Change(ref hasFilters, value);
|
set => Change(ref hasFilters, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MessageFilterPanelModel FilterModel { get; }
|
private FilterPanelModel FilterModel { get; }
|
||||||
|
|
||||||
private readonly Window window;
|
private readonly Window window;
|
||||||
private readonly IDatabaseFile db;
|
private readonly IDatabaseFile db;
|
||||||
@ -43,7 +43,7 @@ namespace DHT.Desktop.Main.Pages {
|
|||||||
this.window = window;
|
this.window = window;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
|
|
||||||
FilterModel = new MessageFilterPanelModel(window, db);
|
FilterModel = new FilterPanelModel(window, db);
|
||||||
FilterModel.FilterPropertyChanged += OnFilterPropertyChanged;
|
FilterModel.FilterPropertyChanged += OnFilterPropertyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,12 +135,12 @@ namespace DHT.Desktop.Main.Pages {
|
|||||||
|
|
||||||
if (DatabaseToolFilterModeKeep) {
|
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?")) {
|
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) {
|
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?")) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace DHT.Server.Data.Filters {
|
namespace DHT.Server.Data.Filters {
|
||||||
public enum FilterRemovalMode {
|
public enum MessageFilterRemovalMode {
|
||||||
KeepMatching,
|
KeepMatching,
|
||||||
RemoveMatching
|
RemoveMatching
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ namespace DHT.Server.Database {
|
|||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveMessages(MessageFilter filter, FilterRemovalMode mode) {}
|
public void RemoveMessages(MessageFilter filter, MessageFilterRemovalMode mode) {}
|
||||||
|
|
||||||
public void Vacuum() {}
|
public void Vacuum() {}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace DHT.Server.Database {
|
|||||||
void AddMessages(Message[] messages);
|
void AddMessages(Message[] messages);
|
||||||
int CountMessages(MessageFilter? filter = null);
|
int CountMessages(MessageFilter? filter = null);
|
||||||
List<Message> GetMessages(MessageFilter? filter = null);
|
List<Message> GetMessages(MessageFilter? filter = null);
|
||||||
void RemoveMessages(MessageFilter filter, FilterRemovalMode mode);
|
void RemoveMessages(MessageFilter filter, MessageFilterRemovalMode mode);
|
||||||
|
|
||||||
void Vacuum();
|
void Vacuum();
|
||||||
}
|
}
|
||||||
|
@ -356,8 +356,8 @@ LEFT JOIN replied_to rt ON m.message_id = rt.message_id" + filter.GenerateWhereC
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveMessages(MessageFilter filter, FilterRemovalMode mode) {
|
public void RemoveMessages(MessageFilter filter, MessageFilterRemovalMode mode) {
|
||||||
var whereClause = filter.GenerateWhereClause(invert: mode == FilterRemovalMode.KeepMatching);
|
var whereClause = filter.GenerateWhereClause(invert: mode == MessageFilterRemovalMode.KeepMatching);
|
||||||
if (string.IsNullOrEmpty(whereClause)) {
|
if (string.IsNullOrEmpty(whereClause)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user