aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.rs
diff options
context:
space:
mode:
authorsam-anthony <samanthony6@protonmail.com>2022-03-06 21:56:57 -0330
committersam-anthony <samanthony6@protonmail.com>2022-03-06 21:56:57 -0330
commitd286ed3eb877365c01f7a7ec56de9a0dc84bab2e (patch)
tree8bf158027b0677bed2d1c06f13d42c426d30f263 /src/app.rs
parentd0c7b0a39ed6703940da4896d2caa79ad36590e0 (diff)
downloadvolute-d286ed3eb877365c01f7a7ec56de9a0dc84bab2e.zip
simplify/remove a lot of stuff
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs90
1 files changed, 1 insertions, 89 deletions
diff --git a/src/app.rs b/src/app.rs
index bc12812..dedb11e 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,82 +1,9 @@
-use crate::input::{InputMode, InputParam, Row};
-
-#[derive(Copy, Clone)]
-pub enum Tab {
- Const = 0,
- Input = 1,
- Config = 2,
-}
-
-impl Tab {
- fn next(&self) -> Self {
- match self {
- Self::Const => Self::Input,
- Self::Input => Self::Config,
- Self::Config => Self::Const,
- }
- }
-
- fn previous(&self) -> Self {
- match self {
- Self::Const => Self::Config,
- Self::Input => Self::Const,
- Self::Config => Self::Input,
- }
- }
-
- fn string(&self) -> String {
- match self {
- Self::Const => "Const".to_string(),
- Self::Input => "Input".to_string(),
- Self::Config => "Config".to_string(),
- }
- }
-}
-
-impl IntoIterator for Tab {
- type Item = Tab;
- type IntoIter = TabIter;
-
- fn into_iter(self) -> Self::IntoIter {
- TabIter { tab: Some(self) }
- }
-}
-
-pub struct TabIter {
- tab: Option<Tab>,
-}
-
-impl Iterator for TabIter {
- type Item = Tab;
-
- fn next(&mut self) -> Option<Self::Item> {
- match self.tab {
- Some(Tab::Const) => {
- self.tab = Some(Tab::Input);
- Some(Tab::Const)
- }
- Some(Tab::Input) => {
- self.tab = Some(Tab::Config);
- Some(Tab::Input)
- }
- Some(Tab::Config) => {
- self.tab = None;
- Some(Tab::Config)
- }
- None => None,
- }
- }
-}
+use crate::input::{InputParam, Row};
pub struct App {
- pub tab: Tab,
- tab_titles: Vec<String>,
-
rows: Vec<Row>,
selected_row: usize,
selected_column: InputParam,
-
- pub input_mode: InputMode,
}
impl App {
@@ -84,18 +11,6 @@ impl App {
&self.rows
}
- pub fn tab_titles(&self) -> &Vec<String> {
- &self.tab_titles
- }
-
- pub fn next_tab(&mut self) {
- self.tab = self.tab.next();
- }
-
- pub fn previous_tab(&mut self) {
- self.tab = self.tab.previous();
- }
-
pub fn next_row(&mut self) {
if self.selected_row < self.rows.len() - 1 {
self.selected_row += 1;
@@ -155,12 +70,9 @@ impl App {
impl Default for App {
fn default() -> App {
App {
- tab: Tab::Const,
- tab_titles: Tab::Const.into_iter().map(|t| t.string()).collect(),
rows: vec![Row::default()],
selected_row: 0,
selected_column: InputParam::Rpm(String::new()),
- input_mode: InputMode::Normal,
}
}
}