@@ -62,7 +62,7 @@ impl Default for LogViewerApp {
62
62
should_scroll : Default :: default ( ) ,
63
63
show_last_filename : true ,
64
64
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 ) ,
66
66
}
67
67
}
68
68
}
@@ -77,6 +77,8 @@ pub enum LoadingStatus {
77
77
}
78
78
79
79
impl LogViewerApp {
80
+ const DEFAULT_MAX_DATA_SAVE_SIZE : usize = 2 * 1024 * 1024 ; // 2MB
81
+
80
82
/// Called once before the first frame.
81
83
pub fn new ( cc : & eframe:: CreationContext < ' _ > ) -> Self {
82
84
// This is also where you can customize the look and feel of egui using
@@ -440,6 +442,35 @@ impl LogViewerApp {
440
442
} ) ;
441
443
}
442
444
} ) ;
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
+ } ) ;
443
474
} ) ;
444
475
}
445
476
0 commit comments