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/feature/format-request' into HEAD

KnifeLemon8344cc0d5508
diff --cc src/Filee.App/Assets/i18n/en.json
index 3040bd78,ccc172b1..52c51462
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@@ -68,12 -56,12 +68,15 @@@
"toast.cancel": "Cancel",
"error.unsupported_source": "This file type isn't supported",
+ "format_request.request": "Request this format",
+ "format_request.notice_title": "Filee can't convert {0} files yet",
+ "format_request.notice_text": "Tell us which format you need.\nRequests decide what Filee supports next.\nEncrypted or copy-protected (DRM) files can't be converted, whatever the format.",
"error.no_route": "No engine can do this conversion",
"error.cannot_turn": "Rotate and flip work on images only",
+ "error.too_many_frames": "Too many frames to save as pictures, raise \"Every Nth frame\"",
+ "error.not_enough_space": "Not enough free disk space for the pictures",
"error.conversion_failed": "The engine reported an error",
+ "notice.pdf_not_smaller": "Couldn't make it smaller, so it was copied as it is",
"engine.reason.not_installed": "Not installed",
"engine.reason.error": "Error while checking",
diff --cc src/Filee.App/Assets/i18n/ko.json
index cf12ffaa,7a8895b4..1c53de4d
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@@ -68,12 -56,12 +68,15 @@@
"toast.cancel": "취소",
"error.unsupported_source": "지원하지 않는 파일 형식이에요",
+ "format_request.request": "이 형식 요청하기",
+ "format_request.notice_title": "아직 {0} 파일은 변환할 수 없어요",
+ "format_request.notice_text": "필요한 형식을 알려주세요.\n요청을 보고 다음에 지원할 형식을 정해요.\n암호화되거나 DRM이 걸린 파일은 변환할 수 없어요.",
"error.no_route": "이 변환을 할 수 있는 엔진이 없어요",
"error.cannot_turn": "회전·반전은 이미지에만 할 수 있어요",
+ "error.too_many_frames": "프레임이 너무 많아요. 'N번째 프레임마다' 값을 늘려 주세요",
+ "error.not_enough_space": "이미지를 저장할 디스크 공간이 부족해요",
"error.conversion_failed": "엔진에서 오류가 발생했어요",
+ "notice.pdf_not_smaller": "더 작게 만들 수 없어서 그대로 복사했어요",
"engine.reason.not_installed": "설치되지 않음",
"engine.reason.error": "확인 중 오류",
diff --cc src/Filee.App/Assets/i18n/zh-CN.json
index 14d4f712,b2b065ce..abb0b93a
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@@ -68,12 -56,12 +68,15 @@@
"toast.cancel": "取消",
"error.unsupported_source": "不支持此文件类型",
+ "format_request.request": "请求支持此格式",
+ "format_request.notice_title": "Filee 暂时无法转换 {0} 文件",
+ "format_request.notice_text": "告诉我们你需要的格式。\n我们会根据请求决定接下来支持哪些格式。\n加密或有复制保护 (DRM) 的文件,无论什么格式都无法转换。",
"error.no_route": "没有引擎可以完成此转换",
"error.cannot_turn": "只能旋转和翻转图片",
+ "error.too_many_frames": "帧数太多,请调大“每 N 帧”",
+ "error.not_enough_space": "磁盘空间不足,无法保存这些图片",
"error.conversion_failed": "转换引擎出错",
+ "notice.pdf_not_smaller": "无法再缩小,已原样复制",
"engine.reason.not_installed": "未安装",
"engine.reason.error": "检查时出错",
diff --cc src/Filee.App/Services/RadialController.cs
index 789759aa,3212a406..3456df0a
--- a/src/Filee.App/Services/RadialController.cs
+++ b/src/Filee.App/Services/RadialController.cs
@@@ -46,10 -47,8 +47,12 @@@ public sealed class RadialController
private JobViewModel? _lastRingJob; // for "click the ✓ to open the folder"
private IDisposable? _handOffTimer;
private int _dragGeneration;
+ private bool _dragReachedDonut;
+
+ /// <summary>A gesture over something that isn't a file drag (a rubber-band selection) is common: a line now and then.</summary>
+ private static readonly LogThrottle Throttle = new(TimeSpan.FromMinutes(1));
+ private bool _converted; // a conversion started from the files on the donut now
+ private readonly HashSet<string> _formatRequestsOffered = new(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// How long a drag that never brought files may keep the invisible window up, in case the button release is
@@@ -73,7 -72,7 +76,8 @@@
// A ring from an earlier conversion (finished or handed to the toast) must not keep this gesture's window up.
window.DonutControl.LeaveProgressMode();
_dropped = false;
+ _dragReachedDonut = false;
+ _converted = false;
viewModel.ResetForDrag();
window.DonutControl.AllowContextEdit = false;
PlaceAndShow(window, x, y, activate: false);
diff --cc src/Filee.App/Services/WindowService.cs
index be501452,6044a3b9..c435b52c
--- a/src/Filee.App/Services/WindowService.cs
+++ b/src/Filee.App/Services/WindowService.cs
@@@ -130,17 -133,22 +133,33 @@@ public sealed class WindowService(ILoca
_feedbackNotice.Show();
}
+ /// <summary>Shows the "Filee is running as administrator" card in the bottom-right corner (once per run).</summary>
+ public void ShowElevationNotice()
+ {
+ if (_elevationNoticeShown)
+ return;
+ _elevationNoticeShown = true;
+ new ElevationNoticeWindow(services.GetRequiredService<ElevationService>()).Show();
+ }
+
+ private bool _elevationNoticeShown;
+
+ /// <summary>
+ /// Shows the "Filee can't convert .ncm files yet" card with "Request this format", replacing an earlier one.
+ /// </summary>
+ public void ShowFormatRequestNotice(IReadOnlyList<string> extensions)
+ {
+ _formatRequestNotice?.Close();
+ var notice = new FormatRequestNoticeWindow(extensions, loc.Format("format_request.notice_title", FormatRequest.Label(extensions)));
+ notice.Closed += (_, _) =>
+ {
+ if (_formatRequestNotice == notice)
+ _formatRequestNotice = null;
+ };
+ _formatRequestNotice = notice;
+ notice.Show();
+ }
+
/// <summary>Opens the preset popup. Returns true when the user saved (the preset object was updated).</summary>
public async Task<bool> EditPresetAsync(Preset preset, Window? owner)
{
diff --cc src/Filee.App/ViewModels/JobViewModel.cs
index f7f9f72c,b0000016..6cf19a25
--- a/src/Filee.App/ViewModels/JobViewModel.cs
+++ b/src/Filee.App/ViewModels/JobViewModel.cs
@@@ -41,9 -42,12 +42,15 @@@ public sealed partial class JobViewMode
[ObservableProperty] private string? _errorDetails;
[ObservableProperty] private bool _canRetry;
+ /// <summary>Notes on files that converted (e.g. a PDF that couldn't be made smaller and was copied), one per line.</summary>
+ [ObservableProperty] private string? _notices;
+ [ObservableProperty] private bool _hasNotices;
+ /// <summary>Extensions of failed files Filee can't read (".ncm"), for "Request this format".</summary>
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(CanRequestFormat))]
+ private IReadOnlyList<string> _unknownExtensions = [];
+
+ public bool CanRequestFormat => UnknownExtensions.Count > 0;
/// <summary>Source files that failed.</summary>
public IEnumerable<string> FailedSources => Job.Files.Where(f => f.State == FileState.Failed).Select(f => f.SourcePath);
@@@ -64,12 -68,11 +71,16 @@@
ErrorDetails = failed.Count == 0 ? null : string.Join(Environment.NewLine,
failed.Select(f => $"{Path.GetFileName(f.SourcePath)} — {FailureText.Reason(_loc, f.ErrorKey, f.ErrorDetail)}"));
CanRetry = _retry is not null && !IsRunning && failed.Count > 0;
+ IReadOnlyList<string> unknown = IsRunning ? [] : FormatRequest.UnknownExtensions(
+ failed.Where(f => f.ErrorKey == "error.unsupported_source").Select(f => f.SourcePath));
+ if (!unknown.SequenceEqual(UnknownExtensions))
+ UnknownExtensions = unknown;
+ var noted = Job.Files.Where(f => f.State == FileState.Done && f.NoticeKey is not null).ToList();
+ HasNotices = noted.Count > 0;
+ Notices = noted.Count == 0 ? null : string.Join(Environment.NewLine,
+ noted.Select(f => $"{Path.GetFileName(f.SourcePath)} — {_loc[f.NoticeKey!]}"));
+
Status = Job.State switch
{
JobState.Completed when Job.Files.All(f => f.State == FileState.Skipped) => _loc["toast.skipped"],
diff --cc src/Filee.App/Views/ToastWindow.axaml
index c0ac3544,7562790d..9d8498c9
--- a/src/Filee.App/Views/ToastWindow.axaml
+++ b/src/Filee.App/Views/ToastWindow.axaml
@@@ -83,8 -83,9 +83,11 @@@
</DockPanel>
<TextBlock Classes="caption danger" Text="{Binding ErrorDetails}" TextWrapping="Wrap" MaxLines="4"
IsVisible="{Binding HasErrors}" />
+ <TextBlock Classes="caption" Text="{Binding Notices}" TextWrapping="Wrap" MaxLines="4"
+ IsVisible="{Binding HasNotices}" />
+ <!-- Files of a type Filee doesn't know: open the GitHub "Format request" form (FormatRequest). -->
+ <Button HorizontalAlignment="Left" Padding="10,4" Click="OnRequestFormat"
+ IsVisible="{Binding CanRequestFormat}" Content="{DynamicResource format_request.request}" />
</StackPanel>
</Border>
</DataTemplate>
diff --cc tests/Filee.App.Tests/RenderTests.cs
index a141fdd7,36b71464..0f48b26b
--- a/tests/Filee.App.Tests/RenderTests.cs
+++ b/tests/Filee.App.Tests/RenderTests.cs
@@@ -1202,16 -1113,17 +1202,31 @@@ public class RenderTest
[InlineData("en")]
[InlineData("ko")]
[InlineData("zh-CN")]
+ public void Close_dialog_renders(string language)
+ {
+ TestServices.EnsureInitialized(language);
+ var dialog = new CloseAskWindow();
+ dialog.Show();
+ Pump();
+ Save(dialog, $"window-close-{language}.png");
+ dialog.Close();
+ }
+
++ [AvaloniaTheory]
++ [InlineData("en")]
++ [InlineData("ko")]
++ [InlineData("zh-CN")]
+ public void Format_request_notice_renders(string language)
+ {
+ TestServices.EnsureInitialized(language);
+ var loc = AppHost.Get<ILocalizer>();
+ var notice = new FormatRequestNoticeWindow([".ncm"], loc.Format("format_request.notice_title", ".ncm"));
+ notice.Show();
+ Pump();
+ Save(notice, $"window-format-request-{language}.png");
+ notice.Close();
+ }
+
private static void Pump()
{
// Let layout, bindings and a few animation frames run.