From f156defd5b1a7e38b8f98e6df3135b288ac61722 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 10 Jul 2020 21:51:10 +0530 Subject: move to crossterm backend --- src/main.rs | 59 ++++++++++++++--------------------------------------------- 1 file changed, 14 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 418ec3b..4f91990 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,63 +1,32 @@ #![allow(unused_must_use)] -use chrono::NaiveDate; - -use lazy_static::lazy_static; - -//use cursive::views::{Dialog, EditView, LinearLayout, ListView, SelectView}; -use cursive::theme::{BaseColor, Color}; -use cursive::views::NamedView; -use cursive::Cursive; - -mod habit; -use crate::habit::{Bit, Count, Habit}; +use std::default::Default; mod app; mod command; +mod habit; mod theme; -use crate::app::{App, ViewMode}; -use crate::command::{open_command_window, Command}; - +mod utils; mod views; -pub struct AppConfig { - pub true_chr: char, - pub false_chr: char, - pub future_chr: char, - - // view dimensions - pub view_width: usize, - pub view_height: usize, - - // app dimensions - pub grid_width: usize, +use crate::app::{App, ViewMode}; +use crate::command::{open_command_window, Command}; +use crate::habit::{Bit, Count, Habit}; +use crate::utils::{load_configuration_file, AppConfig}; - // color config - pub reached_color: Color, - pub todo_color: Color, - pub future_color: Color, -} +use chrono::NaiveDate; +use cursive::theme::{BaseColor, Color}; +use cursive::views::NamedView; +use cursive::Cursive; +use lazy_static::lazy_static; +use serde::{Deserialize, Serialize}; lazy_static! { pub static ref CONFIGURATION: AppConfig = load_configuration_file(); } -fn load_configuration_file() -> AppConfig { - return AppConfig { - true_chr: '·', - false_chr: '·', - future_chr: '·', - view_width: 25, - view_height: 8, - grid_width: 3, - reached_color: Color::Dark(BaseColor::Cyan), - todo_color: Color::Dark(BaseColor::Magenta), - future_color: Color::Light(BaseColor::Black), - }; -} - fn main() { - let mut s = Cursive::default(); + let mut s = Cursive::crossterm().unwrap(); // let mut gymming = Count::new("gym", 5); // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 11), 7); -- cgit v1.2.3