We got VTE BOYS

This commit is contained in:
Ward from fusion-voyager-3 2024-01-20 22:01:20 +03:00
parent 25565f7542
commit e8780ae35b
6 changed files with 278 additions and 4 deletions

128
Cargo.lock generated
View File

@ -27,7 +27,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi 0.1.19",
"libc", "libc",
"winapi", "winapi",
] ]
@ -38,6 +38,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.4.1" version = "2.4.1"
@ -50,7 +56,7 @@ version = "0.18.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2"
dependencies = [ dependencies = [
"bitflags", "bitflags 2.4.1",
"cairo-sys-rs", "cairo-sys-rs",
"glib", "glib",
"libc", "libc",
@ -314,7 +320,7 @@ version = "0.18.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5"
dependencies = [ dependencies = [
"bitflags", "bitflags 2.4.1",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-executor", "futures-executor",
@ -495,6 +501,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.1.0" version = "2.1.0"
@ -505,6 +517,17 @@ dependencies = [
"hashbrown", "hashbrown",
] ]
[[package]]
name = "io-lifetimes"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
"hermit-abi 0.3.4",
"libc",
"windows-sys",
]
[[package]] [[package]]
name = "libadwaita" name = "libadwaita"
version = "0.5.3" version = "0.5.3"
@ -606,6 +629,7 @@ dependencies = [
"libadwaita", "libadwaita",
"pretty-bytes", "pretty-bytes",
"time", "time",
"zoha-vte4",
] ]
[[package]] [[package]]
@ -933,6 +957,72 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.5.34" version = "0.5.34"
@ -941,3 +1031,35 @@ checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "zoha-vte4"
version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e09b58dbfab3b62c5544cafadc504db3b7d12f21ac6e55048489dbf90c979caf"
dependencies = [
"bitflags 1.3.2",
"gdk4",
"gio",
"glib",
"gtk4",
"io-lifetimes",
"libc",
"pango",
"zoha-vte4-sys",
]
[[package]]
name = "zoha-vte4-sys"
version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "749df284a2c2e68c2c359762b277854d533a4d50c7a216a3adf45cd5e5ee2993"
dependencies = [
"gdk4-sys",
"gio-sys",
"glib",
"gtk4-sys",
"libc",
"pango-sys",
"system-deps",
]

View File

@ -13,3 +13,4 @@ glib = "0.18.5"
gtk = { version = "0.7.3", package = "gtk4", features = ["v4_12"] } gtk = { version = "0.7.3", package = "gtk4", features = ["v4_12"] }
pretty-bytes = "0.2.2" pretty-bytes = "0.2.2"
time = "0.3.31" time = "0.3.31"
vte = { version = "0.0.2", package = "zoha-vte4", features = ["v0_72"] }

View File

@ -16,6 +16,7 @@ use crate::eula_page;
use crate::timezone_page; use crate::timezone_page;
use crate::keyboard_page; use crate::keyboard_page;
use crate::partitioning_page; use crate::partitioning_page;
use crate::install_page;
use std::path::Path; use std::path::Path;
@ -120,6 +121,9 @@ pub fn build_ui(app: &adw::Application) {
// Add partitioning_page.rs as a page for content_stack // Add partitioning_page.rs as a page for content_stack
partitioning_page(&window, &content_stack); partitioning_page(&window, &content_stack);
// Add install_page.rs as a page for content_stack
install_page(&content_stack);
// glib maximization // glib maximization
if glib_settings.boolean("is-maximized") == true { if glib_settings.boolean("is-maximized") == true {
window.maximize() window.maximize()

145
src/install_page.rs Normal file
View File

@ -0,0 +1,145 @@
// 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 vte::prelude::*;
use vte::*;
pub fn install_page(content_stack: &gtk::Stack) {
let install_main_box = gtk::Box::builder()
.orientation(Orientation::Vertical)
.build();
let install_nested_stack = gtk::Stack::builder()
.transition_type(StackTransitionType::SlideLeftRight)
.build();
let install_confirm_box = gtk::Box::builder()
.orientation(Orientation::Vertical)
.build();
// the header box for the install page
let install_confirm_header_box = gtk::Box::builder()
.orientation(Orientation::Horizontal)
.build();
// the header text for the install page
let install_confirm_header_text = gtk::Label::builder()
.label("Sit back, Relax, and watch the show.")
.halign(gtk::Align::End)
.hexpand(true)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(5)
.build();
install_confirm_header_text.add_css_class("header_sized_text");
// the header icon for the install icon
let install_confirm_header_icon = gtk::Spinner::builder()
.halign(gtk::Align::Start)
.hexpand(true)
.margin_top(15)
.margin_bottom(15)
.margin_start(0)
.margin_end(15)
.build();
install_confirm_header_icon.start();
// make install selection box for choosing installation or live media
let install_confirm_selection_box = gtk::Box::builder()
.orientation(Orientation::Vertical)
.build();
let install_confirm_button = gtk::Button::builder()
.label("Confirm & Install PikaOS")
.vexpand(true)
.hexpand(true)
.halign(gtk::Align::Center)
.valign(gtk::Align::Start)
.build();
install_confirm_button.add_css_class("destructive-action");
// / install_confirm_header_box appends
//// Add the install page header text and icon
install_confirm_header_box.append(&install_confirm_header_text);
install_confirm_header_box.append(&install_confirm_header_icon);
// / install_confirm_box appends
//// Add the install header to install main box
install_confirm_box.append(&install_confirm_header_box);
//// Add the install selection/page content box to install main box
install_confirm_box.append(&install_confirm_selection_box);
// Start Appending widgets to boxes
// / install_confirm_selection_box appends
//// add live and install media button to install page selections
install_confirm_selection_box.append(&install_confirm_button);
// / install_confirm_header_box appends
//// Add the install page header text and icon
install_confirm_header_box.append(&install_confirm_header_text);
install_confirm_header_box.append(&install_confirm_header_icon);
// / install_confirm_box appends
//// Add the install header to install main box
install_confirm_box.append(&install_confirm_header_box);
//// Add the install selection/page content box to install main box
install_confirm_box.append(&install_confirm_selection_box);
install_main_box.append(&install_nested_stack);
///
let install_progress_box = gtk::Box::builder()
.orientation(Orientation::Vertical)
.build();
let the_terminal = vte::Terminal::builder()
.vexpand(true)
.hexpand(true)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.sensitive(false)
.build();
the_terminal.spawn_async(
PtyFlags::DEFAULT,
Some(""),
&["bash"],
&[],
SpawnFlags::DEFAULT,
|| {},
10,
None::<&gio::Cancellable>,
move |result| {
match result {
Ok(pid) => { eprintln!("could not spawn terminal:") }
Err(err) => {
eprintln!("could not spawn terminal: {}", err);
}
}
},
);
install_progress_box.append(&the_terminal);
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");
// / Content stack appends
//// Add the install_main_box as page: install_page, Give it nice title
content_stack.add_titled(&install_main_box, Some("install_page"), "Welcome");
install_confirm_button.connect_clicked(clone!(@weak install_nested_stack => move |_| install_nested_stack.set_visible_child_name("progress_page")));
}

View File

@ -19,6 +19,7 @@ mod eula_page;
mod timezone_page; mod timezone_page;
mod keyboard_page; mod keyboard_page;
mod partitioning_page; mod partitioning_page;
mod install_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;
@ -27,6 +28,7 @@ use crate::eula_page::eula_page;
use crate::timezone_page::timezone_page; 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;
/// main function /// main function
fn main() { fn main() {

View File

@ -938,7 +938,7 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::S
manual_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_manual_page"))); manual_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_manual_page")));
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("installation_page") content_stack.set_visible_child_name("install_page")
})); }));
bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack => move |_| { bottom_back_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack => move |_| {
content_stack.set_visible_child_name("keyboard_page"); content_stack.set_visible_child_name("keyboard_page");