From 12936391d4657ccf40865e61c90c764713212676 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Wed, 27 Nov 2024 19:29:22 +0300 Subject: [PATCH] Part 1: Refine manual parting UI --- locales/en_US.json | 7 ++- src/automatic_partitioning_page/mod.rs | 4 +- src/drive_mount_row/imp.rs | 4 +- src/manual_partitioning_page/func.rs | 10 +--- src/manual_partitioning_page/mod.rs | 82 +++++++++++++++++++++++++- 5 files changed, 91 insertions(+), 16 deletions(-) diff --git a/locales/en_US.json b/locales/en_US.json index b86baf8..ce870f2 100644 --- a/locales/en_US.json +++ b/locales/en_US.json @@ -14,7 +14,8 @@ "manual_method_button_label": "Manually Partition The Drive", "automatic_method_button_label": "Automatically Partition\nThe Drive", "manual_partitioning_page_title": "Manual Disk Partitioning", - "manual_partitioning_page_subtitle": "Use This Page to Create a Custom Filesystem Table for PikaOS to install into.\nInstructions:\n 1 - Use The Partitioning Utility to Create New Partitions or Reformat and Reuse Existing Ones. \n 2 - The Mandatory System Partitons are:\n\t* 512MB+ Fat32/vfat Partition for /boot/efi (An Existing EFI Partition Can be Left Unformated and Used for /boot/efi in Order to Achieve Dual-Boot).\n\t* 1000MB+ EXT4 Partition for /boot (Can NOT Be Shared... Format MANDATORY!).\n\t* 26GB+ EXT4/BTRFS/XFS/F2FS Partition for / (a.k.a Root) (Can NOT Be Shared... Format MANDATORY!).\n 3 - This Installer Doesn't Erase Any Data Automatically, Format Your Drives MANUALLY Via The Partitioning Utility.\n 4 - Once All The Required Partitions are Present, Go Through The Systematic Filesystem Entries List, and Select The Correct Partition for The Entry\n 5 - Additional Mount Options Can be Left Empty.\n 6 - If a Filesystem Entry's Additional Mount Options Contain subvol, Duplicate Usage Checks for That Entry's Partition Will be Disabled, Allowing use of SUBVOLS.\n 7 - The User Can Add Additional Filesystem Entries in The Custom User Filesystem Entries List\n\tProvided He Defines A Mountpoint such as /home\n 8 - In Order To Add a linux-swap Partition Set Mountpoint to [SWAP]\n 9 - To Add LUKS Encrypted Partitions or Any Kind of Partition That Uses Mapper\n\tUse The Partitioning Utility to Map/Unlock Them, Then Their Mapping Will be Shown as Partition Selections.\n 10 - Once All That is Done Press The Validate Filesystem Table Button, If All is Well, It Will Allow You To Begin Installation.", + "manual_partitioning_page_subtitle": "Use This Page to Create a Custom Filesystem Table for PikaOS to install into.", + "manual_partitioning_help_dialog_textview_buffer_text": "Instructions:\n 1 - Use The Partitioning Utility to Create New Partitions or Reformat and Reuse Existing Ones. \n 2 - The Mandatory System Partitons are:\n\t* 512MB+ Fat32/vfat Partition for /boot/efi (An Existing EFI Partition Can be Left Unformated and Used for /boot/efi in Order to Achieve Dual-Boot).\n\t* 1000MB+ EXT4 Partition for /boot (Can NOT Be Shared... Format MANDATORY!).\n\t* 26GB+ EXT4/BTRFS/XFS/F2FS Partition for / (a.k.a Root) (Can NOT Be Shared... Format MANDATORY!).\n 3 - This Installer Doesn't Erase Any Data Automatically, Format Your Drives MANUALLY Via The Partitioning Utility.\n 4 - Once All The Required Partitions are Present, Go Through The Systematic Filesystem Entries List, and Select The Correct Partition for The Entry\n 5 - Additional Mount Options Can be Left Empty.\n 6 - If a Filesystem Entry's Additional Mount Options Contain subvol, Duplicate Usage Checks for That Entry's Partition Will be Disabled, Allowing use of SUBVOLS.\n 7 - The User Can Add Additional Filesystem Entries in The Custom User Filesystem Entries List\n\tProvided He Defines A Mountpoint such as /home\n 8 - In Order To Add a linux-swap Partition Set Mountpoint to [SWAP]\n 9 - To Add LUKS Encrypted Partitions or Any Kind of Partition That Uses Mapper,\n\tUse The Partitioning Utility to Map/Unlock Them, Then Their Mapping Will be Shown as Partition Selections.\n 10 - Once All That is Done Press The Validate Filesystem Table Button, If All is Well, It Will Allow You To Begin Installation.", "partition_row_subtitle_needs_mapper": "This partition needs a mapper!", "language_page_title": "Select a Language", "language_page_subtitle": "Please Select a Locale for The System to Use", @@ -141,5 +142,7 @@ "drive_mount_row_title_root": "Root Filesystem Entry", "drive_mount_row_subtitle_root": "This Entry's Partition Mounted at (/) Will Store The All The System Files and Applications. (Must Be Formatted)", "drive_mount_row_title_custom": "Custom User Filesystem Entry (ID: {ID})", - "drive_mount_row_subtitle_custom": "A Custom Filesystem Entry Added by You" + "drive_mount_row_subtitle_custom": "A Custom Filesystem Entry Added by You", + "manual_partitioning_help_dialog_label": "OK", + "manual_partitioning_help_button_label": "Need Help?" } diff --git a/src/automatic_partitioning_page/mod.rs b/src/automatic_partitioning_page/mod.rs index 42e0b0a..c65b08d 100644 --- a/src/automatic_partitioning_page/mod.rs +++ b/src/automatic_partitioning_page/mod.rs @@ -289,8 +289,8 @@ pub fn automatic_partitioning_page( let devices_selection_button_row_dialog = adw::AlertDialog::builder() .extra_child(&devices_selection_button_row_viewport) - .width_request(400) - .height_request(400) + .width_request(600) + .height_request(600) .build(); devices_selection_button_row_dialog.add_response( diff --git a/src/drive_mount_row/imp.rs b/src/drive_mount_row/imp.rs index 15c66a0..04d2f7b 100644 --- a/src/drive_mount_row/imp.rs +++ b/src/drive_mount_row/imp.rs @@ -220,8 +220,8 @@ impl ObjectImpl for DriveMountRow { let partition_button_row_dialog = adw::AlertDialog::builder() .extra_child(&partition_button_row_dialog_extra_child) - .width_request(400) - .height_request(400) + .width_request(600) + .height_request(600) .title(t!("devices_selection_button_row_dialog_manual_title")) .body(t!("devices_selection_button_row_dialog_manual_body")) .build(); diff --git a/src/manual_partitioning_page/func.rs b/src/manual_partitioning_page/func.rs index aef5265..3b5ed00 100644 --- a/src/manual_partitioning_page/func.rs +++ b/src/manual_partitioning_page/func.rs @@ -3,7 +3,7 @@ use crate::{ config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, MINIMUM_ROOT_BYTE_SIZE}, drive_mount_row::DriveMountRow, }; -use adw::{prelude::*, ExpanderRow}; +use adw::{prelude::*}; use glib::{clone, closure_local}; use gtk::{gio, glib}; use std::{cell::RefCell, rc::Rc}; @@ -61,8 +61,6 @@ pub fn create_efi_row( row.set_mountpoint("/boot/efi"); - row.set_expanded(true); - row.set_id(0); let null_checkbutton = gtk::CheckButton::builder().build(); @@ -301,8 +299,6 @@ pub fn create_boot_row( row.set_id(1); - row.set_expanded(true); - let null_checkbutton = gtk::CheckButton::builder().build(); for partition in partition_array { @@ -539,8 +535,6 @@ pub fn create_root_row( row.set_id(2); - row.set_expanded(true); - let null_checkbutton = gtk::CheckButton::builder().build(); for partition in partition_array { @@ -793,8 +787,6 @@ pub fn create_mount_row( (*extra_mount_id_refcell.borrow_mut()) += 1; - row.set_expanded(true); - let null_checkbutton = gtk::CheckButton::builder().build(); for partition in partition_array { diff --git a/src/manual_partitioning_page/mod.rs b/src/manual_partitioning_page/mod.rs index 30d1e30..8fc1953 100644 --- a/src/manual_partitioning_page/mod.rs +++ b/src/manual_partitioning_page/mod.rs @@ -56,6 +56,70 @@ pub fn manual_partitioning_page( .vexpand(true) .build(); + // + + let manual_partitioning_help_dialog_button_listbox = gtk::ListBox::builder() + .selection_mode(gtk::SelectionMode::None) + .hexpand(true) + .halign(gtk::Align::End) + .margin_top(15) + .margin_bottom(15) + .margin_start(15) + .margin_end(15) + .build(); + + manual_partitioning_help_dialog_button_listbox.add_css_class("boxed-list"); + + let manual_partitioning_help_dialog_button = adw::ButtonRow::builder() + .start_icon_name("dialog-question-symbolic") + .build(); + + manual_partitioning_help_dialog_button_listbox.append(&manual_partitioning_help_dialog_button); + manual_partitioning_help_dialog_button_listbox.add_css_class("accent-blink"); + + let manual_partitioning_help_dialog_textview_buffer = gtk::TextBuffer::builder().build(); + + let manual_partitioning_help_dialog_textview = gtk::TextView::with_buffer(&manual_partitioning_help_dialog_textview_buffer); + + /*let manual_partitioning_help_dialog_viewport_box = gtk::ListBox::builder() + .selection_mode(gtk::SelectionMode::None) + .build(); + manual_partitioning_help_dialog_viewport_box.add_css_class("boxed-list"); + manual_partitioning_help_dialog_viewport_box.add_css_class("no-round-borders"); + + manual_partitioning_help_dialog_viewport_box.append(&manual_partitioning_help_dialog_textview);*/ + + let manual_partitioning_help_dialog_viewport = gtk::ScrolledWindow::builder() + .vexpand(true) + .hexpand(true) + .has_frame(true) + .overflow(gtk::Overflow::Hidden) + .child(&manual_partitioning_help_dialog_textview) + .build(); + + let manual_partitioning_help_dialog = adw::AlertDialog::builder() + .extra_child(&manual_partitioning_help_dialog_viewport) + .width_request(600) + .height_request(500) + .build(); + + manual_partitioning_help_dialog.add_response( + "manual_partitioning_help_dialog", + "manual_partitioning_help_dialog_label", + ); + + manual_partitioning_help_dialog_button.connect_activated(clone!( + #[strong] + window, + #[strong] + manual_partitioning_help_dialog, + move |_| { + manual_partitioning_help_dialog.present(Some(&window)); + } + )); + + // + let system_drive_mounts_adw_listbox_label = gtk::Label::builder() .hexpand(true) .halign(gtk::Align::Start) @@ -66,6 +130,7 @@ pub fn manual_partitioning_page( let system_drive_mounts_adw_listbox = gtk::ListBox::builder() //.selection_mode(gtk::SelectionMode::None) + .show_separators(true) .build(); system_drive_mounts_adw_listbox.add_css_class("boxed-list"); system_drive_mounts_adw_listbox.add_css_class("no-round-borders"); @@ -82,6 +147,7 @@ pub fn manual_partitioning_page( let custom_drive_mounts_adw_listbox = gtk::ListBox::builder() //.selection_mode(gtk::SelectionMode::None) + .show_separators(true) .build(); custom_drive_mounts_adw_listbox.add_css_class("boxed-list"); custom_drive_mounts_adw_listbox.add_css_class("no-round-borders"); @@ -454,6 +520,7 @@ pub fn manual_partitioning_page( } )); + content_box.append(&manual_partitioning_help_dialog_button_listbox); content_box.append(&system_drive_mounts_adw_listbox_label); content_box.append(&system_drive_mounts_viewport); content_box.append(&custom_drive_mounts_adw_listbox_label); @@ -531,12 +598,25 @@ pub fn manual_partitioning_page( system_drive_mounts_adw_listbox_label, #[weak] custom_drive_mounts_adw_listbox_label, + #[weak] + manual_partitioning_help_dialog, + #[weak] + manual_partitioning_help_dialog_button, + #[strong] + manual_partitioning_help_dialog_textview_buffer, move |_, _| { manual_partitioning_page.set_page_title(t!("manual_partitioning_page_title")); manual_partitioning_page.set_page_subtitle(t!("manual_partitioning_page_subtitle")); manual_partitioning_page.set_back_tooltip_label(t!("back")); manual_partitioning_page.set_next_tooltip_label(t!("next")); // + manual_partitioning_help_dialog.set_response_label( + "manual_partitioning_help_dialog", + &t!("manual_partitioning_help_dialog_label"), + ); + manual_partitioning_help_dialog_textview_buffer.set_text(&t!("manual_partitioning_help_dialog_textview_buffer_text")); + manual_partitioning_help_dialog_button.set_title(&t!("manual_partitioning_help_button_label")); + // system_drive_mounts_adw_listbox_label.set_label(&t!( "system_drive_mounts_adw_listbox_label_label" )); @@ -671,7 +751,7 @@ fn set_crypttab_entries( //.transient_for(&window) //.hide_on_close(true) .extra_child(&crypttab_password_child_box) - .width_request(400) + .width_request(600) .height_request(200) .heading( strfmt::strfmt(