Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Add configurable conversion history limit

gtxPrimeb35c64441721
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index df3dd260..1475b0e2 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -211,6 +211,7 @@
"general.close.Quit": "Quit Filee",
"general.history": "Conversion history",
"general.no_history": "Don't keep a history of recent conversions",
+ "general.max_history": "Maximum history items to keep",
"general.clear_history": "Clear history",
"general.history_count": "{0} conversion(s) in the history",
"general.history_cleared": "History cleared.",
diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.json
index a4a7658f..2a3f33e2 100644
--- a/src/Filee.App/Assets/i18n/es.json
+++ b/src/Filee.App/Assets/i18n/es.json
@@ -200,6 +200,7 @@
"general.close.Quit": "Salir de Filee",
"general.history": "Historial de conversiones",
"general.no_history": "No guardar un historial de las conversiones recientes",
+ "general.max_history": "Máximo de elementos en el historial",
"general.clear_history": "Borrar historial",
"general.history_count": "{0} conversión(es) en el historial",
"general.history_cleared": "Historial borrado.",
diff --git a/src/Filee.App/Assets/i18n/hi.json b/src/Filee.App/Assets/i18n/hi.json
index cdef7ca9..64b08049 100644
--- a/src/Filee.App/Assets/i18n/hi.json
+++ b/src/Filee.App/Assets/i18n/hi.json
@@ -200,6 +200,7 @@
"general.close.Quit": "Filee बंद करें",
"general.history": "कन्वर्ज़न इतिहास",
"general.no_history": "हाल के कन्वर्ज़न का इतिहास न रखें",
+ "general.max_history": "इतिहास में रखने के लिए अधिकतम प्रविष्टियाँ",
"general.clear_history": "इतिहास साफ़ करें",
"general.history_count": "इतिहास में {0} कन्वर्ज़न",
"general.history_cleared": "इतिहास साफ़ हो गया।",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index e70dfab9..36e5ec5d 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -211,6 +211,7 @@
"general.close.Quit": "Filee 종료",
"general.history": "변환 기록",
"general.no_history": "최근 변환 기록 남기지 않기",
+ "general.max_history": "보관할 최대 기록 수",
"general.clear_history": "기록 지우기",
"general.history_count": "기록 {0}개",
"general.history_cleared": "기록을 지웠어요.",
diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.json
index 969fc55b..e6338588 100644
--- a/src/Filee.App/Assets/i18n/pl.json
+++ b/src/Filee.App/Assets/i18n/pl.json
@@ -211,6 +211,7 @@
"general.close.Quit": "Zakończ Filee",
"general.history": "Historia konwersji",
"general.no_history": "Nie zapisuj historii ostatnich konwersji",
+ "general.max_history": "Maksymalna liczba wpisów w historii",
"general.clear_history": "Wyczyść historię",
"general.history_count": "Konwersje w historii: {0}",
"general.history_cleared": "Historia wyczyszczona.",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 19c10eb3..aa98a6fb 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -211,6 +211,7 @@
"general.close.Quit": "退出 Filee",
"general.history": "转换记录",
"general.no_history": "不保留最近的转换记录",
+ "general.max_history": "最多保留的历史记录条数",
"general.clear_history": "清除记录",
"general.history_count": "共 {0} 条记录",
"general.history_cleared": "记录已清除。",
diff --git a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
index c67b9e2e..9c35aa36 100644
--- a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
+++ b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
@@ -33,6 +33,7 @@ public sealed partial class GeneralPageViewModel : ObservableObject, IDisposable
_startWithSystem = store.Settings.StartWithSystem;
_contextMenu = store.Settings.ContextMenuEnabled;
_noHistory = !store.Settings.KeepHistory;
+ _maxHistoryCount = Math.Clamp(store.Settings.MaxHistory, 50, 2000);
OutputLocations = new[] { OutputLocation.SameFolder, OutputLocation.Subfolder, OutputLocation.CustomFolder }
.Select(v => new Choice<OutputLocation>(v, loc[$"presets.location.{v}"])).ToList();
var output = store.Settings.DefaultOutput;
@@ -194,6 +195,14 @@ public sealed partial class GeneralPageViewModel : ObservableObject, IDisposable
partial void OnNoHistoryChanged(bool value) => Save(s => s.KeepHistory = !value);
+ [ObservableProperty] private int _maxHistoryCount;
+
+ partial void OnMaxHistoryCountChanged(int value)
+ {
+ var clamped = Math.Clamp(value, 50, 2000);
+ Save(s => s.MaxHistory = clamped);
+ }
+
partial void OnHistoryClearedChanged(bool value) => OnPropertyChanged(nameof(HistoryText));
private bool CanClearHistory() => HistoryCount > 0;
diff --git a/src/Filee.App/Views/Pages/GeneralPage.axaml b/src/Filee.App/Views/Pages/GeneralPage.axaml
index 776ec64a..e59cfff2 100644
--- a/src/Filee.App/Views/Pages/GeneralPage.axaml
+++ b/src/Filee.App/Views/Pages/GeneralPage.axaml
@@ -57,6 +57,11 @@
<StackPanel Spacing="12">
<TextBlock Classes="h2" Text="{DynamicResource general.history}" />
<ToggleSwitch Content="{DynamicResource general.no_history}" IsChecked="{Binding NoHistory}" />
+ <StackPanel Orientation="Horizontal" Spacing="10" IsVisible="{Binding !NoHistory}">
+ <TextBlock Classes="label" VerticalAlignment="Center" Text="{DynamicResource general.max_history}" />
+ <NumericUpDown Value="{Binding MaxHistoryCount}" Minimum="50" Maximum="2000" Increment="50"
+ FormatString="0" Width="120" />
+ </StackPanel>
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="{DynamicResource general.clear_history}" Command="{Binding ClearHistoryCommand}" />
<TextBlock Classes="muted" VerticalAlignment="Center" Text="{Binding HistoryText}" />
diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.cs
index f1d77877..313d90fb 100644
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@ -85,6 +85,9 @@ public sealed class AppSettings
/// <summary>Record finished conversions in the history (home page). Off: nothing new is recorded.</summary>
public bool KeepHistory { get; set; } = true;
+ /// <summary>Maximum number of finished conversions kept on the Home page (50–2000). Default 200.</summary>
+ public int MaxHistory { get; set; } = 200;
+
/// <summary>Newest version the user was already told about, so the update notice shows once per release.</summary>
public string? NotifiedUpdateVersion { get; set; }
diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.cs
index 72d44f90..a7975248 100644
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@ -16,7 +16,6 @@ namespace Filee.Core.Settings;
/// </summary>
public sealed class UserDataStore
{
- private const int MaxHistory = 200;
private readonly ILogger _log;
private readonly object _saveLock = new();
@@ -110,11 +109,12 @@ public sealed class UserDataStore
{
if (!Settings.KeepHistory)
return;
+ var maxHistory = Math.Clamp(Settings.MaxHistory, 50, 2000);
lock (_saveLock)
{
History.Insert(0, entry);
- if (History.Count > MaxHistory)
- History.RemoveRange(MaxHistory, History.Count - MaxHistory);
+ if (History.Count > maxHistory)
+ History.RemoveRange(maxHistory, History.Count - maxHistory);
}
Write(HistoryPath, History, FileeJsonContext.Default.ListHistoryEntry);
HistoryChanged?.Invoke(this, EventArgs.Empty);