Commit Graph

50 Commits

Author SHA1 Message Date
f3668c45c3 Improve UX, add popover tour, metadata, and hicolor icons
- Redesign tutorial tour from modal dialogs to popovers pointing at actual UI elements
- Add beginner-friendly improvements: help buttons, tooltips, welcome wizard enhancements
- Add AppStream metainfo with screenshots, branding, categories, keywords, provides
- Update desktop file with GTK category and SingleMainWindow
- Add hicolor icon theme with all sizes (16-512px)
- Fix debounce SourceId panic in rename step
- Various step UI improvements and bug fixes
2026-03-08 14:18:15 +02:00
8d754017fa Clean up low-severity code quality issues
- Share IMAGE_EXTENSIONS between discovery.rs and watcher.rs (DRY)
- Extract compute_renamed_path() to deduplicate ~100 lines in executor
- Extract estimate_text_dimensions() to deduplicate watermark calc (3 copies)
- Fix encoder fallback defaults: WebP 85, AVIF 63 (match QualityPreset::High)
- Extract watch_config_dir() and load_watches() helpers in CLI (4 copies)
- Remove redundant else branches after unwrap_or_default()
- Rename misleading chrono_timestamp() to unix_timestamp()
2026-03-08 00:22:24 +02:00
7e5d19ab03 Fix 12 medium-severity bugs across all crates
- Escape backslashes in Nautilus preset names preventing Python injection
- Fix tiled watermarks starting at (spacing,spacing) instead of (0,0)
- Fix text watermark width overestimation (1.0x to 0.6x multiplier)
- Fix output_dpi forcing re-encoding for metadata-only presets
- Fix AVIF/WebP compression detection comparing against wrong preset values
- Add shared batch_updating guard for Ctrl+A/Ctrl+Shift+A select actions
- Fix overwrite conflict check ignoring preserve_directory_structure
- Add changes_filename()/changes_extension() for smarter overwrite checks
- Fix watch folder hardcoding "Blog Photos" preset
- Fix undo dropping history for partially-trashed batches
- Fix skipped files inflating size statistics
- Make CLI watch config writes atomic
2026-03-07 23:35:32 +02:00
1a174d40a7 Fix 5 deferred performance/UX issues from audit
M8: Pre-compile regex once before rename preview loop instead of
recompiling per file. Adds apply_simple_compiled() to RenameConfig.

M9: Cache font data in watermark module using OnceLock (default font)
and Mutex<HashMap> (named fonts) to avoid repeated filesystem walks
during preview updates.

M12: Add 150ms debounce to watermark opacity, rotation, margin, and
scale sliders to avoid spawning preview threads on every pixel of
slider movement.

M13: Add 150ms debounce to compress per-format quality sliders (JPEG,
PNG, WebP, AVIF) for the same reason.

M14: Move thumbnail loading to background threads instead of blocking
the GTK main loop. Each thumbnail is decoded via image crate in a
spawned thread and delivered to the main thread via channel polling.
2026-03-07 23:11:00 +02:00
9fcbe237bd Fix 16 medium-severity bugs from audit
CLI: add UTC suffix to timestamps, validate image extensions on
single-file input, canonicalize watch paths for reliable matching,
derive counter_enabled from template presence, warn when undo count
exceeds available batches.

Core: apply space/special-char transforms in template rename path,
warn on metadata preservation for unsupported formats, derive AVIF
speed from compress preset quality level.

