Complete Clean Architecture migration

Phase 1-7: Full migration from src/app/ to Clean Architecture

BREAKING CHANGES:
- Removed src/app/ (old TEA-style implementation)
- Removed src/constant.rs (constants now local to modules)
- Removed deprecated canvas_to_image_coords functions

NEW STRUCTURE:
- src/ui/           - UI Layer (COSMIC interface)
- src/application/  - Application Layer (DocumentManager, Commands)
- src/domain/       - Domain Layer (Document types, Operations)
- src/infrastructure/ - Infrastructure Layer (Loaders, Cache, System)

FEATURES:
- DocumentManager as Single Source of Truth
- Command Pattern for all operations
- Model caching for render data (performance)
- Sync mechanism between DocumentManager and UI Model
- Wallpaper support (COSMIC, KDE, GNOME, feh)
- Thumbnail cache with disk persistence

IMPROVEMENTS:
- Warnings: 62 → 43 (-31%)
- Deprecated warnings: 2 → 0 (-100%)
- Code removed: src/app/ (~2000 lines), constant.rs, deprecated functions
- Better Locality of Reference (constants local to modules)
- Clean separation of concerns
- No circular dependencies

DOCUMENTATION:
- Updated AGENTS.md (100% migration status)
- Updated README.md (architecture section)
- Updated Workflow.md
- Added Migration-Plan.md with full completion summary

TESTS:
- All 41 tests passing
- Build successful (0 errors, 43 warnings)
- Release build verified

Migration Status:  100% Complete
This commit is contained in:
wfx 2026-02-03 08:43:21 +01:00
parent f8087a3c6a
commit fc73e4b76b
87 changed files with 9461 additions and 3324 deletions

101
src/ui/message.rs Normal file
View file

@ -0,0 +1,101 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// src/app/message.rs
//
// Application messages: events, user actions, and internal signals.
use std::path::PathBuf;
use crate::ui::components::crop::DragHandle;
#[derive(Debug, Clone)]
pub enum AppMessage {
// File / navigation.
#[allow(dead_code)]
OpenPath(PathBuf),
NextDocument,
PrevDocument,
GotoPage(usize),
GenerateThumbnailPage(usize),
// Transformations.
RotateCW,
RotateCCW,
FlipHorizontal,
FlipVertical,
// View / zoom.
ZoomIn,
ZoomOut,
ZoomReset,
ZoomFit,
ViewerStateChanged {
scale: f32,
offset_x: f32,
offset_y: f32,
canvas_size: cosmic::iced::Size,
image_size: cosmic::iced::Size,
},
// Pan control.
PanLeft,
PanRight,
PanUp,
PanDown,
PanReset,
// Tool modes.
ToggleCropMode,
ToggleScaleMode,
// Crop operations.
StartCrop,
CancelCrop,
ApplyCrop,
CropDragStart {
x: f32,
y: f32,
handle: DragHandle,
},
CropDragMove {
x: f32,
y: f32,
max_x: f32,
max_y: f32,
},
CropDragEnd,
// Panels.
ToggleContextPage(crate::ui::app::ContextPage),
ToggleNavBar,
OpenFormatPanel,
// Menu.
ToggleMainMenu,
// Format operations.
SetPaperFormat(super::model::PaperFormat),
SetOrientation(super::model::Orientation),
// Metadata.
#[allow(dead_code)]
RefreshMetadata,
// Save operations.
SaveAs,
// Wallpaper.
SetAsWallpaper,
// Errors.
#[allow(dead_code)]
ShowError(String),
#[allow(dead_code)]
ClearError,
// UI refresh.
RefreshView,
// Fallback.
#[allow(dead_code)]
NoOp,
}