refactor: improve code quality and consistency

Comprehensive code audit addressing naming consistency, dead code removal,
and documentation improvements across the entire codebase.

- Rename panel_pages.rs → pages_panel.rs for consistent naming
- Unify view functions: all panels now use view() convention
- Rename header_start/end() → start/end() for brevity
- Update all imports and references

- Remove Rotation::from_degrees() (only 4 fixed states needed)
- Remove TransformState::identity() and is_identity() (Default suffices)
- Remove duplicate convenience methods from RasterDocument, VectorDocument,
  PortableDocument (rotate_cw/ccw, flip_horizontal/vertical)
- Remove unused imports and constants (ROTATION_STEP, FULL_ROTATION)

- Rename constants: PDF_RENDER_SCALE → PDF_RENDER_QUALITY,
  PDF_THUMBNAIL_SCALE → PDF_THUMBNAIL_SIZE
- Add comprehensive trait documentation explaining type erasure pattern
- Document why large enum variants are acceptable
- Add #[allow(dead_code)] with explanations for trait API types
- Improve all constant and config comments

- Collapse nested if statements using Rust 2024 let-chains
- Replace single-arm match with if-let
- Introduce StateChangeCallback<Message> type alias
- Apply clippy auto-fixes for better code style
This commit is contained in:
wfx 2026-01-19 19:42:54 +01:00
parent 0e31b146a3
commit 9399a008c4
19 changed files with 744 additions and 418 deletions

View file

@ -166,11 +166,11 @@ impl cosmic::Application for Noctua {
}
fn header_start(&self) -> Vec<Element<'_, Self::Message>> {
view::header::header_start(&self.model)
view::header::start(&self.model)
}
fn header_end(&self) -> Vec<Element<'_, Self::Message>> {
view::header::header_end(&self.model)
view::header::end(&self.model)
}
fn view(&self) -> Element<'_, Self::Message> {
@ -182,7 +182,7 @@ impl cosmic::Application for Noctua {
return None;
}
Some(context_drawer::context_drawer(
view::panels::properties_panel(&self.model),
view::panels::view(&self.model),
AppMessage::ToggleContextPage(ContextPage::Properties),
))
}
@ -307,7 +307,7 @@ fn thumbnail_refresh_subscription(app: &Noctua) -> Subscription<AppMessage> {
.model
.document
.as_ref()
.map_or(false, |doc| doc.is_multi_page() && !doc.thumbnails_ready());
.is_some_and(|doc| doc.is_multi_page() && !doc.thumbnails_ready());
if needs_refresh {
time::every(Duration::from_millis(100)).map(|_| AppMessage::RefreshView)