GTK: use buffer size for apples-to-apples compress preview comparison,
shorten approximate format labels, cache file sizes to avoid repeated
syscalls on checkbox toggle, add batch-update guard to prevent O(n^2)
in select/deselect all, use widget names for reliable progress/log
lookup, add unique suffix for duplicate download filenames.
2026-03-07 23:02:57 +02:00
e65ed866eb Fix 5 high-risk bugs from 13th audit pass
- cleanup_placeholder now removes 1-byte marker files on error (regression)
- {width}/{height} template vars replaced with "0" when dimensions unavailable
- Text watermark width multiplier 0.6->1.0 to prevent CJK/wide char clipping
- cmd_undo preserves history entries when trash operations fail
- cmd_watch_remove exits on write failure instead of silent discard
2026-03-07 22:27:37 +02:00
d1cab8a691 Fix 40+ bugs from audit passes 9-12
- PNG chunk parsing overflow protection with checked arithmetic
- Font directory traversal bounded with global result limit
- find_unique_path TOCTOU race fixed with create_new + marker byte
- Watch mode "processed" dir exclusion narrowed to prevent false skips
- Metadata copy now checks format support before little_exif calls
- Clipboard temp files cleaned up on app exit
- Atomic writes for file manager integration scripts
- BMP format support added to encoder and convert step
- Regex DoS protection with DFA size limit
- Watermark NaN/negative scale guard
- Selective EXIF stripping for privacy/custom metadata modes
- CLI watch mode: file stability checks, per-file history saves
- High contrast toggle preserves and restores original theme
- Image list deduplication uses O(1) HashSet lookups
- Saturation/trim/padding overflow guards in adjustments
2026-03-07 22:14:48 +02:00
adef810691 Fix 30 critical and high severity bugs from audit passes 6-8
Critical fixes:
- Prevent path traversal via rename templates (sanitize_filename)
- Prevent input == output data loss (paths_are_same check)
- Undo now uses actual executor output paths instead of scanning directory
- Filter empty paths from output_files (prevents trashing CWD on undo)
- Sanitize URL download filenames to prevent path traversal writes

High severity fixes:
- Fix EXIF orientation 5/7 transforms per spec
- Atomic file creation in find_unique_path (TOCTOU race)
- Clean up 0-byte placeholder files on encoding failure
- Cap canvas padding to 10000px, total dimensions to 65535
- Clamp crop dimensions to minimum 1px
- Clamp DPI to 65535 before u16 cast in JPEG encoder
- Force pixel path for non-JPEG/TIFF metadata stripping
- Fast path now applies regex find/replace on rename stem
- Add output_dpi to needs_pixel_processing check
- Cap watermark image scale dimensions to 16384
- Cap template counter padding to 10
- Cap URL download size to 100MB
- Fix progress bar NaN when total is zero
- Fix calculate_eta underflow when current > total
- Fix loaded.len()-1 underflow in preview callbacks
- Replace ListItem downcast unwrap with if-let
- Fix resize preview division by zero on degenerate images
- Clamp rename cursor position to prevent overflow panic
- Watch mode: skip output dirs to prevent infinite loop
- Watch mode: drop tx sender so channel closes on exit
- Watch mode: add delay for partially-written files
- Watch mode: warn and skip unmatched files instead of wrong preset
- Clean temp download directory on app close
- Replace action downcast unwrap with checked if-let
- Add BatchResult.output_files for accurate undo tracking
2026-03-07 20:49:10 +02:00
b432cc7431 Fix 26 bugs, edge cases, and consistency issues from fifth audit pass
Critical: undo toast now trashes only batch output files (not entire dir),
JPEG scanline write errors propagated, selective metadata write result returned.

High: zero-dimension guards in ResizeConfig/fit_within, negative aspect ratio
rejection, FM integration toggle infinite recursion guard, saturating counter
arithmetic in executor.

Medium: PNG compression level passed to oxipng, pct mode updates job_config,
external file loading updates step indicator, CLI undo removes history entries,
watch config write failures reported, fast-copy path reads image dimensions for
rename templates, discovery excludes unprocessable formats (heic/svg/ico/jxl),
CLI warns on invalid algorithm/overwrite values, resolve_collision trailing dot
fix, generation guards on all preview threads to cancel stale results, default
DPI aligned to 0, watermark text width uses char count not byte length.

Low: binary path escaped in Nautilus extension, file dialog filter aligned with
discovery, reset_wizard clears preset_mode and output_dir.
2026-03-07 19:47:23 +02:00
704f556867 Add EXIF auto-orient and aspect ratio lock toggle
- Implement auto_orient_from_exif() that reads EXIF Orientation tag
  and applies the correct rotation/flip for all 8 EXIF orientations
- Add aspect ratio lock toggle to resize step Width/Height mode
- When lock is active, changing width auto-calculates height from
  the first loaded image's aspect ratio, and vice versa
