diff --git a/data/icons/run-debug-symbolic.svg b/data/icons/run-debug-symbolic.svg new file mode 100644 index 0000000..b0d1ccb --- /dev/null +++ b/data/icons/run-debug-symbolic.svg @@ -0,0 +1,290 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/resources.gresource.xml b/data/resources.gresource.xml index 040f799..8354989 100644 --- a/data/resources.gresource.xml +++ b/data/resources.gresource.xml @@ -1,9 +1,19 @@ - + style.css + - icons/org.gabmus.envision.svg - icons/org.gabmus.envision-symbolic.svg + + icons/org.gabmus.envision.svg + icons/org.gabmus.envision.Devel.svg + + + + icons/org.gabmus.envision-symbolic.svg + + + + icons/run-debug-symbolic.svg diff --git a/src/ui/app.rs b/src/ui/app.rs index b7a24cb..6c635e4 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -45,7 +45,7 @@ use crate::profiles::wivrn::wivrn_profile; use crate::profiles::wmr::wmr_profile; use crate::stateless_action; use crate::ui::build_window::{BuildWindowMsg, BuildWindowOutMsg}; -use crate::ui::debug_view::DebugViewInit; +use crate::ui::debug_view::{DebugViewInit, DebugViewOutMsg}; use crate::ui::libsurvive_setup_window::LibsurviveSetupMsg; use crate::ui::main_view::{MainView, MainViewInit, MainViewOutMsg}; use crate::xr_devices::XRDevice; @@ -765,7 +765,6 @@ impl SimpleComponent for App { }) .forward(sender.input_sender(), |message| match message { MainViewOutMsg::DoStartStopXRService => Msg::DoStartStopXRService, - MainViewOutMsg::StartWithDebug => Msg::StartWithDebug, MainViewOutMsg::RestartXRService => Msg::RestartXRService, MainViewOutMsg::ProfileSelected(uuid) => Msg::ProfileSelected(uuid), MainViewOutMsg::DeleteProfile => Msg::DeleteProfile, @@ -776,7 +775,7 @@ impl SimpleComponent for App { debug_view: DebugView::builder().launch(DebugViewInit {}).forward( sender.input_sender(), |message| match message { - _ => Msg::ClockTicking, + DebugViewOutMsg::StartWithDebug => Msg::StartWithDebug, }, ), about_dialog: AboutDialog::builder() diff --git a/src/ui/debug_view.rs b/src/ui/debug_view.rs index ca925d8..1b49c97 100644 --- a/src/ui/debug_view.rs +++ b/src/ui/debug_view.rs @@ -26,6 +26,11 @@ pub enum DebugViewMsg { SetColorScheme, } +#[derive(Debug)] +pub enum DebugViewOutMsg { + StartWithDebug, +} + #[tracker::track] pub struct DebugView { xrservice_active: bool, @@ -47,7 +52,7 @@ pub struct DebugViewInit {} impl SimpleComponent for DebugView { type Init = DebugViewInit; type Input = DebugViewMsg; - type Output = (); + type Output = DebugViewOutMsg; menu! { debug_menu: { @@ -76,6 +81,16 @@ impl SimpleComponent for DebugView { set_tooltip_text: Some("Filter Log"), }, pack_start: &log_level_dropdown, + pack_start: run_debug_btn = >k::Button { + set_icon_name: "run-debug-symbolic", + set_tooltip_text: Some("Start with gdbserver"), + connect_clicked[sender] => move |_| { + sender.output(Self::Output::StartWithDebug) + .expect("Sender output failed"); + }, + #[track = "model.changed(Self::xrservice_active())"] + set_sensitive: !model.xrservice_active + }, }, add_top_bar: searchbar = >k::SearchBar { set_margin_start: 1, diff --git a/src/ui/main_view.rs b/src/ui/main_view.rs index 28be410..20d2466 100644 --- a/src/ui/main_view.rs +++ b/src/ui/main_view.rs @@ -58,7 +58,6 @@ pub struct MainView { pub enum MainViewMsg { ClockTicking, StartStopClicked, - StartWithDebug, RestartXRService, XRServiceActiveChanged(bool, Option), EnableDebugViewChanged(bool), @@ -77,7 +76,6 @@ pub enum MainViewMsg { #[derive(Debug)] pub enum MainViewOutMsg { DoStartStopXRService, - StartWithDebug, RestartXRService, ProfileSelected(Profile), DeleteProfile, @@ -175,14 +173,6 @@ impl SimpleComponent for MainView { sender.input(MainViewMsg::StartStopClicked); }, }, - gtk::Button { - set_label: "Start with gdbserver", - #[track = "model.changed(Self::xrservice_active()) || model.changed(Self::enable_debug_view())"] - set_visible: model.enable_debug_view && !model.xrservice_active, - connect_clicked[sender] => move |_| { - sender.input(MainViewMsg::StartWithDebug); - }, - }, gtk::Button { set_halign: gtk::Align::Center, set_valign: gtk::Align::Center, @@ -502,11 +492,6 @@ impl SimpleComponent for MainView { .output(Self::Output::DoStartStopXRService) .expect("Sender output failed"); } - Self::Input::StartWithDebug => { - sender - .output(Self::Output::StartWithDebug) - .expect("Sender output failed"); - } Self::Input::RestartXRService => { sender .output(Self::Output::RestartXRService)