@@ -62,7 +62,7 @@ impl Default for LogViewerApp {
6262 should_scroll : Default :: default ( ) ,
6363 show_last_filename : true ,
6464 last_save_hash : Default :: default ( ) ,
65- max_data_save_size : Some ( 2 * 1024 * 1024 ) , // 2 MB
65+ max_data_save_size : Some ( Self :: DEFAULT_MAX_DATA_SAVE_SIZE ) ,
6666 }
6767 }
6868}
@@ -77,6 +77,8 @@ pub enum LoadingStatus {
7777}
7878
7979impl LogViewerApp {
80+ const DEFAULT_MAX_DATA_SAVE_SIZE : usize = 2 * 1024 * 1024 ; // 2MB
81+
8082 /// Called once before the first frame.
8183 pub fn new ( cc : & eframe:: CreationContext < ' _ > ) -> Self {
8284 // This is also where you can customize the look and feel of egui using
@@ -440,6 +442,35 @@ impl LogViewerApp {
440442 } ) ;
441443 }
442444 } ) ;
445+
446+ ui. horizontal ( |ui| {
447+ let mut has_max_data_size_for_save = self . max_data_save_size . is_some ( ) ;
448+ ui. checkbox (
449+ & mut has_max_data_size_for_save,
450+ "Enable Max Data Size To Save" ,
451+ ) ;
452+ match (
453+ has_max_data_size_for_save,
454+ self . max_data_save_size . is_some ( ) ,
455+ ) {
456+ ( true , true ) | ( false , false ) => { }
457+ ( true , false ) => {
458+ self . max_data_save_size = Some ( Self :: DEFAULT_MAX_DATA_SAVE_SIZE )
459+ }
460+ ( false , true ) => self . max_data_save_size = None ,
461+ }
462+
463+ if let Some ( max_data_save_size) = self . max_data_save_size . as_mut ( ) {
464+ ui. label ( format ! (
465+ "Allowed Size: {}" ,
466+ SizeUnits :: Auto . convert_trimmed( * max_data_save_size)
467+ ) ) ;
468+ ui. add (
469+ egui:: Slider :: new ( max_data_save_size, 0 ..=100 * 1024 * 1024 )
470+ . step_by ( 1024.0 ) ,
471+ ) ;
472+ }
473+ } ) ;
443474 } ) ;
444475 }
445476
0 commit comments