mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-03 06:38:52 +00:00
feat: revealer for steamvr calibration card
This commit is contained in:
parent
2d76fc3d16
commit
10af1ee05f
1 changed files with 52 additions and 18 deletions
|
@ -5,6 +5,7 @@ use super::job_worker::{
|
||||||
};
|
};
|
||||||
use crate::paths::get_steamvr_bin_dir_path;
|
use crate::paths::get_steamvr_bin_dir_path;
|
||||||
use relm4::{
|
use relm4::{
|
||||||
|
binding::{Binding, ConnectBinding, StringBinding},
|
||||||
gtk::{self, prelude::*},
|
gtk::{self, prelude::*},
|
||||||
ComponentParts, ComponentSender, RelmWidgetExt, SimpleComponent,
|
ComponentParts, ComponentSender, RelmWidgetExt, SimpleComponent,
|
||||||
};
|
};
|
||||||
|
@ -58,27 +59,50 @@ impl SimpleComponent for SteamVrCalibrationBox {
|
||||||
add_css_class: "heading",
|
add_css_class: "heading",
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_xalign: 0.0,
|
set_xalign: 0.0,
|
||||||
set_label: "SteamVR Calibration",
|
set_label: "SteamVR Quick Calibration",
|
||||||
set_wrap: true,
|
set_wrap: true,
|
||||||
set_wrap_mode: gtk::pango::WrapMode::Word,
|
set_wrap_mode: gtk::pango::WrapMode::Word,
|
||||||
},
|
},
|
||||||
gtk::Label {
|
gtk::Button {
|
||||||
add_css_class: "dim-label",
|
add_css_class: "flat",
|
||||||
set_hexpand: true,
|
gtk::Box {
|
||||||
set_label: concat!(
|
set_orientation: gtk::Orientation::Horizontal,
|
||||||
"Run a quick SteamVR calibration.\n\n",
|
set_hexpand: true,
|
||||||
" \u{2022} Plug in your HMD and place it on the floor, ",
|
set_vexpand: false,
|
||||||
"approximately in the middle of your play area\n",
|
set_spacing: 6,
|
||||||
" \u{2022} Make sure your controllers and other VR devices ",
|
set_halign: gtk::Align::Start,
|
||||||
"are turned off\n",
|
#[name(revealer_icon)]
|
||||||
" \u{2022} Click the Calibrate button and wait for the ",
|
gtk::Image {
|
||||||
"process to finish\n\n",
|
set_icon_name: Some("pan-end-symbolic"),
|
||||||
"Note that the orientation of your HMD during this process ",
|
},
|
||||||
"will dictate the forward direction of your play area.",
|
gtk::Label {
|
||||||
),
|
set_label: "Details"
|
||||||
set_xalign: 0.0,
|
}
|
||||||
set_wrap: true,
|
},
|
||||||
set_wrap_mode: gtk::pango::WrapMode::Word,
|
connect_clicked[revealer] => move |_| {
|
||||||
|
revealer.set_reveal_child(!revealer.reveals_child())
|
||||||
|
},
|
||||||
|
},
|
||||||
|
#[name(revealer)]
|
||||||
|
gtk::Revealer {
|
||||||
|
gtk::Label {
|
||||||
|
add_css_class: "dim-label",
|
||||||
|
set_hexpand: true,
|
||||||
|
set_label: concat!(
|
||||||
|
"Run a quick SteamVR calibration.\n\n",
|
||||||
|
" \u{2022} Plug in your HMD and place it on the floor, ",
|
||||||
|
"approximately in the middle of your play area\n",
|
||||||
|
" \u{2022} Make sure your controllers and other VR devices ",
|
||||||
|
"are turned off\n",
|
||||||
|
" \u{2022} Click the Calibrate button and wait for the ",
|
||||||
|
"process to finish\n\n",
|
||||||
|
"Note that the orientation of your HMD during this process ",
|
||||||
|
"will dictate the forward direction of your play area.",
|
||||||
|
),
|
||||||
|
set_xalign: 0.0,
|
||||||
|
set_wrap: true,
|
||||||
|
set_wrap_mode: gtk::pango::WrapMode::Word,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
gtk::Label {
|
gtk::Label {
|
||||||
add_css_class: "error",
|
add_css_class: "error",
|
||||||
|
@ -203,6 +227,16 @@ impl SimpleComponent for SteamVrCalibrationBox {
|
||||||
|
|
||||||
let widgets = view_output!();
|
let widgets = view_output!();
|
||||||
|
|
||||||
|
let _ = &widgets
|
||||||
|
.revealer
|
||||||
|
.bind_property("reveal-child", &widgets.revealer_icon, "icon-name")
|
||||||
|
.transform_to(|_, reveal_child| match reveal_child {
|
||||||
|
true => Some("pan-down-symbolic"),
|
||||||
|
false => Some("pan-end-symbolic"),
|
||||||
|
})
|
||||||
|
.sync_create()
|
||||||
|
.build();
|
||||||
|
|
||||||
ComponentParts { model, widgets }
|
ComponentParts { model, widgets }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue