diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 59 |
1 files changed, 14 insertions, 45 deletions
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 @@ | |||
1 | #![allow(unused_must_use)] | 1 | #![allow(unused_must_use)] |
2 | 2 | ||
3 | use chrono::NaiveDate; | 3 | use std::default::Default; |
4 | |||
5 | use lazy_static::lazy_static; | ||
6 | |||
7 | //use cursive::views::{Dialog, EditView, LinearLayout, ListView, SelectView}; | ||
8 | use cursive::theme::{BaseColor, Color}; | ||
9 | use cursive::views::NamedView; | ||
10 | use cursive::Cursive; | ||
11 | |||
12 | mod habit; | ||
13 | use crate::habit::{Bit, Count, Habit}; | ||
14 | 4 | ||
15 | mod app; | 5 | mod app; |
16 | mod command; | 6 | mod command; |
7 | mod habit; | ||
17 | mod theme; | 8 | mod theme; |
18 | use crate::app::{App, ViewMode}; | 9 | mod utils; |
19 | use crate::command::{open_command_window, Command}; | ||
20 | |||
21 | mod views; | 10 | mod views; |
22 | 11 | ||
23 | pub struct AppConfig { | 12 | use crate::app::{App, ViewMode}; |
24 | pub true_chr: char, | 13 | use crate::command::{open_command_window, Command}; |
25 | pub false_chr: char, | 14 | use crate::habit::{Bit, Count, Habit}; |
26 | pub future_chr: char, | 15 | use crate::utils::{load_configuration_file, AppConfig}; |
27 | |||
28 | // view dimensions | ||
29 | pub view_width: usize, | ||
30 | pub view_height: usize, | ||
31 | |||
32 | // app dimensions | ||
33 | pub grid_width: usize, | ||
34 | 16 | ||
35 | // color config | 17 | use chrono::NaiveDate; |
36 | pub reached_color: Color, | 18 | use cursive::theme::{BaseColor, Color}; |
37 | pub todo_color: Color, | 19 | use cursive::views::NamedView; |
38 | pub future_color: Color, | 20 | use cursive::Cursive; |
39 | } | 21 | use lazy_static::lazy_static; |
22 | use serde::{Deserialize, Serialize}; | ||
40 | 23 | ||
41 | lazy_static! { | 24 | lazy_static! { |
42 | pub static ref CONFIGURATION: AppConfig = load_configuration_file(); | 25 | pub static ref CONFIGURATION: AppConfig = load_configuration_file(); |
43 | } | 26 | } |
44 | 27 | ||
45 | fn load_configuration_file() -> AppConfig { | ||
46 | return AppConfig { | ||
47 | true_chr: '·', | ||
48 | false_chr: '·', | ||
49 | future_chr: '·', | ||
50 | view_width: 25, | ||
51 | view_height: 8, | ||
52 | grid_width: 3, | ||
53 | reached_color: Color::Dark(BaseColor::Cyan), | ||
54 | todo_color: Color::Dark(BaseColor::Magenta), | ||
55 | future_color: Color::Light(BaseColor::Black), | ||
56 | }; | ||
57 | } | ||
58 | |||
59 | fn main() { | 28 | fn main() { |
60 | let mut s = Cursive::default(); | 29 | let mut s = Cursive::crossterm().unwrap(); |
61 | 30 | ||
62 | // let mut gymming = Count::new("gym", 5); | 31 | // let mut gymming = Count::new("gym", 5); |
63 | // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 11), 7); | 32 | // gymming.insert_entry(NaiveDate::from_ymd(2020, 5, 11), 7); |