Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions application/apps/indexer/gui/application/src/common/modal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use egui::{
Button, Context, Frame, Id, Label, ModalResponse, NumExt as _, Spinner, Ui, Widget as _, vec2,
Button, Context, Frame, Id, ModalResponse, NumExt as _, Spinner, Ui, Widget as _, vec2,
};

/// Show standard modal dialog filled with the provided content.
Expand Down Expand Up @@ -31,7 +31,7 @@ where
show_modal(ctx, "busy indicator", 200.0, |ui| {
ui.vertical_centered(|ui| {
if let Some(label) = label {
Label::new(label).selectable(false).ui(ui);
ui.label(label);
ui.add_space(5.);
}
Spinner::new().size(25.).ui(ui);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use egui::Style;

/// Applies global style settings to the provided `style` object.
pub fn global_styles(style: &mut Style) {
// We expect the labels to be not selectable by default.
style.interaction.selectable_labels = false;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod app_style;
pub mod colors;
pub mod dlt_stats;
pub mod file_utls;
Expand Down
8 changes: 4 additions & 4 deletions application/apps/indexer/gui/application/src/host/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ use crate::{
#[derive(Debug)]
pub enum HostMessage {
/// Open Session Setup with the provided state.
SessionSetupOpened(SessionSetupState),
SessionSetupOpened(Box<SessionSetupState>),
/// Close session setup with the provided id.
SessionSetupClosed { id: Uuid },
/// Close multiple files setup with the provided id.
MultiSetupClose { id: Uuid },
/// The collected DLT statistics on a file for a SessionSetup
DltStatistics {
setup_session_id: Uuid,
statistics: Option<DltStatistics>,
statistics: Option<Box<DltStatistics>>,
},
/// A new session has been successfully created.
SessionCreated {
session_params: InitSessionParams,
session_params: Box<InitSessionParams>,
/// ID for session_setup used to create this session to replace its tab
/// instead of creating a new tab for the session.
session_setup_id: Option<Uuid>,
},
/// Open Session Setup for concatenating files.
MultiFilesSetup(MultiFileState),
MultiFilesSetup(Box<MultiFileState>),
}
18 changes: 9 additions & 9 deletions application/apps/indexer/gui/application/src/host/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl HostService {

self.communication
.senders
.send_message(HostMessage::SessionSetupOpened(session_setup))
.send_message(HostMessage::SessionSetupOpened(Box::new(session_setup)))
.await;
} else {
// Start sessions directly for text files.
Expand All @@ -200,7 +200,7 @@ impl HostService {
self.communication
.senders
.send_message(HostMessage::SessionCreated {
session_params,
session_params: Box::new(session_params),
session_setup_id: None,
})
.await;
Expand Down Expand Up @@ -238,7 +238,7 @@ impl HostService {

self.communication
.senders
.send_message(HostMessage::MultiFilesSetup(state))
.send_message(HostMessage::MultiFilesSetup(Box::new(state)))
.await;

Ok(())
Expand Down Expand Up @@ -273,7 +273,7 @@ impl HostService {
let files = files.into_iter().map(|path| (path, format)).collect_vec();

let state = MultiFileState::new(files);
let msg = HostMessage::MultiFilesSetup(state);
let msg = HostMessage::MultiFilesSetup(Box::new(state));

self.communication.senders.send_message(msg).await;

Expand Down Expand Up @@ -357,7 +357,7 @@ impl HostService {

self.communication
.senders
.send_message(HostMessage::SessionSetupOpened(session_setup))
.send_message(HostMessage::SessionSetupOpened(Box::new(session_setup)))
.await;
}
ParserConfig::Text => {
Expand Down Expand Up @@ -387,7 +387,7 @@ impl HostService {
self.communication
.senders
.send_message(HostMessage::SessionCreated {
session_params,
session_params: Box::new(session_params),
session_setup_id: None,
})
.await;
Expand Down Expand Up @@ -422,7 +422,7 @@ impl HostService {

self.communication
.senders
.send_message(HostMessage::SessionSetupOpened(session_setup))
.send_message(HostMessage::SessionSetupOpened(Box::new(session_setup)))
.await;
}

Expand All @@ -439,7 +439,7 @@ impl HostService {
senders
.send_message(HostMessage::DltStatistics {
setup_session_id,
statistics: Some(statistics),
statistics: Some(Box::new(statistics)),
})
.await;
});
Expand Down Expand Up @@ -574,7 +574,7 @@ impl HostService {
self.communication
.senders
.send_message(HostMessage::SessionCreated {
session_params,
session_params: Box::new(session_params),
session_setup_id,
})
.await;
Expand Down
19 changes: 10 additions & 9 deletions application/apps/indexer/gui/application/src/host/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::time::Duration;

use anyhow::ensure;
use eframe::NativeOptions;
use egui::{Align, CentralPanel, Context, Frame, Layout, TopBottomPanel, Ui, Widget, vec2};
use egui::{Align, CentralPanel, Context, Frame, Layout, TopBottomPanel, Ui, vec2};
use itertools::Itertools;
use log::{info, trace, warn};

Expand All @@ -11,6 +11,7 @@ use crate::{
common::{modal::show_modal, phosphor},
host::{
command::{HostCommand, StartSessionParam},
common::app_style,
communication::{UiReceivers, UiSenders},
message::HostMessage,
service::HostService,
Expand Down Expand Up @@ -80,6 +81,8 @@ impl Host {
ui_actions: UiActions::new(tokio_handle),
};

ctx.egui_ctx.all_styles_mut(app_style::global_styles);

host.handle_cli(cli_cmds)?;

Ok(Box::new(host))
Expand Down Expand Up @@ -129,25 +132,25 @@ impl Host {
match message {
HostMessage::SessionSetupOpened(setup_state) => self
.state
.add_session_setup(setup_state, self.senders.cmd_tx.clone()),
.add_session_setup(*setup_state, self.senders.cmd_tx.clone()),
HostMessage::DltStatistics {
setup_session_id,
statistics,
} => {
if let Some(setup) = self.state.session_setups.get_mut(&setup_session_id)
&& let ParserConfig::Dlt(config) = &mut setup.state.parser
{
config.dlt_statistics = Some(Box::new(statistics.unwrap_or_default()));
config.dlt_statistics = Some(Box::new(*statistics.unwrap_or_default()));
config.update_summary();
}
}
HostMessage::SessionCreated {
session_params,
session_setup_id,
} => self.state.add_session(session_params, session_setup_id),
} => self.state.add_session(*session_params, session_setup_id),
HostMessage::MultiFilesSetup(state) => self
.state
.add_multi_files(state, self.senders.cmd_tx.clone()),
.add_multi_files(*state, self.senders.cmd_tx.clone()),
HostMessage::SessionSetupClosed { id } => self.state.close_session_setup(id),
HostMessage::MultiSetupClose { id } => self.state.close_multi_setup(id),
}
Expand Down Expand Up @@ -262,12 +265,10 @@ impl Host {

ui.add_space(6.);

egui::Label::new(
ui.label(
"A file picker is currently open.\
If you don't see it, please check your taskbar or move this window",
)
.selectable(false)
.ui(ui);
);
})
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ mod table_columns;

pub fn render_content(ui: &mut Ui, state: &mut MultiFileState) {
main_panel_group_frame(ui).show(ui, |ui| {
Label::new(RichText::new("Multiple files").heading())
.selectable(false)
.ui(ui);
ui.label(RichText::new("Multiple files").heading());

ui.add_space(10.);

Expand Down Expand Up @@ -73,11 +71,9 @@ fn render_table(ui: &mut Ui, state: &mut MultiFileState) {
}

fn table_header(ui: &mut Ui, column: TableColumn) {
Label::new(RichText::new(column.header()).strong())
.selectable(false)
.ui(ui);
ui.label(RichText::new(column.header()).strong());
}

fn table_cell_text(ui: &mut Ui, content: String) {
Label::new(content).selectable(false).truncate().ui(ui);
Label::new(content).truncate().ui(ui);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ impl MultiSidePanel {
}

fn render_summary(ui: &mut Ui, state: &mut MultiFileState) {
Label::new(RichText::new("Summary").heading())
.selectable(false)
.ui(ui);
ui.label(RichText::new("Summary").heading());

ui.add_space(6.);

Expand All @@ -55,9 +53,7 @@ impl MultiSidePanel {
}

fn render_overview(&mut self, ui: &mut Ui, state: &mut MultiFileState) {
Label::new(RichText::new("Concat Overview").heading())
.selectable(false)
.ui(ui);
ui.label(RichText::new("Concat Overview").heading());
ui.add_space(6.);

// ------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn render_socket_address<C: ConfigBindAddress>(config: &mut C, ui: &mut Ui) -> R
let mut outcome = RenderOutcome::None;

ui.vertical(|ui| {
Label::new("Socket Address:").selectable(false).ui(ui);
ui.label("Socket Address:");

let ip_txt_res = TextEdit::singleline(config.bind_addr())
.vertical_align(Align::Center)
Expand All @@ -113,7 +113,7 @@ fn render_socket_address<C: ConfigBindAddress>(config: &mut C, ui: &mut Ui) -> R
.size(10.5)
.small()
.color(ui.style().visuals.warn_fg_color);
Label::new(err_txt).selectable(false).ui(ui);
Label::new(err_txt).selectable(true).ui(ui);
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ fn working_dir(config: &mut ProcessConfig, actions: &mut UiActions, ui: &mut Ui)
egui::Sides::new().show(
ui,
|ui| {
Label::new("Working Folder:").selectable(false).ui(ui);
Label::new(path_txt).ui(ui);
ui.label("Working Folder:");
Label::new(path_txt).selectable(true).ui(ui);
},
|ui| {
let btn_size = vec2(12., height);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use egui::{
Align, Button, ComboBox, Frame, Label, Layout, Margin, Popup, RectAlign, RichText, TextEdit,
Ui, Widget, vec2,
Align, Button, ComboBox, Frame, Layout, Margin, Popup, RectAlign, RichText, TextEdit, Ui,
Widget, vec2,
};

use crate::host::ui::session_setup::{
Expand All @@ -27,9 +27,7 @@ pub fn render_connection(config: &mut SerialConfig, ui: &mut Ui) -> RenderOutcom
);

ui.separator();
Label::new(RichText::new("Settings").heading().size(15.))
.selectable(false)
.ui(ui);
ui.label(RichText::new("Settings").heading().size(15.));

ui.horizontal_wrapped(|ui| {
ui.style_mut().spacing.combo_width = CONTROL_WIDTH;
Expand Down Expand Up @@ -201,7 +199,7 @@ fn labeled_field(ui: &mut Ui, label: &str, add_widget: impl FnOnce(&mut Ui)) {
Frame::NONE
.inner_margin(Margin::symmetric(CONTROL_GROUP_SIDE_MARGIN, 0))
.show(ui, |ui| {
Label::new(label).selectable(false).ui(ui);
ui.label(label);
add_widget(ui);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn label_input_field(
ui.allocate_ui_with_layout(vec2(200., 70.), Layout::top_down(Align::LEFT), |ui| {
ui.style_mut().spacing.item_spacing.y += 2.;

Label::new(label).selectable(false).ui(ui);
ui.label(label);

let input_res = TextEdit::singleline(value).hint_text(hint_text).ui(ui);

Expand All @@ -123,7 +123,7 @@ fn label_input_field(
.size(11.)
.color(ui.visuals().warn_fg_color);

ui.label(txt);
Label::new(txt).selectable(true).ui(ui);
}

ui.allocate_space(ui.available_size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,26 @@ impl SessionSetup {
self.state.update_parser(selected_parser);
}

Label::new("Used Parser:").selectable(false).ui(ui);
ui.label("Used Parser:");

ui.add_space(10.);

match &mut self.state.source {
ByteSourceConfig::File(source_file_info) => {
if let Some(size) = &source_file_info.size_byte {
Label::new(format!("({})", file_utls::format_file_size(*size))).ui(ui);
Label::new(format!("({})", file_utls::format_file_size(*size)))
.selectable(true)
.ui(ui);
}
Label::new(RichText::new(source_file_info.name.as_str()).strong()).ui(ui);
Label::new(RichText::new(source_file_info.name.as_str()).strong())
.selectable(true)
.ui(ui);
}
ByteSourceConfig::Concat(files) => {
let size = files.iter().filter_map(|f| f.size_byte).sum();
Label::new(format!("({})", file_utls::format_file_size(size))).ui(ui);

Label::new(RichText::new(format!("{} files", files.len())).strong())
.selectable(false)
.ui(ui)
ui.label(RichText::new(format!("{} files", files.len())).strong())
.on_hover_ui(|ui| {
files.iter().enumerate().for_each(|(idx, f)| {
if idx != 0 {
Expand All @@ -150,7 +152,7 @@ impl SessionSetup {
Label::new(format!("{}", f.path.display())).ui(ui);
});
});
Label::new("Concating:").selectable(false).ui(ui);
ui.label("Concating:");
}
ByteSourceConfig::Stream(stream_config) => {
let mut selected_stream = StreamNames::from(stream_config.deref());
Expand All @@ -173,7 +175,7 @@ impl SessionSetup {
self.state.update_stream(selected_stream);
}

Label::new("Stream From:").selectable(false).ui(ui);
ui.label("Stream From:");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use egui::{Color32, Label, RichText, Ui, Widget};
use egui::{Color32, RichText, Ui};

use crate::host::{
common::{parsers::ParserNames, ui_utls::side_panel_group_frame},
Expand Down Expand Up @@ -50,7 +50,7 @@ fn validation_errors(state: &SessionSetupState, ui: &mut Ui) {
} else {
Color32::DARK_RED
});
Label::new(txt).selectable(false).ui(ui);
ui.label(txt);
}
});
}
Loading