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.

Merge remote-tracking branch 'origin/main' into feature/interactive-crop-and-donut-paging

KnifeLemonc446911fc10f
diff --cc src/Filee.Core/Settings/AppSettings.cs
index 4b28a9fb,79863577..1ed547f8
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@@ -64,7 -65,7 +65,7 @@@ public sealed class DonutSetting
public 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 = 26;
public int SchemaVersion { get; set; } = CurrentSchemaVersion;
diff --cc src/Filee.Core/Settings/UserDataStore.cs
index 92eeb56b,17dea6ea..c00f21b6
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@@ -627,29 -627,10 +627,33 @@@ internal static class SettingsMigration
// the user already takes them.
if (from < 23)
changed |= LearnExtensions(profiles, out _, ["mhtml", "mht"]);
- // v24: interactive "Crop" tool, after "Remove background" as in a new library, on no donut: users add it in
- // Settings → Toolbar. Present already but saved since by a Filee before 24: that one read the unknown
+ // v24: macro-enabled PowerPoint templates (.potm) open from the presentation donut next to POTX, unless a donut
+ // of the user already takes them.
+ if (from < 24)
+ changed |= LearnExtensions(profiles, out _, ["potm"]);
++ // v26: interactive "Crop" tool, after "Remove background" as in a new library, on no donut: users add it in
++ // Settings → Toolbar. Present already but saved since by a Filee before 26: that one read the unknown
+ // kind as a Group, dropped the target format and left an empty group. Kind and target format are put back,
+ // the user's own changes (name, file name pattern) stay.
- if (from < 24)
++ if (from < 26)
+ {
+ if (BuiltInData.CreatePresets().FirstOrDefault(p => p.Id == "tool-crop") is { } crop)
+ {
+ if (presets.FirstOrDefault(p => p.Id == "tool-crop") is not { } existing)
+ {
+ var at = presets.FindIndex(p => p.Id == "remove-background");
+ presets.Insert(at < 0 ? presets.Count : at + 1, crop);
+ changed = true;
+ }
+ else if (existing.Kind != PresetKind.Tool)
+ {
+ existing.Kind = PresetKind.Tool;
+ existing.TargetFormat = crop.TargetFormat;
+ existing.SubPresetIds = [];
+ changed = true;
+ }
+ }
+ }
return changed;
}
diff --cc tests/Filee.Core.Tests/UserDataStoreTests.cs
index 5374aba2,5129bac7..2f5637e1
--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs
+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs
@@@ -843,42 -998,6 +998,42 @@@ public class UserDataStoreTest
Assert.False(SettingsMigrations.ApplyToLibrary(17, presets, profiles)); // once only
}
+ [Fact]
- public void Version_23_libraries_get_crop_tool_preset_after_remove_background_on_no_donut()
++ public void Version_25_libraries_get_crop_tool_preset_after_remove_background_on_no_donut()
+ {
+ var presets = BuiltInData.CreatePresets();
+ presets.RemoveAll(p => p.Id == "tool-crop");
+ var profiles = BuiltInData.CreateProfiles();
+
- Assert.True(SettingsMigrations.ApplyToLibrary(23, presets, profiles));
++ Assert.True(SettingsMigrations.ApplyToLibrary(25, presets, profiles));
+
+ var crop = presets.Single(p => p.Id == "tool-crop");
+ Assert.Equal(PresetKind.Tool, crop.Kind);
+ Assert.Equal("remove-background", presets[presets.IndexOf(crop) - 1].Id);
+ Assert.DoesNotContain(profiles, p => p.PresetIds.Contains("tool-crop"));
- Assert.False(SettingsMigrations.ApplyToLibrary(23, presets, profiles)); // once only
++ Assert.False(SettingsMigrations.ApplyToLibrary(25, presets, profiles)); // once only
+ }
+
+ [Fact]
+ public void Back_from_an_older_Filee_tool_crop_works_again_and_keeps_the_users_changes()
+ {
- // What a Filee before 24 leaves after saving: kind read as Group, TargetFormat dropped, SubPresetIds empty, the rest as it was.
++ // What a Filee before 26 leaves after saving: kind read as Group, TargetFormat dropped, SubPresetIds empty, the rest as it was.
+ var presets = BuiltInData.CreatePresets();
+ var crop = presets.Single(p => p.Id == "tool-crop");
+ crop.Kind = PresetKind.Group;
+ crop.TargetFormat = Preset.GroupTarget;
+ crop.SubPresetIds = [];
+ crop.Name = "Trim";
+
- Assert.True(SettingsMigrations.ApplyToLibrary(23, presets, BuiltInData.CreateProfiles()));
++ Assert.True(SettingsMigrations.ApplyToLibrary(25, presets, BuiltInData.CreateProfiles()));
+
+ Assert.Equal(PresetKind.Tool, crop.Kind);
+ Assert.Equal(BuiltInData.SameAsSource, crop.TargetFormat);
+ Assert.Empty(crop.SubPresetIds);
+ Assert.Equal("Trim", crop.Name);
+ Assert.Single(presets, p => p.Id == "tool-crop");
+ }
+
[Fact]
public void Back_from_an_older_Filee_compress_pdf_compresses_again_and_keeps_the_users_changes()
{