feat: stub stardust section in main view

This commit is contained in:
Gabriele Musco 2023-12-06 17:38:28 +00:00
commit ece8da4210
4 changed files with 277 additions and 214 deletions

View file

@ -2,9 +2,9 @@ use super::alert::alert;
use super::devices_box::{DevicesBox, DevicesBoxMsg}; use super::devices_box::{DevicesBox, DevicesBoxMsg};
use super::install_wivrn_box::{InstallWivrnBox, InstallWivrnBoxInit, InstallWivrnBoxMsg}; use super::install_wivrn_box::{InstallWivrnBox, InstallWivrnBoxInit, InstallWivrnBoxMsg};
use super::profile_editor::{ProfileEditor, ProfileEditorMsg, ProfileEditorOutMsg}; use super::profile_editor::{ProfileEditor, ProfileEditorMsg, ProfileEditorOutMsg};
use super::stardust::stardust_view::StardustView;
use super::steam_launch_options_box::{SteamLaunchOptionsBox, SteamLaunchOptionsBoxMsg}; use super::steam_launch_options_box::{SteamLaunchOptionsBox, SteamLaunchOptionsBoxMsg};
use crate::config::Config; use crate::config::Config;
use crate::constants::APP_NAME;
use crate::file_utils::mount_has_nosuid; use crate::file_utils::mount_has_nosuid;
use crate::gpu_profile::{ use crate::gpu_profile::{
get_amd_gpu_power_profile, get_first_amd_gpu, get_set_amd_vr_pow_prof_cmd, GpuPowerProfile, get_amd_gpu_power_profile, get_first_amd_gpu, get_set_amd_vr_pow_prof_cmd, GpuPowerProfile,
@ -48,6 +48,8 @@ pub struct MainView {
profile_editor: Option<Controller<ProfileEditor>>, profile_editor: Option<Controller<ProfileEditor>>,
#[tracker::do_not_track] #[tracker::do_not_track]
root_win: gtk::Window, root_win: gtk::Window,
#[tracker::do_not_track]
stardust_view: Controller<StardustView>
} }
#[derive(Debug)] #[derive(Debug)]
@ -146,7 +148,8 @@ impl SimpleComponent for MainView {
}, },
}, },
#[wrap(Some)] #[wrap(Some)]
set_content: content = &gtk::ScrolledWindow { set_content: section_stack = &adw::ViewStack {
add: main_page = &gtk::ScrolledWindow {
set_hscrollbar_policy: gtk::PolicyType::Never, set_hscrollbar_policy: gtk::PolicyType::Never,
set_hexpand: true, set_hexpand: true,
set_vexpand: true, set_vexpand: true,
@ -374,6 +377,12 @@ impl SimpleComponent for MainView {
}, },
} }
} }
} -> {
set_name: Some("main_view"),
set_title: Some("XR"),
set_icon_name: Some("org.gabmus.envision-symbolic"),
},
add_titled_with_icon: (model.stardust_view.widget(), Some("stardust_view"), "Stardust", "starred-symbolic"),
}, },
add_bottom_bar: bottom_bar = &gtk::Box { add_bottom_bar: bottom_bar = &gtk::Box {
set_orientation: gtk::Orientation::Horizontal, set_orientation: gtk::Orientation::Horizontal,
@ -435,6 +444,10 @@ impl SimpleComponent for MainView {
}, },
}, },
}, },
},
add_bottom_bar: section_switcher = &adw::ViewSwitcherBar {
set_reveal: true,
set_stack: Some(&section_stack),
} }
} }
} }
@ -648,6 +661,7 @@ impl SimpleComponent for MainView {
profile_delete_confirm_dialog, profile_delete_confirm_dialog,
root_win: init.root_win.clone(), root_win: init.root_win.clone(),
profile_editor: None, profile_editor: None,
stardust_view: StardustView::builder().launch(()).detach(),
tracker: 0, tracker: 0,
}; };
let widgets = view_output!(); let widgets = view_output!();

View file

@ -17,3 +17,4 @@ pub mod profile_editor;
pub mod steam_launch_options_box; pub mod steam_launch_options_box;
pub mod util; pub mod util;
pub mod wivrn_conf_editor; pub mod wivrn_conf_editor;
pub mod stardust;

1
src/ui/stardust/mod.rs Normal file
View file

@ -0,0 +1 @@
pub mod stardust_view;

View file

@ -0,0 +1,47 @@
use relm4::prelude::*;
use gtk::prelude::*;
#[derive(Debug)]
pub enum StardustViewMsg {}
#[derive(Debug)]
pub enum StardustViewOutMsg {}
#[tracker::track]
pub struct StardustView {}
#[relm4::component(pub)]
impl SimpleComponent for StardustView {
type Init = ();
type Input = StardustViewMsg;
type Output = StardustViewOutMsg;
view! {
gtk::Box {
set_orientation: gtk::Orientation::Vertical,
gtk::Label {
set_label: "Stardust",
},
}
}
fn update(&mut self, message: Self::Input, sender: ComponentSender<Self>) {
self.reset();
match message {}
}
fn init(
init: Self::Init,
root: &Self::Root,
sender: ComponentSender<Self>,
) -> ComponentParts<Self> {
let model = Self {
tracker: 0,
};
let widgets = view_output!();
ComponentParts { model, widgets }
}
}