diff --git a/.gitignore b/.gitignore index 39481e5..bc6c66d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target /tests/media +/dist diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..77a6e26 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Quince contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 2a92fb8..3335534 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,18 @@ folders, playlists and links (through yt-dlp). The controls float over the video - Colours from the desktop (Caelestia, KDE), your own colour or the video playing; light, dark and AMOLED; four styles, three contrast levels and four motion levels. +## Install + +Releases are on the [Releases page](https://archlinux.tail7c4f5e.ts.net/git/astar76/Quince/releases): + +- Arch: `sudo pacman -U Quince--arch-x86_64.pkg.tar.zst` +- Debian 12, Ubuntu 22.04 or newer: `sudo apt install ./Quince--amd64.deb` +- Any distribution: the AppImage, or unpack the tar.gz and run its `install.sh` (`--system` for /usr/local, + `uninstall.sh` to remove it). Both need mpv's library (libmpv) from the distribution. +- Windows 10/11: `Quince--Setup.exe` (installs for your user, no admin) or the portable zip. + +Linux builds need glibc 2.35 or newer. + ## Build Needs Rust, libmpv (mpv 0.38 or newer) and, for previews, ffmpeg. @@ -25,6 +37,13 @@ cargo build --release ./target/release/quince video.mkv ``` +`quince --gallery` opens every control in every state instead of the player (`--gallery over` starts on the page +with the real top bar, dock, menu and toasts over a made-up film), with light, dark and AMOLED and a few seed colours. + +`tools/package.sh` builds the release packages into `dist/`: tar.gz, AppImage, Arch package, .deb, the Nix file, and +the Windows installer and portable zip (cross-built with mingw, installer made with Inno Setup under wine). It needs +cargo-zigbuild, and takes appimagetool, libmpv-2.dll and the link stub for libmpv from `~/.local/opt/build-tools`. + ## Tests `cargo test` runs the unit tests. `tools/smoke.sh script.txt outdir [files]` runs the app hidden in a nested niri on Xvfb diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..121418e --- /dev/null +++ b/build.rs @@ -0,0 +1,29 @@ +//! Windows: embed the icon and version resource into quince.exe (needs windres on PATH; skipped without it). + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=packaging/quince.ico"); + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") { + return; + } + let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); + let ver = std::env::var("CARGO_PKG_VERSION").unwrap(); + let nums: Vec<&str> = ver.split('.').collect(); + let comma = format!("{},{},{},0", nums[0], nums.get(1).unwrap_or(&"0"), nums.get(2).unwrap_or(&"0")); + let ico = std::fs::canonicalize("packaging/quince.ico").unwrap().to_string_lossy().replace('\\', "/"); + let rc = format!( + "1 ICON \"{ico}\"\n\ + 1 VERSIONINFO\nFILEVERSION {comma}\nPRODUCTVERSION {comma}\nBEGIN\n BLOCK \"StringFileInfo\"\n BEGIN\n BLOCK \"040904b0\"\n BEGIN\n\ + \x20 VALUE \"ProductName\", \"Quince\"\n VALUE \"FileDescription\", \"Quince video player\"\n VALUE \"FileVersion\", \"{ver}\"\n VALUE \"ProductVersion\", \"{ver}\"\n VALUE \"OriginalFilename\", \"quince.exe\"\n\ + \x20 END\n END\n BLOCK \"VarFileInfo\"\n BEGIN\n VALUE \"Translation\", 0x0409, 1200\n END\nEND\n" + ); + let rc_path = out.join("quince.rc"); + std::fs::write(&rc_path, rc).unwrap(); + let obj = out.join("quince_res.o"); + let ok = std::process::Command::new("x86_64-w64-mingw32-windres").arg(&rc_path).arg(&obj).status().map(|s| s.success()).unwrap_or(false); + if ok { + println!("cargo:rustc-link-arg-bins={}", obj.display()); + } else { + println!("cargo:warning=windres not available: quince.exe has no icon/version resource"); + } +} diff --git a/docs/STATUS.md b/docs/STATUS.md index 7dd994a..69456ab 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -29,6 +29,18 @@ Version 0.1.0, first build (2026-11-26). small thread that does the asking. - The dock covered mpv's console; a space typed in the console came out twice. -## Missing -- A `--gallery` page of every control in every state (the /material skill asks for one). -- Packaging (AppImage / tar.gz) and a release. +## Gallery and packages (2026-11-27) +- `quince --gallery`: every control at rest, chosen and disabled, in light, dark and AMOLED and four seeds; hover, + press and focus checked by hand in screenshots. `--gallery over` runs the real top bar, dock, menu, on-screen text + and toasts on a made-up film. It found two bugs, both fixed: the disabled play triangle showed a darker seam, and + a toast's action button (Undo) was drawn under the toast and never showed. +- `tools/package.sh` builds 0.1.0 into `dist/`: tar.gz, AppImage (bundles libmpv's closure), Arch package, .deb, + Nix file, Windows installer and portable zip. glibc floor 2.35. +- Smoke-tested: the AppImage plays the test clip with hardware decoding; the Windows build plays it under wine; the + installer installs per user to `AppData\Local\Programs\Quince` with a Start menu entry. + +## Not done +- No release published yet: the packages are in `dist/`, notes in `docs/releases/0.1.0.md`. +- Windows: screensaver inhibit is D-Bus only, so it does nothing there; seek previews need ffmpeg on PATH. Not tried + on real Windows. +- Text fields clip a too-long value at the edge (egui's TextEdit) instead of fading it. diff --git a/docs/releases/0.1.0.md b/docs/releases/0.1.0.md new file mode 100644 index 0000000..8f53834 --- /dev/null +++ b/docs/releases/0.1.0.md @@ -0,0 +1,9 @@ +First release of Quince, a Material You video player built on mpv. + +- Plays anything mpv plays, with hardware decoding; your mpv.conf, scripts and key bindings keep working, and mpv's console opens with `. +- Controls over the video that hide while you watch: a wavy seek bar with chapter marks and preview pictures, a play button that changes shape, volume, speed, and menus for sound, subtitles, chapters and video. +- Playlist you can reorder by dragging, and an Adjust panel for picture, sound and subtitles. +- Colours from your desktop, your own colour, or the video playing; light, dark and AMOLED; contrast and motion settings. +- Open files, folders and links, drag files in, and resume where you stopped. + +Downloads: AppImage and tar.gz for any Linux with glibc 2.35 or newer (needs libmpv), an Arch package, a .deb for Debian 12 / Ubuntu 22.04 and newer, and a Windows installer (per user, no admin) or portable zip. Checksums are in SHA256SUMS-0.1.0. diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e81b730 --- /dev/null +++ b/flake.nix @@ -0,0 +1,10 @@ +{ + description = "Material You video player built on mpv"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + outputs = { self, nixpkgs }: + let pkgs = nixpkgs.legacyPackages.x86_64-linux; + in { + packages.x86_64-linux.default = pkgs.callPackage ./packaging/nix { }; + apps.x86_64-linux.default = { type = "app"; program = "${self.packages.x86_64-linux.default}/bin/quince"; }; + }; +} diff --git a/installer.sh b/installer.sh new file mode 100755 index 0000000..34e5d24 --- /dev/null +++ b/installer.sh @@ -0,0 +1,159 @@ +#!/bin/sh +# Quince installer. Installs from a release tar.gz or AppImage, or removes an install. +# installer.sh [--user|--system] [--prefix DIR] [--url URL] [FILE] +# installer.sh --uninstall [--purge] [--user|--system] [--prefix DIR] +# --user (default): ~/.local, no root. --system: /usr/local, sudo only for the copy. +# Without FILE it uses the unpacked release folder it sits in, or Quince-*-Linux-x86_64.tar.gz or +# Quince-*-x86_64.AppImage next to it. SHA256SUMS- beside the file is checked when present. +# --purge also deletes settings and data (~/.config/quince, ~/.local/state/quince, ~/.cache/quince: settings, resume positions, previews and logs). DESTDIR=dir stages under dir (no sudo). +# Needs glibc 2.35 or newer. +set -eu + +app=quince main=quince need=2.35 +mode=install scope=user purge=0 prefix= url= file= +while [ $# -gt 0 ]; do + case $1 in + --user) scope=user ;; + --system) scope=system ;; + --prefix) [ $# -ge 2 ] || { echo "--prefix needs a folder." >&2; exit 2; }; prefix=$2; shift ;; + --url) [ $# -ge 2 ] || { echo "--url needs an address." >&2; exit 2; }; url=$2; shift ;; + --uninstall) mode=uninstall ;; + --purge) purge=1 ;; + -h|--help) sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -*) echo "Unknown option: $1 (see --help)." >&2; exit 2 ;; + *) file=$1 ;; + esac + shift +done +[ "$purge" = 0 ] || [ "$mode" = uninstall ] || { echo "--purge only goes with --uninstall." >&2; exit 2; } +if [ -z "$prefix" ]; then + if [ "$scope" = system ]; then prefix=/usr/local; else prefix=$HOME/.local; fi +fi +case $prefix in /*) ;; *) echo "--prefix must be an absolute path." >&2; exit 2 ;; esac +prefix=${prefix%/} +destdir=${DESTDIR:-} +root=$destdir$prefix +list=$root/lib/$app/files +sudo= +if [ -z "$destdir" ] && [ "$(id -u)" != 0 ]; then + d=$root; while [ ! -e "$d" ]; do d=$(dirname "$d"); done + [ -w "$d" ] || sudo=sudo +fi + +refresh() { + [ -z "$destdir" ] || return 0 + command -v update-desktop-database >/dev/null 2>&1 && $sudo update-desktop-database -q "$root/share/applications" 2>/dev/null || true + [ -f "$root/share/icons/hicolor/index.theme" ] && command -v gtk-update-icon-cache >/dev/null 2>&1 \ + && $sudo gtk-update-icon-cache -q -t -f "$root/share/icons/hicolor" 2>/dev/null || true +} + +# Removes the files the last install listed, then the folders that became empty. +remove_listed() { + [ -f "$list" ] || return 0 + while IFS= read -r f; do + [ -n "$f" ] || continue + $sudo rm -f "$root/$f" + d=$(dirname "$f") + while [ "$d" != . ] && $sudo rmdir "$root/$d" 2>/dev/null; do d=$(dirname "$d"); done + done < "$list" + $sudo rm -f "$list" + $sudo rmdir "$root/lib/$app" "$root/lib" 2>/dev/null || true +} + +if [ "$mode" = uninstall ]; then + if [ ! -f "$list" ]; then + echo "Quince is not installed in $prefix (no $list)." >&2 + [ "$purge" = 1 ] || exit 1 + else + remove_listed + refresh + echo "Quince removed from $prefix." + fi + if [ "$purge" = 1 ]; then + rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/quince" + rm -rf "${XDG_STATE_HOME:-$HOME/.local/state}/quince" + rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/quince" + echo "Settings and data removed (~/.config/quince, ~/.local/state/quince, ~/.cache/quince: settings, resume positions, previews and logs)." + else + echo "Settings and data are kept (--purge deletes them)." + fi + exit 0 +fi + +# glibc check (MULBERRY_GLIBC overrides the detected version, for tests) +have=${MULBERRY_GLIBC:-$(getconf GNU_LIBC_VERSION 2>/dev/null | sed 's/^glibc //')} +if [ -z "$have" ]; then + echo "Quince needs glibc $need or newer, and this system does not report a glibc (musl?). Nothing was installed." >&2; exit 1 +fi +if [ "$(printf '%s\n%s\n' "$need" "$have" | sort -V | head -n 1)" != "$need" ]; then + echo "Quince needs glibc $need or newer, and this system has glibc $have. Nothing was installed." >&2; exit 1 +fi + +here=$(cd "$(dirname "$0")" && pwd) +tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT INT TERM + +if [ -n "$url" ]; then + file=$tmp/$(basename "${url%%\?*}") + if command -v curl >/dev/null 2>&1; then curl -fL -o "$file" -- "$url" + elif command -v wget >/dev/null 2>&1; then wget -O "$file" -- "$url" + else echo "Neither curl nor wget is installed, so $url cannot be fetched." >&2; exit 1; fi +fi +src= +if [ -z "$file" ]; then + if [ -f "$here/bin/$main" ]; then src=$here + else + for f in "$here"/Quince-*-Linux-x86_64.tar.gz "$here"/Quince-*-x86_64.AppImage; do + [ -f "$f" ] && { file=$f; break; } + done + fi +fi +if [ -z "$src" ]; then + [ -n "$file" ] && [ -f "$file" ] || { echo "No Quince tar.gz or AppImage was given or found next to the installer." >&2; exit 1; } + dir=$(dirname "$file"); name=$(basename "$file") + for s in "$dir"/SHA256SUMS-*; do + [ -f "$s" ] || continue + line=$(grep -F " $name" "$s" | head -n 1 || true) + [ -n "$line" ] || continue + [ "${line%% *}" = "$(sha256sum "$file" | cut -d' ' -f1)" ] \ + || { echo "The checksum of $name does not match $(basename "$s"). Nothing was installed." >&2; exit 1; } + echo "Checksum ok." + done + mkdir "$tmp/x" + case $name in + *.tar.gz) + tar -xzf "$file" -C "$tmp/x" + src=$(find "$tmp/x" -maxdepth 1 -mindepth 1 -type d | head -n 1) + [ -n "$src" ] && [ -f "$src/bin/$main" ] || { echo "$name has no bin/$main, so it is not a Quince release." >&2; exit 1; } ;; + *.AppImage) + cp "$file" "$tmp/app"; chmod 755 "$tmp/app" + (cd "$tmp/x" && "$tmp/app" --appimage-extract >/dev/null 2>&1) || true + [ -d "$tmp/x/squashfs-root/usr/share" ] || { echo "Could not read the contents of $name. Nothing was installed." >&2; exit 1; } + src=$tmp/src; mkdir -p "$src/bin" + mv "$tmp/app" "$src/bin/$main" + mv "$tmp/x/squashfs-root/usr/share" "$src/share" + [ ! -d "$tmp/x/squashfs-root/usr/lib" ] || mv "$tmp/x/squashfs-root/usr/lib" "$src/lib" ;; + *) echo "Unknown file type: $name (need .tar.gz or .AppImage)." >&2; exit 1 ;; + esac +fi + +# Stage with launchers pointing at this prefix, then copy and list every file for --uninstall. +st=$tmp/stage +mkdir -p "$st" +for d in bin lib share; do [ ! -d "$src/$d" ] || cp -R "$src/$d" "$st/$d"; done +for d in "$st"/share/applications/*.desktop; do + [ -f "$d" ] || continue + for b in "$st"/bin/*; do + b=$(basename "$b") + sed -i -e "s#^Exec=$b\( \|\$\)#Exec=$prefix/bin/$b\1#" -e "s#^TryExec=$b\$#TryExec=$prefix/bin/$b#" "$d" + done +done +chmod 755 "$st"/bin/* +(cd "$st" && find . \( -type f -o -type l \) | sed 's|^\./||' | sort) > "$tmp/files" +mkdir -p "$st/lib/$app"; echo "lib/$app/files" >> "$tmp/files"; cp "$tmp/files" "$st/lib/$app/files" + +remove_listed +$sudo mkdir -p "$root" +$sudo cp -R "$st/." "$root/" +refresh +echo "Quince installed in $prefix/bin/$main" +case ":$PATH:" in *":$prefix/bin:"*) ;; *) echo "Note: $prefix/bin is not on your PATH." ;; esac diff --git a/packaging/arch/.SRCINFO b/packaging/arch/.SRCINFO new file mode 100644 index 0000000..9ef8a5f --- /dev/null +++ b/packaging/arch/.SRCINFO @@ -0,0 +1,33 @@ +pkgbase = quince-bin + pkgdesc = Material You video player built on mpv + pkgver = 0.1.0 + pkgrel = 1 + url = https://archlinux.tail7c4f5e.ts.net/git/astar76/Quince + arch = x86_64 + license = MIT + depends = glibc>=2.35 + depends = gcc-libs + depends = mpv + depends = dbus + depends = fontconfig + depends = libglvnd + depends = wayland + depends = libxkbcommon + depends = libxkbcommon-x11 + depends = libx11 + depends = libxcb + depends = libxcursor + depends = libxi + depends = libxrender + depends = hicolor-icon-theme + optdepends = xdg-desktop-portal: open file and folder dialogs + optdepends = ffmpeg: preview pictures on the seek bar + optdepends = yt-dlp: web links + provides = quince + conflicts = quince + options = !strip + options = !debug + source = Quince-0.1.0-Linux-x86_64.tar.gz::https://archlinux.tail7c4f5e.ts.net/git/astar76/Quince/releases/download/v0.1.0/Quince-0.1.0-Linux-x86_64.tar.gz + sha256sums = 0651a250de7a2dffb10721e8d03f13fe679ab1207e6da4b87b1d5203d43fa76e + +pkgname = quince-bin diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD new file mode 100644 index 0000000..457035c --- /dev/null +++ b/packaging/arch/PKGBUILD @@ -0,0 +1,31 @@ +# Maintainer: astar76 +# Built by tools/package.sh from the release tar.gz (TARBALL=file://… for an offline build); it keeps pkgver, +# sha256sums and the glibc floor current. +pkgname=quince-bin +pkgver=0.1.0 +pkgrel=1 +pkgdesc='Material You video player built on mpv' +arch=('x86_64') +url='https://archlinux.tail7c4f5e.ts.net/git/astar76/Quince' +license=('MIT') +depends=('glibc>=2.35' 'gcc-libs' 'mpv' 'dbus' 'fontconfig' 'libglvnd' 'wayland' 'libxkbcommon' 'libxkbcommon-x11' 'libx11' 'libxcb' 'libxcursor' 'libxi' 'libxrender' 'hicolor-icon-theme') +optdepends=( + 'xdg-desktop-portal: open file and folder dialogs' + 'ffmpeg: preview pictures on the seek bar' + 'yt-dlp: web links' +) +provides=('quince') +conflicts=('quince') +options=('!strip' '!debug') +source=("Quince-$pkgver-Linux-x86_64.tar.gz::${TARBALL:-$url/releases/download/v$pkgver/Quince-$pkgver-Linux-x86_64.tar.gz}") +sha256sums=('0651a250de7a2dffb10721e8d03f13fe679ab1207e6da4b87b1d5203d43fa76e') + +package() { + cd "$srcdir/quince-$pkgver" + install -d "$pkgdir/usr" + for d in bin lib share; do [ ! -d "$d" ] || cp -R "$d" "$pkgdir/usr/"; done + if [ -d "$pkgdir/usr/share/licenses/quince" ] && [ "$pkgname" != quince ]; then + mv "$pkgdir/usr/share/licenses/quince" "$pkgdir/usr/share/licenses/$pkgname" + fi + install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md" +} diff --git a/packaging/nix/default.nix b/packaging/nix/default.nix new file mode 100644 index 0000000..7b34ade --- /dev/null +++ b/packaging/nix/default.nix @@ -0,0 +1,33 @@ +# Quince for Nix, from the release tar.gz. Written by tools/package.sh (version and hash); edit the header there. +# nix build .#default or nix profile install . (from the repo), or callPackage this file. +{ lib, stdenv, fetchurl, autoPatchelfHook, makeWrapper, libGL, wayland, libxkbcommon, xorg, fontconfig, dbus, mpv-unwrapped }: + +stdenv.mkDerivation rec { + pname = "quince"; + version = "0.1.0"; + src = fetchurl { + url = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Quince/releases/download/v${version}/Quince-${version}-Linux-x86_64.tar.gz"; + hash = "sha256-BlGiUN56Lf+xByHo0D8T/measSB+baS4ex1SA9Q/p24="; + }; + nativeBuildInputs = [ autoPatchelfHook makeWrapper ]; + buildInputs = [ mpv-unwrapped stdenv.cc.cc.lib ]; + # Loaded with dlopen at run time, so autoPatchelf can't see them. + runtimeDependencies = [ libGL wayland libxkbcommon xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr fontconfig dbus ]; + dontBuild = true; + installPhase = '' + runHook preInstall + mkdir -p $out + for d in bin lib share; do [ ! -d $d ] || cp -R $d $out/; done + install -Dm644 README.md $out/share/doc/quince/README.md + runHook postInstall + ''; + + meta = { + description = "Material You video player built on mpv"; + homepage = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Quince"; + license = lib.licenses.mit; + platforms = [ "x86_64-linux" ]; + mainProgram = "quince"; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +} diff --git a/packaging/quince.ico b/packaging/quince.ico new file mode 100644 index 0000000..c472ae8 Binary files /dev/null and b/packaging/quince.ico differ diff --git a/packaging/quince.iss b/packaging/quince.iss new file mode 100644 index 0000000..76dfdad --- /dev/null +++ b/packaging/quince.iss @@ -0,0 +1,51 @@ +; Inno Setup script: per-user install (no admin), Start menu entry, uninstaller. +; Built by tools/package.sh under wine: iscc /DVersion= /DSrc= /DOut= quince.iss +#ifndef Version + #define Version "0.0.0" +#endif +#ifndef Src + #define Src "..\dist\Quince" +#endif +#ifndef Out + #define Out "..\dist" +#endif + +[Setup] +AppId={{B87F98FA-E5F3-4869-A1EB-25FA4BC2F0DF} +AppName=Quince +AppVersion={#Version} +AppVerName=Quince {#Version} +AppPublisher=astar76 +AppPublisherURL=https://archlinux.tail7c4f5e.ts.net/git/astar76/Quince +VersionInfoVersion={#Version} +VersionInfoProductName=Quince +VersionInfoDescription=Quince Setup +DefaultDirName={localappdata}\Programs\Quince +DisableProgramGroupPage=yes +DisableDirPage=auto +PrivilegesRequired=lowest +ArchitecturesAllowed=x64compatible +ArchitecturesInstallIn64BitMode=x64compatible +OutputDir={#Out} +OutputBaseFilename=Quince-{#Version}-Setup +SetupIconFile=quince.ico +UninstallDisplayIcon={app}\quince.exe +UninstallDisplayName=Quince +LicenseFile=..\LICENSE +Compression=lzma2/max +SolidCompression=yes +WizardStyle=modern +CloseApplications=yes + +[Tasks] +Name: "desktopicon"; Description: "Create a desktop shortcut"; Flags: unchecked + +[Files] +Source: "{#Src}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs + +[Icons] +Name: "{userprograms}\Quince"; Filename: "{app}\quince.exe" +Name: "{userdesktop}\Quince"; Filename: "{app}\quince.exe"; Tasks: desktopicon + +[Run] +Filename: "{app}\quince.exe"; Description: "Launch Quince"; Flags: nowait postinstall skipifsilent diff --git a/src/main.rs b/src/main.rs index 9fd0c9e..e56b6fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,13 +20,14 @@ use eframe::egui; fn main() -> eframe::Result { let args: Vec = std::env::args().skip(1).collect(); if args.iter().any(|a| a == "--help" || a == "-h") { - println!("Usage: quince [FILE or LINK]...\n\nPlays videos and sound with mpv. Settings live in ~/.config/quince."); + println!("Usage: quince [FILE or LINK]...\n quince --gallery [over] every control in every state\n\nPlays videos and sound with mpv. Settings live in ~/.config/quince."); return Ok(()); } if args.iter().any(|a| a == "--version") { println!("quince {}", env!("CARGO_PKG_VERSION")); return Ok(()); } + let gallery = args.iter().position(|a| a == "--gallery").map(|i| usize::from(args.get(i + 1).is_some_and(|p| p == "over"))); let files: Vec = args .into_iter() .filter(|a| !a.starts_with("--")) @@ -48,6 +49,9 @@ fn main() -> eframe::Result { renderer: eframe::Renderer::Glow, ..Default::default() }; + if let Some(page) = gallery { + return eframe::run_native("Quince", options, Box::new(move |cc| Ok(Box::new(ui::gallery::Gallery::new(cc, page))))); + } eframe::run_native("Quince", options, Box::new(move |cc| Ok(Box::new(app::App::new(cc, files))))) } diff --git a/src/ui/chrome.rs b/src/ui/chrome.rs index 47cee44..f08b21d 100644 --- a/src/ui/chrome.rs +++ b/src/ui/chrome.rs @@ -422,10 +422,14 @@ pub fn toasts(ctx: &egui::Context, v: &mut View, list: &mut Vec) { area(ctx, &format!("toast-btn-{key}"), br, Order::Foreground, |ui| { let resp = ui.interact(br, Id::new(("toast-btn", key)), Sense::click()); let f = feel(&resp, true); + // painted on the toast's own layer: the area's layer may sit under it if f.tint > 0.001 { - ui.painter().rect_filled(br, cr(radius::FULL), alpha(t.inverse_primary, f.tint)); + p2.rect_filled(br, cr(radius::FULL), alpha(t.inverse_primary, f.tint)); } - ui.painter().text(br.center(), Align2::CENTER_CENTER, label, fonts::med(text::BODY), t.inverse_primary); + if f.focus { + crate::widgets::ring(&p2, t, br, cr(radius::FULL)); + } + p2.text(br.center(), Align2::CENTER_CENTER, label, fonts::med(text::BODY), t.inverse_primary); clicked = resp.clicked(); }); if clicked { diff --git a/src/ui/controls.rs b/src/ui/controls.rs index d2eb612..db990f3 100644 --- a/src/ui/controls.rs +++ b/src/ui/controls.rs @@ -61,13 +61,21 @@ pub fn play_pause_glyph(p: &Painter, c: Pos2, s: f32, k: f32, color: Color32) { [(-0.30, -0.36), (-0.08, -0.36), (-0.08, 0.36), (-0.30, 0.36)], [(0.08, -0.36), (0.30, -0.36), (0.30, 0.36), (0.08, 0.36)], ]; - for (a, b) in play.iter().zip(pause.iter()) { - let pts: Vec = a - .iter() - .zip(b.iter()) - .map(|(x, y)| c + vec2(lerp(x.0, y.0, k), lerp(x.1, y.1, k)) * s) - .collect(); - p.add(Shape::convex_polygon(pts, color, Stroke::new(s * 0.06, color))); + let halves: Vec> = play + .iter() + .zip(pause.iter()) + .map(|(a, b)| a.iter().zip(b.iter()).map(|(x, y)| c + vec2(lerp(x.0, y.0, k), lerp(x.1, y.1, k)) * s).collect()) + .collect(); + let stroke = Stroke::new(s * 0.06, color); + if k.abs() < 0.05 { + // While the halves still touch they are one triangle: two would overlap at their seam, which shows when the + // colour is see-through (a disabled button). + let (l, r) = (&halves[0], &halves[1]); + p.add(Shape::convex_polygon(vec![l[0], r[1], r[2], l[3]], color, stroke)); + return; + } + for pts in halves { + p.add(Shape::convex_polygon(pts, color, stroke)); } } diff --git a/src/ui/gallery.rs b/src/ui/gallery.rs new file mode 100644 index 0000000..8b089ff --- /dev/null +++ b/src/ui/gallery.rs @@ -0,0 +1,415 @@ +//! Every control in every state (`quince --gallery`). For whoever builds Quince: nothing plays here, and the words +//! are the gallery's own. "Controls" lays out each control at rest, chosen and disabled (hover, press and focus come +//! from the hand); "Over the video" runs the real top bar, dock, menus, on-screen text and toasts on a made-up film. + +use super::controls::{self, keycap, play_button, row, seek_bar, slider, tabs, text_field}; +use super::glyphs as g; +use super::menu::{self, Menu}; +use super::{View, chrome, menus}; +use crate::app::{Act, MenuKind, Osd, Toast}; +use crate::config::Settings; +use crate::fonts; +use crate::motion::{self, Motion}; +use crate::mpv::{Chapter, Entry, State, Track}; +use crate::script::Script; +use crate::theme::{self, Appearance, Contrast, Scheme, Theme, mix}; +use crate::thumbs::Thumbs; +use crate::tokens::{size, space, text}; +use crate::widgets::{Kind, button, chip, icon_button, segmented, switch}; +use eframe::egui::{self, Color32, Id, Rect, ScrollArea, Sense, Ui, UiBuilder, pos2, vec2}; + +const PAGES: [&str; 2] = ["Controls", "Over the video"]; +const LOOKS: [&str; 3] = ["Light", "Dark", "AMOLED"]; +/// Seeds to try the controls under: the desktop's, Quince's own gold, and two far from it. +const SEEDS: [(&str, &str); 4] = [("Desktop", ""), ("Gold", "#c9a227"), ("Leaf", "#5f8f2f"), ("Sea", "#2f6f9f")]; +/// Left column with the names of the rows. +const NAMES_W: f32 = 132.0; + +pub struct Gallery { + theme: Theme, + page: usize, + look: usize, + seed: usize, + desktop: (Option, Option), + script: Option