mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-14 09:27:04 +01:00
feat(gui,core): modern Photos layout
Lay the timeline out in justified rows. Each photo keeps its own shape, clamped between 1:2 and 5:2, and every row but a section's last spans the width to the pixel. "Square Tiles" in the page menu restores the even grid, and the Year zoom stays square. The zoom level and the tile shape persist in a new `photos_view` config section. Move Timeline/Albums/Places into the header as an icon-and-label switch that shows only icons in a narrow window. The filters take a single row whose kind tabs scroll sideways. Selection mode follows GNOME apps: - the header shows "N selected" and Cancel; - an ActionBar along the bottom offers Favorite (or unfavorite), Add to Album, Remove from Album, Save Copies and Move to Trash; - each section heading gets a check that selects the whole section. One function, sync_header, decides the header for the page, an open album or place, and selection mode. The heading of the section at the top of the grid floats over the grid. Favorites get a star badge, and video placeholders a video glyph. New bundled icons: pdfs-photos, pdfs-album and pdfs-slideshow. Upload takes several photos and videos at once, and files dropped on the timeline upload too. The media type comes from the MIME database, except that a recording-sized .ts counts as video. The viewer's details panel moves into an OverlaySplitView that lies over the photo below 800sp.
This commit is contained in:
1 parent
0183f17435
commit
1c50797772
23 files changed
+3751
-1850
No files matched your search
@@ -163,6 +163,10 @@ pub struct AppConfig {
|
||||
/// Defaulted for configs predating the field.
|
||||
#[serde(default)]
|
||||
pub files_view: FilesView,
|
||||
/// How the desktop app's Photos page lays out its grid. Defaulted for
|
||||
/// configs predating the field.
|
||||
#[serde(default)]
|
||||
pub photos_view: PhotosView,
|
||||
/// The desktop app's main window size, remembered between runs. Defaulted
|
||||
/// for configs predating the field.
|
||||
#[serde(default)]
|
||||
@@ -233,6 +237,18 @@ impl Default for FilesView {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Photos page's grid choices, remembered between runs.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
#[serde(default)]
|
||||
pub struct PhotosView {
|
||||
/// The zoom level: the row height the grid aims for, in logical pixels.
|
||||
/// `None` means the app's default.
|
||||
pub row_height: Option<i32>,
|
||||
/// Crop every photo to a square tile instead of showing it at its own
|
||||
/// shape.
|
||||
pub square: bool,
|
||||
}
|
||||
|
||||
/// The desktop app's main window, as it was when it last closed.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[serde(default)]
|
||||
@@ -762,6 +778,10 @@ mod tests {
|
||||
descending: true,
|
||||
folders_first: false,
|
||||
},
|
||||
photos_view: PhotosView {
|
||||
row_height: Some(240),
|
||||
square: true,
|
||||
},
|
||||
window: WindowState {
|
||||
width: 1200,
|
||||
height: 800,
|
||||
@@ -792,6 +812,7 @@ mod tests {
|
||||
assert_eq!(decoded.upload_limit, Some(500_000));
|
||||
assert_eq!(decoded.download_limit, None);
|
||||
assert_eq!(decoded.files_view, config.files_view);
|
||||
assert_eq!(decoded.photos_view, config.photos_view);
|
||||
assert_eq!(decoded.window, config.window);
|
||||
}
|
||||
|
||||
@@ -837,6 +858,16 @@ mod tests {
|
||||
assert!(partial.folders_first);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_config_without_a_photos_view_gets_the_default() {
|
||||
let decoded: AppConfig =
|
||||
serde_json::from_str(r#"{"app_version":"a","user_agent":"b"}"#).unwrap();
|
||||
assert_eq!(decoded.photos_view, PhotosView::default());
|
||||
let partial: PhotosView = serde_json::from_str(r#"{"square":true}"#).unwrap();
|
||||
assert!(partial.square);
|
||||
assert_eq!(partial.row_height, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_old_proton_accent_setting_turns_on_the_proton_theme() {
|
||||
let decoded: AppConfig =
|
||||
|
||||
Reference in new issue
Block a user