- Uses recursive update guard (Cell<bool>) to prevent infinite loops
2026-03-06 18:18:04 +02:00
0a7a6ee95c Implement watermark rotation for text and image watermarks
- Add rotate_watermark_image() using imageproc rotate_about_center
  for 45/-45 degree rotations and image::rotate90 for 90 degrees
- Add render_text_to_image() helper that renders text to a
  transparent buffer for rotation before compositing
- Apply rotation to single text, tiled text, single image, and
  tiled image watermark modes
- Fix tiled image watermark to use actual overlay dimensions
  (which change after rotation) instead of pre-rotation values
2026-03-06 18:14:53 +02:00
a666fbad05 Fix pipeline order, add selective metadata stripping, rename case/regex
- Move watermark step after compress in processing pipeline to match
  design doc order (resize, adjustments, convert, compress, metadata,
  watermark, rename)
- Implement selective EXIF metadata stripping for Privacy and Custom
  modes using little_exif tag filtering (GPS, camera, software,
  timestamps, copyright categories)
- Add case conversion support to rename (none/lower/upper/title)
- Add regex find-and-replace on original filenames
- Wire case and regex controls in rename step UI to JobConfig
- Add regex crate dependency to pixstrip-core
2026-03-06 18:12:18 +02:00
5104d66aaf Add EXIF-based rename template variables
Support {date}, {exif_date}, {camera}, and {original_ext} in rename
templates. Reads DateTimeOriginal and Model from EXIF metadata via
little_exif when these variables are used in templates.
2026-03-06 18:03:12 +02:00
afabdf3548 Persist advanced options expand/collapse state per section
Each ExpanderRow now remembers its expanded state between sessions
using a per-section key stored in SessionState. Replaces the global
detailed_mode toggle with granular per-section persistence.
2026-03-06 17:49:07 +02:00
d8bb1a726a Add watermark tiling, rotation types, margin/scale controls
Wire tiled, margin, and scale UI controls to JobConfig and pass
through to WatermarkConfig. Add tiled text and image watermark
implementations that repeat across the full image. Add font family
filesystem search for named fonts. Add WatermarkRotation enum.
2026-03-06 17:36:07 +02:00
fbb9cddbb8 Add PNG DPI support via pHYs chunk and fix font picker
PNG files now embed pHYs chunk for DPI when output_dpi is set, matching
the existing JPEG DPI support. Also fixed FontDialogButton signal handler
to properly unwrap the Option<FontDescription>.
2026-03-06 17:16:43 +02:00
d9ce1f8731 Add font family selector for watermark text
Font picker using GTK FontDialog/FontDialogButton lets users choose
any installed system font for text watermarks. The selected font family
is passed through the processing pipeline and used to find the matching
font file on disk.
2026-03-06 17:12:23 +02:00
1ab21307d6 Apply output DPI to JPEG files via mozjpeg pixel density
- Add output_dpi field to EncoderOptions
- Set JFIF pixel density header in JPEG output when DPI > 0
- Wire output_dpi from ProcessingJob through to encoder in both
  parallel and sequential execution paths
2026-03-06 16:53:32 +02:00
a0bb00eddf Add Watch Folders settings page with full CRUD
- New settings page: Watch Folders with add/remove/edit controls
- Each watch folder has: path, linked preset dropdown, recursive toggle,
  active/inactive switch, and remove button
- Watch folder config persisted in AppConfig
- Empty state message when no folders configured
2026-03-06 16:13:14 +02:00
ced65f10ec Add tutorial overlay tour after welcome wizard
Semi-transparent dialog-based tour with 6 stops covering step
indicator, workflow selection, image adding, navigation, menu,
and a final ready message. Skippable at any time. State persisted
via tutorial_complete flag in AppConfig.
2026-03-06 15:48:06 +02:00
1d33be1e3d Wire DPI setting from resize step through to processing job
Add output_dpi field to JobConfig, ProcessingJob, and Preset.
Connect the DPI SpinRow in the resize step's advanced options to
update the config value.
2026-03-06 15:41:25 +02:00
b50147404a Add file manager integration install/uninstall logic
Implements actual extension file creation for Nautilus (Python
extension), Nemo (.nemo_action files), Thunar (custom actions XML),
and Dolphin (KDE service menu .desktop). Each extension creates a
"Process with Pixstrip" submenu with all presets listed. Toggle
switches in welcome wizard and settings now call install/uninstall.
2026-03-06 15:37:25 +02:00
4dd868078a Add completion sound, preserve directory structure support
- Play system notification sound via canberra-gtk-play when enabled
- Implement preserve_directory_structure in output_path_for to maintain
  relative paths from input directory in output
