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.

Setup as one soft card with motion

KnifeLemon2a7827ac7ce2
diff --git a/.gitattributes b/.gitattributes
index e4cd7dff..93a4e242 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -24,3 +24,4 @@
*.shx binary
*.dbf binary
*.kmz binary
+*.webp binary
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 9ce382cc..c5190196 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -152,6 +152,15 @@ order), `AppLanguages` and `Assets/i18n/*.json` (Setup's texts are the `installe
Windows' own UI fonts (Segoe UI, Nirmala UI and the UI language's CJK font first; titles bold, as those CJK fonts
have no semibold) instead of the app's embedded Noto fonts.
+- **Look**: one borderless 640×420 card (`SetupWindow`, its own window buttons, drag to move) whose states crossfade
+ (`Views/StateViews.axaml`): Welcome (the logo assembling itself, `DonutLogo`; one Install button; an Options sheet
+ sliding up with the language, folder, options and engines), Progress (feature clips with captions, crossfading every
+ 6 s, a thin `ShimmerBar`), Done (`CheckBurst`, "Launch Filee"), Failed ("Copy details") and the uninstaller's
+ states. `SoftBackdrop` draws slowly drifting accent blobs behind it. The clips are animated WebP files
+ (`Assets/Showcase`, ~330 KB each) played by `AnimatedWebp` (SkiaSharp decodes one frame at a time). Every animation
+ runs on `FrameLoop` (only while the window is visible and not minimized) and turns into its still version when
+ Windows' "Show animations" is off (`SetupMotion`). `/SILENT` shows only the progress card, without clips.
+
- **Build** (`build/build-installer.ps1`): Setup is published as one self-contained, trimmed file
(`-p:FileeSetupPublish=true`), so it runs on Windows 10 1809+ x64 without .NET. `build/tools/make-setup.cs` appends
the app's publish folder as the payload: `[program][LZMA streams of all files][manifest JSON][72-byte trailer]`
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index 027c2539..c0882725 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -675,25 +675,13 @@
"setup.selection": "Download: {0}",
"setup.nothing_selected": "Nothing selected",
"installer.title": "Filee Setup",
- "installer.back": "Back",
- "installer.next": "Next",
"installer.install": "Install",
"installer.update": "Update",
- "installer.finish": "Finish",
- "installer.step.welcome": "Welcome",
- "installer.step.options": "Options",
- "installer.step.engines": "Engines",
- "installer.step.install": "Install",
- "installer.step.done": "Done",
- "installer.step.uninstall": "Confirm",
- "installer.step.remove": "Remove",
- "installer.welcome.title": "Welcome to Filee",
"installer.welcome.fresh": "Setup installs Filee {0} on this computer.",
"installer.welcome.update": "Filee {0} is installed. Setup updates it to {1}; your settings, presets and engines stay as they are.",
- "installer.welcome.about": "Filee converts files where you are: hold a key while dragging files, or right-click them in File Explorer, and pick a format.",
"installer.welcome.license": "Filee is free and open source (MIT license).",
"installer.language": "Language",
- "installer.options.title": "Choose how Filee fits in",
+ "installer.options.title": "Options",
"installer.options.folder": "Install folder",
"installer.options.browse": "Change…",
"installer.options.space": "Filee needs about {0} of disk space.",
@@ -741,6 +729,13 @@
"installer.uninstall.done": "Filee is no longer on this computer.",
"installer.uninstall.settings_kept": "Your settings stay, for when you install Filee again.",
"installer.uninstall.not_installed": "Filee is not installed in {0}.",
+ "installer.options.hide": "Hide",
+ "installer.minimize": "Minimize",
+ "installer.error.copy": "Copy details",
+ "installer.error.copied": "Copied",
+ "installer.showcase.expand": "Hold a key and drag a file: drop it on a format. Groups open more formats.",
+ "installer.showcase.flip": "Press Tab on the donut for its other side: crop, rotate, merge PDFs, remove backgrounds and more.",
+ "installer.showcase.browser": "Drag a picture straight from the browser: Filee downloads it and converts it.",
"watch.title": "Watch folders",
"watch.description": "Files that land in these folders are converted while Filee runs.\nDownloads and copies wait until they're complete.",
"watch.add": "Add folder",
diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.json
index 6df52c36..49e89bb9 100644
--- a/src/Filee.App/Assets/i18n/es.json
+++ b/src/Filee.App/Assets/i18n/es.json
@@ -655,25 +655,13 @@
"setup.selection": "Descarga: {0}",
"setup.nothing_selected": "Nada seleccionado",
"installer.title": "Instalación de Filee",
- "installer.back": "Atrás",
- "installer.next": "Siguiente",
"installer.install": "Instalar",
"installer.update": "Actualizar",
- "installer.finish": "Finalizar",
- "installer.step.welcome": "Bienvenida",
- "installer.step.options": "Opciones",
- "installer.step.engines": "Motores",
- "installer.step.install": "Instalación",
- "installer.step.done": "Listo",
- "installer.step.uninstall": "Confirmar",
- "installer.step.remove": "Quitar",
- "installer.welcome.title": "Te damos la bienvenida a Filee",
"installer.welcome.fresh": "El instalador instalará Filee {0} en este equipo.",
"installer.welcome.update": "Filee {0} está instalado. El instalador lo actualizará a {1}; tus ajustes, ajustes preestablecidos y motores se mantienen.",
- "installer.welcome.about": "Filee convierte archivos donde estés: mantén pulsada una tecla mientras arrastras archivos, o haz clic derecho sobre ellos en el Explorador, y elige un formato.",
"installer.welcome.license": "Filee es libre y de código abierto (licencia MIT).",
"installer.language": "Idioma",
- "installer.options.title": "Elige cómo se integra Filee",
+ "installer.options.title": "Opciones",
"installer.options.folder": "Carpeta de instalación",
"installer.options.browse": "Cambiar…",
"installer.options.space": "Filee necesita unos {0} de espacio en disco.",
@@ -721,6 +709,13 @@
"installer.uninstall.done": "Filee ya no está en este equipo.",
"installer.uninstall.settings_kept": "Tus ajustes se conservan para cuando vuelvas a instalar Filee.",
"installer.uninstall.not_installed": "Filee no está instalado en {0}.",
+ "installer.options.hide": "Ocultar",
+ "installer.minimize": "Minimizar",
+ "installer.error.copy": "Copiar detalles",
+ "installer.error.copied": "Copiado",
+ "installer.showcase.expand": "Mantén pulsada una tecla y arrastra un archivo: suéltalo sobre un formato. Los grupos abren más formatos.",
+ "installer.showcase.flip": "Pulsa Tab en el donut para ver su otra cara: recortar, girar, unir PDF, quitar fondos y más.",
+ "installer.showcase.browser": "Arrastra una imagen directamente desde el navegador: Filee la descarga y la convierte.",
"watch.title": "Carpetas supervisadas",
"watch.description": "Los archivos que lleguen a estas carpetas se convierten mientras Filee esté en ejecución.\nLas descargas y las copias se convierten cuando terminan.",
"watch.add": "Añadir carpeta",
diff --git a/src/Filee.App/Assets/i18n/hi.json b/src/Filee.App/Assets/i18n/hi.json
index f7b85290..c6c50157 100644
--- a/src/Filee.App/Assets/i18n/hi.json
+++ b/src/Filee.App/Assets/i18n/hi.json
@@ -655,25 +655,13 @@
"setup.selection": "डाउनलोड: {0}",
"setup.nothing_selected": "कुछ भी चुना नहीं गया",
"installer.title": "Filee सेटअप",
- "installer.back": "पीछे",
- "installer.next": "आगे",
"installer.install": "इंस्टॉल करें",
"installer.update": "अपडेट करें",
- "installer.finish": "समाप्त",
- "installer.step.welcome": "स्वागत",
- "installer.step.options": "विकल्प",
- "installer.step.engines": "इंजन",
- "installer.step.install": "इंस्टॉल",
- "installer.step.done": "हो गया",
- "installer.step.uninstall": "पुष्टि",
- "installer.step.remove": "हटाना",
- "installer.welcome.title": "Filee में आपका स्वागत है",
"installer.welcome.fresh": "सेटअप इस कंप्यूटर पर Filee {0} इंस्टॉल करेगा।",
"installer.welcome.update": "Filee {0} पहले से इंस्टॉल है। सेटअप इसे {1} में अपडेट करेगा; आपकी सेटिंग्स, प्रीसेट और इंजन वैसे ही रहेंगे।",
- "installer.welcome.about": "Filee फ़ाइलों को वहीं कन्वर्ट करता है जहाँ आप हैं: कोई कुंजी दबाए रखकर फ़ाइलें खींचें, या Explorer में उन पर राइट-क्लिक करें, और फ़ॉर्मेट चुनें।",
"installer.welcome.license": "Filee मुफ़्त और ओपन सोर्स है (MIT लाइसेंस)।",
"installer.language": "भाषा",
- "installer.options.title": "चुनें कि Filee कैसे काम करे",
+ "installer.options.title": "विकल्प",
"installer.options.folder": "इंस्टॉल फ़ोल्डर",
"installer.options.browse": "बदलें…",
"installer.options.space": "Filee को लगभग {0} डिस्क स्थान चाहिए।",
@@ -721,6 +709,13 @@
"installer.uninstall.done": "Filee अब इस कंप्यूटर पर नहीं है।",
"installer.uninstall.settings_kept": "आपकी सेटिंग्स रखी गई हैं, ताकि Filee दोबारा इंस्टॉल करने पर काम आएँ।",
"installer.uninstall.not_installed": "{0} में Filee इंस्टॉल नहीं है।",
+ "installer.options.hide": "छिपाएँ",
+ "installer.minimize": "छोटा करें",
+ "installer.error.copy": "विवरण कॉपी करें",
+ "installer.error.copied": "कॉपी हो गया",
+ "installer.showcase.expand": "कोई कुंजी दबाए रखकर फ़ाइल खींचें और किसी फ़ॉर्मेट पर छोड़ें। समूह खोलने पर और फ़ॉर्मेट दिखते हैं।",
+ "installer.showcase.flip": "डोनट पर Tab दबाकर उसकी दूसरी तरफ़ जाएँ: क्रॉप, घुमाना, PDF जोड़ना, बैकग्राउंड हटाना और भी बहुत कुछ।",
+ "installer.showcase.browser": "ब्राउज़र से कोई तस्वीर सीधे खींचें: Filee उसे डाउनलोड करके कन्वर्ट करता है।",
"watch.title": "वॉच फ़ोल्डर",
"watch.description": "इन फ़ोल्डरों में आने वाली फ़ाइलें Filee चलते समय कन्वर्ट हो जाती हैं।\nडाउनलोड और कॉपी पूरी होने तक प्रतीक्षा करते हैं।",
"watch.add": "फ़ोल्डर जोड़ें",
diff --git a/src/Filee.App/Assets/i18n/ja.json b/src/Filee.App/Assets/i18n/ja.json
index e6d16e45..5eaca2e1 100644
--- a/src/Filee.App/Assets/i18n/ja.json
+++ b/src/Filee.App/Assets/i18n/ja.json
@@ -655,25 +655,13 @@
"setup.selection": "ダウンロード:{0}",
"setup.nothing_selected": "何も選択されていません",
"installer.title": "Filee セットアップ",
- "installer.back": "戻る",
- "installer.next": "次へ",
"installer.install": "インストール",
"installer.update": "更新",
- "installer.finish": "完了",
- "installer.step.welcome": "ようこそ",
- "installer.step.options": "オプション",
- "installer.step.engines": "エンジン",
- "installer.step.install": "インストール",
- "installer.step.done": "完了",
- "installer.step.uninstall": "確認",
- "installer.step.remove": "削除",
- "installer.welcome.title": "Fileeへようこそ",
"installer.welcome.fresh": "このコンピューターにFilee {0}をインストールします。",
"installer.welcome.update": "Filee {0}がインストールされています。{1}に更新します。設定、プリセット、エンジンはそのまま残ります。",
- "installer.welcome.about": "Fileeは、その場でファイルを変換します。キーを押しながらファイルをドラッグするか、エクスプローラーで右クリックして、形式を選ぶだけです。",
"installer.welcome.license": "Fileeは無料のオープンソースソフトウェアです(MITライセンス)。",
"installer.language": "言語",
- "installer.options.title": "Fileeの使い方を選択",
+ "installer.options.title": "オプション",
"installer.options.folder": "インストール先フォルダー",
"installer.options.browse": "変更…",
"installer.options.space": "約{0}のディスク容量が必要です。",
@@ -721,6 +709,13 @@
"installer.uninstall.done": "Fileeはこのコンピューターから削除されました。",
"installer.uninstall.settings_kept": "設定は残してあります。Fileeを再インストールすると、そのまま使えます。",
"installer.uninstall.not_installed": "{0}にFileeはインストールされていません。",
+ "installer.options.hide": "閉じる",
+ "installer.minimize": "最小化",
+ "installer.error.copy": "詳細をコピー",
+ "installer.error.copied": "コピーしました",
+ "installer.showcase.expand": "キーを押しながらファイルをドラッグして、形式の上にドロップ。グループを開くと、さらに多くの形式が現れます。",
+ "installer.showcase.flip": "ドーナツでTabキーを押すと裏面へ。切り抜き、回転、PDFの結合、背景の削除などができます。",
+ "installer.showcase.browser": "ブラウザーの画像をそのままドラッグ。Fileeがダウンロードして変換します。",
"watch.title": "監視フォルダー",
"watch.description": "Fileeの起動中、これらのフォルダーに追加されたファイルを変換します。\nダウンロードやコピーが完了するまで処理を待ちます。",
"watch.add": "フォルダーを追加",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 0173173d..6e6d69e0 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -675,25 +675,13 @@
"setup.selection": "다운로드: {0}",
"setup.nothing_selected": "선택한 엔진 없음",
"installer.title": "Filee 설치",
- "installer.back": "이전",
- "installer.next": "다음",
"installer.install": "설치",
"installer.update": "업데이트",
- "installer.finish": "마침",
- "installer.step.welcome": "시작",
- "installer.step.options": "옵션",
- "installer.step.engines": "엔진",
- "installer.step.install": "설치",
- "installer.step.done": "완료",
- "installer.step.uninstall": "확인",
- "installer.step.remove": "제거",
- "installer.welcome.title": "Filee에 오신 걸 환영해요",
"installer.welcome.fresh": "이 컴퓨터에 Filee {0} 버전을 설치해요.",
"installer.welcome.update": "Filee {0} 버전이 설치되어 있어요. {1} 버전으로 업데이트하고, 설정·프리셋·엔진은 그대로 둬요.",
- "installer.welcome.about": "Filee는 지금 있는 자리에서 파일을 변환해요. 키를 누른 채 파일을 끌거나 탐색기에서 우클릭하고 형식을 고르면 돼요.",
"installer.welcome.license": "Filee는 무료 오픈 소스예요 (MIT 라이선스).",
"installer.language": "언어",
- "installer.options.title": "Filee를 어떻게 쓸지 골라 주세요",
+ "installer.options.title": "옵션",
"installer.options.folder": "설치 폴더",
"installer.options.browse": "변경…",
"installer.options.space": "디스크 공간이 약 {0} 필요해요.",
@@ -741,6 +729,13 @@
"installer.uninstall.done": "Filee가 이 컴퓨터에서 제거됐어요.",
"installer.uninstall.settings_kept": "설정은 남겨 뒀어요. Filee를 다시 설치하면 그대로 쓸 수 있어요.",
"installer.uninstall.not_installed": "{0}에 Filee가 설치되어 있지 않아요.",
+ "installer.options.hide": "접기",
+ "installer.minimize": "최소화",
+ "installer.error.copy": "자세한 내용 복사",
+ "installer.error.copied": "복사했어요",
+ "installer.showcase.expand": "키를 누른 채 파일을 끌어 원하는 형식에 놓으세요. 그룹을 열면 더 많은 형식이 나와요.",
+ "installer.showcase.flip": "도넛에서 Tab을 누르면 뒷면이 나와요. 자르기, 회전, PDF 합치기, 배경 제거 등을 할 수 있어요.",
+ "installer.showcase.browser": "브라우저의 그림을 바로 끌어 놓으세요. Filee가 내려받아 변환해요.",
"watch.title": "자동 변환 폴더",
"watch.description": "Filee가 켜져 있는 동안 이 폴더에 들어온 파일을 자동으로 변환해요.\n다운로드·복사 중인 파일은 끝난 뒤에 변환해요.",
"watch.add": "폴더 추가",
diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.json
index 19bda2e0..a079e57b 100644
--- a/src/Filee.App/Assets/i18n/pl.json
+++ b/src/Filee.App/Assets/i18n/pl.json
@@ -675,25 +675,13 @@
"setup.selection": "Pobieranie: {0}",
"setup.nothing_selected": "Nic nie wybrano",
"installer.title": "Instalator Filee",
- "installer.back": "Wstecz",
- "installer.next": "Dalej",
"installer.install": "Zainstaluj",
"installer.update": "Zaktualizuj",
- "installer.finish": "Zakończ",
- "installer.step.welcome": "Powitanie",
- "installer.step.options": "Opcje",
- "installer.step.engines": "Silniki",
- "installer.step.install": "Instalacja",
- "installer.step.done": "Gotowe",
- "installer.step.uninstall": "Potwierdzenie",
- "installer.step.remove": "Usuwanie",
- "installer.welcome.title": "Witaj w Filee",
"installer.welcome.fresh": "Instalator zainstaluje Filee {0} na tym komputerze.",
"installer.welcome.update": "Filee {0} jest zainstalowany. Instalator zaktualizuje go do wersji {1}; ustawienia, ustawienia wstępne i silniki pozostaną bez zmian.",
- "installer.welcome.about": "Filee konwertuje pliki tam, gdzie jesteś: przytrzymaj klawisz podczas przeciągania plików albo kliknij je prawym przyciskiem w Eksploratorze i wybierz format.",
"installer.welcome.license": "Filee jest darmowy i ma otwarty kod źródłowy (licencja MIT).",
"installer.language": "Język",
- "installer.options.title": "Wybierz, jak Filee ma działać",
+ "installer.options.title": "Opcje",
"installer.options.folder": "Folder instalacji",
"installer.options.browse": "Zmień…",
"installer.options.space": "Filee potrzebuje około {0} miejsca na dysku.",
@@ -741,6 +729,13 @@
"installer.uninstall.done": "Filee nie ma już na tym komputerze.",
"installer.uninstall.settings_kept": "Ustawienia zostały zachowane na wypadek ponownej instalacji Filee.",
"installer.uninstall.not_installed": "Filee nie jest zainstalowany w {0}.",
+ "installer.options.hide": "Ukryj",
+ "installer.minimize": "Minimalizuj",
+ "installer.error.copy": "Kopiuj szczegóły",
+ "installer.error.copied": "Skopiowano",
+ "installer.showcase.expand": "Przytrzymaj klawisz i przeciągnij plik: upuść go na format. Grupy otwierają więcej formatów.",
+ "installer.showcase.flip": "Naciśnij Tab na donucie, aby zobaczyć drugą stronę: kadrowanie, obracanie, łączenie PDF, usuwanie tła i więcej.",
+ "installer.showcase.browser": "Przeciągnij obraz prosto z przeglądarki: Filee pobierze go i przekonwertuje.",
"watch.title": "Obserwowane foldery",
"watch.description": "Pliki trafiające do tych folderów są konwertowane, gdy Filee działa.\nPobierane i kopiowane pliki czekają na zakończenie.",
"watch.add": "Dodaj folder",
diff --git a/src/Filee.App/Assets/i18n/ru.json b/src/Filee.App/Assets/i18n/ru.json
index 6a30c922..45d3d93c 100644
--- a/src/Filee.App/Assets/i18n/ru.json
+++ b/src/Filee.App/Assets/i18n/ru.json
@@ -675,25 +675,13 @@
"setup.selection": "Скачать: {0}",
"setup.nothing_selected": "Ничего не выбрано",
"installer.title": "Установка Filee",
- "installer.back": "Назад",
- "installer.next": "Далее",
"installer.install": "Установить",
"installer.update": "Обновить",
- "installer.finish": "Готово",
- "installer.step.welcome": "Начало",
- "installer.step.options": "Параметры",
- "installer.step.engines": "Движки",
- "installer.step.install": "Установка",
- "installer.step.done": "Готово",
- "installer.step.uninstall": "Подтверждение",
- "installer.step.remove": "Удаление",
- "installer.welcome.title": "Добро пожаловать в Filee",
"installer.welcome.fresh": "Программа установит Filee {0} на этот компьютер.",
"installer.welcome.update": "Filee {0} уже установлен. Программа обновит его до версии {1}; настройки, пресеты и движки останутся как есть.",
- "installer.welcome.about": "Filee конвертирует файлы прямо там, где вы работаете: перетащите файлы, удерживая клавишу, или щёлкните по ним правой кнопкой в Проводнике и выберите формат.",
"installer.welcome.license": "Filee — бесплатная программа с открытым исходным кодом (лицензия MIT).",
"installer.language": "Язык",
- "installer.options.title": "Выберите, как будет работать Filee",
+ "installer.options.title": "Параметры",
"installer.options.folder": "Папка установки",
"installer.options.browse": "Изменить…",
"installer.options.space": "Filee нужно около {0} места на диске.",
@@ -741,6 +729,13 @@
"installer.uninstall.done": "Filee больше нет на этом компьютере.",
"installer.uninstall.settings_kept": "Настройки сохранены на случай повторной установки Filee.",
"installer.uninstall.not_installed": "Filee не установлен в {0}.",
+ "installer.options.hide": "Скрыть",
+ "installer.minimize": "Свернуть",
+ "installer.error.copy": "Копировать подробности",
+ "installer.error.copied": "Скопировано",
+ "installer.showcase.expand": "Удерживая клавишу, перетащите файл и отпустите его на формате. В группах — ещё больше форматов.",
+ "installer.showcase.flip": "Нажмите Tab на пончике, чтобы перевернуть его: обрезка, поворот, объединение PDF, удаление фона и многое другое.",
+ "installer.showcase.browser": "Перетащите картинку прямо из браузера: Filee скачает и конвертирует её.",
"watch.title": "Папки наблюдения",
"watch.description": "Файлы, попавшие в эти папки, конвертируются, пока работает Filee.\nСкачиваемые и копируемые файлы ждут, пока не появятся целиком.",
"watch.add": "Добавить папку",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 52ba94a0..430a048d 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -675,25 +675,13 @@
"setup.selection": "下载:{0}",
"setup.nothing_selected": "未选择引擎",
"installer.title": "Filee 安装程序",
- "installer.back": "上一步",
- "installer.next": "下一步",
"installer.install": "安装",
"installer.update": "更新",
- "installer.finish": "完成",
- "installer.step.welcome": "欢迎",
- "installer.step.options": "选项",
- "installer.step.engines": "引擎",
- "installer.step.install": "安装",
- "installer.step.done": "完成",
- "installer.step.uninstall": "确认",
- "installer.step.remove": "移除",
- "installer.welcome.title": "欢迎使用 Filee",
"installer.welcome.fresh": "安装程序将在这台电脑上安装 Filee {0}。",
"installer.welcome.update": "已安装 Filee {0}。安装程序会将其更新到 {1},设置、预设和引擎保持不变。",
- "installer.welcome.about": "Filee 就地转换文件。按住按键拖动文件,或在资源管理器中右键单击文件,然后选择格式即可。",
"installer.welcome.license": "Filee 是免费的开源软件(MIT 许可证)。",
"installer.language": "语言",
- "installer.options.title": "选择 Filee 的使用方式",
+ "installer.options.title": "选项",
"installer.options.folder": "安装文件夹",
"installer.options.browse": "更改…",
"installer.options.space": "Filee 需要约 {0} 的磁盘空间。",
@@ -741,6 +729,13 @@
"installer.uninstall.done": "Filee 已从这台电脑上移除。",
"installer.uninstall.settings_kept": "你的设置已保留,重新安装 Filee 时即可使用。",
"installer.uninstall.not_installed": "{0} 中没有安装 Filee。",
+ "installer.options.hide": "收起",
+ "installer.minimize": "最小化",
+ "installer.error.copy": "复制详细信息",
+ "installer.error.copied": "已复制",
+ "installer.showcase.expand": "按住按键拖动文件,放到想要的格式上。打开分组可看到更多格式。",
+ "installer.showcase.flip": "在圆环上按 Tab 翻到另一面,可以裁剪、旋转、合并 PDF、去除背景等。",
+ "installer.showcase.browser": "直接从浏览器拖动图片,Filee 会下载并转换。",
"watch.title": "自动转换文件夹",
"watch.description": "Filee 运行时,放入这些文件夹的文件会自动转换。\n正在下载或复制的文件会等完成后再转换。",
"watch.add": "添加文件夹",
diff --git a/src/Filee.Setup/App.axaml b/src/Filee.Setup/App.axaml
index 19a13596..0c2f3340 100644
--- a/src/Filee.Setup/App.axaml
+++ b/src/Filee.Setup/App.axaml
@@ -4,6 +4,13 @@
Name="Filee Setup"
RequestedThemeVariant="Default">
<!-- Light or dark follows Windows (RequestedThemeVariant="Default"), like Filee's "System" theme. -->
+ <Application.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ResourceInclude Source="avares://Filee.Setup/Views/StateViews.axaml" />
+ </ResourceDictionary.MergedDictionaries>
+ </ResourceDictionary>
+ </Application.Resources>
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Filee.Setup/Styles/Soft.axaml" />
diff --git a/src/Filee.Setup/Assets/Showcase/browser-640.webp b/src/Filee.Setup/Assets/Showcase/browser-640.webp
new file mode 100644
index 00000000..d710ea37
Binary files /dev/null and b/src/Filee.Setup/Assets/Showcase/browser-640.webp differ
diff --git a/src/Filee.Setup/Assets/Showcase/expand-640.webp b/src/Filee.Setup/Assets/Showcase/expand-640.webp
new file mode 100644
index 00000000..04f63a25
Binary files /dev/null and b/src/Filee.Setup/Assets/Showcase/expand-640.webp differ
diff --git a/src/Filee.Setup/Assets/Showcase/expand-dark-640.webp b/src/Filee.Setup/Assets/Showcase/expand-dark-640.webp
new file mode 100644
index 00000000..dddff684
Binary files /dev/null and b/src/Filee.Setup/Assets/Showcase/expand-dark-640.webp differ
diff --git a/src/Filee.Setup/Assets/Showcase/flip-640.webp b/src/Filee.Setup/Assets/Showcase/flip-640.webp
new file mode 100644
index 00000000..5cf3f69d
Binary files /dev/null and b/src/Filee.Setup/Assets/Showcase/flip-640.webp differ
diff --git a/src/Filee.Setup/Controls/AnimatedWebp.cs b/src/Filee.Setup/Controls/AnimatedWebp.cs
new file mode 100644
index 00000000..60f559e7
--- /dev/null
+++ b/src/Filee.Setup/Controls/AnimatedWebp.cs
@@ -0,0 +1,177 @@
+// Plays an animated WebP (Avalonia shows only its first frame): SkiaSharp's codec decodes one frame at a time into a
+// bitmap, timed by the frames' own durations. Only the current frame is kept in memory. Without animations it shows
+// one representative frame. A minimal player for Setup's feature clips; an app-wide AnimatedImage control could
+// replace it later.
+
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Media;
+using Avalonia.Media.Imaging;
+using Avalonia.Platform;
+using Avalonia.Threading;
+using SkiaSharp;
+
+namespace Filee.Setup.Controls;
+
+public sealed class AnimatedWebp : Control, IDisposable
+{
+ /// <summary>An avares:// URI.</summary>
+ public static readonly StyledProperty<string?> SourceProperty =
+ AvaloniaProperty.Register<AnimatedWebp, string?>(nameof(Source));
+
+ private SKData? _data;
+ private SKCodec? _codec;
+ private SKCodecFrameInfo[] _frames = [];
+ private SKBitmap? _canvas;
+ private WriteableBitmap? _bitmap;
+ private DispatcherTimer? _timer;
+ private int _frame = -1;
+
+ public string? Source { get => GetValue(SourceProperty); set => SetValue(SourceProperty, value); }
+
+ /// <summary>The frame shown now (tests).</summary>
+ public int Frame => _frame;
+
+ public int FrameCount => Math.Max(1, _frames.Length);
+
+ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
+ {
+ base.OnPropertyChanged(change);
+ if (change.Property == SourceProperty)
+ {
+ Load();
+ InvalidateMeasure();
+ }
+ }
+
+ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnAttachedToVisualTree(e);
+ if (_codec is null)
+ Load();
+ Schedule();
+ }
+
+ protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnDetachedFromVisualTree(e);
+ _timer?.Stop();
+ }
+
+ private void Load()
+ {
+ Release();
+ if (string.IsNullOrEmpty(Source))
+ return;
+ using (var stream = AssetLoader.Open(new Uri(Source)))
+ {
+ using var copy = new MemoryStream();
+ stream.CopyTo(copy);
+ _data = SKData.CreateCopy(copy.ToArray());
+ }
+ _codec = SKCodec.Create(_data);
+ if (_codec is null)
+ return;
+ _frames = _codec.FrameInfo;
+ var info = new SKImageInfo(_codec.Info.Width, _codec.Info.Height, SKColorType.Bgra8888, SKAlphaType.Premul);
+ _canvas = new SKBitmap(info);
+ _bitmap = new WriteableBitmap(new PixelSize(info.Width, info.Height), new Vector(96, 96), PixelFormat.Bgra8888, AlphaFormat.Premul);
+ // Without animations: a frame from the middle, where the clip shows what it is about.
+ ShowFrame(SetupMotion.Enabled ? 0 : FrameCount * 45 / 100);
+ }
+
+ /// <summary>Decodes frame <paramref name="index"/>, from the frame shown now when the codec needs it.</summary>
+ internal void ShowFrame(int index)
+ {
+ if (_codec is null || _canvas is null || _bitmap is null)
+ return;
+ index = Math.Clamp(index, 0, FrameCount - 1);
+ // A frame that builds on earlier ones needs them decoded first (in order).
+ var required = _frames.Length > index ? _frames[index].RequiredFrame : -1;
+ if (required >= 0 && !(_frame >= required && _frame == index - 1))
+ {
+ for (var i = 0; i < index; i++)
+ Decode(i);
+ }
+ Decode(index);
+ using (var target = _bitmap.Lock())
+ {
+ var rowBytes = Math.Min(target.RowBytes, _canvas.RowBytes);
+ for (var y = 0; y < _canvas.Height; y++)
+ {
+ unsafe
+ {
+ Buffer.MemoryCopy((byte*)_canvas.GetPixels() + y * _canvas.RowBytes, (byte*)target.Address + y * target.RowBytes, target.RowBytes, rowBytes);
+ }
+ }
+ }
+ InvalidateVisual();
+ }
+
+ private void Decode(int index)
+ {
+ var required = _frames.Length > index ? _frames[index].RequiredFrame : -1;
+ var prior = required >= 0 && _frame >= required && _frame < index ? _frame : -1;
+ var options = new SKCodecOptions(index, prior);
+ _codec!.GetPixels(_canvas!.Info, _canvas.GetPixels(), options);
+ _frame = index;
+ }
+
+ private void Schedule()
+ {
+ if (!SetupMotion.Enabled || _frames.Length < 2 || VisualRoot is null)
+ return;
+ _timer ??= new DispatcherTimer(TimeSpan.FromMilliseconds(40), DispatcherPriority.Render, (_, _) => Next());
+ _timer.Interval = TimeSpan.FromMilliseconds(Math.Max(20, _frames[Math.Max(0, _frame)].Duration));
+ _timer.Start();
+ }
+
+ private void Next()
+ {
+ _timer?.Stop();
+ if (VisualRoot is null)
+ return;
+ if (TopLevel.GetTopLevel(this) is not Window { WindowState: WindowState.Minimized })
+ ShowFrame((_frame + 1) % FrameCount);
+ Schedule();
+ }
+
+ protected override Size MeasureOverride(Size availableSize)
+ {
+ if (_bitmap is null)
+ return default;
+ var size = _bitmap.Size;
+ var scale = Math.Min(
+ double.IsInfinity(availableSize.Width) ? 1 : availableSize.Width / size.Width,
+ double.IsInfinity(availableSize.Height) ? 1 : availableSize.Height / size.Height);
+ return size * scale;
+ }
+
+ public override void Render(DrawingContext context)
+ {
+ if (_bitmap is null)
+ return;
+ var size = _bitmap.Size;
+ var scale = Math.Min(Bounds.Width / size.Width, Bounds.Height / size.Height);
+ var drawn = size * scale;
+ var target = new Rect((Bounds.Width - drawn.Width) / 2, (Bounds.Height - drawn.Height) / 2, drawn.Width, drawn.Height);
+ context.DrawImage(_bitmap, new Rect(size), target);
+ }
+
+ private void Release()
+ {
+ _timer?.Stop();
+ _codec?.Dispose();
+ _codec = null;
+ _data?.Dispose();
+ _data = null;
+ _canvas?.Dispose();
+ _canvas = null;
+ _bitmap?.Dispose();
+ _bitmap = null;
+ _frames = [];
+ _frame = -1;
+ }
+
+ public void Dispose() => Release();
+}
diff --git a/src/Filee.Setup/Controls/CheckBurst.cs b/src/Filee.Setup/Controls/CheckBurst.cs
new file mode 100644
index 00000000..d0a6cc33
--- /dev/null
+++ b/src/Filee.Setup/Controls/CheckBurst.cs
@@ -0,0 +1,97 @@
+// The "done" moment: an accent circle pops in, the check mark draws itself and a few soft accent dots burst outwards
+// and fade (the finished check mark without animations).
+
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Media;
+
+namespace Filee.Setup.Controls;
+
+public sealed class CheckBurst : Control
+{
+ public static readonly StyledProperty<IBrush?> FillProperty =
+ AvaloniaProperty.Register<CheckBurst, IBrush?>(nameof(Fill));
+
+ public static readonly StyledProperty<IBrush?> MarkProperty =
+ AvaloniaProperty.Register<CheckBurst, IBrush?>(nameof(Mark));
+
+ private static readonly TimeSpan Duration = TimeSpan.FromMilliseconds(1100);
+ private readonly FrameLoop _loop;
+ private double _progress;
+
+ static CheckBurst()
+ {
+ AffectsRender<CheckBurst>(FillProperty, MarkProperty);
+ }
+
+ public CheckBurst()
+ {
+ _progress = SetupMotion.Enabled ? 0 : 1;
+ _loop = new FrameLoop(this, elapsed =>
+ {
+ _progress = Math.Min(1, elapsed / Duration);
+ InvalidateVisual();
+ return _progress < 1;
+ });
+ }
+
+ public IBrush? Fill { get => GetValue(FillProperty); set => SetValue(FillProperty, value); }
+ public IBrush? Mark { get => GetValue(MarkProperty); set => SetValue(MarkProperty, value); }
+
+ protected override Size MeasureOverride(Size availableSize) => new(88, 88);
+
+ public override void Render(DrawingContext context)
+ {
+ var t = SetupMotion.Enabled ? _progress : 1;
+ var center = new Point(Bounds.Width / 2, Bounds.Height / 2);
+ var r = Math.Min(Bounds.Width, Bounds.Height) * 0.30;
+
+ // Dots fly out between 0.15 and 0.75 and fade.
+ var dots = Math.Clamp((t - 0.15) / 0.6, 0, 1);
+ if (dots is > 0 and < 1 && Fill is ISolidColorBrush solid)
+ {
+ var brush = new SolidColorBrush(solid.Color, 1 - dots);
+ for (var i = 0; i < 10; i++)
+ {
+ var angle = i * Math.PI / 5 + 0.3;
+ var distance = r * (1.05 + 0.75 * DonutLogo.EaseOut(dots));
+ var size = (i % 2 == 0 ? 3.4 : 2.4) * (1 - 0.5 * dots);
+ context.DrawEllipse(brush, null, center + new Vector(Math.Cos(angle), Math.Sin(angle)) * distance, size, size);
+ }
+ }
+
+ var pop = DonutLogo.BackOut(Math.Clamp(t / 0.4, 0, 1));
+ if (pop > 0)
+ context.DrawEllipse(Fill, null, center, r * pop, r * pop);
+
+ // The check mark: two strokes, drawn in order.
+ var draw = Math.Clamp((t - 0.3) / 0.45, 0, 1);
+ if (draw <= 0)
+ return;
+ var a = center + new Vector(-r * 0.42, r * 0.02);
+ var b = center + new Vector(-r * 0.12, r * 0.32);
+ var c = center + new Vector(r * 0.45, -r * 0.30);
+ var first = Distance(a, b);
+ var second = Distance(b, c);
+ var length = (first + second) * DonutLogo.EaseOut(draw);
+ var pen = new Pen(Mark, r * 0.16, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round);
+ var geometry = new StreamGeometry();
+ using (var g = geometry.Open())
+ {
+ g.BeginFigure(a, false);
+ if (length <= first)
+ {
+ g.LineTo(a + (b - a) * (length / first));
+ }
+ else
+ {
+ g.LineTo(b);
+ g.LineTo(b + (c - b) * ((length - first) / second));
+ }
+ g.EndFigure(false);
+ }
+ context.DrawGeometry(null, pen, geometry);
+ }
+
+ private static double Distance(Point a, Point b) => Math.Sqrt((b.X - a.X) * (b.X - a.X) + (b.Y - a.Y) * (b.Y - a.Y));
+}
diff --git a/src/Filee.Setup/Controls/DonutLogo.cs b/src/Filee.Setup/Controls/DonutLogo.cs
new file mode 100644
index 00000000..35da26b5
--- /dev/null
+++ b/src/Filee.Setup/Controls/DonutLogo.cs
@@ -0,0 +1,129 @@
+// Filee's logo (src/Filee.App/Assets/Icons/filee.svg) drawn from its paths, so it can assemble itself: the six slices
+// spring in one after the other while the ring turns into place, then the file in the middle drops in. Without
+// animations (or after 1.4 s) it is simply the logo.
+
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Media;
+using Avalonia.Media.Immutable;
+
+namespace Filee.Setup.Controls;
+
+public sealed class DonutLogo : Control
+{
+ /// <summary>Plays the entrance when shown; off draws the finished logo.</summary>
+ public static readonly StyledProperty<bool> AnimateProperty =
+ AvaloniaProperty.Register<DonutLogo, bool>(nameof(Animate), true);
+
+ private const double ViewBox = 512;
+ private static readonly TimeSpan Duration = TimeSpan.FromMilliseconds(1400);
+
+ // filee.svg: the slices (path, colour, offset of the "pulled out" slice) and the file in the middle.
+ private static readonly (Geometry Path, IBrush Fill, Vector Offset)[] Slices =
+ [
+ (Geometry.Parse("M154.61 65.27 A216 216 0 0 1 357.39 65.27 L304.82 164.17 A104 104 0 0 0 207.18 164.17 Z"), Brush("#7F77DD"), default),
+ (Geometry.Parse("M373.66 67.74 A222 222 0 0 1 477.86 248.23 L359.94 252.36 A104 104 0 0 0 311.12 167.81 Z"), Brush("#1D9E75"), new Vector(13.86, -8)),
+ (Geometry.Parse("M471.87 263.56 A216 216 0 0 1 370.48 439.17 L311.12 344.19 A104 104 0 0 0 359.94 259.64 Z"), Brush("#7F77DD"), default),
+ (Geometry.Parse("M357.39 446.73 A216 216 0 0 1 154.61 446.73 L207.18 347.83 A104 104 0 0 0 304.82 347.83 Z"), Brush("#6A62C9"), default),
+ (Geometry.Parse("M141.52 439.17 A216 216 0 0 1 40.13 263.56 L152.06 259.64 A104 104 0 0 0 200.88 344.19 Z"), Brush("#7F77DD"), default),
+ (Geometry.Parse("M40.13 248.44 A216 216 0 0 1 141.52 72.83 L200.88 167.81 A104 104 0 0 0 152.06 252.36 Z"), Brush("#6A62C9"), default),
+ ];
+
+ private static readonly Geometry FileBody = Geometry.Parse("M222 212 h44 l24 24 v64 h-68 z");
+ private static readonly Geometry FileCorner = Geometry.Parse("M266 212 v24 h24 z");
+ private static readonly IBrush FileBodyBrush = Brush("#3C3489");
+ private static readonly IBrush FileCornerBrush = Brush("#AFA9EC");
+
+ private readonly FrameLoop _loop;
+ private double _progress;
+
+ static DonutLogo()
+ {
+ AffectsRender<DonutLogo>(AnimateProperty);
+ }
+
+ public DonutLogo()
+ {
+ _progress = SetupMotion.Enabled ? 0 : 1;
+ _loop = new FrameLoop(this, elapsed =>
+ {
+ _progress = Math.Min(1, elapsed / Duration);
+ InvalidateVisual();
+ return _progress < 1;
+ });
+ }
+
+ public bool Animate { get => GetValue(AnimateProperty); set => SetValue(AnimateProperty, value); }
+
+ /// <summary>Plays the entrance again.</summary>
+ public void Replay()
+ {
+ if (!SetupMotion.Enabled || !Animate)
+ return;
+ _progress = 0;
+ _loop.Restart();
+ }
+
+ private static IBrush Brush(string color) => new ImmutableSolidColorBrush(Color.Parse(color));
+
+ protected override Size MeasureOverride(Size availableSize)
+ {
+ var side = Math.Min(double.IsInfinity(availableSize.Width) ? 96 : availableSize.Width,
+ double.IsInfinity(availableSize.Height) ? 96 : availableSize.Height);
+ return new Size(side, side);
+ }
+
+ public override void Render(DrawingContext context)
+ {
+ var progress = Animate && SetupMotion.Enabled ? _progress : 1;
+ var side = Math.Min(Bounds.Width, Bounds.Height);
+ if (side <= 0)
+ return;
+ var scale = side / ViewBox;
+ var origin = new Point((Bounds.Width - side) / 2, (Bounds.Height - side) / 2);
+ var center = new Point(ViewBox / 2, ViewBox / 2);
+ // The ring turns a third of a turn into place while the slices arrive.
+ var ring = EaseOut(Math.Min(1, progress / 0.75));
+ var rotation = Matrix.CreateTranslation(-center.X, -center.Y)
+ * Matrix.CreateRotation((1 - ring) * -2.1)
+ * Matrix.CreateTranslation(center.X, center.Y);
+ var view = Matrix.CreateScale(scale, scale) * Matrix.CreateTranslation(origin.X, origin.Y);
+
+ for (var i = 0; i < Slices.Length; i++)
+ {
+ var (path, fill, offset) = Slices[i];
+ var local = Math.Clamp((progress - i * 0.07) / 0.45, 0, 1);
+ if (local <= 0)
+ continue;
+ var spring = BackOut(local);
+ // Each slice grows from the ring's centre line outwards, with a little overshoot.
+ var grow = Matrix.CreateTranslation(-center.X, -center.Y)
+ * Matrix.CreateScale(0.55 + 0.45 * spring, 0.55 + 0.45 * spring)
+ * Matrix.CreateTranslation(center.X + offset.X, center.Y + offset.Y);
+ using (context.PushTransform(grow * rotation * view))
+ using (context.PushOpacity(Math.Min(1, local * 1.6)))
+ context.DrawGeometry(fill, null, path);
+ }
+
+ var file = Math.Clamp((progress - 0.55) / 0.4, 0, 1);
+ if (file > 0)
+ {
+ var drop = (1 - BackOut(file)) * -40;
+ using (context.PushTransform(Matrix.CreateTranslation(0, drop) * view))
+ using (context.PushOpacity(file))
+ {
+ context.DrawGeometry(FileBodyBrush, null, FileBody);
+ context.DrawGeometry(FileCornerBrush, null, FileCorner);
+ }
+ }
+ }
+
+ internal static double EaseOut(double t) => 1 - Math.Pow(1 - t, 3);
+
+ internal static double BackOut(double t)
+ {
+ const double c1 = 1.70158;
+ const double c3 = c1 + 1;
+ return 1 + c3 * Math.Pow(t - 1, 3) + c1 * Math.Pow(t - 1, 2);
+ }
+}
diff --git a/src/Filee.Setup/Controls/FrameLoop.cs b/src/Filee.Setup/Controls/FrameLoop.cs
new file mode 100644
index 00000000..24420e3a
--- /dev/null
+++ b/src/Filee.Setup/Controls/FrameLoop.cs
@@ -0,0 +1,77 @@
+// A frame loop for custom-drawn animations: calls back on every rendered frame (at most ~60 fps) while the control is
+// in a visible, not minimized window and animations are on; stops otherwise and starts again when that changes.
+
+using Avalonia;
+using Avalonia.Controls;
+
+namespace Filee.Setup.Controls;
+
+internal sealed class FrameLoop
+{
+ private readonly Control _owner;
+ private readonly Func<TimeSpan, bool> _onFrame;
+ private TopLevel? _top;
+ private bool _running;
+ private TimeSpan? _start;
+
+ /// <param name="onFrame">Gets the time since the loop started; returns false to stop.</param>
+ public FrameLoop(Control owner, Func<TimeSpan, bool> onFrame)
+ {
+ _owner = owner;
+ _onFrame = onFrame;
+ owner.AttachedToVisualTree += (_, _) => Attach();
+ owner.DetachedFromVisualTree += (_, _) => Detach();
+ }
+
+ /// <summary>Starts (again) from time zero.</summary>
+ public void Restart()
+ {
+ _start = null;
+ Kick();
+ }
+
+ public void Kick()
+ {
+ if (_running || _top is null || !SetupMotion.Enabled)
+ return;
+ if (_top is Window { WindowState: WindowState.Minimized })
+ return;
+ _running = true;
+ _top.RequestAnimationFrame(OnFrame);
+ }
+
+ private void OnFrame(TimeSpan now)
+ {
+ _running = false;
+ if (_top is null || !_owner.IsEffectivelyVisible || _top is Window { WindowState: WindowState.Minimized })
+ return;
+ _start ??= now;
+ if (_onFrame(now - _start.Value))
+ {
+ _running = true;
+ _top.RequestAnimationFrame(OnFrame);
+ }
+ }
+
+ private void Attach()
+ {
+ _top = TopLevel.GetTopLevel(_owner);
+ if (_top is Window window)
+ window.PropertyChanged += OnWindowChanged;
+ Kick();
+ }
+
+ private void Detach()
+ {
+ if (_top is Window window)
+ window.PropertyChanged -= OnWindowChanged;
+ _top = null;
+ _running = false;
+ }
+
+ private void OnWindowChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
+ {
+ if (e.Property == Window.WindowStateProperty)
+ Kick();
+ }
+}
diff --git a/src/Filee.Setup/Controls/SetupMotion.cs b/src/Filee.Setup/Controls/SetupMotion.cs
new file mode 100644
index 00000000..68c3cf7b
--- /dev/null
+++ b/src/Filee.Setup/Controls/SetupMotion.cs
@@ -0,0 +1,32 @@
+// Whether Setup animates: Windows' "Show animations in Windows" (SPI_GETCLIENTAREAANIMATION). Off gives the static
+// versions of the logo, the background, the clips and the check mark. Tests switch it off for stable screenshots.
+
+using System.Runtime.InteropServices;
+
+namespace Filee.Setup.Controls;
+
+public static partial class SetupMotion
+{
+ private const uint SPI_GETCLIENTAREAANIMATION = 0x1042;
+
+ /// <summary>False when Windows' animations are off (or a test turned them off).</summary>
+ public static bool Enabled { get; set; } = ReadSystem();
+
+ [LibraryImport("user32.dll", EntryPoint = "SystemParametersInfoW")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static partial bool SystemParametersInfo(uint action, uint param, [MarshalAs(UnmanagedType.Bool)] out bool value, uint winIni);
+
+ private static bool ReadSystem()
+ {
+ if (!OperatingSystem.IsWindows())
+ return true;
+ try
+ {
+ return !SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, out var enabled, 0) || enabled;
+ }
+ catch (Exception ex) when (ex is DllNotFoundException or EntryPointNotFoundException)
+ {
+ return true;
+ }
+ }
+}
diff --git a/src/Filee.Setup/Controls/ShimmerBar.cs b/src/Filee.Setup/Controls/ShimmerBar.cs
new file mode 100644
index 00000000..c11b257f
--- /dev/null
+++ b/src/Filee.Setup/Controls/ShimmerBar.cs
@@ -0,0 +1,87 @@
+// A thin rounded progress bar: the fill eases towards the value and a soft highlight sweeps across it while work goes
+// on (static without animations).
+
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Media;
+
+namespace Filee.Setup.Controls;
+
+public sealed class ShimmerBar : Control
+{
+ public static readonly StyledProperty<double> ValueProperty =
+ AvaloniaProperty.Register<ShimmerBar, double>(nameof(Value));
+
+ public static readonly StyledProperty<IBrush?> TrackProperty =
+ AvaloniaProperty.Register<ShimmerBar, IBrush?>(nameof(Track));
+
+ public static readonly StyledProperty<IBrush?> FillProperty =
+ AvaloniaProperty.Register<ShimmerBar, IBrush?>(nameof(Fill));
+
+ private readonly FrameLoop _loop;
+ private double _shown;
+ private double _sweep;
+
+ static ShimmerBar()
+ {
+ AffectsRender<ShimmerBar>(TrackProperty, FillProperty);
+ }
+
+ public ShimmerBar()
+ {
+ Height = 6;
+ _loop = new FrameLoop(this, elapsed =>
+ {
+ _shown += (Value - _shown) * 0.12;
+ _sweep = elapsed.TotalSeconds / 1.6 % 1;
+ InvalidateVisual();
+ return true;
+ });
+ }
+
+ /// <summary>0 to 100.</summary>
+ public double Value { get => GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
+ public IBrush? Track { get => GetValue(TrackProperty); set => SetValue(TrackProperty, value); }
+ public IBrush? Fill { get => GetValue(FillProperty); set => SetValue(FillProperty, value); }
+
+ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
+ {
+ base.OnPropertyChanged(change);
+ if (change.Property == ValueProperty)
+ {
+ if (!SetupMotion.Enabled)
+ _shown = Value;
+ InvalidateVisual();
+ _loop.Kick();
+ }
+ }
+
+ public override void Render(DrawingContext context)
+ {
+ var bounds = new Rect(Bounds.Size);
+ var radius = bounds.Height / 2;
+ context.DrawRectangle(Track, null, bounds, radius, radius);
+ var value = Math.Clamp(SetupMotion.Enabled ? _shown : Value, 0, 100);
+ if (value <= 0.1)
+ return;
+ var fill = new Rect(0, 0, Math.Max(bounds.Height, bounds.Width * value / 100), bounds.Height);
+ context.DrawRectangle(Fill, null, fill, radius, radius);
+ if (!SetupMotion.Enabled || value >= 100)
+ return;
+ // The highlight: a short white gradient band moving left to right over the fill.
+ var band = Math.Max(40, fill.Width * 0.25);
+ var x = -band + (fill.Width + band) * _sweep;
+ var shine = new LinearGradientBrush
+ {
+ StartPoint = new RelativePoint(x, 0, RelativeUnit.Absolute),
+ EndPoint = new RelativePoint(x + band, 0, RelativeUnit.Absolute),
+ GradientStops =
+ {
+ new GradientStop(Color.FromArgb(0, 255, 255, 255), 0),
+ new GradientStop(Color.FromArgb(110, 255, 255, 255), 0.5),
+ new GradientStop(Color.FromArgb(0, 255, 255, 255), 1),
+ },
+ };
+ context.DrawRectangle(shine, null, fill, radius, radius);
+ }
+}
diff --git a/src/Filee.Setup/Controls/SoftBackdrop.cs b/src/Filee.Setup/Controls/SoftBackdrop.cs
new file mode 100644
index 00000000..ef88e6e4
--- /dev/null
+++ b/src/Filee.Setup/Controls/SoftBackdrop.cs
@@ -0,0 +1,84 @@
+// The soft background of Setup's card: three blurred blobs in the accent tints that drift slowly (about 30 fps, only
+// while the window is visible and animations are on; otherwise they stay where they are).
+
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Media;
+
+namespace Filee.Setup.Controls;
+
+public sealed class SoftBackdrop : Control
+{
+ public static readonly StyledProperty<IBrush?> BackgroundProperty =
+ Border.BackgroundProperty.AddOwner<SoftBackdrop>();
+
+ public static readonly StyledProperty<Color> AccentProperty =
+ AvaloniaProperty.Register<SoftBackdrop, Color>(nameof(Accent), Color.Parse("#7F77DD"));
+
+ public static readonly StyledProperty<Color> SecondProperty =
+ AvaloniaProperty.Register<SoftBackdrop, Color>(nameof(Second), Color.Parse("#1D9E75"));
+
+ /// <summary>How strong the blobs are (lower in dark mode).</summary>
+ public static readonly StyledProperty<double> IntensityProperty =
+ AvaloniaProperty.Register<SoftBackdrop, double>(nameof(Intensity), 0.30);
+
+ private readonly FrameLoop _loop;
+ private double _time = 1.7;
+ private TimeSpan _lastDrawn = TimeSpan.FromSeconds(-1);
+
+ static SoftBackdrop()
+ {
+ AffectsRender<SoftBackdrop>(BackgroundProperty, AccentProperty, SecondProperty, IntensityProperty);
+ }
+
+ public SoftBackdrop()
+ {
+ IsHitTestVisible = false;
+ _loop = new FrameLoop(this, elapsed =>
+ {
+ // About 30 fps is plenty for blobs that move a few pixels a second.
+ if (elapsed - _lastDrawn < TimeSpan.FromMilliseconds(33))
+ return true;
+ _lastDrawn = elapsed;
+ _time = 1.7 + elapsed.TotalSeconds;
+ InvalidateVisual();
+ return true;
+ });
+ }
+
+ public IBrush? Background { get => GetValue(BackgroundProperty); set => SetValue(BackgroundProperty, value); }
+ public Color Accent { get => GetValue(AccentProperty); set => SetValue(AccentProperty, value); }
+ public Color Second { get => GetValue(SecondProperty); set => SetValue(SecondProperty, value); }
+ public double Intensity { get => GetValue(IntensityProperty); set => SetValue(IntensityProperty, value); }
+
+ public override void Render(DrawingContext context)
+ {
+ var bounds = new Rect(Bounds.Size);
+ if (Background is { } background)
+ context.FillRectangle(background, bounds);
+ var w = bounds.Width;
+ var h = bounds.Height;
+ var t = _time;
+ Blob(context, Accent, w * (0.18 + 0.06 * Math.Sin(t * 0.21)), h * (0.22 + 0.08 * Math.Cos(t * 0.17)), w * 0.42, Intensity);
+ Blob(context, Second, w * (0.86 + 0.05 * Math.Cos(t * 0.19 + 1.3)), h * (0.80 + 0.07 * Math.Sin(t * 0.23)), w * 0.36, Intensity * 0.75);
+ Blob(context, Accent, w * (0.70 + 0.07 * Math.Sin(t * 0.13 + 2.1)), h * (0.12 + 0.06 * Math.Cos(t * 0.29 + 0.7)), w * 0.28, Intensity * 0.6);
+ }
+
+ private static void Blob(DrawingContext context, Color color, double x, double y, double radius, double strength)
+ {
+ var brush = new RadialGradientBrush
+ {
+ Center = new RelativePoint(0.5, 0.5, RelativeUnit.Relative),
+ GradientOrigin = new RelativePoint(0.5, 0.5, RelativeUnit.Relative),
+ RadiusX = new RelativeScalar(0.5, RelativeUnit.Relative),
+ RadiusY = new RelativeScalar(0.5, RelativeUnit.Relative),
+ GradientStops =
+ {
+ new GradientStop(Color.FromArgb((byte)(255 * strength), color.R, color.G, color.B), 0),
+ new GradientStop(Color.FromArgb((byte)(255 * strength * 0.35), color.R, color.G, color.B), 0.55),
+ new GradientStop(Color.FromArgb(0, color.R, color.G, color.B), 1),
+ },
+ };
+ context.DrawEllipse(brush, null, new Point(x, y), radius, radius);
+ }
+}
diff --git a/src/Filee.Setup/Filee.Setup.csproj b/src/Filee.Setup/Filee.Setup.csproj
index bae625df..ae4f308e 100644
--- a/src/Filee.Setup/Filee.Setup.csproj
+++ b/src/Filee.Setup/Filee.Setup.csproj
@@ -57,6 +57,8 @@
<AvaloniaResource Include="..\Filee.App\Styles\Soft.axaml" Link="Styles\Soft.axaml" />
<AvaloniaResource Include="..\Filee.App\Assets\Icons\filee.ico" Link="Assets\Icons\filee.ico" />
<AvaloniaResource Include="..\Filee.App\Assets\Icons\filee.png" Link="Assets\Icons\filee.png" />
+ <!-- Feature clips shown while installing (640 px animated WebP, ~330 KB each). -->
+ <AvaloniaResource Include="Assets\Showcase\*.webp" />
<EmbeddedResource Include="..\Filee.App\Assets\i18n\*.json" Link="i18n\%(Filename)%(Extension)" LogicalName="i18n.%(Filename)%(Extension)" />
</ItemGroup>
diff --git a/src/Filee.Setup/Styles/Setup.axaml b/src/Filee.Setup/Styles/Setup.axaml
index 0410316d..6ca80437 100644
--- a/src/Filee.Setup/Styles/Setup.axaml
+++ b/src/Filee.Setup/Styles/Setup.axaml
@@ -1,59 +1,153 @@
-<!-- Setup's own pieces on top of Filee's Soft.axaml: the step column and the option cards. -->
+<!-- Setup's card on top of Filee's Soft.axaml: big soft buttons, the Options sheet, the window chrome. -->
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Styles.Resources>
+ <StreamGeometry x:Key="Setup.Close">M1,1 L11,11 M11,1 L1,11</StreamGeometry>
+ <StreamGeometry x:Key="Setup.Minimize">M1,6 L11,6</StreamGeometry>
+ <StreamGeometry x:Key="Setup.ChevronDown">M1,1 L6,6 L11,1</StreamGeometry>
+ <StreamGeometry x:Key="Setup.ChevronUp">M1,6 L6,1 L11,6</StreamGeometry>
+ </Styles.Resources>
+
<!-- Windows' CJK UI fonts (Malgun Gothic, Yu Gothic UI, Microsoft YaHei) have no semibold face: titles are bold, so
Korean, Japanese and Chinese titles look as heavy as Latin ones. -->
+ <Style Selector="TextBlock.title">
+ <Setter Property="FontSize" Value="26" />
+ <Setter Property="FontWeight" Value="Bold" />
+ </Style>
+ <Style Selector="TextBlock.heading">
+ <Setter Property="FontSize" Value="17" />
+ <Setter Property="FontWeight" Value="Bold" />
+ </Style>
<Style Selector="TextBlock.h1, TextBlock.h2">
<Setter Property="FontWeight" Value="Bold" />
</Style>
- <Style Selector="Border.steps">
- <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
+ <!-- The card: rounded, with a soft shadow; the window around it is transparent. -->
+ <Style Selector="Border.setupcard">
+ <Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusLarge}" />
+ <Setter Property="BoxShadow" Value="0 10 30 0 #33000000, 0 2 8 0 #1A000000" />
+ <Setter Property="BorderBrush" Value="{DynamicResource SubtleBorderBrush}" />
+ <Setter Property="BorderThickness" Value="1" />
+ <Setter Property="ClipToBounds" Value="True" />
</Style>
- <Style Selector="TextBlock.step">
- <Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
- <Setter Property="TextWrapping" Value="Wrap" />
+ <!-- Window buttons. -->
+ <Style Selector="Button.chrome">
+ <Setter Property="Width" Value="34" />
+ <Setter Property="Height" Value="28" />
+ <Setter Property="Padding" Value="0" />
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderThickness" Value="0" />
+ <Setter Property="HorizontalContentAlignment" Value="Center" />
+ <Setter Property="VerticalContentAlignment" Value="Center" />
+ <Setter Property="Focusable" Value="True" />
</Style>
- <Style Selector="TextBlock.step.current">
- <Setter Property="Foreground" Value="{DynamicResource AccentStrongBrush}" />
- <Setter Property="FontWeight" Value="Bold" />
+ <Style Selector="Button.chrome Path">
+ <Setter Property="Stroke" Value="{DynamicResource TextSecondaryBrush}" />
+ <Setter Property="StrokeThickness" Value="1.4" />
+ <Setter Property="StrokeLineCap" Value="Round" />
</Style>
- <Style Selector="TextBlock.step.done">
- <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
+ <Style Selector="Button.chrome.close:pointerover /template/ ContentPresenter#PART_ContentPresenter">
+ <Setter Property="Background" Value="{DynamicResource DangerBrush}" />
+ </Style>
+ <Style Selector="Button.chrome.close:pointerover Path">
+ <Setter Property="Stroke" Value="White" />
</Style>
- <Style Selector="Border.stepdot">
- <Setter Property="Width" Value="10" />
- <Setter Property="Height" Value="10" />
- <Setter Property="CornerRadius" Value="5" />
- <Setter Property="BorderThickness" Value="1.5" />
- <Setter Property="BorderBrush" Value="{DynamicResource TextSecondaryBrush}" />
+ <!-- The one big button of each state. -->
+ <Style Selector="Button.big">
+ <Setter Property="MinWidth" Value="200" />
+ <Setter Property="MinHeight" Value="46" />
+ <Setter Property="Padding" Value="28,10" />
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="FontSize" Value="15" />
+ <Setter Property="FontWeight" Value="Bold" />
+ <Setter Property="HorizontalContentAlignment" Value="Center" />
+ <Setter Property="VerticalContentAlignment" Value="Center" />
+ </Style>
+ <Style Selector="Button.soft">
+ <Setter Property="MinWidth" Value="120" />
+ <Setter Property="MinHeight" Value="46" />
+ <Setter Property="Padding" Value="22,10" />
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="FontSize" Value="14" />
+ <Setter Property="HorizontalContentAlignment" Value="Center" />
+ <Setter Property="VerticalContentAlignment" Value="Center" />
+ </Style>
+ <Style Selector="Button.link">
<Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderThickness" Value="0" />
+ <Setter Property="Padding" Value="10,6" />
+ <Setter Property="Foreground" Value="{DynamicResource Setup.LinkBrush}" />
+ <Setter Property="FontWeight" Value="Bold" />
</Style>
- <Style Selector="Border.stepdot.current">
- <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
- <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
+ <Style Selector="Button.link Path">
+ <Setter Property="Stroke" Value="{DynamicResource Setup.LinkBrush}" />
+ <Setter Property="StrokeThickness" Value="1.6" />
+ <Setter Property="StrokeLineCap" Value="Round" />
+ <Setter Property="StrokeJoin" Value="Round" />
</Style>
- <Style Selector="Border.stepdot.done">
- <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
+
+ <Style Selector="Border.pill">
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="Padding" Value="9,2" />
<Setter Property="Background" Value="{DynamicResource AccentSoftBrush}" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ </Style>
+ <Style Selector="Border.pill > TextBlock">
+ <Setter Property="FontSize" Value="12" />
+ <Setter Property="FontWeight" Value="Bold" />
+ <Setter Property="Foreground" Value="{DynamicResource Setup.LinkBrush}" />
+ </Style>
+
+ <!-- The Options sheet slides up from the bottom of the card. -->
+ <Style Selector="Border.sheet">
+ <Setter Property="Background" Value="{DynamicResource SurfaceBrush}" />
+ <Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusLarge}" />
+ <Setter Property="BoxShadow" Value="0 -6 24 0 #26000000" />
+ <Setter Property="RenderTransform" Value="translateY(460px)" />
+ <Setter Property="Transitions">
+ <Transitions>
+ <TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.38" Easing="CubicEaseOut" />
+ </Transitions>
+ </Setter>
+ </Style>
+ <Style Selector="Border.sheet.open">
+ <Setter Property="RenderTransform" Value="none" />
</Style>
<!-- Options: one checkbox per row, its text wrapping in long languages. -->
<Style Selector="CheckBox.option">
- <Setter Property="Margin" Value="0,2" />
+ <Setter Property="Margin" Value="0,1" />
</Style>
- <Style Selector="CheckBox.option > TextBlock, CheckBox.option TextBlock">
+ <Style Selector="CheckBox.option TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
+ <Style Selector="Border.clip">
+ <Setter Property="CornerRadius" Value="{DynamicResource SoftRadius}" />
+ <Setter Property="ClipToBounds" Value="True" />
+ <Setter Property="BoxShadow" Value="0 6 22 0 #22000000" />
+ <Setter Property="Background" Value="{DynamicResource SurfaceBrush}" />
+ </Style>
+
<Style Selector="Border.warning">
<Setter Property="Background" Value="{DynamicResource SurfaceBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource WarningBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusSmall}" />
- <Setter Property="Padding" Value="14,10" />
+ <Setter Property="Padding" Value="12,8" />
+ </Style>
+
+ <!-- Without animations: no slide, no springy buttons. -->
+ <Style Selector="Window.reduced-motion Border.sheet">
+ <Setter Property="Transitions" Value="{x:Null}" />
+ </Style>
+ <Style Selector="Window.reduced-motion :is(Button)">
+ <Setter Property="Transitions" Value="{x:Null}" />
+ </Style>
+ <Style Selector="Window.reduced-motion Button:pressed">
+ <Setter Property="RenderTransform" Value="none" />
</Style>
</Styles>
diff --git a/src/Filee.Setup/ViewModels/SetupViewModel.cs b/src/Filee.Setup/ViewModels/SetupViewModel.cs
index ae38c258..61ee926c 100644
--- a/src/Filee.Setup/ViewModels/SetupViewModel.cs
+++ b/src/Filee.Setup/ViewModels/SetupViewModel.cs
@@ -1,7 +1,7 @@
-// The wizard: Welcome (with the language) → Options (folder, Explorer menu, start at sign-in, PATH, desktop icon) →
-// Engines (fresh installs, when there is something to download) → Install (progress) → Done ("Launch Filee").
-// An update shows only what it may change (desktop icon, PATH); Filee's own settings stay as they are. The uninstaller
-// uses the same window: Uninstall (keep or delete the settings) → progress → Done.
+// One compact card in a few states: Welcome (the logo, one Install button and an Options sheet with the folder, the
+// options, the engines and the language) → Progress (feature clips while the files go in) → Done ("Launch Filee") or
+// Failed ("Copy details"). An update shows only what it may change (desktop icon, PATH); Filee's own settings stay as
+// they are. The uninstaller uses the same card: Uninstall (keep or delete the settings) → Progress → Uninstalled.
using System.Collections.ObjectModel;
using Avalonia.Threading;
@@ -15,8 +15,6 @@ namespace Filee.Setup.ViewModels;
public enum SetupPage
{
Welcome,
- Options,
- Engines,
Progress,
Done,
Failed,
@@ -24,7 +22,7 @@ public enum SetupPage
Uninstalled,
}
-/// <summary>What the wizard does when the user goes ahead (the real installer, or a fake in tests).</summary>
+/// <summary>What the card does when the user goes ahead (the real installer, or a fake in tests).</summary>
public interface ISetupRunner
{
InstallResult Install(InstallChoices choices, IProgress<SetupProgress> progress);
@@ -39,7 +37,7 @@ public sealed record LanguageItem(string Code, string Name)
public override string ToString() => Name;
}
-/// <summary>An engine package on the Engines page.</summary>
+/// <summary>An engine package in the Options sheet.</summary>
public sealed partial class EngineItem(EngineOffer offer, bool installed) : ObservableObject
{
public EngineOffer Offer { get; } = offer;
@@ -52,18 +50,24 @@ public sealed partial class EngineItem(EngineOffer offer, bool installed) : Obse
[ObservableProperty] private string _detail = "";
}
-/// <summary>A step in the left column.</summary>
-public sealed partial class StepItem(string key, SetupPage[] pages) : ObservableObject
-{
- public string Key { get; } = key;
- public SetupPage[] Pages { get; } = pages;
- [ObservableProperty] private string _title = "";
- [ObservableProperty] private bool _isCurrent;
- [ObservableProperty] private bool _isDone;
-}
+/// <summary>A feature clip shown while installing.</summary>
+/// <param name="Clip">avares:// URI of the light clip.</param>
+/// <param name="DarkClip">The clip for dark mode, when there is one.</param>
+public sealed record Showcase(string Clip, string? DarkClip, string CaptionKey);
public sealed partial class SetupViewModel : ObservableObject
{
+ /// <summary>The feature clips (Assets/Showcase), in the order they play.</summary>
+ public static readonly IReadOnlyList<Showcase> Clips =
+ [
+ new("avares://Filee.Setup/Assets/Showcase/expand-640.webp", "avares://Filee.Setup/Assets/Showcase/expand-dark-640.webp", "installer.showcase.expand"),
+ new("avares://Filee.Setup/Assets/Showcase/flip-640.webp", null, "installer.showcase.flip"),
+ new("avares://Filee.Setup/Assets/Showcase/browser-640.webp", null, "installer.showcase.browser"),
+ ];
+
+ /// <summary>How long each clip stays before the next one crossfades in.</summary>
+ public static readonly TimeSpan ClipTime = TimeSpan.FromSeconds(6);
+
private readonly SetupTexts _texts;
private readonly ISetupRunner _runner;
private readonly PreviousInstall? _previous;
@@ -71,12 +75,13 @@ public sealed partial class SetupViewModel : ObservableObject
private readonly long _neededSpace;
private bool _languagePicked;
private InstallResult? _result;
+ private DispatcherTimer? _clipTimer;
/// <param name="version">The Filee version Setup installs (or the uninstaller removes).</param>
/// <param name="initial">The choices from the command line and the defaults.</param>
/// <param name="engines">Packages offered on a fresh install, with whether each is installed already.</param>
/// <param name="modernMenuSupported">Windows 11 x64 and administrator rights: the top-level menu can be offered.</param>
- /// <param name="uninstall">The uninstaller's window.</param>
+ /// <param name="uninstall">The uninstaller's card.</param>
public SetupViewModel(SetupTexts texts, ISetupRunner runner, string version, InstallChoices initial, PreviousInstall? previous,
IReadOnlyList<(EngineOffer Offer, bool Installed)> engines, bool modernMenuSupported, long neededSpace, bool uninstall = false,
bool languagePicked = false)
@@ -108,23 +113,6 @@ public sealed partial class SetupViewModel : ObservableObject
UpdateEngineSelection();
};
}
- var steps = new List<StepItem>();
- if (uninstall)
- {
- steps.Add(new StepItem("installer.step.uninstall", [SetupPage.Uninstall]));
- steps.Add(new StepItem("installer.step.remove", [SetupPage.Progress, SetupPage.Failed]));
- steps.Add(new StepItem("installer.step.done", [SetupPage.Uninstalled]));
- }
- else
- {
- steps.Add(new StepItem("installer.step.welcome", [SetupPage.Welcome]));
- steps.Add(new StepItem("installer.step.options", [SetupPage.Options]));
- if (HasEnginesPage)
- steps.Add(new StepItem("installer.step.engines", [SetupPage.Engines]));
- steps.Add(new StepItem("installer.step.install", [SetupPage.Progress, SetupPage.Failed]));
- steps.Add(new StepItem("installer.step.done", [SetupPage.Done]));
- }
- Steps = steps;
_page = uninstall ? SetupPage.Uninstall : SetupPage.Welcome;
texts.LanguageChanged += (_, _) => RefreshTexts();
RefreshTexts();
@@ -137,10 +125,25 @@ public sealed partial class SetupViewModel : ObservableObject
public bool ModernMenuSupported { get; }
public IReadOnlyList<LanguageItem> Languages { get; }
public ObservableCollection<EngineItem> Engines { get; }
- public IReadOnlyList<StepItem> Steps { get; }
/// <summary>Fresh installs offer the engines that aren't downloaded yet.</summary>
- public bool HasEnginesPage => IsFresh && Engines.Any(e => !e.Installed);
+ public bool HasEngines => IsFresh && Engines.Any(e => !e.Installed);
+
+ /// <summary>/SILENT: the progress card only, no clips.</summary>
+ public bool Silent { get; set; }
+
+ /// <summary>Dark mode: the clips with a dark variant use it.</summary>
+ public bool Dark
+ {
+ get;
+ set
+ {
+ if (field == value)
+ return;
+ field = value;
+ OnPropertyChanged(nameof(CurrentClip));
+ }
+ }
/// <summary>Raised when the window should close (finished, cancelled).</summary>
public event EventHandler? CloseRequested;
@@ -148,21 +151,25 @@ public sealed partial class SetupViewModel : ObservableObject
/// <summary>Asks the view for a folder (the folder picker); null when cancelled.</summary>
public Func<string, Task<string?>>? PickFolder { get; set; }
+ /// <summary>Puts text on the clipboard (the view's).</summary>
+ public Func<string, Task>? CopyText { get; set; }
+
[ObservableProperty]
- [NotifyPropertyChangedFor(nameof(IsWelcome), nameof(IsOptions), nameof(IsEngines), nameof(IsProgress), nameof(IsDone),
- nameof(IsFailed), nameof(IsUninstallPage), nameof(IsUninstalled), nameof(CanGoBack), nameof(ShowCancel), nameof(NextText),
- nameof(ShowNext))]
+ [NotifyPropertyChangedFor(nameof(IsWelcome), nameof(IsProgress), nameof(IsDone), nameof(IsFailed), nameof(IsUninstallPage),
+ nameof(IsUninstalled), nameof(ShowShowcase), nameof(PrimaryText))]
private SetupPage _page;
public bool IsWelcome => Page == SetupPage.Welcome;
- public bool IsOptions => Page == SetupPage.Options;
- public bool IsEngines => Page == SetupPage.Engines;
public bool IsProgress => Page == SetupPage.Progress;
public bool IsDone => Page == SetupPage.Done;
public bool IsFailed => Page == SetupPage.Failed;
public bool IsUninstallPage => Page == SetupPage.Uninstall;
public bool IsUninstalled => Page == SetupPage.Uninstalled;
+ /// <summary>The progress card plays feature clips (not for /SILENT or the uninstaller).</summary>
+ public bool ShowShowcase => IsProgress && !Silent && !IsUninstall;
+
+ [ObservableProperty] private bool _optionsOpen;
[ObservableProperty] private LanguageItem _selectedLanguage;
[ObservableProperty] private string _folder;
[ObservableProperty] private bool _contextMenu;
@@ -170,7 +177,6 @@ public sealed partial class SetupViewModel : ObservableObject
[ObservableProperty] private bool _startup;
[ObservableProperty] private bool _cli;
[ObservableProperty] private bool _desktopIcon;
- [ObservableProperty] private bool _launchFilee = true;
[ObservableProperty] private bool _deleteSettings;
[ObservableProperty] private string _welcomeText = "";
@@ -178,17 +184,42 @@ public sealed partial class SetupViewModel : ObservableObject
[ObservableProperty] private string _statusText = "";
[ObservableProperty] private double _percent;
[ObservableProperty] private string _progressTitle = "";
+ [ObservableProperty] private string _doneTitle = "";
[ObservableProperty] private string _doneText = "";
[ObservableProperty] private string _warningText = "";
- [ObservableProperty] private string _errorText = "";
[ObservableProperty] private string _errorTitle = "";
+ [ObservableProperty] private string _errorText = "";
[ObservableProperty] private string _uninstallText = "";
[ObservableProperty] private string _uninstalledText = "";
[ObservableProperty] private string _engineSelectionText = "";
[ObservableProperty] private string _logText = "";
[ObservableProperty] private string _settingsText = "";
+ [ObservableProperty] private bool _copied;
+
+ [ObservableProperty]
+ [NotifyPropertyChangedFor(nameof(CurrentClip), nameof(CurrentCaption))]
+ private int _clipIndex;
+
+ /// <summary>The clip playing now.</summary>
+ public string CurrentClip => Dark && Clips[ClipIndex].DarkClip is { } dark ? dark : Clips[ClipIndex].Clip;
+
+ public string CurrentCaption => _texts[Clips[ClipIndex].CaptionKey];
+
+ /// <summary>The big button of the Welcome card.</summary>
+ public string PrimaryText => _texts[IsUpdate ? "installer.update" : "installer.install"];
+
+ /// <summary>The fresh install's top-level menu option needs the Explorer menu option.</summary>
+ public bool ModernMenuEnabled => ContextMenu;
- /// <summary>Setup's log file (named on the error page).</summary>
+ /// <summary>Exit code for Setup (Inno Setup's: 0 done, 2 cancelled before installing, 4 failed during installing).</summary>
+ public int ExitCode { get; private set; } = 2;
+
+ /// <summary>What to start when the window closes ("Launch Filee").</summary>
+ public LaunchRequest? Launch { get; private set; }
+
+ public InstallResult? Result => _result;
+
+ /// <summary>Setup's log file (named on the error card).</summary>
public string? LogFile
{
get;
@@ -199,7 +230,7 @@ public sealed partial class SetupViewModel : ObservableObject
}
}
- /// <summary>Filee's settings folder (named on the uninstall page).</summary>
+ /// <summary>Filee's settings folder (named on the uninstall card).</summary>
public string SettingsFolder
{
get;
@@ -210,34 +241,6 @@ public sealed partial class SetupViewModel : ObservableObject
}
} = "";
- /// <summary>The page has a working Back button.</summary>
- public bool CanGoBack => Page is SetupPage.Options or SetupPage.Engines;
-
- public bool ShowCancel => Page is SetupPage.Welcome or SetupPage.Options or SetupPage.Engines or SetupPage.Uninstall;
-
- public bool ShowNext => Page != SetupPage.Progress;
-
- public string NextText => Page switch
- {
- SetupPage.Options when !HasEnginesPage => _texts[IsUpdate ? "installer.update" : "installer.install"],
- SetupPage.Engines => _texts["installer.install"],
- SetupPage.Done => _texts["installer.finish"],
- SetupPage.Failed or SetupPage.Uninstalled => _texts["common.close"],
- SetupPage.Uninstall => _texts["installer.uninstall.button"],
- _ => _texts["installer.next"],
- };
-
- /// <summary>The fresh install's top-level menu option needs the Explorer menu option.</summary>
- public bool ModernMenuEnabled => ContextMenu;
-
- /// <summary>Exit code for Setup (Inno Setup's: 0 done, 2 cancelled before installing, 4 failed during installing).</summary>
- public int ExitCode { get; private set; } = 2;
-
- /// <summary>What to start when the window closes (Done with "Launch Filee").</summary>
- public LaunchRequest? Launch { get; private set; }
-
- public InstallResult? Result => _result;
-
partial void OnSelectedLanguageChanged(LanguageItem value)
{
if (value is null || value.Code == _texts.Language)
@@ -250,14 +253,21 @@ public sealed partial class SetupViewModel : ObservableObject
partial void OnPageChanged(SetupPage value)
{
- var current = Steps.ToList().FindIndex(s => s.Pages.Contains(value));
- for (var i = 0; i < Steps.Count; i++)
+ if (ShowShowcase)
+ {
+ ClipIndex = 0;
+ _clipTimer ??= new DispatcherTimer(ClipTime, DispatcherPriority.Background, (_, _) => NextClip());
+ _clipTimer.Start();
+ }
+ else
{
- Steps[i].IsCurrent = i == current;
- Steps[i].IsDone = i < current;
+ _clipTimer?.Stop();
}
}
+ /// <summary>The next feature clip (every <see cref="ClipTime"/> while installing).</summary>
+ public void NextClip() => ClipIndex = (ClipIndex + 1) % Clips.Count;
+
/// <summary>Recomputes the texts with arguments (after a language change).</summary>
private void RefreshTexts()
{
@@ -268,8 +278,6 @@ public sealed partial class SetupViewModel : ObservableObject
UninstallText = _texts.Format("installer.uninstall.text", Version);
SettingsText = _texts.Format("installer.uninstall.settings_where", SettingsFolder);
LogText = LogFile is null ? "" : _texts.Format("installer.error.log", LogFile);
- foreach (var step in Steps)
- step.Title = _texts[step.Key];
foreach (var engine in Engines)
{
engine.Name = _texts[$"engines.package.{engine.Id}.name"];
@@ -280,8 +288,9 @@ public sealed partial class SetupViewModel : ObservableObject
UpdateEngineSelection();
ErrorTitle = _texts[IsUninstall ? "installer.error.uninstall_title" : "installer.error.title"];
ProgressTitle = _texts[IsUninstall ? "installer.uninstall.progress" : IsUpdate ? "installer.progress.update" : "installer.progress.install"];
- OnPropertyChanged(nameof(NextText));
- OnPageChanged(Page);
+ DoneTitle = _texts["installer.done.title"];
+ OnPropertyChanged(nameof(PrimaryText));
+ OnPropertyChanged(nameof(CurrentCaption));
}
private void UpdateEngineSelection()
@@ -290,6 +299,9 @@ public sealed partial class SetupViewModel : ObservableObject
EngineSelectionText = selected.Count == 0 ? _texts["setup.nothing_selected"] : _texts.Format("setup.selection", string.Join(", ", selected));
}
+ [RelayCommand]
+ private void ToggleOptions() => OptionsOpen = !OptionsOpen;
+
[RelayCommand]
private async Task BrowseAsync()
{
@@ -304,61 +316,55 @@ public sealed partial class SetupViewModel : ObservableObject
}
}
+ /// <summary>The window's close button and Escape: closes the Options sheet first, then cancels (before installing).</summary>
[RelayCommand]
- private void Back()
+ private void Cancel()
{
- Page = Page switch
+ if (OptionsOpen)
{
- SetupPage.Engines => SetupPage.Options,
- SetupPage.Options => SetupPage.Welcome,
- _ => Page,
- };
+ OptionsOpen = false;
+ return;
+ }
+ if (IsProgress)
+ return;
+ WindowClosing();
+ CloseRequested?.Invoke(this, EventArgs.Empty);
}
- /// <summary>The window's close button: Cancel before installing, Finish on the Done page.</summary>
+ /// <summary>The window is closing: before installing it is a cancel; after, nothing is started.</summary>
public void WindowClosing()
{
- if (Page == SetupPage.Done)
- Launch = LaunchFilee ? _result?.Launch : null;
- else if (Page is SetupPage.Welcome or SetupPage.Options or SetupPage.Engines or SetupPage.Uninstall)
+ if (Page is SetupPage.Welcome or SetupPage.Uninstall)
ExitCode = 2;
}
[RelayCommand]
- private void Cancel()
+ private Task Install() => InstallAsync();
+
+ [RelayCommand]
+ private Task Uninstall() => UninstallAsync();
+
+ /// <summary>"Launch Filee" on the Done card.</summary>
+ [RelayCommand]
+ private void LaunchAndClose()
{
- ExitCode = 2;
+ Launch = _result?.Launch;
CloseRequested?.Invoke(this, EventArgs.Empty);
}
[RelayCommand]
- private async Task NextAsync()
+ private void Close() => CloseRequested?.Invoke(this, EventArgs.Empty);
+
+ [RelayCommand]
+ private async Task CopyDetailsAsync()
{
- switch (Page)
- {
- case SetupPage.Welcome:
- Page = SetupPage.Options;
- break;
- case SetupPage.Options when HasEnginesPage:
- Page = SetupPage.Engines;
- break;
- case SetupPage.Options or SetupPage.Engines:
- await InstallAsync();
- break;
- case SetupPage.Uninstall:
- await UninstallAsync();
- break;
- case SetupPage.Done:
- Launch = LaunchFilee ? _result?.Launch : null;
- CloseRequested?.Invoke(this, EventArgs.Empty);
- break;
- default:
- CloseRequested?.Invoke(this, EventArgs.Empty);
- break;
- }
+ if (CopyText is null)
+ return;
+ await CopyText(ErrorText + Environment.NewLine + Environment.NewLine + LogText);
+ Copied = true;
}
- /// <summary>The choices as they stand on the pages.</summary>
+ /// <summary>The choices as they stand in the Options sheet.</summary>
public InstallChoices Choices()
{
var tasks = new SetupTasks(ContextMenu, ContextMenu && ModernMenu && ModernMenuSupported, Startup, Cli, DesktopIcon);
@@ -375,8 +381,11 @@ public sealed partial class SetupViewModel : ObservableObject
/// <summary>Installs with the current choices (also what /SILENT does right away).</summary>
public async Task InstallAsync()
{
+ if (Page != SetupPage.Welcome)
+ return;
RefreshTexts();
var choices = Choices();
+ OptionsOpen = false;
Page = SetupPage.Progress;
Percent = 0;
var progress = new SyncProgress<SetupProgress>(p => Dispatcher.UIThread.Post(() => ShowProgress(p)));
@@ -384,9 +393,14 @@ public sealed partial class SetupViewModel : ObservableObject
if (_result.Succeeded)
{
ExitCode = 0;
- DoneText = _texts[IsUpdate ? "installer.done.updated" : "installer.done.text"]
- + (choices.Engines.Count > 0 ? Environment.NewLine + Environment.NewLine + _texts["installer.done.engines"] : "");
+ Percent = 100;
WarningText = string.Join(Environment.NewLine + Environment.NewLine, _result.Warnings.Select(WarningMessage));
+ // With a warning to read, the card leaves out how to use Filee (Filee shows that itself).
+ DoneText = string.Join(Environment.NewLine + Environment.NewLine, new[]
+ {
+ IsUpdate ? _texts["installer.done.updated"] : WarningText.Length > 0 ? "" : _texts["installer.done.text"],
+ choices.Engines.Count > 0 ? _texts["installer.done.engines"] : "",
+ }.Where(t => t.Length > 0));
Page = SetupPage.Done;
}
else
@@ -401,6 +415,8 @@ public sealed partial class SetupViewModel : ObservableObject
/// <summary>Uninstalls (also what a silent uninstall does right away).</summary>
public async Task UninstallAsync()
{
+ if (Page != SetupPage.Uninstall)
+ return;
RefreshTexts();
var deleteSettings = DeleteSettings;
Page = SetupPage.Progress;
@@ -410,6 +426,7 @@ public sealed partial class SetupViewModel : ObservableObject
if (error is null)
{
ExitCode = 0;
+ Percent = 100;
UninstalledText = _texts["installer.uninstall.done"]
+ (deleteSettings ? "" : Environment.NewLine + Environment.NewLine + _texts["installer.uninstall.settings_kept"]);
Page = SetupPage.Uninstalled;
diff --git a/src/Filee.Setup/Views/SetupWindow.axaml b/src/Filee.Setup/Views/SetupWindow.axaml
index 648caa89..0cb58797 100644
--- a/src/Filee.Setup/Views/SetupWindow.axaml
+++ b/src/Filee.Setup/Views/SetupWindow.axaml
@@ -1,89 +1,82 @@
-<!-- Setup and the uninstaller: steps on the left, the page on the right, the buttons below it. -->
+<!-- Setup and the uninstaller: one soft card (640×420) on a transparent window, with its own window buttons, a
+ drifting background, the state in the middle (crossfading) and the Options sheet sliding over it. -->
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Filee.Setup.ViewModels"
+ xmlns:c="using:Filee.Setup.Controls"
x:Class="Filee.Setup.Views.SetupWindow"
x:DataType="vm:SetupViewModel"
Title="{DynamicResource installer.title}"
Icon="avares://Filee.Setup/Assets/Icons/filee.ico"
- Width="800" Height="560" MinWidth="640" MinHeight="480"
- CanResize="True"
+ Width="664" Height="444"
+ CanResize="False"
+ WindowDecorations="None"
+ Background="Transparent"
+ TransparencyLevelHint="Transparent"
WindowStartupLocation="CenterScreen">
- <Grid ColumnDefinitions="232,*">
- <!-- ───────── Steps ───────── -->
- <Border Classes="steps" Padding="24,26,20,22">
+ <Border x:Name="Card" Classes="setupcard" Margin="12">
+ <Panel>
+ <c:SoftBackdrop x:Name="Backdrop" Background="{DynamicResource PageBrush}" Accent="{DynamicResource AccentColor}" />
+
<DockPanel>
- <StackPanel DockPanel.Dock="Top" Spacing="2" Margin="0,0,0,26">
- <Image Source="avares://Filee.Setup/Assets/Icons/filee.png" Width="52" Height="52" HorizontalAlignment="Left" Margin="0,0,0,10" />
- <TextBlock Classes="h2" Text="Filee" />
- <TextBlock Classes="caption" Text="{Binding Version}" />
- </StackPanel>
- <TextBlock DockPanel.Dock="Bottom" Classes="caption" Text="filee.sh" />
- <ItemsControl ItemsSource="{Binding Steps}" Focusable="False">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Spacing="14" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate x:DataType="vm:StepItem">
- <DockPanel>
- <Border DockPanel.Dock="Left" Classes="stepdot" Classes.current="{Binding IsCurrent}" Classes.done="{Binding IsDone}"
- VerticalAlignment="Top" Margin="0,5,12,0" />
- <TextBlock Classes="step" Classes.current="{Binding IsCurrent}" Classes.done="{Binding IsDone}" Text="{Binding Title}" />
- </DockPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </DockPanel>
- </Border>
+ <!-- Window bar: drag to move, minimize, close. -->
+ <Grid x:Name="TitleBar" DockPanel.Dock="Top" Height="42" Background="Transparent" ColumnDefinitions="*,Auto,Auto">
+ <TextBlock Classes="caption" Margin="20,0" VerticalAlignment="Center" Text="{DynamicResource installer.title}" />
+ <Button Grid.Column="1" Classes="chrome" Click="OnMinimize" AutomationProperties.Name="{DynamicResource installer.minimize}"
+ ToolTip.Tip="{DynamicResource installer.minimize}">
+ <Path Data="{DynamicResource Setup.Minimize}" Width="12" Height="12" />
+ </Button>
+ <Button Grid.Column="2" Classes="chrome close" Margin="0,0,8,0" Command="{Binding CancelCommand}"
+ IsVisible="{Binding !IsProgress}" AutomationProperties.Name="{DynamicResource common.close}"
+ ToolTip.Tip="{DynamicResource common.close}">
+ <Path Data="{DynamicResource Setup.Close}" Width="12" Height="12" />
+ </Button>
+ </Grid>
- <!-- ───────── Page ───────── -->
- <DockPanel Grid.Column="1" Margin="34,28,30,22">
- <!-- Buttons -->
- <DockPanel DockPanel.Dock="Bottom" Margin="0,16,0,0" LastChildFill="False">
- <Button DockPanel.Dock="Left" MinWidth="96" HorizontalContentAlignment="Center" Content="{DynamicResource installer.back}"
- Command="{Binding BackCommand}" IsVisible="{Binding CanGoBack}" />
- <Button x:Name="NextButton" DockPanel.Dock="Right" Classes="accent" MinWidth="112" HorizontalContentAlignment="Center"
- Content="{Binding NextText}" Command="{Binding NextCommand}" IsVisible="{Binding ShowNext}" IsDefault="True" />
- <Button DockPanel.Dock="Right" MinWidth="96" Margin="0,0,8,0" HorizontalContentAlignment="Center"
- Content="{DynamicResource common.cancel}" Command="{Binding CancelCommand}" IsVisible="{Binding ShowCancel}" IsCancel="True" />
+ <TransitioningContentControl x:Name="Host" />
</DockPanel>
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="0,0,6,0">
- <Panel>
- <!-- Welcome -->
- <StackPanel Spacing="10" IsVisible="{Binding IsWelcome}">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{DynamicResource installer.welcome.title}" />
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{Binding WelcomeText}" />
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{DynamicResource installer.welcome.about}" />
- <TextBlock Classes="label" Margin="0,18,0,0" Text="{DynamicResource installer.language}" />
- <ComboBox x:Name="LanguageBox" MinWidth="240" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}">
- <ComboBox.ItemTemplate>
- <DataTemplate x:DataType="vm:LanguageItem">
- <TextBlock Text="{Binding Name}" />
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
- <TextBlock Classes="caption" TextWrapping="Wrap" Margin="0,18,0,0" Text="{DynamicResource installer.welcome.license}" />
- </StackPanel>
-
- <!-- Options -->
- <StackPanel Spacing="12" IsVisible="{Binding IsOptions}">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{DynamicResource installer.options.title}" />
- <StackPanel Spacing="4" IsVisible="{Binding IsFresh}">
- <TextBlock Classes="label" Text="{DynamicResource installer.options.folder}" />
+ <!-- Options: slides up over the card. -->
+ <Border x:Name="Sheet" Classes="sheet" Classes.open="{Binding OptionsOpen}" IsEnabled="{Binding OptionsOpen}" Margin="0,42,0,0">
+ <DockPanel Margin="24,16,24,18">
+ <DockPanel DockPanel.Dock="Top" Margin="0,0,0,10">
+ <Button DockPanel.Dock="Right" Classes="link" Command="{Binding ToggleOptionsCommand}">
+ <StackPanel Orientation="Horizontal" Spacing="6">
+ <TextBlock Text="{DynamicResource installer.options.hide}" />
+ <Path Data="{DynamicResource Setup.ChevronDown}" Width="12" Height="8" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button>
+ <TextBlock Classes="heading" VerticalAlignment="Center" Text="{DynamicResource installer.options.title}" />
+ </DockPanel>
+ <DockPanel DockPanel.Dock="Bottom" Margin="0,12,0,0">
+ <Button DockPanel.Dock="Right" Classes="big accent" MinWidth="160" Content="{Binding PrimaryText}" Command="{Binding InstallCommand}" />
+ <TextBlock Classes="caption" VerticalAlignment="Center" TextWrapping="Wrap" Margin="0,0,12,0" Text="{Binding SpaceText}" />
+ </DockPanel>
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="0,0,10,0">
+ <StackPanel Spacing="14">
<DockPanel>
- <Button DockPanel.Dock="Right" Margin="8,0,0,0" Content="{DynamicResource installer.options.browse}" Command="{Binding BrowseCommand}" />
- <TextBox x:Name="FolderBox" Text="{Binding Folder}" />
+ <ComboBox x:Name="LanguageBox" DockPanel.Dock="Right" MinWidth="170" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}">
+ <ComboBox.ItemTemplate>
+ <DataTemplate x:DataType="vm:LanguageItem">
+ <TextBlock Text="{Binding Name}" />
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+ <TextBlock VerticalAlignment="Center" Text="{DynamicResource installer.language}" />
</DockPanel>
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding SpaceText}" />
- </StackPanel>
- <StackPanel Spacing="4" IsVisible="{Binding IsUpdate}">
- <TextBlock Classes="label" Text="{DynamicResource installer.options.folder}" />
- <TextBlock TextWrapping="Wrap" Text="{Binding Folder}" />
- </StackPanel>
- <Border Classes="card" Padding="16,12">
+
+ <StackPanel Spacing="4" IsVisible="{Binding IsFresh}">
+ <TextBlock Classes="label" Text="{DynamicResource installer.options.folder}" />
+ <DockPanel>
+ <Button DockPanel.Dock="Right" Margin="8,0,0,0" Content="{DynamicResource installer.options.browse}" Command="{Binding BrowseCommand}" />
+ <TextBox Text="{Binding Folder}" />
+ </DockPanel>
+ </StackPanel>
+ <StackPanel Spacing="2" IsVisible="{Binding IsUpdate}">
+ <TextBlock Classes="label" Text="{DynamicResource installer.options.folder}" />
+ <TextBlock TextWrapping="Wrap" Text="{Binding Folder}" />
+ </StackPanel>
+
<StackPanel Spacing="2">
<CheckBox Classes="option" IsChecked="{Binding ContextMenu}" IsVisible="{Binding IsFresh}">
<TextBlock Text="{DynamicResource general.context_menu}" />
@@ -106,87 +99,30 @@
<CheckBox Classes="option" IsChecked="{Binding DesktopIcon}">
<TextBlock Text="{DynamicResource installer.task.desktop_icon}" />
</CheckBox>
+ <TextBlock Classes="caption" TextWrapping="Wrap" Margin="0,4,0,0" Text="{DynamicResource installer.options.later}" IsVisible="{Binding IsFresh}" />
+ <TextBlock Classes="caption" TextWrapping="Wrap" Margin="0,4,0,0" Text="{DynamicResource installer.options.update_note}" IsVisible="{Binding IsUpdate}" />
</StackPanel>
- </Border>
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource installer.options.later}" IsVisible="{Binding IsFresh}" />
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource installer.options.update_note}" IsVisible="{Binding IsUpdate}" />
- </StackPanel>
-
- <!-- Engines -->
- <StackPanel Spacing="12" IsVisible="{Binding IsEngines}">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{DynamicResource setup.title}" />
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{DynamicResource setup.description}" />
- <ItemsControl ItemsSource="{Binding Engines}" Focusable="False">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Spacing="8" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate x:DataType="vm:EngineItem">
- <Border Classes="card" Padding="14,10">
- <CheckBox Classes="option" IsChecked="{Binding Selected}" IsEnabled="{Binding CanSelect}">
- <StackPanel Spacing="2">
- <TextBlock FontWeight="Bold" TextWrapping="Wrap" Text="{Binding Name}" />
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding Detail}" />
- </StackPanel>
- </CheckBox>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{Binding EngineSelectionText}" />
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource installer.engines.when}" />
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource setup.note}" />
- </StackPanel>
-
- <!-- Progress -->
- <StackPanel Spacing="14" IsVisible="{Binding IsProgress}" VerticalAlignment="Center">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{Binding ProgressTitle}" />
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{Binding StatusText}" />
- <ProgressBar Classes="soft" Minimum="0" Maximum="100" Value="{Binding Percent}" />
- </StackPanel>
-
- <!-- Done -->
- <StackPanel Spacing="12" IsVisible="{Binding IsDone}">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{DynamicResource installer.done.title}" />
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{Binding DoneText}" />
- <Border Classes="warning" IsVisible="{Binding WarningText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
- <SelectableTextBlock TextWrapping="Wrap" Text="{Binding WarningText}" />
- </Border>
- <CheckBox Classes="option" Margin="0,8,0,0" IsChecked="{Binding LaunchFilee}">
- <TextBlock Text="{DynamicResource installer.done.launch}" />
- </CheckBox>
- </StackPanel>
- <!-- Failed -->
- <StackPanel Spacing="12" IsVisible="{Binding IsFailed}">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{Binding ErrorTitle}" />
- <SelectableTextBlock Classes="muted" TextWrapping="Wrap" Text="{Binding ErrorText}" />
- <SelectableTextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding LogText}" />
- </StackPanel>
-
- <!-- Uninstall -->
- <StackPanel Spacing="12" IsVisible="{Binding IsUninstallPage}">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{DynamicResource installer.uninstall.title}" />
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{Binding UninstallText}" />
- <Border Classes="card" Padding="16,12" Margin="0,6,0,0">
- <StackPanel Spacing="4">
- <CheckBox Classes="option" IsChecked="{Binding DeleteSettings}">
- <TextBlock Text="{DynamicResource installer.uninstall.delete_settings}" />
- </CheckBox>
- <TextBlock Classes="caption" Margin="28,0,0,0" TextWrapping="Wrap" Text="{Binding SettingsText}" />
+ <StackPanel Spacing="4" IsVisible="{Binding HasEngines}">
+ <TextBlock Classes="label" Text="{DynamicResource setup.title}" />
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource installer.engines.when}" />
+ <ItemsControl ItemsSource="{Binding Engines}" Focusable="False" Margin="0,4,0,0">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate x:DataType="vm:EngineItem">
+ <CheckBox Classes="option" IsChecked="{Binding Selected}" IsEnabled="{Binding CanSelect}">
+ <StackPanel>
+ <TextBlock TextWrapping="Wrap" Text="{Binding Name}" />
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding Detail}" />
+ </StackPanel>
+ </CheckBox>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
</StackPanel>
- </Border>
- </StackPanel>
-
- <!-- Uninstalled -->
- <StackPanel Spacing="12" IsVisible="{Binding IsUninstalled}">
- <TextBlock Classes="h1" TextWrapping="Wrap" Text="{DynamicResource installer.uninstall.done_title}" />
- <TextBlock Classes="muted" TextWrapping="Wrap" Text="{Binding UninstalledText}" />
- </StackPanel>
- </Panel>
- </ScrollViewer>
- </DockPanel>
- </Grid>
+ </StackPanel>
+ </ScrollViewer>
+ </DockPanel>
+ </Border>
+ </Panel>
+ </Border>
</Window>
diff --git a/src/Filee.Setup/Views/SetupWindow.axaml.cs b/src/Filee.Setup/Views/SetupWindow.axaml.cs
index 8e2bf6d0..d3c7a370 100644
--- a/src/Filee.Setup/Views/SetupWindow.axaml.cs
+++ b/src/Filee.Setup/Views/SetupWindow.axaml.cs
@@ -1,5 +1,16 @@
+using System.ComponentModel;
+using Avalonia;
+using Avalonia.Animation;
using Avalonia.Controls;
+using Avalonia.Controls.Templates;
+using Avalonia.Input;
+using Avalonia.Input.Platform;
+using Avalonia.Interactivity;
+using Avalonia.LogicalTree;
+using Avalonia.Media;
using Avalonia.Platform.Storage;
+using Avalonia.Styling;
+using Filee.Setup.Controls;
using Filee.Setup.ViewModels;
namespace Filee.Setup.Views;
@@ -14,7 +25,7 @@ public partial class SetupWindow : Window
{
}
- /// <param name="silent">/SILENT: install at once, show only the progress and close when done.</param>
+ /// <param name="silent">/SILENT: install at once, show only the progress card and close when done.</param>
public SetupWindow(SetupViewModel model, bool silent)
{
InitializeComponent();
@@ -22,12 +33,24 @@ public partial class SetupWindow : Window
DataContext = model;
if (model is null)
return;
+ model.Silent = silent;
+ if (!SetupMotion.Enabled)
+ Classes.Add("reduced-motion");
+ else
+ Host.PageTransition = new CrossFade(TimeSpan.FromMilliseconds(320));
model.PickFolder = PickFolderAsync;
+ model.CopyText = text => Clipboard?.SetTextAsync(text) ?? Task.CompletedTask;
model.CloseRequested += (_, _) =>
{
_closing = true;
Close();
};
+ model.PropertyChanged += OnModelChanged;
+ TitleBar.PointerPressed += (_, e) =>
+ {
+ if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
+ BeginMoveDrag(e);
+ };
// Installing can't be stopped halfway: the window stays until the files are in place (or back).
Closing += (_, e) =>
{
@@ -38,6 +61,17 @@ public partial class SetupWindow : Window
else
model.WindowClosing();
};
+ KeyDown += (_, e) =>
+ {
+ if (e.Key == Key.Escape)
+ {
+ model.CancelCommand.Execute(null);
+ e.Handled = true;
+ }
+ };
+ ActualThemeVariantChanged += (_, _) => ApplyTheme();
+ ApplyTheme();
+ ShowState();
Opened += async (_, _) =>
{
if (silent)
@@ -51,13 +85,100 @@ public partial class SetupWindow : Window
Close();
return;
}
- (model.IsUninstall ? (Control)NextButton : LanguageBox).Focus();
+ FocusPrimary();
};
}
/// <summary>A /SILENT run ended (before the window closes): Program shows an error message if there was one.</summary>
public event EventHandler? SilentFinished;
+ /// <summary>The state shown now (tests).</summary>
+ public Control? State => Host.Content as Control;
+
+ private void ApplyTheme()
+ {
+ var dark = ActualThemeVariant == ThemeVariant.Dark;
+ _model.Dark = dark;
+ // Links and the version pill: the deeper accent on light, the accent itself on dark (enough contrast on both).
+ if (Application.Current?.FindResource(dark ? "AccentBrush" : "AccentStrongBrush") is { } link)
+ Resources["Setup.LinkBrush"] = link;
+ Backdrop.Intensity = dark ? 0.22 : 0.30;
+ }
+
+ private void OnModelChanged(object? sender, PropertyChangedEventArgs e)
+ {
+ switch (e.PropertyName)
+ {
+ case nameof(SetupViewModel.Page):
+ ShowState();
+ break;
+ case nameof(SetupViewModel.ClipIndex) or nameof(SetupViewModel.CurrentClip):
+ ShowClip();
+ break;
+ case nameof(SetupViewModel.CurrentCaption):
+ ShowCaption();
+ break;
+ case nameof(SetupViewModel.OptionsOpen) when _model.OptionsOpen:
+ LanguageBox.Focus();
+ break;
+ case nameof(SetupViewModel.OptionsOpen):
+ FocusPrimary();
+ break;
+ }
+ }
+
+ /// <summary>Builds the card for the current state (StateViews.axaml) and crossfades to it.</summary>
+ private void ShowState()
+ {
+ if (this.FindResource("Setup." + _model.Page) is not IDataTemplate template)
+ return;
+ var state = template.Build(_model);
+ if (state is null)
+ return;
+ state.DataContext = _model;
+ Host.Content = state;
+ ShowClip();
+ ShowCaption();
+ FocusPrimary();
+ }
+
+ private T? Find<T>(string name) where T : Control =>
+ State?.GetLogicalDescendants().OfType<T>().FirstOrDefault(c => c.Name == name);
+
+ private void ShowClip()
+ {
+ if (!_model.ShowShowcase || Find<TransitioningContentControl>("ClipHost") is not { } host)
+ return;
+ if (SetupMotion.Enabled)
+ host.PageTransition ??= new CrossFade(TimeSpan.FromMilliseconds(600));
+ (host.Content as AnimatedWebp)?.Dispose();
+ host.Content = new AnimatedWebp { Source = _model.CurrentClip };
+ }
+
+ private void ShowCaption()
+ {
+ if (!_model.ShowShowcase || Find<TransitioningContentControl>("CaptionHost") is not { } host)
+ return;
+ if (SetupMotion.Enabled)
+ host.PageTransition ??= new CrossFade(TimeSpan.FromMilliseconds(600));
+ host.Content = new TextBlock
+ {
+ Text = _model.CurrentCaption,
+ TextWrapping = TextWrapping.Wrap,
+ TextAlignment = TextAlignment.Center,
+ Classes = { "muted" },
+ };
+ }
+
+ private void FocusPrimary()
+ {
+ if (_model.OptionsOpen)
+ return;
+ Avalonia.Threading.Dispatcher.UIThread.Post(() => Find<Button>("PrimaryButton")?.Focus(), Avalonia.Threading.DispatcherPriority.Loaded);
+ }
+
+ private void OnMinimize(object? sender, RoutedEventArgs e) => WindowState = WindowState.Minimized;
+
private async Task<string?> PickFolderAsync(string current)
{
IStorageFolder? start = null;
diff --git a/src/Filee.Setup/Views/StateViews.axaml b/src/Filee.Setup/Views/StateViews.axaml
new file mode 100644
index 00000000..eb072332
--- /dev/null
+++ b/src/Filee.Setup/Views/StateViews.axaml
@@ -0,0 +1,139 @@
+<!-- The states of Setup's card. SetupWindow shows one at a time (crossfading); all bind the same SetupViewModel. -->
+<ResourceDictionary xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:Filee.Setup.ViewModels"
+ xmlns:c="using:Filee.Setup.Controls">
+
+ <!-- Welcome: the logo assembling, one big button, Options. -->
+ <DataTemplate x:Key="Setup.Welcome" x:DataType="vm:SetupViewModel">
+ <Grid RowDefinitions="*,Auto">
+ <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="6" MaxWidth="470" Margin="24,0">
+ <c:DonutLogo Width="96" Height="96" HorizontalAlignment="Center" Margin="0,0,0,10" />
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
+ <TextBlock Classes="title" Text="Filee" />
+ <Border Classes="pill">
+ <TextBlock Text="{Binding Version}" />
+ </Border>
+ </StackPanel>
+ <TextBlock Classes="muted" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding WelcomeText}" />
+ <Button x:Name="PrimaryButton" Classes="big accent" HorizontalAlignment="Center" Margin="0,18,0,2"
+ Content="{Binding PrimaryText}" Command="{Binding InstallCommand}" IsDefault="True" />
+ <Button Classes="link" HorizontalAlignment="Center" Command="{Binding ToggleOptionsCommand}">
+ <StackPanel Orientation="Horizontal" Spacing="6">
+ <TextBlock Text="{DynamicResource installer.options.title}" />
+ <Path Data="{DynamicResource Setup.ChevronUp}" Width="12" Height="8" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button>
+ </StackPanel>
+ <TextBlock Grid.Row="1" Classes="caption" HorizontalAlignment="Center" Margin="24,0,24,16" TextWrapping="Wrap"
+ TextAlignment="Center" Text="{DynamicResource installer.welcome.license}" />
+ </Grid>
+ </DataTemplate>
+
+ <!-- Installing (and uninstalling): feature clips, one status line, a thin bar. -->
+ <DataTemplate x:Key="Setup.Progress" x:DataType="vm:SetupViewModel">
+ <Grid RowDefinitions="*,Auto" Margin="32,0,32,26">
+ <StackPanel VerticalAlignment="Center" Spacing="12" IsVisible="{Binding ShowShowcase}">
+ <Border Classes="clip" Width="448" Height="252" HorizontalAlignment="Center">
+ <TransitioningContentControl x:Name="ClipHost" />
+ </Border>
+ <TransitioningContentControl x:Name="CaptionHost" HorizontalAlignment="Center" MaxWidth="500" Height="40" />
+ </StackPanel>
+ <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="14" IsVisible="{Binding !ShowShowcase}">
+ <c:DonutLogo Width="84" Height="84" HorizontalAlignment="Center" />
+ <TextBlock Classes="heading" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding ProgressTitle}" />
+ </StackPanel>
+ <StackPanel Grid.Row="1" Spacing="10" Margin="0,8,0,0">
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Right" Classes="caption" Margin="12,0,0,0" Text="{Binding Percent, StringFormat={}{0:0}%}" />
+ <TextBlock Classes="muted" TextTrimming="CharacterEllipsis" Text="{Binding StatusText}" />
+ </DockPanel>
+ <c:ShimmerBar x:Name="Bar" Value="{Binding Percent}" Track="{DynamicResource SurfaceAltBrush}" Fill="{DynamicResource AccentBrush}" />
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+
+ <!-- Done: the check mark bursts, "Launch Filee". -->
+ <DataTemplate x:Key="Setup.Done" x:DataType="vm:SetupViewModel">
+ <Grid RowDefinitions="*,Auto" Margin="32,0,32,24">
+ <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="8" MaxWidth="500" Margin="0,0,0,12">
+ <c:CheckBurst Width="88" Height="88" HorizontalAlignment="Center" Fill="{DynamicResource AccentBrush}" Mark="{DynamicResource OnAccentBrush}" />
+ <TextBlock Classes="title" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding DoneTitle}" />
+ <TextBlock Classes="muted" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding DoneText}" />
+ <Border Classes="warning" Margin="0,4,0,0" IsVisible="{Binding WarningText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
+ <ScrollViewer MaxHeight="84" HorizontalScrollBarVisibility="Disabled">
+ <SelectableTextBlock FontSize="12.5" TextWrapping="Wrap" Text="{Binding WarningText}" />
+ </ScrollViewer>
+ </Border>
+ </StackPanel>
+ <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
+ <Button Classes="soft" Content="{DynamicResource common.close}" Command="{Binding CloseCommand}" />
+ <Button x:Name="PrimaryButton" Classes="big accent" Content="{DynamicResource installer.done.launch}"
+ Command="{Binding LaunchAndCloseCommand}" IsDefault="True" />
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+
+ <!-- Something went wrong: what, and the details to copy. -->
+ <DataTemplate x:Key="Setup.Failed" x:DataType="vm:SetupViewModel">
+ <Grid RowDefinitions="*,Auto" Margin="32,0,32,24">
+ <StackPanel VerticalAlignment="Center" Spacing="10" MaxWidth="520" HorizontalAlignment="Center">
+ <Border Width="64" Height="64" CornerRadius="32" HorizontalAlignment="Center" Background="{DynamicResource DangerBrush}">
+ <TextBlock Text="!" FontSize="34" FontWeight="Bold" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
+ </Border>
+ <TextBlock Classes="title" FontSize="22" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding ErrorTitle}" />
+ <ScrollViewer MaxHeight="120" HorizontalScrollBarVisibility="Disabled">
+ <SelectableTextBlock Classes="muted" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding ErrorText}" />
+ </ScrollViewer>
+ <TextBlock Classes="caption" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding LogText}" />
+ </StackPanel>
+ <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
+ <Button Classes="soft" Command="{Binding CopyDetailsCommand}">
+ <Panel>
+ <TextBlock Text="{DynamicResource installer.error.copy}" IsVisible="{Binding !Copied}" />
+ <TextBlock Text="{DynamicResource installer.error.copied}" IsVisible="{Binding Copied}" />
+ </Panel>
+ </Button>
+ <Button x:Name="PrimaryButton" Classes="big accent" MinWidth="140" Content="{DynamicResource common.close}"
+ Command="{Binding CloseCommand}" IsDefault="True" />
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+
+ <!-- The uninstaller: keep or delete the settings. -->
+ <DataTemplate x:Key="Setup.Uninstall" x:DataType="vm:SetupViewModel">
+ <Grid RowDefinitions="*,Auto" Margin="32,0,32,24">
+ <StackPanel VerticalAlignment="Center" Spacing="8" MaxWidth="500" HorizontalAlignment="Center">
+ <c:DonutLogo Width="76" Height="76" HorizontalAlignment="Center" Margin="0,0,0,6" />
+ <TextBlock Classes="title" FontSize="22" TextAlignment="Center" TextWrapping="Wrap" Text="{DynamicResource installer.uninstall.title}" />
+ <TextBlock Classes="muted" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding UninstallText}" />
+ <Border Classes="card" Padding="14,10" Margin="0,8,0,0">
+ <StackPanel Spacing="2">
+ <CheckBox Classes="option" IsChecked="{Binding DeleteSettings}">
+ <TextBlock Text="{DynamicResource installer.uninstall.delete_settings}" />
+ </CheckBox>
+ <TextBlock Classes="caption" Margin="28,0,0,0" TextWrapping="Wrap" Text="{Binding SettingsText}" />
+ </StackPanel>
+ </Border>
+ </StackPanel>
+ <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10">
+ <Button Classes="soft" Content="{DynamicResource common.cancel}" Command="{Binding CancelCommand}" />
+ <Button x:Name="PrimaryButton" Classes="big accent" MinWidth="160" Content="{DynamicResource installer.uninstall.button}"
+ Command="{Binding UninstallCommand}" IsDefault="True" />
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+
+ <!-- Uninstalled. -->
+ <DataTemplate x:Key="Setup.Uninstalled" x:DataType="vm:SetupViewModel">
+ <Grid RowDefinitions="*,Auto" Margin="32,0,32,24">
+ <StackPanel VerticalAlignment="Center" Spacing="8" MaxWidth="480" HorizontalAlignment="Center">
+ <c:CheckBurst Width="96" Height="96" HorizontalAlignment="Center" Fill="{DynamicResource AccentBrush}" Mark="{DynamicResource OnAccentBrush}" />
+ <TextBlock Classes="title" FontSize="22" TextAlignment="Center" TextWrapping="Wrap" Text="{DynamicResource installer.uninstall.done_title}" />
+ <TextBlock Classes="muted" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding UninstalledText}" />
+ </StackPanel>
+ <Button x:Name="PrimaryButton" Grid.Row="1" Classes="big accent" MinWidth="140" HorizontalAlignment="Center"
+ Content="{DynamicResource common.close}" Command="{Binding CloseCommand}" IsDefault="True" />
+ </Grid>
+ </DataTemplate>
+</ResourceDictionary>
diff --git a/tests/Filee.Setup.Tests/SetupTextsTests.cs b/tests/Filee.Setup.Tests/SetupTextsTests.cs
index acbd098c..8e23dc7c 100644
--- a/tests/Filee.Setup.Tests/SetupTextsTests.cs
+++ b/tests/Filee.Setup.Tests/SetupTextsTests.cs
@@ -49,14 +49,14 @@ public partial class SetupTextsTests
{
var texts = new SetupTexts("ko");
Assert.Equal("ko", texts.Language);
- Assert.NotEqual("installer.welcome.title", texts["installer.welcome.title"]);
+ Assert.NotEqual("installer.install", texts["installer.install"]);
Assert.Contains("9.9.9", texts.Format("installer.welcome.fresh", "9.9.9"));
Assert.Equal("no.such.key", texts["no.such.key"]);
var changed = 0;
texts.LanguageChanged += (_, _) => changed++;
texts.SetLanguage("en");
Assert.Equal(1, changed);
- Assert.Equal("Welcome to Filee", texts["installer.welcome.title"]);
+ Assert.Equal("Install", texts["installer.install"]);
}
[Fact]
@@ -69,10 +69,10 @@ public partial class SetupTextsTests
.SelectMany(f => DynamicResource().Matches(File.ReadAllText(f)).Select(m => m.Groups[1].Value))
.Concat(Directory.EnumerateFiles(source, "*.cs", SearchOption.AllDirectories)
.SelectMany(f => KeyLiteral().Matches(File.ReadAllText(f)).Select(m => m.Groups[1].Value)))
- .Where(k => k.Contains('.') && !k.EndsWith('.'))
+ .Where(k => k.Contains('.') && !k.EndsWith('.') && !k.StartsWith("Setup.", StringComparison.Ordinal))
.Distinct()
.ToList();
- Assert.Contains("installer.welcome.title", used);
+ Assert.Contains("installer.welcome.fresh", used);
Assert.Contains("general.context_menu", used);
Assert.DoesNotContain(used, k => !english.ContainsKey(k));
// Engine names come from the app's own keys.
diff --git a/tests/Filee.Setup.Tests/SetupWindowTests.cs b/tests/Filee.Setup.Tests/SetupWindowTests.cs
index 2d95c445..50e6bc9d 100644
--- a/tests/Filee.Setup.Tests/SetupWindowTests.cs
+++ b/tests/Filee.Setup.Tests/SetupWindowTests.cs
@@ -1,15 +1,19 @@
-// Renders every page of Setup and the uninstaller headlessly (Skia) in Filee's languages, light and dark: catches XAML
-// and binding errors, text that doesn't fit, and leaves screenshots in bin/.../screenshots for review.
+// Renders every state of Setup's card headlessly (Skia) in Filee's languages, light and dark: catches XAML and binding
+// errors and text that doesn't fit, and leaves screenshots in bin/.../screenshots for review. Animations are off
+// (static logo, a still from each clip) except in the test that runs them.
+using System.Runtime.CompilerServices;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Headless;
using Avalonia.Headless.XUnit;
using Avalonia.Input;
+using Avalonia.Media;
using Avalonia.Styling;
using Avalonia.Threading;
using Avalonia.VisualTree;
+using Filee.Setup.Controls;
using Filee.Setup.Installation;
using Filee.Setup.Payload;
using Filee.Setup.ViewModels;
@@ -19,6 +23,9 @@ namespace Filee.Setup.Tests;
public class SetupWindowTests
{
+ [ModuleInitializer]
+ internal static void StaticScreenshots() => SetupMotion.Enabled = false;
+
/// <summary>Every language Setup offers.</summary>
public static TheoryData<string> Languages => new(SetupTexts.Languages.Select(l => l.Code));
@@ -27,11 +34,13 @@ public class SetupWindowTests
public InstallChoices? Installed { get; private set; }
public bool? DeletedSettings { get; private set; }
public InstallResult Result { get; set; } = new(new LaunchRequest(@"C:\Program Files\Filee\Filee.exe", "--background"), []);
+ public TaskCompletionSource? Hold { get; set; }
public InstallResult Install(InstallChoices choices, IProgress<SetupProgress> progress)
{
Installed = choices;
- progress.Report(new SetupProgress(SetupStep.Copying, 0.5));
+ progress.Report(new SetupProgress(SetupStep.Copying, 0.62));
+ Hold?.Task.Wait();
return Result;
}
@@ -72,69 +81,100 @@ public class SetupWindowTests
[AvaloniaTheory]
[MemberData(nameof(Languages))]
- public async Task Every_install_page_renders_and_fits(string language)
+ public async Task Every_state_renders_and_fits(string language)
{
var (model, _, runner) = Model(language);
var window = Show(model);
Check(window, $"setup-1-welcome-{language}.png");
- Assert.True(model.IsWelcome);
-
- await model.NextCommand.ExecuteAsync(null);
- Assert.True(model.IsOptions);
- Check(window, $"setup-2-options-{language}.png");
- await model.NextCommand.ExecuteAsync(null);
- Assert.True(model.IsEngines);
+ model.ToggleOptionsCommand.Execute(null);
+ Pump();
+ Assert.True(model.OptionsOpen);
// FFmpeg is installed already: shown, not offered.
Assert.False(model.Engines.Single(e => e.Id == "ffmpeg").CanSelect);
- Check(window, $"setup-3-engines-{language}.png", mayScroll: true);
+ Check(window, $"setup-2-options-{language}.png", sheetMayScroll: true);
- model.Page = SetupPage.Progress;
- model.StatusText = new SetupTexts(language)["installer.status.copying"];
- model.Percent = 62;
- Check(window, $"setup-4-progress-{language}.png");
+ runner.Hold = new TaskCompletionSource();
+ var install = model.InstallAsync();
+ Pump();
+ Assert.True(model.IsProgress);
+ Assert.False(model.OptionsOpen);
+ Assert.Equal(62, model.Percent);
+ Assert.NotNull(window.GetVisualDescendants().OfType<AnimatedWebp>().SingleOrDefault());
+ Check(window, $"setup-3-installing-{language}.png");
runner.Result = new InstallResult(new LaunchRequest(@"C:\Program Files\Filee\Filee.exe", "--install-engines=pandoc"),
- [
- new ExplorerMenuWarning("Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation."),
- new RuntimeWarning([new MissingRuntime(@"engines\rhwp\rhwp.exe", "vcruntime140.dll")]),
- ]);
- model.Page = SetupPage.Engines;
- await model.NextCommand.ExecuteAsync(null);
+ [new RuntimeWarning([new MissingRuntime(@"engines\rhwp\rhwp.exe", "vcruntime140.dll")])]);
+ runner.Hold.SetResult();
+ await install;
Pump();
Assert.True(model.IsDone);
- Check(window, $"setup-5-done-{language}.png", mayScroll: true);
+ Check(window, $"setup-4-done-{language}.png");
window.Close();
}
[AvaloniaFact]
- public async Task Update_and_failure_pages_render()
+ public async Task Dark_cards_follow_the_system()
+ {
+ var app = Application.Current!;
+ try
+ {
+ app.RequestedThemeVariant = ThemeVariant.Dark;
+ foreach (var language in new[] { "en", "ko", "ru" })
+ {
+ var (model, _, runner) = Model(language);
+ var window = Show(model);
+ Assert.True(model.Dark);
+ Check(window, $"setup-dark-1-welcome-{language}.png");
+ model.ToggleOptionsCommand.Execute(null);
+ Check(window, $"setup-dark-2-options-{language}.png", sheetMayScroll: true);
+ runner.Hold = new TaskCompletionSource();
+ var install = model.InstallAsync();
+ Pump();
+ // The donut clip has a dark version.
+ Assert.Contains("expand-dark", window.GetVisualDescendants().OfType<AnimatedWebp>().Single().Source);
+ Check(window, $"setup-dark-3-installing-{language}.png");
+ runner.Hold.SetResult();
+ await install;
+ Check(window, $"setup-dark-4-done-{language}.png");
+ window.Close();
+ }
+ var (uninstall, _, _) = Model("ko", uninstall: true);
+ var card = Show(uninstall);
+ Check(card, "uninstall-dark-1-confirm-ko.png");
+ card.Close();
+ }
+ finally
+ {
+ app.RequestedThemeVariant = ThemeVariant.Default;
+ }
+ }
+
+ [AvaloniaFact]
+ public async Task Updates_and_failures_render()
{
- foreach (var language in new[] { "en", "ko", "ja", "hi" })
+ foreach (var language in new[] { "en", "ko", "ru" })
{
- var (model, _, runner) = Model(language, update: true);
+ var (model, texts, runner) = Model(language, update: true);
var window = Show(model);
- Assert.False(model.HasEnginesPage);
+ Assert.False(model.HasEngines);
+ Assert.Equal(texts["installer.update"], model.PrimaryText);
Check(window, $"setup-update-1-welcome-{language}.png");
- await model.NextCommand.ExecuteAsync(null);
- Check(window, $"setup-update-2-options-{language}.png");
- // An update offers only what it may change.
- Assert.Equal(model.NextText, new SetupTexts(language)["installer.update"]);
- runner.Result = new InstallResult(null, [], new SetupException("installer.error.space", "space", "C:\\", "420 MB", "12 MB"), RolledBack: false);
- await model.NextCommand.ExecuteAsync(null);
+ runner.Result = new InstallResult(null, [], new SetupException("installer.error.space", "space", "C:\\", "420 MB", "12 MB"));
+ await model.InstallAsync();
Pump();
Assert.True(model.IsFailed);
Assert.Equal(4, model.ExitCode);
- Check(window, $"setup-update-3-failed-{language}.png");
+ Check(window, $"setup-update-2-failed-{language}.png");
window.Close();
}
}
[AvaloniaFact]
- public async Task Uninstall_pages_render_and_keep_the_settings_by_default()
+ public async Task Uninstall_renders_and_keeps_the_settings_by_default()
{
- foreach (var language in new[] { "en", "ko", "ja", "zh-CN", "pl" })
+ foreach (var language in new[] { "en", "ko", "ru", "zh-CN" })
{
var (model, _, runner) = Model(language, uninstall: true);
var window = Show(model);
@@ -142,7 +182,7 @@ public class SetupWindowTests
Assert.False(model.DeleteSettings);
Assert.Contains(@"C:\Users\me\AppData\Roaming\Filee", model.SettingsText);
Check(window, $"uninstall-1-confirm-{language}.png");
- await model.NextCommand.ExecuteAsync(null);
+ await model.UninstallAsync();
Pump();
Assert.True(model.IsUninstalled);
Assert.False(runner.DeletedSettings);
@@ -153,26 +193,72 @@ public class SetupWindowTests
}
[AvaloniaFact]
- public void Dark_windows_follow_the_system()
+ public void The_clips_take_turns_with_their_captions()
{
- var app = Application.Current!;
+ var (model, texts, runner) = Model("en");
+ var window = Show(model);
+ runner.Hold = new TaskCompletionSource();
+ _ = model.InstallAsync();
+ Pump();
+ var seen = new HashSet<string>();
+ for (var i = 0; i < SetupViewModel.Clips.Count + 1; i++)
+ {
+ // The clip on the card and its caption are the current ones (the 6-second timer may move on meanwhile).
+ var shown = window.GetVisualDescendants().OfType<AnimatedWebp>().Last().Source!;
+ Assert.Equal(SetupViewModel.Clips[model.ClipIndex].Clip, shown);
+ Assert.Equal(texts[SetupViewModel.Clips[model.ClipIndex].CaptionKey], model.CurrentCaption);
+ seen.Add(shown);
+ var before = model.ClipIndex;
+ model.NextClip();
+ Assert.Equal((before + 1) % SetupViewModel.Clips.Count, model.ClipIndex);
+ Pump();
+ }
+ Assert.Equal(SetupViewModel.Clips.Count, seen.Count);
+ runner.Hold.SetResult();
+ window.Close();
+ }
+
+ [AvaloniaFact]
+ public void A_clip_plays_frame_after_frame()
+ {
+ var clip = new AnimatedWebp { Source = SetupViewModel.Clips[1].Clip };
+ Assert.True(clip.FrameCount > 30);
+ var window = new Window { Content = clip, Width = 640, Height = 360 };
+ window.Show();
+ foreach (var frame in new[] { 0, 1, 2, clip.FrameCount - 1, 0 })
+ {
+ clip.ShowFrame(frame);
+ Assert.Equal(frame, clip.Frame);
+ }
+ // Jumping ahead decodes the frames it builds on.
+ clip.ShowFrame(clip.FrameCount / 2);
+ Assert.Equal(clip.FrameCount / 2, clip.Frame);
+ window.Close();
+ clip.Dispose();
+ }
+
+ [AvaloniaFact]
+ public async Task With_animations_on_the_card_still_works()
+ {
+ SetupMotion.Enabled = true;
try
{
- app.RequestedThemeVariant = ThemeVariant.Dark;
- var (model, _, _) = Model("en");
+ var (model, _, runner) = Model("en");
var window = Show(model);
- Check(window, "setup-dark-welcome-en.png");
- model.Page = SetupPage.Options;
- Check(window, "setup-dark-options-en.png");
- window.Close();
- var (uninstall, _, _) = Model("ko", uninstall: true);
- window = Show(uninstall);
- Check(window, "uninstall-dark-confirm-ko.png");
+ Pump(120);
+ Check(window, "setup-motion-welcome-en.png");
+ runner.Hold = new TaskCompletionSource();
+ var install = model.InstallAsync();
+ Pump(120);
+ runner.Hold.SetResult();
+ await install;
+ Pump(120);
+ Check(window, "setup-motion-done-en.png");
window.Close();
}
finally
{
- app.RequestedThemeVariant = ThemeVariant.Default;
+ SetupMotion.Enabled = false;
}
}
@@ -184,13 +270,11 @@ public class SetupWindowTests
model.SelectedLanguage = model.Languages.Single(l => l.Code == "ko");
Pump();
Assert.Equal("ko", texts.Language);
- Assert.Equal(texts["installer.next"], model.NextText);
- Assert.Equal(texts["installer.step.welcome"], model.Steps[0].Title);
+ Assert.Equal(texts["installer.install"], model.PrimaryText);
Assert.Contains("2.0.0", model.WelcomeText);
var choices = model.Choices();
Assert.Equal("ko", choices.Language);
Assert.True(choices.LanguagePicked);
- Check(window, "setup-language-switched-ko.png");
window.Close();
}
@@ -212,29 +296,49 @@ public class SetupWindowTests
}
[AvaloniaFact]
- public void Keyboard_escape_cancels_and_enter_goes_on()
+ public void Keyboard_enter_installs_and_escape_closes_the_options_then_cancels()
{
- var (model, _, _) = Model("en");
+ var (model, _, runner) = Model("en");
var window = Show(model);
var closed = false;
model.CloseRequested += (_, _) => closed = true;
- var next = window.FindControl<Button>("NextButton")!;
- Assert.True(next.IsDefault);
- next.Focus();
- window.KeyPressQwerty(PhysicalKey.Enter, RawInputModifiers.None);
+
+ model.ToggleOptionsCommand.Execute(null);
+ Pump();
+ window.KeyPressQwerty(PhysicalKey.Escape, RawInputModifiers.None);
Pump();
- Assert.True(model.IsOptions);
+ Assert.False(model.OptionsOpen);
+ Assert.False(closed);
+
+ var primary = window.GetVisualDescendants().OfType<Button>().Single(b => b.Name == "PrimaryButton");
+ Assert.True(primary.IsDefault);
+ Assert.True(primary.IsFocused);
window.KeyPressQwerty(PhysicalKey.Escape, RawInputModifiers.None);
Pump();
Assert.True(closed);
Assert.Equal(2, model.ExitCode);
+ Assert.Null(runner.Installed);
+ }
+
+ [AvaloniaFact]
+ public async Task Launch_or_close_on_the_done_card()
+ {
+ var (model, _, _) = Model("en");
+ var window = Show(model);
+ await model.InstallAsync();
+ Pump();
+ model.CloseCommand.Execute(null);
+ Assert.Null(model.Launch);
+ Assert.Equal(0, model.ExitCode);
+ model.LaunchAndCloseCommand.Execute(null);
+ Assert.Equal("--background", model.Launch!.Arguments);
+ window.Close();
}
[AvaloniaFact]
public void Closing_the_window_before_installing_cancels()
{
var (model, _, _) = Model("en");
- model.LaunchFilee = true;
model.WindowClosing();
Assert.Equal(2, model.ExitCode);
Assert.Null(model.Launch);
@@ -242,20 +346,40 @@ public class SetupWindowTests
private static Window Show(SetupViewModel model)
{
- var window = new SetupWindow(model, silent: false);
+ // The desktop behind the transparent window's rounded corners (headless captures have no desktop).
+ var window = new SetupWindow(model, silent: false) { Background = new SolidColorBrush(Color.Parse("#D9DCE3")) };
window.Show();
Pump();
return window;
}
- /// <summary>Saves a screenshot; the page must fit the window (no scrolling) and no button may cut its text.</summary>
- private static void Check(Window window, string name, bool mayScroll = false)
+ /// <summary>
+ /// Saves a screenshot. Everything visible must lie inside the card (no text pushed out of it), no button may cut its
+ /// text, and the Options sheet may scroll but not the page.
+ /// </summary>
+ private static void Check(Window window, string name, bool sheetMayScroll = false)
{
Pump();
- var scroller = window.GetVisualDescendants().OfType<ScrollViewer>().First();
- if (!mayScroll)
- Assert.True(scroller.Extent.Height <= scroller.Viewport.Height + 1, $"{name}: the page needs scrolling ({scroller.Extent.Height} > {scroller.Viewport.Height})");
- // Push buttons only: check boxes wrap their text.
+ var card = window.GetVisualDescendants().OfType<Border>().First(b => b.Name == "Card");
+ var cardBounds = new Rect(card.Bounds.Size);
+ var state = ((SetupWindow)window).State!;
+ foreach (var text in state.GetVisualDescendants().OfType<TextBlock>().Where(t => t.IsEffectivelyVisible && t.Bounds.Height > 0))
+ {
+ var corner = text.TranslatePoint(new Point(text.Bounds.Width, text.Bounds.Height), card);
+ Assert.True(corner is { } p && p.Y <= cardBounds.Height + 0.5 && p.X <= cardBounds.Width + 0.5, $"{name}: \"{text.Text}\" runs out of the card");
+ text.Measure(new Size(text.Bounds.Width + text.Margin.Left + text.Margin.Right, double.PositiveInfinity));
+ Assert.True(text.DesiredSize.Height - text.Margin.Top - text.Margin.Bottom <= text.Bounds.Height + 1, $"{name}: \"{text.Text}\" is cut off");
+ }
+ // Nothing may overlap the buttons at the bottom of the card.
+ if (state.GetVisualDescendants().OfType<Button>().FirstOrDefault(b => b.Name == "PrimaryButton" && b.IsEffectivelyVisible) is { } primary
+ && state is Grid { RowDefinitions.Count: 2 } grid
+ && grid.Children.OfType<Control>().First(c => Grid.GetRow(c) == 0 && c.IsEffectivelyVisible) is { } content
+ && !content.IsVisualAncestorOf(primary))
+ {
+ var contentBottom = content.TranslatePoint(new Point(0, content.Bounds.Height), card)!.Value.Y;
+ var buttonsTop = primary.TranslatePoint(default, card)!.Value.Y;
+ Assert.True(contentBottom <= buttonsTop + 0.5, $"{name}: the content ({contentBottom:0}) runs into the buttons ({buttonsTop:0})");
+ }
foreach (var button in window.GetVisualDescendants().OfType<Button>().Where(b => b is not ToggleButton && b.IsEffectivelyVisible))
{
button.Measure(Size.Infinity);
@@ -263,6 +387,9 @@ public class SetupWindowTests
button.InvalidateMeasure();
Assert.True(wanted <= button.Bounds.Width + 1, $"{name}: a button cuts its text ({button.Content})");
}
+ if (!sheetMayScroll)
+ Assert.DoesNotContain(state.GetVisualDescendants().OfType<ScrollViewer>(), s => s.Extent.Height > s.Viewport.Height + 1 && s.MaxHeight is double.PositiveInfinity);
+ Pump();
using var frame = window.CaptureRenderedFrame();
Assert.NotNull(frame);
var folder = Path.Combine(AppContext.BaseDirectory, "screenshots");
@@ -271,9 +398,9 @@ public class SetupWindowTests
frame.Save(stream, new Avalonia.Media.Imaging.PngBitmapEncoderOptions());
}
- private static void Pump()
+ private static void Pump(int times = 40)
{
- for (var i = 0; i < 40; i++)
+ for (var i = 0; i < times; i++)
{
Dispatcher.UIThread.RunJobs();
AvaloniaHeadlessPlatform.ForceRenderTimerTick();