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.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Keep the history search, the history limit and One ZIP on the archives donut
KnifeLemon0f5805735b48
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.jsonindex c2cb2325..3ca7d56b 100644--- a/src/Filee.App/Assets/i18n/en.json+++ b/src/Filee.App/Assets/i18n/en.json@@ -39,6 +39,7 @@"startup.no_answer": "Filee is running but didn't answer.\nIf it runs as administrator, quit it from the tray and start it again.","home.recent": "Recent conversions","home.recent_empty": "Your converted files will show up here.",+ "home.no_matches": "No recent conversion matches the search.","home.open_folder": "Open folder","home.clear_history": "Clear","home.files": "{0} files",@@ -215,7 +216,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.history_limit": "Conversions to keep in the history","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.jsonindex be99729e..a25c675e 100644--- a/src/Filee.App/Assets/i18n/es.json+++ b/src/Filee.App/Assets/i18n/es.json@@ -36,6 +36,7 @@"startup.no_answer": "Filee se está ejecutando pero no responde.\nSi se está ejecutando como administrador, ciérralo desde la bandeja del sistema y vuelve a iniciarlo.","home.recent": "Conversiones recientes","home.recent_empty": "Tus archivos convertidos aparecerán aquí.",+ "home.no_matches": "Ninguna conversión reciente coincide con la búsqueda.","home.open_folder": "Abrir carpeta","home.clear_history": "Borrar","home.files": "{0} archivos",@@ -204,7 +205,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.history_limit": "Conversiones que se guardan 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.jsonindex 9e831317..28724f67 100644--- a/src/Filee.App/Assets/i18n/hi.json+++ b/src/Filee.App/Assets/i18n/hi.json@@ -36,6 +36,7 @@"startup.no_answer": "Filee चल रहा है लेकिन उसने जवाब नहीं दिया।\nअगर वह एडमिनिस्ट्रेटर के रूप में चल रहा है, तो उसे ट्रे से बंद करके दोबारा शुरू करें।","home.recent": "हाल के कन्वर्ज़न","home.recent_empty": "आपकी कन्वर्ट की गई फ़ाइलें यहाँ दिखाई देंगी।",+ "home.no_matches": "खोज से मेल खाता कोई हाल का कन्वर्ज़न नहीं है।","home.open_folder": "फ़ोल्डर खोलें","home.clear_history": "साफ़ करें","home.files": "{0} फ़ाइलें",@@ -204,7 +205,7 @@"general.close.Quit": "Filee बंद करें","general.history": "कन्वर्ज़न इतिहास","general.no_history": "हाल के कन्वर्ज़न का इतिहास न रखें",- "general.max_history": "इतिहास में रखने के लिए अधिकतम प्रविष्टियाँ",+ "general.history_limit": "इतिहास में रखे जाने वाले कन्वर्ज़न","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.jsonindex 3def4450..b2995845 100644--- a/src/Filee.App/Assets/i18n/ko.json+++ b/src/Filee.App/Assets/i18n/ko.json@@ -39,6 +39,7 @@"startup.no_answer": "Filee가 실행 중이지만 응답하지 않아요.\n관리자 권한으로 실행 중이라면 트레이에서 종료한 뒤 다시 실행해 주세요.","home.recent": "최근 변환","home.recent_empty": "변환한 파일이 여기에 표시됩니다.",+ "home.no_matches": "검색과 일치하는 변환 기록이 없어요.","home.open_folder": "폴더 열기","home.clear_history": "지우기","home.files": "파일 {0}개",@@ -215,7 +216,7 @@"general.close.Quit": "Filee 종료","general.history": "변환 기록","general.no_history": "최근 변환 기록 남기지 않기",- "general.max_history": "보관할 최대 기록 수",+ "general.history_limit": "보관할 최대 기록 수","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.jsonindex 9cbeb9e4..a2de2aab 100644--- a/src/Filee.App/Assets/i18n/pl.json+++ b/src/Filee.App/Assets/i18n/pl.json@@ -39,6 +39,7 @@"startup.no_answer": "Filee działa, ale nie odpowiada.\nJeśli działa jako administrator, zamknij je z zasobnika i uruchom jeszcze raz.","home.recent": "Ostatnie konwersje","home.recent_empty": "Tu pojawią się przekonwertowane pliki.",+ "home.no_matches": "Żadna z ostatnich konwersji nie pasuje do wyszukiwania.","home.open_folder": "Otwórz folder","home.clear_history": "Wyczyść","home.files": "Pliki: {0}",@@ -215,7 +216,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.history_limit": "Liczba konwersji zapisywanych 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.jsonindex 7e6564fd..3643fc1a 100644--- a/src/Filee.App/Assets/i18n/zh-CN.json+++ b/src/Filee.App/Assets/i18n/zh-CN.json@@ -39,6 +39,7 @@"startup.no_answer": "Filee 正在运行,但没有响应。\n如果它以管理员身份运行,请从托盘退出,然后再次启动。","home.recent": "最近的转换","home.recent_empty": "转换后的文件会显示在这里。",+ "home.no_matches": "没有与搜索匹配的转换记录。","home.open_folder": "打开文件夹","home.clear_history": "清除","home.files": "{0} 个文件",@@ -215,7 +216,7 @@"general.close.Quit": "退出 Filee","general.history": "转换记录","general.no_history": "不保留最近的转换记录",- "general.max_history": "最多保留的历史记录条数",+ "general.history_limit": "最多保留的转换记录条数","general.clear_history": "清除记录","general.history_count": "共 {0} 条记录","general.history_cleared": "记录已清除。",diff --git a/src/Filee.App/Services/DraggedFiles.cs b/src/Filee.App/Services/DraggedFiles.csindex 98b369a9..e5fca059 100644--- a/src/Filee.App/Services/DraggedFiles.cs+++ b/src/Filee.App/Services/DraggedFiles.cs@@ -16,11 +16,11 @@ internal static class DraggedFilesdata.Contains(DataFormat.File) || data.Items.Any(item => item.Formats.Any(IsFilenames));/// <summary>- /// Local file and folder paths in the drag (virtual items are ignored). A shortcut counts as the item it points- /// to; one to a folder counts as the folder.+ /// Local file paths in the drag (folders and virtual items are ignored). A shortcut counts as the file it points+ /// to; one to a folder is ignored like the folder./// </summary>public static IReadOnlyList<string> Local(IDataTransfer data) =>- Local(data, ConversionService.Exists, AppHost.Get<IPlatformServices>().ResolveShortcuts);+ Local(data, File.Exists, AppHost.Get<IPlatformServices>().ResolveShortcuts);internal static IReadOnlyList<string> Local(IDataTransfer data, Func<string, bool> fileExists,Func<IReadOnlyList<string>, IReadOnlyList<string>>? resolveShortcuts = null)diff --git a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.csindex 4bb41122..fdc231e6 100644--- a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs@@ -39,7 +39,7 @@ public sealed partial class GeneralPageViewModel : ObservableObject, IDisposable_showMenuBarIcon = store.Settings.ShowMenuBarIcon;_contextMenu = store.Settings.ContextMenuEnabled;_noHistory = !store.Settings.KeepHistory;- _maxHistoryCount = Math.Clamp(store.Settings.MaxHistory, 50, 2000);+ _historyLimit = store.Settings.EffectiveHistoryLimit;OutputLocations = new[] { OutputLocation.SameFolder, OutputLocation.Subfolder, OutputLocation.CustomFolder }.Select(v => new Choice<OutputLocation>(v, loc[$"presets.location.{v}"])).ToList();var output = store.Settings.DefaultOutput;@@ -222,7 +222,7 @@ public sealed partial class GeneralPageViewModel : ObservableObject, IDisposable}];}- // Conversion history (home page): don't record it, or clear what is there.+ // Conversion history (home page): don't record it, how much of it to keep, or clear what is there.[ObservableProperty] private bool _noHistory;[ObservableProperty]@@ -236,13 +236,11 @@ public sealed partial class GeneralPageViewModel : ObservableObject, IDisposablepartial void OnNoHistoryChanged(bool value) => Save(s => s.KeepHistory = !value);- [ObservableProperty] private int _maxHistoryCount;+ /// <summary>How many conversions the history keeps (<see cref="AppSettings.HistoryLimit"/>).</summary>+ [ObservableProperty] private int _historyLimit;- partial void OnMaxHistoryCountChanged(int value)- {- var clamped = Math.Clamp(value, 50, 2000);- Save(s => s.MaxHistory = clamped);- }+ partial void OnHistoryLimitChanged(int value) =>+ Save(s => s.HistoryLimit = Math.Clamp(value, AppSettings.MinHistoryLimit, AppSettings.MaxHistoryLimit));partial void OnHistoryClearedChanged(bool value) => OnPropertyChanged(nameof(HistoryText));diff --git a/src/Filee.App/ViewModels/Pages/HomePageViewModel.cs b/src/Filee.App/ViewModels/Pages/HomePageViewModel.csindex 07248013..45a691dd 100644--- a/src/Filee.App/ViewModels/Pages/HomePageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/HomePageViewModel.cs@@ -146,29 +146,52 @@ public sealed partial class HomePageViewModel : ObservableObject, IDisposablepublic string DropHint { get; }- public ObservableCollection<HistoryItemViewModel> History { get; } = [];+ /// <summary>How many conversions the page lists: the newest, or the newest that match the search.</summary>+ internal const int Shown = 40;- /// <summary>The history entries visible after the search query is applied.</summary>- public FilteredList<HistoryItemViewModel> VisibleHistory { get; }+ /// <summary>The conversions listed (each looks for its outputs on disk, so only <see cref="Shown"/> of them).</summary>+ public ObservableCollection<HistoryItemViewModel> History { get; } = [];+ /// <summary>+ /// What was typed in the search box: the list shows the conversions whose preset or a source file name contains+ /// it, from the whole history (<see cref="AppSettings.HistoryLimit"/>), not just the ones listed without it.+ /// </summary>[ObservableProperty] private string _search = "";- partial void OnSearchChanged(string value) => VisibleHistory.Query = value;+ partial void OnSearchChanged(string value) => Reload();+ /// <summary>No history at all: no search box, and the hint that converted files show up here.</summary>[ObservableProperty] private bool _isEmpty;+ /// <summary>A search that matches nothing.</summary>+ [ObservableProperty] private bool _noMatches;+private void Reload(){+ var query = Search.Trim();+ // The entries are picked first, then built: building one looks for its outputs on disk.+ var entries = _store.History+ .Where(entry => query.Length == 0 || Matches(entry, query))+ .Take(Shown)+ .ToList();History.Clear();- var max = Math.Clamp(_store.Settings.MaxHistory, 50, 2000);- foreach (var entry in _store.History.Take(max))+ foreach (var entry in entries)History.Add(new HistoryItemViewModel(entry, _loc, _platform, _conversions));- IsEmpty = History.Count == 0;+ IsEmpty = _store.History.Count == 0;+ NoMatches = !IsEmpty && History.Count == 0;+ }++ private static bool Matches(HistoryEntry entry, string query)+ {+ return Contains(entry.PresetName) || entry.Sources.Any(source => Contains(Path.GetFileName(source)));++ bool Contains(string? text) => text?.Contains(query, StringComparison.CurrentCultureIgnoreCase) == true;}[RelayCommand]private void ClearHistory(){+ Search = "";_store.ClearHistory();Reload();}diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.csindex 2a9d8c95..37f25c5b 100644--- a/src/Filee.App/ViewModels/RadialViewModel.cs+++ b/src/Filee.App/ViewModels/RadialViewModel.cs@@ -107,14 +107,6 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,.OfType<Preset>().ToList();- if ((files.Count > 1 || files.Any(Directory.Exists))- && Presets.All(p => !p.Archive.CombineIntoOne || p.TargetFormat != "zip")- && store.FindPreset("zip-all") is { } zipAll- && Presets.Count < ToolbarProfile.MaxSlices)- {- Presets.Add(zipAll);- }-_subPresets = Presets.Select(p => (IReadOnlyList<Preset>)(p.IsGroup ? p.SubPresetIds : []).Select(store.FindPreset).OfType<Preset>().Where(c => !c.IsGroup).Take(Preset.MaxSubPresets).ToList())diff --git a/src/Filee.App/Views/Pages/GeneralPage.axaml b/src/Filee.App/Views/Pages/GeneralPage.axamlindex af8895f4..f86af8f7 100644--- a/src/Filee.App/Views/Pages/GeneralPage.axaml+++ b/src/Filee.App/Views/Pages/GeneralPage.axaml@@ -63,10 +63,10 @@<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 IsVisible="{Binding !NoHistory}">+ <TextBlock Classes="label" Text="{DynamicResource general.history_limit}" />+ <NumericUpDown Value="{Binding HistoryLimit}" Minimum="50" Maximum="2000" Increment="50" FormatString="0"+ HorizontalAlignment="Left" MinWidth="160" /></StackPanel><StackPanel Orientation="Horizontal" Spacing="10"><Button Content="{DynamicResource general.clear_history}" Command="{Binding ClearHistoryCommand}" />diff --git a/src/Filee.App/Views/Pages/HomePage.axaml b/src/Filee.App/Views/Pages/HomePage.axamlindex 2c4bf843..ebdc6017 100644--- a/src/Filee.App/Views/Pages/HomePage.axaml+++ b/src/Filee.App/Views/Pages/HomePage.axaml@@ -74,14 +74,15 @@<Button DockPanel.Dock="Right" Classes="ghost" Content="{DynamicResource home.clear_history}" Command="{Binding ClearHistoryCommand}" /><TextBlock Classes="h2" VerticalAlignment="Center" Text="{DynamicResource home.recent}" /></DockPanel>- <TextBox Classes="search" Text="{Binding Search}" Watermark="{DynamicResource common.search}"+ <TextBox Classes="search" Text="{Binding Search}" PlaceholderText="{DynamicResource common.search}"IsVisible="{Binding !IsEmpty}"><TextBox.InnerLeftContent><PathIcon Width="14" Height="14" Margin="10,0,0,0" Data="{StaticResource Icon.Search}" Foreground="{DynamicResource TextSecondaryBrush}" /></TextBox.InnerLeftContent></TextBox><TextBlock Classes="muted" Text="{DynamicResource home.recent_empty}" IsVisible="{Binding IsEmpty}" />- <ItemsControl ItemsSource="{Binding VisibleHistory}">+ <TextBlock Classes="muted" Text="{DynamicResource home.no_matches}" IsVisible="{Binding NoMatches}" />+ <ItemsControl ItemsSource="{Binding History}"><ItemsControl.ItemsPanel><ItemsPanelTemplate><StackPanel Spacing="8" />diff --git a/src/Filee.Core/Conversion/ConversionJob.cs b/src/Filee.Core/Conversion/ConversionJob.csindex f14c218e..fcd1f06c 100644--- a/src/Filee.Core/Conversion/ConversionJob.cs+++ b/src/Filee.Core/Conversion/ConversionJob.cs@@ -66,18 +66,8 @@ public sealed class ConversionJobpublic IReadOnlyList<FileResult> Files { get; }public JobState State { get; internal set; } = JobState.Queued;- /// <summary>Overall progress 0..1: counts completed files as full and sums partial progress of running ones,- /// so files still waiting at 0 don't dilute the displayed percentage.</summary>- public double Progress- {- get- {- if (Files.Count == 0) return 1;- var done = Files.Count(f => f.State is FileState.Done or FileState.Skipped or FileState.Failed or FileState.Cancelled);- var partialSum = Files.Where(f => f.State == FileState.Running).Sum(f => f.Progress);- return (done + partialSum) / Files.Count;- }- }+ /// <summary>Overall progress 0..1.</summary>+ public double Progress => Files.Count == 0 ? 1 : Files.Average(f => f.Progress);/// <summary>Every file written by the job.</summary>public IEnumerable<string> Outputs => Files.SelectMany(f => f.Outputs);diff --git a/src/Filee.Core/Conversion/JobQueue.cs b/src/Filee.Core/Conversion/JobQueue.csindex 38ea37d6..03aa3dc0 100644--- a/src/Filee.Core/Conversion/JobQueue.cs+++ b/src/Filee.Core/Conversion/JobQueue.cs@@ -541,9 +541,6 @@ public sealed class JobQueue : IAsyncDisposable{await foreach (var job in _channel.Reader.ReadAllAsync()){- // NOTE: _busy was incremented by Enqueue before the job was written to the channel.- // Do NOT call RunAsync here — it has its own increment/decrement for external callers- // (tests, CLI). Calling it would double-increment and triple-decrement _busy.try{if (job.CancellationToken.IsCancellationRequested)@@ -553,7 +550,7 @@ public sealed class JobQueue : IAsyncDisposableJobFinished?.Invoke(this, job);continue;}- await RunJobAsync(job);+ await RunAsync(job);}finally{diff --git a/src/Filee.Core/Presets/BuiltInData.cs b/src/Filee.Core/Presets/BuiltInData.csindex dc6567bd..970c3a4c 100644--- a/src/Filee.Core/Presets/BuiltInData.cs+++ b/src/Filee.Core/Presets/BuiltInData.cs@@ -420,6 +420,7 @@ public static class BuiltInData{Id = "archives", NameKey = "profile.archives",Extensions = ExtensionsOf(FormatCategory.Archive),+ // "One ZIP" since settings schema 28.PresetIds = ["extract", "zip-all", "to-zip", "to-7z", "to-tgz", "to-tar"],},new()diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.csindex 21feb953..432ddcf6 100644--- a/src/Filee.Core/Settings/AppSettings.cs+++ b/src/Filee.Core/Settings/AppSettings.cs@@ -65,7 +65,7 @@ public sealed class DonutSettingspublic sealed class AppSettings{/// <summary>Current schema version. Increase when the format changes and add a migration.</summary>- public const int CurrentSchemaVersion = 24;+ public const int CurrentSchemaVersion = 28;public int SchemaVersion { get; set; } = CurrentSchemaVersion;@@ -86,8 +86,19 @@ 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>+ /// How many finished conversions the history keeps, newest first (<see cref="MinHistoryLimit"/> to+ /// <see cref="MaxHistoryLimit"/>; a value outside is taken as the nearest end). The home page lists the latest+ /// ones and searches all of them.+ /// </summary>+ public int HistoryLimit { get; set; } = 200;++ public const int MinHistoryLimit = 50;+ public const int MaxHistoryLimit = 2000;++ /// <summary><see cref="HistoryLimit"/> within its range.</summary>+ [JsonIgnore]+ public int EffectiveHistoryLimit => Math.Clamp(HistoryLimit, MinHistoryLimit, MaxHistoryLimit);/// <summary>Whether the macOS Dock shows Filee.</summary>[JsonConverter(typeof(IconPreferenceJsonConverter))]diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.csindex 038f1127..96b4e315 100644--- a/src/Filee.Core/Settings/UserDataStore.cs+++ b/src/Filee.Core/Settings/UserDataStore.cs@@ -109,12 +109,13 @@ public sealed class UserDataStore{if (!Settings.KeepHistory)return;- var maxHistory = Math.Clamp(Settings.MaxHistory, 50, 2000);+ // A lowered limit drops the oldest entries here, with the next conversion.+ var limit = Settings.EffectiveHistoryLimit;lock (_saveLock){History.Insert(0, entry);- if (History.Count > maxHistory)- History.RemoveRange(maxHistory, History.Count - maxHistory);+ if (History.Count > limit)+ History.RemoveRange(limit, History.Count - limit);}Write(HistoryPath, History, FileeJsonContext.Default.ListHistoryEntry);HistoryChanged?.Invoke(this, EventArgs.Empty);@@ -631,6 +632,10 @@ internal static class SettingsMigrations// of the user already takes them.if (from < 24)changed |= LearnExtensions(profiles, out _, ["potm"]);+ // v28: "One ZIP" on the archives donut after "Extract", to pack several archives into one. A donut+ // the user filled up, or a library without the preset, stays as it is.+ if (from < 28)+ changed |= Offer(presets, profiles, "archives", "zip-all", "extract");return changed;}diff --git a/src/Filee.Core/Watching/FileNameFilter.cs b/src/Filee.Core/Watching/FileNameFilter.csindex bdd032ea..f91f9275 100644--- a/src/Filee.Core/Watching/FileNameFilter.cs+++ b/src/Filee.Core/Watching/FileNameFilter.cs@@ -60,8 +60,6 @@ public sealed class FileNameFilter{if (patterns is null || patterns.Count == 0)return All;- if (Cache.Count > 256)- Cache.Clear();return Cache.GetOrAdd(string.Join('\n', patterns), _ =>{var regexes = new List<Regex>();diff --git a/src/Filee.Core/Watching/FolderWatcher.cs b/src/Filee.Core/Watching/FolderWatcher.csindex 6c6df318..86149b4c 100644--- a/src/Filee.Core/Watching/FolderWatcher.cs+++ b/src/Filee.Core/Watching/FolderWatcher.cs@@ -146,8 +146,6 @@ public sealed class FolderWatcher : IAsyncDisposablecontinue;_pending.TryRemove(path, out _);// A file that was converted before (same size and time) is not converted again.- if (_handled.Count > 10_000)- _handled.Clear();if (_handled.Add(current.Key(path)))ready.Add(path);}@@ -232,23 +230,9 @@ public sealed class FolderWatcher : IAsyncDisposableDirectory.CreateDirectory(Path.GetDirectoryName(target)!);var name = Path.GetFileNameWithoutExtension(target);var extension = Path.GetExtension(target);- for (var n = 2; ; n++)- {- if (File.Exists(target))- {- target = Path.Combine(Path.GetDirectoryName(target)!, $"{name} ({n}){extension}");- continue;- }- try- {- File.Move(source, target);- break;- }- catch (IOException) when (File.Exists(target) && n < 100)- {- target = Path.Combine(Path.GetDirectoryName(target)!, $"{name} ({n}){extension}");- }- }+ for (var n = 2; File.Exists(target); n++)+ target = Path.Combine(Path.GetDirectoryName(target)!, $"{name} ({n}){extension}");+ File.Move(source, target);}catch (Exception ex) when (ex is IOException or UnauthorizedAccessException){diff --git a/tests/Filee.App.Tests/DonutGroupTests.cs b/tests/Filee.App.Tests/DonutGroupTests.csindex 87028e16..a9591bdc 100644--- a/tests/Filee.App.Tests/DonutGroupTests.cs+++ b/tests/Filee.App.Tests/DonutGroupTests.cs@@ -672,19 +672,4 @@ public class DonutGroupTestsvar position = RadialController.WindowPosition(new PixelPoint(960, 540), new PixelRect(0, 0, 1920, 1080), side);Assert.Equal(new PixelPoint(960 - side / 2, 540 - side / 2), position);}-- [AvaloniaFact]- public void Multiple_files_or_folders_dynamically_include_zip_all_preset_on_the_donut()- {- TestServices.EnsureInitialized("en");- var vm = AppHost.Get<RadialViewModel>();- // Single file: uses images profile without zip-all- vm.Load([@"C:\photos\a.jpg"], clickMode: true);- Assert.DoesNotContain(vm.Items, item => item.Id == "zip-all");-- // Multiple files: dynamically includes zip-all- vm.Load([@"C:\photos\a.jpg", @"C:\photos\b.jpg"], clickMode: true);- Assert.Contains(vm.Items, item => item.Id == "zip-all");- }}-diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.csindex 0302a374..472b7d72 100644--- a/tests/Filee.App.Tests/RenderTests.cs+++ b/tests/Filee.App.Tests/RenderTests.cs@@ -32,6 +32,7 @@ public class RenderTests{ "general", "pl" }, { "toolbar", "pl" }, { "presets", "pl" }, { "home", "pl" },{ "home", "es" }, { "general", "es" }, { "toolbar", "es" }, { "presets", "es" }, { "engines", "es" },{ "home", "hi" }, { "toolbar", "hi" }, { "presets", "hi" }, { "engines", "hi" },+ { "general", "ko" }, { "general", "zh-CN" }, { "general", "pl" }, { "general", "hi" },};[AvaloniaTheory]@@ -323,6 +324,130 @@ public class RenderTests}}+ [AvaloniaTheory]+ [InlineData("en")]+ [InlineData("es")]+ [InlineData("ko")]+ [InlineData("zh-CN")]+ [InlineData("pl")]+ [InlineData("hi")]+ public void Home_page_search_finds_old_conversions_in_a_long_history(string language)+ {+ TestServices.EnsureInitialized(language);+ var store = AppHost.Get<Filee.Core.Settings.UserDataStore>();+ var loc = AppHost.Get<Filee.Core.Localization.ILocalizer>();+ // A full history (newest first), with the report far below what the page lists without a search.+ var entries = Enumerable.Range(0, store.Settings.EffectiveHistoryLimit).Select(i => new Filee.Core.History.HistoryEntry+ {+ FinishedAt = DateTime.Now.AddMinutes(-i),+ PresetName = i == 150 ? "PDF" : "PNG",+ State = Filee.Core.Conversion.JobState.Completed,+ Sources = i == 150 ? [@"C:\Work\Annual report.docx", @"C:\Work\notes.txt"] : [$@"C:\Photos\IMG_{i:0000}.heic"],+ });+ store.History.AddRange(entries);+ try+ {+ var vm = new MainWindowViewModel(AppHost.Services, loc, AppHost.Get<UpdateService>());+ vm.Navigate("home");+ var window = new MainWindow { DataContext = vm, Width = 1080, Height = 820 };+ window.Show();+ Pump();++ var page = (HomePageViewModel)vm.CurrentPage;+ Assert.Equal(HomePageViewModel.Shown, page.History.Count);+ var search = window.GetVisualDescendants().OfType<TextBox>().Single(t => t.Classes.Contains("search"));+ Assert.True(search.IsEffectivelyVisible);+ Assert.Equal(loc["common.search"], search.PlaceholderText);++ page.Search = " REPORT "; // any part of a source file name, ignoring case and spaces around+ Pump();+ var found = Assert.Single(page.History);+ Assert.Equal("PDF", found.Title);+ Assert.False(page.NoMatches);+ Save(window, $"page-home-search-{language}.png");++ page.Search = "PNG"; // the preset: the newest matches, no more than without a search+ Assert.Equal(HomePageViewModel.Shown, page.History.Count);+ Assert.All(page.History, item => Assert.Equal("PNG", item.Title));++ page.Search = "zzz";+ Pump();+ Assert.Empty(page.History);+ Assert.True(page.NoMatches);+ Assert.False(page.IsEmpty);+ Save(window, $"page-home-search-none-{language}.png");++ page.Search = "";+ Assert.Equal(HomePageViewModel.Shown, page.History.Count);+ window.Close();+ }+ finally+ {+ store.ClearHistory(); // also on disk: the next test's application loads the history again+ }+ }++ [AvaloniaFact]+ public void A_new_preset_shows_in_the_list_whatever_was_searched()+ {+ TestServices.EnsureInitialized("en");+ var store = AppHost.Get<Filee.Core.Settings.UserDataStore>();+ var vm = new MainWindowViewModel(AppHost.Services, AppHost.Get<Filee.Core.Localization.ILocalizer>(), AppHost.Get<UpdateService>());+ vm.Navigate("presets");+ var page = (PresetsPageViewModel)vm.CurrentPage;+ page.Search = "zzz";+ Assert.Empty(page.VisiblePresets);++ page.AddCommand.Execute(null);+ try+ {+ Assert.Equal("", page.Search);+ Assert.Contains(page.SelectedPreset!, page.VisiblePresets);+ }+ finally+ {+ store.Presets.Remove(page.SelectedPreset!.Preset);+ store.SaveLibrary();+ }+ }++ [AvaloniaFact]+ public void General_page_keeps_the_history_limit_within_its_range()+ {+ TestServices.EnsureInitialized("en");+ var store = AppHost.Get<Filee.Core.Settings.UserDataStore>();+ var before = store.Settings.HistoryLimit;+ try+ {+ var vm = new MainWindowViewModel(AppHost.Services, AppHost.Get<Filee.Core.Localization.ILocalizer>(), AppHost.Get<UpdateService>());+ vm.Navigate("general");+ var window = new MainWindow { DataContext = vm, Width = 1080, Height = 820 };+ window.Show();+ Pump();++ var page = (GeneralPageViewModel)vm.CurrentPage;+ Assert.Equal(200, page.HistoryLimit);+ var limit = window.GetVisualDescendants().OfType<NumericUpDown>().Single();+ Assert.True(limit.IsEffectivelyVisible);++ page.HistoryLimit = 500;+ Assert.Equal(500, store.Settings.HistoryLimit);+ page.HistoryLimit = 5000;+ Assert.Equal(Filee.Core.Settings.AppSettings.MaxHistoryLimit, store.Settings.HistoryLimit);++ page.NoHistory = true; // nothing is recorded: nothing to limit either+ Pump();+ Assert.False(limit.IsEffectivelyVisible);+ page.NoHistory = false;+ window.Close();+ }+ finally+ {+ store.Settings.HistoryLimit = before;+ store.SaveSettings();+ }+ }+[AvaloniaFact]public void Engines_page_shows_versions_descriptions_and_download_speed(){diff --git a/tests/Filee.Core.Tests/UserDataStoreTests.cs b/tests/Filee.Core.Tests/UserDataStoreTests.csindex 5129bac7..57e8a1b9 100644--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs@@ -330,6 +330,34 @@ public class UserDataStoreTestsAssert.Empty(reloaded.History);}+ [Fact]+ public void History_keeps_the_newest_entries_up_to_the_limit()+ {+ using var dir = new TempDir();+ var store = new UserDataStore(dir.Path);+ store.Load();+ Assert.Equal(200, store.Settings.HistoryLimit);++ store.Settings.HistoryLimit = 60;+ for (var i = 0; i < 70; i++)+ store.AddHistory(new Filee.Core.History.HistoryEntry { JobId = $"{i}" });+ Assert.Equal(60, store.History.Count);+ Assert.Equal("69", store.History[0].JobId);+ Assert.Equal("10", store.History[^1].JobId);++ // Lowered below the smallest limit: the oldest go with the next conversion, down to that smallest limit.+ store.Settings.HistoryLimit = 0;+ store.SaveSettings();+ store.AddHistory(new Filee.Core.History.HistoryEntry { JobId = "70" });+ Assert.Equal(AppSettings.MinHistoryLimit, store.History.Count);++ var reloaded = new UserDataStore(dir.Path);+ reloaded.Load();+ Assert.Equal(0, reloaded.Settings.HistoryLimit);+ Assert.Equal(AppSettings.MinHistoryLimit, reloaded.Settings.EffectiveHistoryLimit);+ Assert.Equal(AppSettings.MinHistoryLimit, reloaded.History.Count);+ }+[Fact]public void Version_1_settings_are_upgraded_to_the_current_engine_list(){@@ -756,6 +784,30 @@ public class UserDataStoreTestsAssert.DoesNotContain("potm", profiles.Single(p => p.Id == "presentations").Extensions);}+ [Fact]+ public void Version_27_libraries_get_one_zip_on_the_archives_donut_after_extract()+ {+ var presets = BuiltInData.CreatePresets();+ var profiles = BuiltInData.CreateProfiles();+ var archives = profiles.Single(p => p.Id == "archives");+ archives.PresetIds.Remove("zip-all");++ Assert.True(SettingsMigrations.ApplyToLibrary(27, presets, profiles));+ Assert.Equal(["extract", "zip-all", "to-zip", "to-7z", "to-tgz", "to-tar"], archives.PresetIds);+ Assert.False(SettingsMigrations.ApplyToLibrary(27, presets, profiles)); // once only++ // A library without the preset (the user deleted it) doesn't get it back, and a full donut stays full.+ presets.RemoveAll(p => p.Id == "zip-all");+ archives.PresetIds.Remove("zip-all");+ Assert.False(SettingsMigrations.ApplyToLibrary(27, presets, profiles));+ Assert.DoesNotContain("zip-all", archives.PresetIds);++ presets = BuiltInData.CreatePresets();+ archives.PresetIds = [.. presets.Where(p => p.Id != "zip-all").Take(ToolbarProfile.MaxSlices).Select(p => p.Id)];+ Assert.False(SettingsMigrations.ApplyToLibrary(27, presets, profiles));+ Assert.DoesNotContain("zip-all", archives.PresetIds);+ }+[Fact]public void Version_15_libraries_get_the_tracing_presets_on_the_images_donut_after_pdf(){