changes good

This commit is contained in:
Ward from fusion-voyager-3 2024-01-22 18:07:38 +03:00
parent c18bd9aecc
commit 725fe96f72
5 changed files with 142 additions and 10 deletions

View File

@ -55,7 +55,7 @@ pub fn build_ui(app: &adw::Application) {
.margin_bottom(15) .margin_bottom(15)
.margin_start(15) .margin_start(15)
.margin_end(15) .margin_end(15)
.sensitive(false) //.sensitive(false)
.build(); .build();
// / _main_box appends // / _main_box appends
@ -122,13 +122,19 @@ pub fn build_ui(app: &adw::Application) {
.orientation(Orientation::Vertical) .orientation(Orientation::Vertical)
.build(); .build();
// Add partitioning_page.rs as a page for content_stack let done_main_box = gtk::Box::builder()
partitioning_page(&install_main_box , &window, &content_stack); .orientation(Orientation::Vertical)
.build();
// Add partitioning_page.rs as a page for content_stack
partitioning_page(&done_main_box, &install_main_box, &content_stack, &window);
// / Content stack appends
//// Add the install_main_box as page: install_page, Give it nice title //// Add the install_main_box as page: install_page, Give it nice title
content_stack.add_titled(&install_main_box, Some("install_page"), "Installation"); content_stack.add_titled(&install_main_box, Some("install_page"), "Installation");
// Add done_page.rs as a page for content_stack
content_stack.add_titled(&done_main_box, Some("installation_successful_page"), "Done");
// glib maximization // glib maximization
if glib_settings.boolean("is-maximized") == true { if glib_settings.boolean("is-maximized") == true {
window.maximize() window.maximize()

115
src/done_page.rs Normal file
View File

@ -0,0 +1,115 @@
// Use libraries
/// Use all gtk4 libraries (gtk4 -> gtk because cargo)
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::prelude::*;
use gtk::*;
use adw::prelude::*;
use adw::*;
use glib::*;
use gdk::Display;
use gtk::subclass::layout_child;
use std::fs;
use std::path::Path;
pub fn done_page(done_main_box: &gtk::Box, content_stack: &gtk::Stack, window: &adw::ApplicationWindow) {
// the header box for the installation_successful page
let done_header_box = gtk::Box::builder()
.orientation(Orientation::Horizontal)
.build();
// the header text for the installation_successful page
let done_header_text = gtk::Label::builder()
.label("We're done!")
.halign(gtk::Align::End)
.hexpand(true)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(5)
.build();
done_header_text.add_css_class("header_sized_text");
// the header icon for the installation_successful icon
let done_header_icon = gtk::Image::builder()
.icon_name("debian-swirl")
.halign(gtk::Align::Start)
.hexpand(true)
.pixel_size(78)
.margin_top(15)
.margin_bottom(15)
.margin_start(0)
.margin_end(15)
.build();
// the header box for the installation_successful page
let installation_successful_main_box = gtk::Box::builder()
.orientation(Orientation::Vertical)
.build();
// make installation_successful selection box for choosing installation or live media
let installation_successful_selection_box = gtk::Box::builder()
.orientation(Orientation::Vertical)
.margin_bottom(15)
.margin_top(15)
.margin_start(15)
.margin_end(15)
.build();
let installation_successful_text = gtk::Label::builder()
.vexpand(true)
.hexpand(true)
.label("The installation of PikaOS has been completed sucessfully.")
.halign(gtk::Align::Center)
.valign(gtk::Align::Center)
.build();
installation_successful_text.add_css_class("header_sized_text");
let installation_successful_exit_button = gtk::Button::builder()
.label("Exit")
.vexpand(true)
.hexpand(true)
.halign(gtk::Align::Center)
.valign(gtk::Align::Center)
.build();
// / installation_successful_selection_box appends
// / done_header_box appends
//// Add the installation_successful page header text and icon
done_header_box.append(&done_header_text);
done_header_box.append(&done_header_icon);
// / installation_successful_main_box appends
//// Add the installation_successful header to installation_successful main box
installation_successful_main_box.append(&done_header_box);
//// Add the installation_successful selection/page content box to installation_successful main box
installation_successful_main_box.append(&installation_successful_selection_box);
// Start Appending widgets to boxes
// / installation_successful_selection_box appends
//// add live and install media button to installation_successful page selections
installation_successful_selection_box.append(&installation_successful_text);
installation_successful_selection_box.append(&installation_successful_exit_button);
// / done_header_box appends
//// Add the installation_successful page header text and icon
done_header_box.append(&done_header_text);
done_header_box.append(&done_header_icon);
// / installation_successful_main_box appends
//// Add the installation_successful selection/page content box to installation_successful main box
installation_successful_main_box.append(&installation_successful_selection_box);
done_main_box.append(&done_header_box);
if Path::new("/tmp/pika-installer-gtk4-successful.txt").exists() {
done_main_box.append(&installation_successful_main_box)
}
// / Content stack appends
//// Add the installation_successful_main_box as page: installation_successful_page, Give it nice title
installation_successful_exit_button.connect_clicked(clone!(@weak window => move |_| window.close()));
}

View File

@ -14,7 +14,9 @@ use vte::*;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
pub fn install_page(install_main_box: &gtk::Box ,content_stack: &gtk::Stack) { use crate::done_page;
pub fn install_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,content_stack: &gtk::Stack, window: &adw::ApplicationWindow) {
// create the bottom box for next and back buttons // create the bottom box for next and back buttons
let bottom_box = gtk::Box::builder() let bottom_box = gtk::Box::builder()
@ -259,6 +261,12 @@ pub fn install_page(install_main_box: &gtk::Box ,content_stack: &gtk::Stack) {
install_nested_stack.add_titled(&install_confirm_box, Some("confirm_page"), "confirm_page"); install_nested_stack.add_titled(&install_confirm_box, Some("confirm_page"), "confirm_page");
install_nested_stack.add_titled(&install_progress_box, Some("progress_page"), "progress_page"); install_nested_stack.add_titled(&install_progress_box, Some("progress_page"), "progress_page");
//
done_page(&done_main_box ,&content_stack, &window);
//
install_confirm_button.connect_clicked(clone!(@weak install_nested_stack => move |_| install_nested_stack.set_visible_child_name("progress_page"))); install_confirm_button.connect_clicked(clone!(@weak install_nested_stack => move |_| install_nested_stack.set_visible_child_name("progress_page")));
progress_log_button.connect_clicked(clone!(@weak install_progress_log_stack => move |_| { progress_log_button.connect_clicked(clone!(@weak install_progress_log_stack => move |_| {

View File

@ -20,6 +20,7 @@ mod timezone_page;
mod keyboard_page; mod keyboard_page;
mod partitioning_page; mod partitioning_page;
mod install_page; mod install_page;
mod done_page;
use crate::save_window_size::save_window_size; use crate::save_window_size::save_window_size;
use crate::welcome_page::welcome_page; use crate::welcome_page::welcome_page;
use crate::efi_error_page::efi_error_page; use crate::efi_error_page::efi_error_page;
@ -29,6 +30,7 @@ use crate::timezone_page::timezone_page;
use crate::keyboard_page::keyboard_page; use crate::keyboard_page::keyboard_page;
use crate::partitioning_page::partitioning_page; use crate::partitioning_page::partitioning_page;
use crate::install_page::install_page; use crate::install_page::install_page;
use crate::done_page::done_page;
/// main function /// main function
fn main() { fn main() {

View File

@ -25,7 +25,7 @@ use std::path::Path;
use crate::install_page; use crate::install_page;
pub fn partitioning_page(install_main_box: &gtk::Box, window: &adw::ApplicationWindow, content_stack: &gtk::Stack) { pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,content_stack: &gtk::Stack, window: &adw::ApplicationWindow) {
// create the bottom box for next and back buttons // create the bottom box for next and back buttons
let bottom_box = gtk::Box::builder() let bottom_box = gtk::Box::builder()
@ -973,12 +973,13 @@ pub fn partitioning_page(install_main_box: &gtk::Box, window: &adw::ApplicationW
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| { bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
content_stack.set_visible_child_name("install_page") content_stack.set_visible_child_name("install_page")
})); }));
bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack, @weak partitioning_main_box => move |_| { bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack, @weak partitioning_main_box, @weak bottom_next_button => move |_| {
content_stack.set_visible_child_name("keyboard_page"); content_stack.set_visible_child_name("keyboard_page");
partitioning_stack.set_visible_child_name("partition_method_select_page"); partitioning_stack.set_visible_child_name("partition_method_select_page");
bottom_next_button.set_sensitive(false);
})); }));
bottom_next_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack, @weak install_main_box => move |_| { bottom_next_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack, @weak install_main_box, @weak window, @weak done_main_box => move |_| {
if Path::new("/tmp/pika-installer-gtk4-target-auto.txt").exists() { if Path::new("/tmp/pika-installer-gtk4-target-auto.txt").exists() {
fs::remove_file("/tmp/pika-installer-gtk4-target-auto.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-auto.txt"); fs::remove_file("/tmp/pika-installer-gtk4-target-auto.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-auto.txt");
} }
@ -999,7 +1000,7 @@ pub fn partitioning_page(install_main_box: &gtk::Box, window: &adw::ApplicationW
} else { } else {
fs::write("/tmp/pika-installer-gtk4-target-automatic-luks.txt", automatic_luks_result); fs::write("/tmp/pika-installer-gtk4-target-automatic-luks.txt", automatic_luks_result);
} }
install_page(&install_main_box, &content_stack); install_page(&done_main_box, &install_main_box, &content_stack, &window);
content_stack.set_visible_child_name("install_page"); content_stack.set_visible_child_name("install_page");
} else { } else {
fs::write("/tmp/pika-installer-gtk4-target-manual.txt", partition_method_manual_target_buffer_clone.text(&partition_method_manual_target_buffer_clone.bounds().0, &partition_method_manual_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file"); fs::write("/tmp/pika-installer-gtk4-target-manual.txt", partition_method_manual_target_buffer_clone.text(&partition_method_manual_target_buffer_clone.bounds().0, &partition_method_manual_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
@ -1010,7 +1011,7 @@ pub fn partitioning_page(install_main_box: &gtk::Box, window: &adw::ApplicationW
} else { } else {
fs::write("/tmp/pika-installer-gtk4-target-manual-luks.txt", manual_luks_result); fs::write("/tmp/pika-installer-gtk4-target-manual-luks.txt", manual_luks_result);
} }
install_page(&install_main_box, &content_stack); install_page(&done_main_box, &install_main_box, &content_stack, &window);
content_stack.set_visible_child_name("install_page"); content_stack.set_visible_child_name("install_page");
} }
})); }));