Skip to content

Commit

Permalink
added button to clear logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAGod1 committed Nov 9, 2021
1 parent 80e9980 commit e824b71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ impl Computer {
)
}

pub fn clear_logs(&mut self) {
self.logs.clear();
}

pub fn logs(&self) -> &Vec<LogEntry> {
&self.logs
}
Expand Down
7 changes: 6 additions & 1 deletion src/ui/log.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::model::Computer;
use imgui::{Ui, im_str, ChildWindow, MenuItem, Io};
use imgui::{Ui, im_str, ChildWindow, MenuItem, Io, StyleColor};
use crate::ui::window::Tool;
use crate::ui::gui::{PopupManager, Gui, GuiState};

Expand Down Expand Up @@ -29,6 +29,11 @@ impl Tool for LogTool {
}
t.end(ui);
}
let token = ui.push_style_color(StyleColor::Button, [0.0,0.0,0.0,0.0]);
if ui.button(im_str!("Очистить"), [0.0, 0.0]) {
gui.computer.clear_logs();
}
token.pop(ui);
});

let mut last_idx = 0u16;
Expand Down

0 comments on commit e824b71

Please sign in to comment.