2026-03-06 15:24:04 +02:00
1e3ffaadd3 Add history pruning with configurable max entries and max days
- Add history_max_entries (default 50) and history_max_days (default 30)
  to AppConfig
- Add prune() method to HistoryStore that removes old entries by age
  and count limits
- Call prune after each history entry is added in the GUI
- Preserve history settings through settings dialog save/load cycle
2026-03-06 15:22:17 +02:00
a29256921e Wire resize algorithm selection, overwrite behavior, and fix rotation/flip scope
- Add ResizeAlgorithm enum (Lanczos3/CatmullRom/Bilinear/Nearest) to core
- Thread algorithm selection from UI ComboRow through ProcessingJob to resize_image
- Add OverwriteBehavior enum (AutoRename/Overwrite/Skip) to core
- Implement overwrite handling in executor with auto-rename suffix logic
- Wire overwrite behavior from output step through to processing job
- Fix rotation/flip to apply when resize step is enabled, not just adjustments
2026-03-06 15:17:59 +02:00
fdaedd8d1a Wire progressive JPEG, AVIF speed, and custom per-format quality to encoder
- Add EncoderOptions struct with progressive_jpeg and avif_speed fields
- Pass encoder options through ProcessingJob to PipelineExecutor
- mozjpeg set_progressive_mode() called when progressive JPEG enabled
- AVIF encoder speed now configurable (was hardcoded to 6)
- run_processing uses CompressConfig::Custom when user overrides preset defaults
- Executor properly handles AVIF quality and PNG level in Custom mode
2026-03-06 15:07:54 +02:00
abd8393079 Auto-show What's New dialog on first launch after update
Track last_seen_version in session state. Show the What's New dialog
automatically when the version changes, but not on very first run
(where the welcome wizard is shown instead).
2026-03-06 14:54:43 +02:00
f71b55da72 Add image adjustments pipeline (brightness, contrast, crop, effects)
New AdjustmentsConfig with brightness, contrast, saturation, sharpen,
grayscale, sepia, crop to aspect ratio, trim whitespace, and canvas
padding. All wired from UI through to executor.

- Saturation uses luminance-based color blending
- Sepia uses standard matrix transformation
- Crop calculates center crop from aspect ratio
- Trim whitespace detects uniform border by corner pixel comparison
- Canvas padding adds white border around image
2026-03-06 14:24:14 +02:00
8212969e9d Wire all missing operations into pipeline executor
Executor now applies rotation, flip, resize, watermark, format
conversion, compression, renaming, and metadata handling. Previously
only resize, convert, and compress were active.

- Rotation: CW90/180/270 via image crate methods
- Flip: horizontal/vertical via image crate methods
- Watermark: text (imageproc + ab_glyph) and image overlay with
  alpha blending, positioned via WatermarkPosition enum
- Rename: apply_simple or template-based renaming with counter
- Metadata: re-encoding strips EXIF; KeepAll copies back via little_exif
2026-03-06 14:20:47 +02:00
fa7936abbd Implement parallel image processing with rayon thread pool
The executor now uses rayon's thread pool for parallel processing when
thread_count > 1. Progress updates are sent via mpsc channel from worker
threads. Falls back to sequential processing for thread_count = 1.
2026-03-06 13:57:14 +02:00
abd794b3b9 Wire thread count and error behavior settings into executor
The PipelineExecutor now stores thread_count and pause_on_error
fields. When pause_on_error is enabled, the executor sets the
pause flag on failures so the user can review errors. The GUI
reads these settings from AppConfig before starting processing.
2026-03-06 13:52:08 +02:00
3284e066a0 Add session memory, resize mode tabs, improved output summary 2026-03-06 12:44:16 +02:00
9efcbd082e Add real pause, desktop notifications, undo, accessibility, CLI watch 2026-03-06 12:38:16 +02:00
e969c4165e Add window persistence, clickable step indicator, file list improvements
- Window size/position remembered between sessions via SessionStore
- Step indicator dots now clickable to navigate directly to that step,
  with keyboard shortcut hints in tooltips
