mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-09 09:38:54 +00:00
feat: cancel build button
This commit is contained in:
parent
d2f7ec8cb8
commit
a4d6ef75fa
2 changed files with 32 additions and 5 deletions
|
@ -37,7 +37,7 @@ use crate::profiles::lighthouse::lighthouse_profile;
|
||||||
use crate::profiles::system_valve_index::system_valve_index_profile;
|
use crate::profiles::system_valve_index::system_valve_index_profile;
|
||||||
use crate::profiles::valve_index::valve_index_profile;
|
use crate::profiles::valve_index::valve_index_profile;
|
||||||
use crate::profiles::wivrn::wivrn_profile;
|
use crate::profiles::wivrn::wivrn_profile;
|
||||||
use crate::ui::build_window::BuildWindowMsg;
|
use crate::ui::build_window::{BuildWindowMsg, BuildWindowOutMsg};
|
||||||
use crate::ui::debug_view::DebugViewInit;
|
use crate::ui::debug_view::DebugViewInit;
|
||||||
use crate::ui::libsurvive_setup_window::LibsurviveSetupMsg;
|
use crate::ui::libsurvive_setup_window::LibsurviveSetupMsg;
|
||||||
use crate::ui::main_view::{MainView, MainViewInit, MainViewOutMsg};
|
use crate::ui::main_view::{MainView, MainViewInit, MainViewOutMsg};
|
||||||
|
@ -102,6 +102,7 @@ pub enum Msg {
|
||||||
OnBuildExit(i32),
|
OnBuildExit(i32),
|
||||||
ClockTicking,
|
ClockTicking,
|
||||||
BuildProfile(bool),
|
BuildProfile(bool),
|
||||||
|
CancelBuild,
|
||||||
EnableDebugViewChanged(bool),
|
EnableDebugViewChanged(bool),
|
||||||
DoStartStopXRService,
|
DoStartStopXRService,
|
||||||
RestartXRService,
|
RestartXRService,
|
||||||
|
@ -460,6 +461,11 @@ impl SimpleComponent for App {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Msg::CancelBuild => {
|
||||||
|
if let Some(w) = self.build_worker.as_ref() {
|
||||||
|
w.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
Msg::DeleteProfile => {
|
Msg::DeleteProfile => {
|
||||||
let todel = self.get_selected_profile();
|
let todel = self.get_selected_profile();
|
||||||
if todel.editable {
|
if todel.editable {
|
||||||
|
@ -617,7 +623,9 @@ impl SimpleComponent for App {
|
||||||
build_window: BuildWindow::builder()
|
build_window: BuildWindow::builder()
|
||||||
.transient_for(root)
|
.transient_for(root)
|
||||||
.launch(())
|
.launch(())
|
||||||
.detach(),
|
.forward(sender.input_sender(), |msg| match msg {
|
||||||
|
BuildWindowOutMsg::CancelBuild => Msg::CancelBuild,
|
||||||
|
}),
|
||||||
libsurvive_setup_window: LibsurviveSetupWindow::builder()
|
libsurvive_setup_window: LibsurviveSetupWindow::builder()
|
||||||
.transient_for(root)
|
.transient_for(root)
|
||||||
.launch(())
|
.launch(())
|
||||||
|
|
|
@ -36,11 +36,16 @@ pub enum BuildWindowMsg {
|
||||||
UpdateCanClose(bool),
|
UpdateCanClose(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum BuildWindowOutMsg {
|
||||||
|
CancelBuild,
|
||||||
|
}
|
||||||
|
|
||||||
#[relm4::component(pub)]
|
#[relm4::component(pub)]
|
||||||
impl SimpleComponent for BuildWindow {
|
impl SimpleComponent for BuildWindow {
|
||||||
type Init = ();
|
type Init = ();
|
||||||
type Input = BuildWindowMsg;
|
type Input = BuildWindowMsg;
|
||||||
type Output = ();
|
type Output = BuildWindowOutMsg;
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
#[name(win)]
|
#[name(win)]
|
||||||
|
@ -87,7 +92,21 @@ impl SimpleComponent for BuildWindow {
|
||||||
set_wrap: true,
|
set_wrap: true,
|
||||||
set_wrap_mode: gtk::pango::WrapMode::Word,
|
set_wrap_mode: gtk::pango::WrapMode::Word,
|
||||||
set_justify: gtk::Justification::Center,
|
set_justify: gtk::Justification::Center,
|
||||||
}
|
},
|
||||||
|
gtk::Button {
|
||||||
|
#[track = "model.changed(BuildWindow::build_status())"]
|
||||||
|
set_visible: match &model.build_status {
|
||||||
|
BuildStatus::Building => true,
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
|
add_css_class: "destructive-action",
|
||||||
|
add_css_class: "circular",
|
||||||
|
set_icon_name: "window-close-symbolic",
|
||||||
|
set_tooltip_text: Some("Cancel build"),
|
||||||
|
connect_clicked[sender] => move |_| {
|
||||||
|
sender.output(Self::Output::CancelBuild);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
#[name(scrolledwin)]
|
#[name(scrolledwin)]
|
||||||
gtk::ScrolledWindow {
|
gtk::ScrolledWindow {
|
||||||
|
@ -174,7 +193,7 @@ impl SimpleComponent for BuildWindow {
|
||||||
fn init(
|
fn init(
|
||||||
_init: Self::Init,
|
_init: Self::Init,
|
||||||
root: &Self::Root,
|
root: &Self::Root,
|
||||||
_sender: ComponentSender<Self>,
|
sender: ComponentSender<Self>,
|
||||||
) -> ComponentParts<Self> {
|
) -> ComponentParts<Self> {
|
||||||
let mut model = Self {
|
let mut model = Self {
|
||||||
tracker: 0,
|
tracker: 0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue