mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 19:44:50 +00:00
feat: debug actions to open data folder and current prefix in file manager
This commit is contained in:
parent
e212c449cf
commit
f2011e74e1
3 changed files with 50 additions and 2 deletions
|
@ -8,6 +8,7 @@ use super::job_worker::job::WorkerJob;
|
|||
use super::job_worker::JobWorker;
|
||||
use super::libsurvive_setup_window::LibsurviveSetupWindow;
|
||||
use super::main_view::MainViewMsg;
|
||||
use super::util::open_with_default_handler;
|
||||
use crate::builders::build_basalt::get_build_basalt_jobs;
|
||||
use crate::builders::build_libsurvive::get_build_libsurvive_jobs;
|
||||
use crate::builders::build_mercury::get_build_mercury_job;
|
||||
|
@ -34,7 +35,7 @@ use crate::file_builders::openvrpaths_vrpath::{
|
|||
use crate::file_utils::setcap_cap_sys_nice_eip;
|
||||
use crate::linux_distro::get_distro;
|
||||
use crate::log_parser::MonadoLog;
|
||||
use crate::paths::get_ipc_file_path;
|
||||
use crate::paths::{get_data_dir, get_ipc_file_path};
|
||||
use crate::profile::{Profile, XRServiceType};
|
||||
use crate::profiles::lighthouse::lighthouse_profile;
|
||||
use crate::profiles::openhmd::openhmd_profile;
|
||||
|
@ -124,6 +125,8 @@ pub enum Msg {
|
|||
Quit,
|
||||
ParseLog(Vec<String>),
|
||||
ConfigFbt,
|
||||
DebugOpenPrefix,
|
||||
DebugOpenData,
|
||||
}
|
||||
|
||||
impl App {
|
||||
|
@ -619,6 +622,15 @@ impl SimpleComponent for App {
|
|||
));
|
||||
self.application.quit();
|
||||
}
|
||||
Msg::DebugOpenData => {
|
||||
open_with_default_handler(&format!("file://{}", get_data_dir()));
|
||||
}
|
||||
Msg::DebugOpenPrefix => {
|
||||
open_with_default_handler(&format!(
|
||||
"file://{}",
|
||||
self.get_selected_profile().prefix
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -754,6 +766,18 @@ impl SimpleComponent for App {
|
|||
sender.input(Msg::Quit);
|
||||
});
|
||||
}
|
||||
{
|
||||
withclones![sender];
|
||||
stateless_action!(actions, DebugOpenDataAction, {
|
||||
sender.input(Msg::DebugOpenData);
|
||||
});
|
||||
}
|
||||
{
|
||||
withclones![sender];
|
||||
stateless_action!(actions, DebugOpenPrefixAction, {
|
||||
sender.input(Msg::DebugOpenPrefix);
|
||||
});
|
||||
}
|
||||
{
|
||||
withclones![sender];
|
||||
actions.add_action(RelmAction::<DebugViewToggleAction>::new_stateful(
|
||||
|
@ -803,3 +827,6 @@ new_stateless_action!(pub BuildProfileCleanDebugAction, AppActionGroup, "buildpr
|
|||
new_stateless_action!(pub ConfigFbtAction, AppActionGroup, "configfbt");
|
||||
new_stateless_action!(pub QuitAction, AppActionGroup, "quit");
|
||||
new_stateful_action!(pub DebugViewToggleAction, AppActionGroup, "debugviewtoggle", (), bool);
|
||||
|
||||
new_stateless_action!(pub DebugOpenDataAction, AppActionGroup, "debugopendata");
|
||||
new_stateless_action!(pub DebugOpenPrefixAction, AppActionGroup, "debugopenprefix");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::log_level::LogLevel;
|
||||
use crate::log_parser::MonadoLog;
|
||||
use crate::ui::app::{DebugOpenDataAction, DebugOpenPrefixAction};
|
||||
use crate::withclones;
|
||||
use gtk::prelude::*;
|
||||
use relm4::prelude::*;
|
||||
|
@ -57,6 +58,15 @@ impl SimpleComponent for DebugView {
|
|||
type Input = DebugViewMsg;
|
||||
type Output = ();
|
||||
|
||||
menu! {
|
||||
debug_menu: {
|
||||
section! {
|
||||
"Open Envision _Data Folder" => DebugOpenDataAction,
|
||||
"Open _Prefix Folder" => DebugOpenPrefixAction,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
view! {
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
|
@ -66,6 +76,11 @@ impl SimpleComponent for DebugView {
|
|||
set_hexpand: true,
|
||||
set_vexpand: false,
|
||||
add_css_class: "flat",
|
||||
pack_end: debug_menu_btn = >k::MenuButton {
|
||||
set_icon_name: "view-more-symbolic",
|
||||
set_tooltip_text: Some("Debug Actions..."),
|
||||
set_menu_model: Some(&debug_menu),
|
||||
},
|
||||
pack_end: search_toggle = >k::ToggleButton {
|
||||
set_icon_name: "edit-find-symbolic",
|
||||
set_tooltip_text: Some("Filter Log"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use gtk4::prelude::*;
|
||||
use gtk4::{gio, prelude::*};
|
||||
|
||||
pub fn limit_dropdown_width(dd: >k4::DropDown, chars: i32) {
|
||||
let mut dd_child = dd
|
||||
|
@ -44,3 +44,9 @@ pub fn warning_heading() -> gtk4::Box {
|
|||
|
||||
b
|
||||
}
|
||||
|
||||
pub fn open_with_default_handler(uri: &str) {
|
||||
if let Err(e) = gio::AppInfo::launch_default_for_uri(uri, gio::AppLaunchContext::NONE) {
|
||||
eprintln!("Error opening uri {}: {}", uri, e)
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue