code: Reformat with group_imports=StdExternalCrate
This commit is contained in:
parent
81c9030288
commit
2648295a18
18 changed files with 86 additions and 90 deletions
|
|
@ -1,3 +1,4 @@
|
|||
format_code_in_doc_comments = true
|
||||
group_imports = "StdExternalCrate"
|
||||
imports_granularity = "Module"
|
||||
wrap_comments = true
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) 2020-2023 Christopher Davis
|
||||
// Copyright (c) 2022-2023 Sophie Herold
|
||||
// Copyright (c) 2022-2023 Sabri Ünal
|
||||
// Copyright (c) 2023 Matteo Nardi
|
||||
// Copyright (c) 2023 Julian Hofer
|
||||
// Copyright (c) 2023 Huan Nguyen
|
||||
//
|
||||
|
|
@ -19,14 +20,12 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use crate::about;
|
||||
use crate::deps::*;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
|
||||
use crate::config;
|
||||
use crate::deps::*;
|
||||
use crate::window::LpWindow;
|
||||
use crate::{about, config};
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
//! Decode using glycin
|
||||
use super::*;
|
||||
use crate::decoder::tiling::{self, FrameBufferExt};
|
||||
use crate::deps::*;
|
||||
use crate::metadata::{ImageFormat, Metadata};
|
||||
use std::sync::Arc;
|
||||
|
||||
use arc_swap::ArcSwap;
|
||||
use gtk::prelude::*;
|
||||
|
||||
use std::sync::Arc;
|
||||
use super::*;
|
||||
use crate::decoder::tiling::{self, FrameBufferExt};
|
||||
use crate::deps::*;
|
||||
use crate::metadata::{ImageFormat, Metadata};
|
||||
|
||||
pub const FRAME_BUFFER: usize = 3;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,18 +16,18 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
//! Decode using librsvg
|
||||
use super::*;
|
||||
use crate::decoder::tiling::{self, FrameBufferExt};
|
||||
use crate::decoder::TileRequest;
|
||||
use crate::deps::*;
|
||||
use crate::metadata::ImageFormat;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Context;
|
||||
use arc_swap::ArcSwap;
|
||||
use async_channel as mpsc;
|
||||
use gtk::prelude::*;
|
||||
|
||||
use std::sync::Arc;
|
||||
use super::*;
|
||||
use crate::decoder::tiling::{self, FrameBufferExt};
|
||||
use crate::decoder::TileRequest;
|
||||
use crate::deps::*;
|
||||
use crate::metadata::ImageFormat;
|
||||
|
||||
/// Current librsvg limit on maximum dimensions. See
|
||||
/// <https://gitlab.gnome.org/GNOME/librsvg/-/issues/938>
|
||||
|
|
|
|||
|
|
@ -20,20 +20,17 @@
|
|||
pub mod formats;
|
||||
pub mod tiling;
|
||||
|
||||
pub use formats::ImageDimensionDetails;
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::metadata::{ImageFormat, Metadata};
|
||||
use formats::*;
|
||||
use tiling::FrameBufferExt;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use arc_swap::ArcSwap;
|
||||
use formats::*;
|
||||
pub use formats::{ImageDimensionDetails, RSVG_MAX_SIZE};
|
||||
use futures::channel::mpsc;
|
||||
use tiling::FrameBufferExt;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use formats::RSVG_MAX_SIZE;
|
||||
use crate::deps::*;
|
||||
use crate::metadata::{ImageFormat, Metadata};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
/// Renderer requests new tiles
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@
|
|||
//! be re-genearted for each zoom level. It can also be used to allow
|
||||
//! showing large JPEGs etc where the complete decoded image would not
|
||||
//! even fit in the VRAM.
|
||||
use super::{DecoderUpdate, ImageDimensionDetails, UpdateSender};
|
||||
use crate::deps::*;
|
||||
use std::collections::{BTreeMap, VecDeque};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use arc_swap::ArcSwap;
|
||||
use gtk::prelude::*;
|
||||
|
||||
use std::collections::{BTreeMap, VecDeque};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use super::{DecoderUpdate, ImageDimensionDetails, UpdateSender};
|
||||
use crate::deps::*;
|
||||
|
||||
const ZOOM_SIGNIFICANT_DIGITS: i32 = 6;
|
||||
pub const MIN_TILE_SIZE: u16 = 500;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::util;
|
||||
use crate::util::gettext::*;
|
||||
use std::cell::{OnceCell, RefCell};
|
||||
|
||||
use anyhow::Context;
|
||||
use gio::prelude::*;
|
||||
|
|
@ -29,7 +27,10 @@ use glib::subclass::Signal;
|
|||
use glib::GString;
|
||||
use indexmap::IndexMap;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::cell::{OnceCell, RefCell};
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::util;
|
||||
use crate::util::gettext::*;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ pub use file::FileInfo;
|
|||
pub use format::ImageFormat;
|
||||
pub use gps::GPSLocation;
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::util;
|
||||
use crate::util::gettext::*;
|
||||
|
||||
use crate::deps::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Metadata {
|
||||
exif: Option<exif::Exif>,
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@
|
|||
|
||||
pub mod gettext;
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::util::gettext::*;
|
||||
use std::fmt::{Debug, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use anyhow::{anyhow, bail, Context};
|
||||
use gio::prelude::*;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::fmt::{Debug, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use crate::deps::*;
|
||||
use crate::util::gettext::*;
|
||||
|
||||
/// Returns localized date + time format
|
||||
pub fn datetime_fmt(datetime: &glib::DateTime) -> Option<String> {
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@
|
|||
//!
|
||||
//! This implementation is inspired by [Amberol](https://gitlab.gnome.org/World/amberol)
|
||||
|
||||
use crate::deps::*;
|
||||
use adw::prelude::*;
|
||||
|
||||
mod imp {
|
||||
use once_cell::sync::OnceCell;
|
||||
use crate::deps::*;
|
||||
|
||||
mod imp {
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::{ParamSpec, Properties, Value};
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2021, 2023 Christopher Davis
|
||||
// Copyright (c) 2021 Christopher Davis
|
||||
// Copyright (c) 2022-2023 Sophie Herold
|
||||
// Copyright (c) 2023 Julian Hofer
|
||||
// Copyright (c) 2023 Lubosz Sarnecki
|
||||
|
|
@ -41,12 +41,10 @@ mod rotation;
|
|||
mod scrollable;
|
||||
mod zoom;
|
||||
|
||||
use crate::deps::*;
|
||||
|
||||
use crate::decoder::tiling::FrameBufferExt;
|
||||
use crate::decoder::{self, tiling, Decoder, DecoderUpdate};
|
||||
use crate::metadata::Metadata;
|
||||
use crate::util::Gesture;
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
|
|
@ -56,10 +54,11 @@ use glib::subclass::Signal;
|
|||
use glib::{Properties, SignalGroup};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
use crate::decoder::tiling::FrameBufferExt;
|
||||
use crate::decoder::{self, tiling, Decoder, DecoderUpdate};
|
||||
use crate::deps::*;
|
||||
use crate::metadata::Metadata;
|
||||
use crate::util::Gesture;
|
||||
|
||||
/// Default background color around images and behind transparent images
|
||||
/// `#242424`
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@
|
|||
//!
|
||||
//! This widget also handles showing the context menu.
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::widgets::LpImage;
|
||||
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::{clone, Properties};
|
||||
use gtk::prelude::*;
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::widgets::LpImage;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,8 @@
|
|||
//! [`LpSlidingView`]: crate::widgets::LpSlidingView
|
||||
//! [`LpFileModel`]: crate::file_model::LpFileModel
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::file_model::LpFileModel;
|
||||
use crate::util::gettext::*;
|
||||
use crate::util::{Direction, Position};
|
||||
use crate::widgets::{LpImage, LpImagePage, LpPrint, LpSlidingView};
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
|
|
@ -45,8 +42,11 @@ use glib::translate::IntoGlib;
|
|||
use glib::{clone, Properties};
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use std::marker::PhantomData;
|
||||
use crate::deps::*;
|
||||
use crate::file_model::LpFileModel;
|
||||
use crate::util::gettext::*;
|
||||
use crate::util::{Direction, Position};
|
||||
use crate::widgets::{LpImage, LpImagePage, LpPrint, LpSlidingView};
|
||||
|
||||
// The number of pages we want to buffer
|
||||
// on either side of the current page.
|
||||
|
|
|
|||
|
|
@ -18,10 +18,8 @@
|
|||
|
||||
//! The print layout widget that also coordinates the print process
|
||||
|
||||
use crate::decoder;
|
||||
use crate::deps::*;
|
||||
use crate::util::gettext::*;
|
||||
use crate::widgets::{LpImage, LpPrintPreview};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
|
|
@ -29,8 +27,10 @@ use glib::Properties;
|
|||
use gtk::CompositeTemplate;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
use crate::decoder;
|
||||
use crate::deps::*;
|
||||
use crate::util::gettext::*;
|
||||
use crate::widgets::{LpImage, LpPrintPreview};
|
||||
|
||||
#[derive(Default, Clone, Copy)]
|
||||
struct PageAlignment {
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
|
||||
//! Print preview widget that shows a fake page with the image on it
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::widgets::LpPrint;
|
||||
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::Properties;
|
||||
use gtk::prelude::*;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::widgets::LpPrint;
|
||||
|
||||
mod imp_page {
|
||||
use super::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,17 +16,16 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use crate::decoder::ImageDimensionDetails;
|
||||
use crate::deps::*;
|
||||
use crate::util;
|
||||
use std::cell::{OnceCell, RefCell};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::Properties;
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
use std::cell::{OnceCell, RefCell};
|
||||
|
||||
use crate::decoder::ImageDimensionDetails;
|
||||
use crate::deps::*;
|
||||
use crate::util;
|
||||
use crate::widgets::image::LpImage;
|
||||
|
||||
const FALLBACK: &str = "–";
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@
|
|||
//!
|
||||
//! This widget it similar to `AdwCarousel`.
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::widgets::LpImagePage;
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
|
|
@ -31,7 +30,8 @@ use glib::Properties;
|
|||
use indexmap::IndexMap;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use crate::deps::*;
|
||||
use crate::widgets::LpImagePage;
|
||||
|
||||
static SCROLL_DAMPING_RATIO: f64 = 1.;
|
||||
static SCROLL_MASS: f64 = 0.5;
|
||||
|
|
@ -46,9 +46,10 @@ static PAGE_SPACING_FIXED: f32 = 25.;
|
|||
const PAGE_SPACING_PERCENT: f32 = 0.02;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
use glib::subclass::Signal;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Default, Properties)]
|
||||
#[properties(wrapper_type = super::LpSlidingView)]
|
||||
pub struct LpSlidingView {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Copyright (c) 2022-2023 Sophie Herold
|
||||
// Copyright (c) 2022 Elton A Rodrigues
|
||||
// Copyright (c) 2022 Maximiliano Sandoval R
|
||||
// Copyright (c) 2023 Matteo Nardi
|
||||
// Copyright (c) 2023 Julian Hofer
|
||||
// Copyright (c) 2023 FineFindus
|
||||
// Copyright (c) 2023 qwel
|
||||
|
|
@ -24,19 +25,18 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use crate::deps::*;
|
||||
use crate::util::gettext::*;
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::clone;
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::application::LpApplication;
|
||||
use crate::config;
|
||||
use crate::deps::*;
|
||||
use crate::util::gettext::*;
|
||||
use crate::util::{Direction, Position};
|
||||
use crate::widgets::{LpDragOverlay, LpImage, LpImageView, LpPropertiesView};
|
||||
|
||||
|
|
@ -789,12 +789,12 @@ impl LpWindow {
|
|||
imp.properties_button.set_sensitive(has_image);
|
||||
}
|
||||
|
||||
/// When the image-properties sidebar is displayed or hidden, we should update the
|
||||
/// "show-properties" setting.
|
||||
/// When the image-properties sidebar is displayed or hidden, we should
|
||||
/// update the "show-properties" setting.
|
||||
fn on_properties_button_toggled(&self) {
|
||||
let imp = self.imp();
|
||||
// When no image is shown, we skip this update as the sidebar should always be hidden.
|
||||
// This can happen when deleting a picture.
|
||||
// When no image is shown, we skip this update as the sidebar should always be
|
||||
// hidden. This can happen when deleting a picture.
|
||||
if imp.image_view.current_page().is_none() {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue