mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-31 01:24:31 +02:00
refactor: remove dead config screen code
This code was never used and might as well be removed for clarity's sake.
This commit is contained in:
parent
f68acc5c9d
commit
1f731358ba
34
src/app.rs
34
src/app.rs
@ -126,9 +126,6 @@ pub struct App {
|
|||||||
#[builder(default = false, setter(skip))]
|
#[builder(default = false, setter(skip))]
|
||||||
pub basic_mode_use_percent: bool,
|
pub basic_mode_use_percent: bool,
|
||||||
|
|
||||||
#[builder(default = false, setter(skip))]
|
|
||||||
pub is_config_open: bool,
|
|
||||||
|
|
||||||
#[builder(default = false, setter(skip))]
|
#[builder(default = false, setter(skip))]
|
||||||
pub did_config_fail_to_save: bool,
|
pub did_config_fail_to_save: bool,
|
||||||
|
|
||||||
@ -217,8 +214,6 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.is_force_redraw = true;
|
self.is_force_redraw = true;
|
||||||
} else if self.is_config_open {
|
|
||||||
self.close_config_screen();
|
|
||||||
} else {
|
} else {
|
||||||
match self.current_widget.widget_type {
|
match self.current_widget.widget_type {
|
||||||
BottomWidgetType::Proc => {
|
BottomWidgetType::Proc => {
|
||||||
@ -296,7 +291,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ignore_normal_keybinds(&self) -> bool {
|
fn ignore_normal_keybinds(&self) -> bool {
|
||||||
self.is_config_open || self.is_in_dialog()
|
self.is_in_dialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_tab(&mut self) {
|
pub fn on_tab(&mut self) {
|
||||||
@ -909,8 +904,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_up_key(&mut self) {
|
pub fn on_up_key(&mut self) {
|
||||||
if self.is_config_open {
|
if !self.is_in_dialog() {
|
||||||
} else if !self.is_in_dialog() {
|
|
||||||
self.decrement_position_count();
|
self.decrement_position_count();
|
||||||
} else if self.help_dialog_state.is_showing_help {
|
} else if self.help_dialog_state.is_showing_help {
|
||||||
self.help_scroll_up();
|
self.help_scroll_up();
|
||||||
@ -931,8 +925,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_down_key(&mut self) {
|
pub fn on_down_key(&mut self) {
|
||||||
if self.is_config_open {
|
if !self.is_in_dialog() {
|
||||||
} else if !self.is_in_dialog() {
|
|
||||||
self.increment_position_count();
|
self.increment_position_count();
|
||||||
} else if self.help_dialog_state.is_showing_help {
|
} else if self.help_dialog_state.is_showing_help {
|
||||||
self.help_scroll_down();
|
self.help_scroll_down();
|
||||||
@ -953,8 +946,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_left_key(&mut self) {
|
pub fn on_left_key(&mut self) {
|
||||||
if self.is_config_open {
|
if !self.is_in_dialog() {
|
||||||
} else if !self.is_in_dialog() {
|
|
||||||
match self.current_widget.widget_type {
|
match self.current_widget.widget_type {
|
||||||
BottomWidgetType::ProcSearch => {
|
BottomWidgetType::ProcSearch => {
|
||||||
let is_in_search_widget = self.is_in_search_widget();
|
let is_in_search_widget = self.is_in_search_widget();
|
||||||
@ -1025,8 +1017,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_right_key(&mut self) {
|
pub fn on_right_key(&mut self) {
|
||||||
if self.is_config_open {
|
if !self.is_in_dialog() {
|
||||||
} else if !self.is_in_dialog() {
|
|
||||||
match self.current_widget.widget_type {
|
match self.current_widget.widget_type {
|
||||||
BottomWidgetType::ProcSearch => {
|
BottomWidgetType::ProcSearch => {
|
||||||
let is_in_search_widget = self.is_in_search_widget();
|
let is_in_search_widget = self.is_in_search_widget();
|
||||||
@ -1190,7 +1181,6 @@ impl App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if self.is_config_open {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1237,7 +1227,6 @@ impl App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if self.is_config_open {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1489,7 +1478,6 @@ impl App {
|
|||||||
'G' => self.skip_to_last(),
|
'G' => self.skip_to_last(),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
} else if self.is_config_open {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1672,16 +1660,6 @@ impl App {
|
|||||||
|
|
||||||
pub fn on_space(&mut self) {}
|
pub fn on_space(&mut self) {}
|
||||||
|
|
||||||
pub fn open_config_screen(&mut self) {
|
|
||||||
self.is_config_open = true;
|
|
||||||
self.is_force_redraw = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn close_config_screen(&mut self) {
|
|
||||||
self.is_config_open = false;
|
|
||||||
self.is_force_redraw = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// TODO: Disabled.
|
/// TODO: Disabled.
|
||||||
/// Call this whenever the config value is updated!
|
/// Call this whenever the config value is updated!
|
||||||
// fn update_config_file(&mut self) -> anyhow::Result<()> {
|
// fn update_config_file(&mut self) -> anyhow::Result<()> {
|
||||||
@ -2263,7 +2241,6 @@ impl App {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
self.reset_multi_tap_keys();
|
self.reset_multi_tap_keys();
|
||||||
} else if self.is_config_open {
|
|
||||||
} else if self.help_dialog_state.is_showing_help {
|
} else if self.help_dialog_state.is_showing_help {
|
||||||
self.help_dialog_state.scroll_state.current_scroll_index = 0;
|
self.help_dialog_state.scroll_state.current_scroll_index = 0;
|
||||||
} else if self.delete_dialog_state.is_showing_dd {
|
} else if self.delete_dialog_state.is_showing_dd {
|
||||||
@ -2342,7 +2319,6 @@ impl App {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
self.reset_multi_tap_keys();
|
self.reset_multi_tap_keys();
|
||||||
} else if self.is_config_open {
|
|
||||||
} else if self.help_dialog_state.is_showing_help {
|
} else if self.help_dialog_state.is_showing_help {
|
||||||
self.help_dialog_state.scroll_state.current_scroll_index = self
|
self.help_dialog_state.scroll_state.current_scroll_index = self
|
||||||
.help_dialog_state
|
.help_dialog_state
|
||||||
|
@ -28,7 +28,6 @@ use crate::{
|
|||||||
mod canvas_colours;
|
mod canvas_colours;
|
||||||
mod dialogs;
|
mod dialogs;
|
||||||
mod drawing_utils;
|
mod drawing_utils;
|
||||||
mod screens;
|
|
||||||
mod widgets;
|
mod widgets;
|
||||||
|
|
||||||
/// Point is of time, data
|
/// Point is of time, data
|
||||||
@ -508,13 +507,6 @@ impl Painter {
|
|||||||
),
|
),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
} else if app_state.is_config_open {
|
|
||||||
let rect = Layout::default()
|
|
||||||
.margin(0)
|
|
||||||
.constraints([Constraint::Percentage(100)])
|
|
||||||
.split(f.size())[0];
|
|
||||||
|
|
||||||
self.draw_config_screen(f, app_state, rect)
|
|
||||||
} else if app_state.app_config_fields.use_basic_mode {
|
} else if app_state.app_config_fields.use_basic_mode {
|
||||||
// Basic mode. This basically removes all graphs but otherwise
|
// Basic mode. This basically removes all graphs but otherwise
|
||||||
// the same info.
|
// the same info.
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
pub mod config_screen;
|
|
||||||
|
|
||||||
pub use config_screen::*;
|
|
@ -1,27 +0,0 @@
|
|||||||
#![allow(unused_variables)] //FIXME: Remove this
|
|
||||||
#![allow(unused_imports)] //FIXME: Remove this
|
|
||||||
use crate::{app::App, canvas::Painter, constants};
|
|
||||||
use tui::{
|
|
||||||
backend::Backend,
|
|
||||||
layout::Constraint,
|
|
||||||
layout::Direction,
|
|
||||||
layout::Layout,
|
|
||||||
layout::{Alignment, Rect},
|
|
||||||
terminal::Frame,
|
|
||||||
text::Span,
|
|
||||||
widgets::{Block, Borders, Paragraph},
|
|
||||||
};
|
|
||||||
|
|
||||||
impl Painter {
|
|
||||||
pub fn draw_config_screen<B: Backend>(
|
|
||||||
&self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect,
|
|
||||||
) {
|
|
||||||
let config_block = Block::default()
|
|
||||||
.title(Span::styled(" Config ", self.colours.widget_title_style))
|
|
||||||
.style(self.colours.border_style)
|
|
||||||
.borders(Borders::ALL)
|
|
||||||
.border_style(self.colours.border_style);
|
|
||||||
|
|
||||||
f.render_widget(config_block, draw_loc);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user