feat: warn the user if lighthouse driver is selected and chapinfo is not found

This commit is contained in:
Gabriele Musco 2023-08-12 09:28:06 +00:00
commit 9f3288011e
3 changed files with 56 additions and 1 deletions

View file

@ -34,6 +34,7 @@ pub mod ui;
pub mod xr_devices;
pub mod build_tools;
pub mod checkerr;
pub mod steamvr_utils;
fn restore_steam_xr_files() {
let active_runtime = get_current_active_runtime();

11
src/steamvr_utils.rs Normal file
View file

@ -0,0 +1,11 @@
use crate::paths::get_home_dir;
use std::path::Path;
pub fn chaperone_info_exists() -> bool {
let path_s = format!(
"{}/.steam/steam/config/chaperone_info.vrchap",
get_home_dir()
);
let path = Path::new(&path_s);
path.is_file()
}

View file

@ -6,7 +6,8 @@ use super::steam_launch_options_box::{SteamLaunchOptionsBox, SteamLaunchOptionsB
use crate::config::Config;
use crate::constants::APP_NAME;
use crate::file_utils::mount_has_nosuid;
use crate::profile::{Profile, LighthouseDriver};
use crate::profile::{LighthouseDriver, Profile};
use crate::steamvr_utils::chaperone_info_exists;
use crate::ui::app::{
AboutAction, BuildProfileAction, BuildProfileCleanAction, DebugViewToggleAction,
};
@ -235,6 +236,48 @@ impl SimpleComponent for MainView {
set_wrap_mode: gtk::pango::WrapMode::Word,
}
},
gtk::Box {
set_orientation: gtk::Orientation::Vertical,
set_hexpand: true,
set_vexpand: false,
set_spacing: 12,
set_margin_top: 12,
set_margin_bottom: 12,
#[track = "model.changed(Self::selected_profile())"]
set_visible: model.selected_profile.lighthouse_driver == LighthouseDriver::SteamVR && !chaperone_info_exists(),
gtk::Separator {
set_orientation: gtk::Orientation::Horizontal,
set_hexpand: true,
},
gtk::Box {
set_orientation: gtk::Orientation::Horizontal,
set_margin_start: 12,
set_margin_end: 12,
set_spacing: 12,
set_hexpand: true,
gtk::Image {
set_icon_name: Some("dialog-warning-symbolic"),
add_css_class: "warning",
},
gtk::Label {
add_css_class: "warning",
add_css_class: "heading",
set_label: "Warning"
}
},
gtk::Label {
set_label: concat!(
"SteamVR room configuration not found.\n",
"To use the SteamVR lighthouse driver, you ",
"will need to run SteamVR and perform the room setup.",
),
set_margin_start: 12,
set_margin_end: 12,
add_css_class: "warning",
set_wrap: true,
set_wrap_mode: gtk::pango::WrapMode::Word,
}
},
model.steam_launch_options_box.widget(),
model.install_wivrn_box.widget(),
gtk::Box {