diff --git a/deja_vu/src/action.rs b/deja_vu/src/action.rs index ba18a79..29b4fa5 100644 --- a/deja_vu/src/action.rs +++ b/deja_vu/src/action.rs @@ -17,8 +17,8 @@ use serde::{Deserialize, Serialize}; use strum::Display; use crate::{ - app::Mode, components::popup::Type, + state::Mode, system::{ disk::{Disk, PartitionTableType}, drivers::Driver, diff --git a/deja_vu/src/app.rs b/deja_vu/src/app.rs index e9c0a24..fd8cf8d 100644 --- a/deja_vu/src/app.rs +++ b/deja_vu/src/app.rs @@ -26,7 +26,6 @@ use ratatui::{ layout::{Constraint, Direction, Layout}, prelude::Rect, }; -use serde::{Deserialize, Serialize}; use tokio::sync::mpsc; use tracing::{debug, info}; @@ -36,6 +35,7 @@ use crate::{ footer::Footer, fps::FpsCounter, left::Left, popup, right::Right, title::Title, Component, }, config::Config, + state::Mode, system::{ boot, disk::{Disk, PartitionTableType}, @@ -71,22 +71,6 @@ pub struct App { tasks: Tasks, } -#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub enum Mode { - #[default] - ScanDisks, - InstallDrivers, - SelectDisks, - SelectTableType, - Confirm, - PreClone, - Clone, - SelectParts, - PostClone, - Done, - Failed, -} - impl App { pub fn new(tick_rate: f64, frame_rate: f64) -> Result { let (action_tx, action_rx) = mpsc::unbounded_channel(); diff --git a/deja_vu/src/components/footer.rs b/deja_vu/src/components/footer.rs index 1530cd7..a085cfe 100644 --- a/deja_vu/src/components/footer.rs +++ b/deja_vu/src/components/footer.rs @@ -21,7 +21,7 @@ use ratatui::{ use tokio::sync::mpsc::UnboundedSender; use super::Component; -use crate::{action::Action, app::Mode, config::Config}; +use crate::{action::Action, config::Config, state::Mode}; #[derive(Default)] pub struct Footer { diff --git a/deja_vu/src/components/left.rs b/deja_vu/src/components/left.rs index 8ccfa12..7b7349c 100644 --- a/deja_vu/src/components/left.rs +++ b/deja_vu/src/components/left.rs @@ -25,8 +25,8 @@ use tracing::info; use super::{popup, state::StatefulList, Component}; use crate::{ action::Action, - app::Mode, config::Config, + state::Mode, system::{ disk::{Disk, Partition, PartitionTableType}, drivers::{self, Driver}, diff --git a/deja_vu/src/components/popup.rs b/deja_vu/src/components/popup.rs index 933dbde..47182e2 100644 --- a/deja_vu/src/components/popup.rs +++ b/deja_vu/src/components/popup.rs @@ -23,7 +23,7 @@ use strum::Display; use tokio::sync::mpsc::UnboundedSender; use super::Component; -use crate::{action::Action, app::Mode, config::Config}; +use crate::{action::Action, config::Config, state::Mode}; #[derive(Default, Debug, Clone, PartialEq, Eq, Display, Serialize, Deserialize)] pub enum Type { diff --git a/deja_vu/src/components/right.rs b/deja_vu/src/components/right.rs index d053b25..1e1fc0f 100644 --- a/deja_vu/src/components/right.rs +++ b/deja_vu/src/components/right.rs @@ -25,8 +25,8 @@ use tracing::info; use super::{state::StatefulList, Component}; use crate::{ action::Action, - app::Mode, config::Config, + state::Mode, system::{ cpu::get_cpu_name, disk::{Disk, Partition, PartitionTableType}, diff --git a/deja_vu/src/config.rs b/deja_vu/src/config.rs index ba2daab..2b659ff 100644 --- a/deja_vu/src/config.rs +++ b/deja_vu/src/config.rs @@ -26,7 +26,7 @@ use ratatui::style::{Color, Modifier, Style}; use serde::{de::Deserializer, Deserialize}; use tracing::error; -use crate::{action::Action, app::Mode}; +use crate::{action::Action, state::Mode}; const CONFIG: &str = include_str!("../config/config.json5"); diff --git a/deja_vu/src/main.rs b/deja_vu/src/main.rs index 72a1b88..085974a 100644 --- a/deja_vu/src/main.rs +++ b/deja_vu/src/main.rs @@ -26,6 +26,7 @@ mod components; mod config; mod errors; mod logging; +mod state; mod system; mod tasks; mod tests; diff --git a/deja_vu/src/state.rs b/deja_vu/src/state.rs new file mode 100644 index 0000000..7e9cacc --- /dev/null +++ b/deja_vu/src/state.rs @@ -0,0 +1,33 @@ +// This file is part of Deja-vu. +// +// Deja-vu is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Deja-vu is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Deja-vu. If not, see . +// + +use serde::{Deserialize, Serialize}; + +#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Mode { + #[default] + ScanDisks, + InstallDrivers, + SelectDisks, + SelectTableType, + Confirm, + PreClone, + Clone, + SelectParts, + PostClone, + Done, + Failed, +}