- File list in add-files dialog shows format and size per image,
  header shows total count and total size
- Welcome dialog now saves skill level choice to config
- SessionState extended with window_width, window_height, window_maximized
2026-03-06 12:27:19 +02:00
f353bbe5e6 Wire welcome dialog with navigation and first-run detection
- Welcome dialog buttons navigate between pages
- Done button closes dialog and marks first_run_complete
- Show welcome dialog on first launch only
- Add first_run_complete field to AppConfig with serde(default)
2026-03-06 11:43:25 +02:00
e1c2e11165 Add file watcher for watch folder functionality
inotify-based folder watcher using the notify crate that detects new
image files, ignores non-image files, and supports start/stop lifecycle.
WatchFolder config struct for preset-linked watched directories.
2026-03-06 11:17:02 +02:00
be7d345aa9 Add storage module for presets, config, session, and history persistence
Preset save/load/list/delete/import/export, config JSON persistence,
session state save/restore, and processing history log with append/clear.
All stored as JSON under ~/.config/pixstrip/.
2026-03-06 02:14:57 +02:00
8ced89a00f Add pipeline executor with progress reporting and cancellation
Sequential execution with per-image progress callbacks, cancellation
via atomic flag, batch result tracking (success/fail/sizes/timing).
Phase 5 complete - 85 tests passing, zero clippy warnings.
2026-03-06 02:08:11 +02:00
d4aef0b774 Add metadata stripping, watermark positioning, and rename template modules
Metadata: JPEG EXIF stripping (APP1 segment removal).
Watermark: 9-position grid calculation with margin support.
Rename: template parser with {name}, {ext}, {counter:N}, {width}, {height}
  and collision resolution with auto-suffix.
Phase 4 complete - 79 tests passing, zero clippy warnings.
2026-03-06 02:06:01 +02:00
52931daf53 Add output encoders (mozjpeg, oxipng, webp, avif) and integration tests
OutputEncoder dispatches to specialized encoders per format.
JPEG: mozjpeg with quality control. PNG: oxipng lossless optimization.
WebP: libwebp encoding. AVIF: ravif via image crate.
GIF/TIFF: fallback via image crate.
Phase 3 complete - 59 tests passing, zero clippy warnings.
2026-03-06 02:02:27 +02:00
a658036326 Fix clippy: collapse nested if in discovery module
Phase 2 complete - 49 tests passing, zero clippy warnings.
2026-03-06 01:59:00 +02:00
545bf27fe4 Add SIMD-accelerated resize operation using fast_image_resize
Lanczos3 filter, supports ByWidth, ByHeight, FitInBox, Exact modes.
All 5 resize tests passing.
2026-03-06 01:54:57 +02:00
c445f71163 Add ImageLoader and file discovery modules
ImageLoader: load image info (dimensions, format, file size) and pixels.
Discovery: find image files by extension, flat or recursive, single file or directory.
All 9 tests passing.
2026-03-06 01:50:46 +02:00
d630d2fb3d Add AppConfig with overwrite behavior, skill level, thread count settings
All 3 config tests passing.
2026-03-06 01:43:22 +02:00
e7142604d4 Add Preset type with 8 built-in presets and JSON serialization
All 5 preset tests passing.
2026-03-06 01:42:35 +02:00
715d8ab626 Add ProcessingJob type with source management and output path resolution
All 6 pipeline tests passing.
2026-03-06 01:41:23 +02:00
0203044a43 Add operation configuration types: resize, convert, compress, metadata, watermark, rename
All 11 operation tests passing.
2026-03-06 01:40:24 +02:00
3e176e3d65 Add error types and core image types: ImageFormat, ImageSource, Dimensions, QualityPreset 2026-03-06 01:37:39 +02:00
dab049b0d3 Add core module structure 2026-03-06 01:28:44 +02:00
2a5e0e7289 Init Cargo workspace with three crates: pixstrip-core, pixstrip-gtk, pixstrip-cli 2026-03-06 01:28:24 +02:00