mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-08 09:08:47 +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::valve_index::valve_index_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::libsurvive_setup_window::LibsurviveSetupMsg;
|
||||
use crate::ui::main_view::{MainView, MainViewInit, MainViewOutMsg};
|
||||
|
@ -102,6 +102,7 @@ pub enum Msg {
|
|||
OnBuildExit(i32),
|
||||
ClockTicking,
|
||||
BuildProfile(bool),
|
||||
CancelBuild,
|
||||
EnableDebugViewChanged(bool),
|
||||
DoStartStopXRService,
|
||||
RestartXRService,
|
||||
|
@ -460,6 +461,11 @@ impl SimpleComponent for App {
|
|||
}
|
||||
};
|
||||
}
|
||||
Msg::CancelBuild => {
|
||||
if let Some(w) = self.build_worker.as_ref() {
|
||||
w.stop();
|
||||
}
|
||||
}
|
||||
Msg::DeleteProfile => {
|
||||
let todel = self.get_selected_profile();
|
||||
if todel.editable {
|
||||
|
@ -617,7 +623,9 @@ impl SimpleComponent for App {
|
|||
build_window: BuildWindow::builder()
|
||||
.transient_for(root)
|
||||
.launch(())
|
||||
.detach(),
|
||||
.forward(sender.input_sender(), |msg| match msg {
|
||||
BuildWindowOutMsg::CancelBuild => Msg::CancelBuild,
|
||||
}),
|
||||
libsurvive_setup_window: LibsurviveSetupWindow::builder()
|
||||
.transient_for(root)
|
||||
.launch(())
|
||||
|
|
|
@ -36,11 +36,16 @@ pub enum BuildWindowMsg {
|
|||
UpdateCanClose(bool),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum BuildWindowOutMsg {
|
||||
CancelBuild,
|
||||
}
|
||||
|
||||
#[relm4::component(pub)]
|
||||
impl SimpleComponent for BuildWindow {
|
||||
type Init = ();
|
||||
type Input = BuildWindowMsg;
|
||||
type Output = ();
|
||||
type Output = BuildWindowOutMsg;
|
||||
|
||||
view! {
|
||||
#[name(win)]
|
||||
|
@ -87,7 +92,21 @@ impl SimpleComponent for BuildWindow {
|
|||
set_wrap: true,
|
||||
set_wrap_mode: gtk::pango::WrapMode::Word,
|
||||
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)]
|
||||
gtk::ScrolledWindow {
|
||||
|
@ -174,7 +193,7 @@ impl SimpleComponent for BuildWindow {
|
|||
fn init(
|
||||
_init: Self::Init,
|
||||
root: &Self::Root,
|
||||
_sender: ComponentSender<Self>,
|
||||
sender: ComponentSender<Self>,
|
||||
) -> ComponentParts<Self> {
|
||||
let mut model = Self {
|
||||
tracker: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue