Skip to content

Commit

Permalink
style: applied fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lilopkins committed Oct 27, 2023
1 parent 3a2e0cd commit f9104a7
Show file tree
Hide file tree
Showing 10 changed files with 2,312 additions and 2,252 deletions.
454 changes: 227 additions & 227 deletions testangel/src/next_ui/actions/execution_dialog.rs

Large diffs are not rendered by default.

648 changes: 331 additions & 317 deletions testangel/src/next_ui/actions/header.rs

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions testangel/src/next_ui/actions/instruction_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use relm4::{
prelude::{DynamicIndex, FactoryComponent},
RelmWidgetExt,
};
use testangel::types::{InstructionParameterSource, InstructionConfiguration};
use testangel_ipc::prelude::{ParameterKind, ParameterValue, Instruction};
use testangel::types::{InstructionConfiguration, InstructionParameterSource};
use testangel_ipc::prelude::{Instruction, ParameterKind, ParameterValue};

use crate::next_ui::{
components::variable_row::{
Expand All @@ -33,7 +33,8 @@ pub struct InstructionComponent {
visible: bool,

possible_outputs: Vec<(String, ParameterKind, InstructionParameterSource)>,
variable_rows: FactoryVecDeque<VariableRow<InstructionParameterSource, String, InstructionComponentInput>>,
variable_rows:
FactoryVecDeque<VariableRow<InstructionParameterSource, String, InstructionComponentInput>>,

/// True when a drag-and-drop operation is proposed to add a component above this one
drop_proposed_above: bool,
Expand Down Expand Up @@ -108,7 +109,7 @@ impl FactoryComponent for InstructionComponent {
map
}
),
set_description: Some(&self.instruction.description()),
set_description: Some(self.instruction.description()),
#[watch]
set_visible: self.visible,

Expand Down
258 changes: 129 additions & 129 deletions testangel/src/next_ui/actions/metadata_component.rs
Original file line number Diff line number Diff line change
@@ -1,129 +1,129 @@
use relm4::{adw, gtk, Component};
use adw::prelude::*;
use testangel::types::Action;

use crate::next_ui::lang;

#[derive(Debug)]
pub enum MetadataInput {
/// Inform the metadata component that the action has changed and as such
/// it should reload the metadata values
ChangeAction(Action),
}

#[derive(Clone, Debug, Default)]
pub struct MetadataOutput {
pub new_name: Option<String>,
pub new_group: Option<String>,
pub new_author: Option<String>,
pub new_description: Option<String>,
pub new_visible: Option<bool>,
}

#[derive(Debug)]
pub struct Metadata;

#[relm4::component(pub)]
impl Component for Metadata {
type Init = ();
type Input = MetadataInput;
type Output = MetadataOutput;
type CommandOutput = ();

view! {
adw::PreferencesGroup {
set_title: &lang::lookup("action-metadata-label"),

#[name = "name"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-name"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_name: Some(entry.text().to_string()),
..Default::default()
});
},
},
#[name = "group"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-group"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_group: Some(entry.text().to_string()),
..Default::default()
});
},
},
#[name = "author"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-author"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_author: Some(entry.text().to_string()),
..Default::default()
});
},
},
#[name = "description"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-description"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_description: Some(entry.text().to_string()),
..Default::default()
});
},
},
adw::ActionRow {
set_title: &lang::lookup("action-metadata-visible"),

#[name = "visible"]
add_suffix = &gtk::Switch {
connect_state_set[sender] => move |_switch, state| {
let _ = sender.output(MetadataOutput {
new_visible: Some(state),
..Default::default()
});
gtk::Inhibit(false)
},
},

}
},
}

fn init(
_init: Self::Init,
root: &Self::Root,
sender: relm4::ComponentSender<Self>,
) -> relm4::ComponentParts<Self> {
let model = Metadata;
let widgets = view_output!();

relm4::ComponentParts { model, widgets }
}

fn update_with_view(
&mut self,
widgets: &mut Self::Widgets,
message: Self::Input,
sender: relm4::ComponentSender<Self>,
_root: &Self::Root,
) {
match message {
MetadataInput::ChangeAction(action) => {
widgets.name.set_text(&action.friendly_name);
widgets.group.set_text(&action.group);
widgets.author.set_text(&action.author);
widgets.description.set_text(&action.description);
widgets.visible.set_active(action.visible);
}
}

self.update_view(widgets, sender)
}
}
use adw::prelude::*;
use relm4::{adw, gtk, Component};
use testangel::types::Action;

use crate::next_ui::lang;

#[derive(Debug)]
pub enum MetadataInput {
/// Inform the metadata component that the action has changed and as such
/// it should reload the metadata values
ChangeAction(Action),
}

#[derive(Clone, Debug, Default)]
pub struct MetadataOutput {
pub new_name: Option<String>,
pub new_group: Option<String>,
pub new_author: Option<String>,
pub new_description: Option<String>,
pub new_visible: Option<bool>,
}

#[derive(Debug)]
pub struct Metadata;

#[relm4::component(pub)]
impl Component for Metadata {
type Init = ();
type Input = MetadataInput;
type Output = MetadataOutput;
type CommandOutput = ();

view! {
adw::PreferencesGroup {
set_title: &lang::lookup("action-metadata-label"),

#[name = "name"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-name"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_name: Some(entry.text().to_string()),
..Default::default()
});
},
},
#[name = "group"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-group"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_group: Some(entry.text().to_string()),
..Default::default()
});
},
},
#[name = "author"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-author"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_author: Some(entry.text().to_string()),
..Default::default()
});
},
},
#[name = "description"]
adw::EntryRow {
set_title: &lang::lookup("action-metadata-description"),

connect_changed[sender] => move |entry| {
let _ = sender.output(MetadataOutput {
new_description: Some(entry.text().to_string()),
..Default::default()
});
},
},
adw::ActionRow {
set_title: &lang::lookup("action-metadata-visible"),

#[name = "visible"]
add_suffix = &gtk::Switch {
connect_state_set[sender] => move |_switch, state| {
let _ = sender.output(MetadataOutput {
new_visible: Some(state),
..Default::default()
});
gtk::Inhibit(false)
},
},

}
},
}

fn init(
_init: Self::Init,
root: &Self::Root,
sender: relm4::ComponentSender<Self>,
) -> relm4::ComponentParts<Self> {
let model = Metadata;
let widgets = view_output!();

relm4::ComponentParts { model, widgets }
}

fn update_with_view(
&mut self,
widgets: &mut Self::Widgets,
message: Self::Input,
sender: relm4::ComponentSender<Self>,
_root: &Self::Root,
) {
match message {
MetadataInput::ChangeAction(action) => {
widgets.name.set_text(&action.friendly_name);
widgets.group.set_text(&action.group);
widgets.author.set_text(&action.author);
widgets.description.set_text(&action.description);
widgets.visible.set_active(action.visible);
}
}

self.update_view(widgets, sender)
}
}
Loading

0 comments on commit f9104a7

Please sign in to comment.