1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
Task Time Tracker
=================
# notes
- Only one task may be active;
- The log will be a circular array. During app startup the array will be loaded from a csv file. The log array should have a fixed length. Each string in the array should also have fixed length. Loading and storing it to a file will be implemented using readline and writeline operations. In order for the log file to be CSV compatible, we must always use the same format when writing to the log array. Best approach is to use a function that enfores the CSV format. The log should be written to a file every 5 minutes (not set in stone), if required; such may be done using a `log_is_dirty` flag. A possible structure for the log entries is: {uint64_t timestamp; uint8_t action[16]; uint8_t task_name[MAX_TASK_NAME+1]; uint8_t notes[16]; }.
# know-how
- [ncurses colors](https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/color.html#COLORBASICS)
- [pprintf](https://cplusplus.com/reference/cstdio/printf/)
- [intmax_t](https://wiki.sei.cmu.edu/confluence/plugins/servlet/mobile?contentId=87152366#content/view/87152366)
# to-do list
- [x] Include check on number of char bits;
- [x] Decide once for all if I'll be using uint8_t or char for strings: use char.
- [x] maybe rename to task-time-tracker?
- [x] Remove hash stuff;
- [x] Tasks should have a `modified_on` timestamp field;
- [x] Change capacity to size_t.
- [x] Change active_task to active_task_ptrdiff.
- [x] Use selected_task_ptrdiff?
- [x] Make sure task names don't include commas ',';
- [x] Format time being displayed.
- [x] Replace max_capacity by its true value;
- [x] Replace intmax_t by int64_t;
- [x] Adapt input cycle to work with `database_t *db` to allow pointing to database/archive.
- [x] Show a symbol to let the user know when we're seeing the archive.
- [x] Status of task will allow to keep counting time even when the process gets terminated forcefully;
- [x] Review code: char !uint8_t;
- [x] Make sure that only one task is running at each time;
- [x] Mouse selection is broken due to entire TUI update: No, it was fixed by using `erase()` on the `draw_tui` instead of `clear()`;
- [x] I bet the headers are no longer being used all on a single cycle. Let's separate them and include "header_title_archive";
- [x] Rename layout members: title_header, archive_header, total_header, days_headers, column_widths, column_alignments, headers_paddings.
- [x] Using the archive header, we can remove the top-left-corner diamond on the archive.
- [x] Allow to cancel a rename_task operation: you can do it by leaving it blank.
- [x] Make sure we are not using `strcat` and `strcpy`... or that we are using them wisely (famous last words).
- [x] Make archive be stored in CSV format: takes less space and allows to quickly archive by appending to end of file;
- [x] Implement `append_to_csv(task_t *task, char *path_name)` and use it in archive function;
- [x] At startup, check for required files and create them if not present.
- [x] Allow to archive task using keys: `a` and `A`;
- [x] By default, store files on `~/.config/task_time_tracker/` or `~/.local/share/task_time_tracker` and allow to store elsewhere if passed by argument `--config`.
- [x] Allow usage of `ttt: ./ttt --dpath ./` to change the app folder: To changes app data path change the environment variable HOME (USERPROFILE for windows users).
- [x] Clone (replicate) task; If task is active, mark newly created task as inactive;
- [x] Check if next/previous is safe against overflows/underflows using https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
- [x] Confirm delete_task operation by show confirmation message on selected line (horizontally centered).
- [x] Check totals update speedup using https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
- For 1M entries, generic C code runs in 12.0ms while special approaches using builtins or SIMD takes around 9.5ms. Not worth the effort.
- [ ] Change task order (using task_t tmp_task + memcpy);
- [ ] Allow to jump to specific task by index number using key `g` and `G`;
- [ ] Add/remove time using keys: `F3`;
- [ ] Add/remove time for any day of week;
- [ ] Implement logs as described above.
- [ ] Go over all `TODO` items;
- [ ] Rethink keys;
- [ ] Create task using keys: `c` and `C`;
- [ ] Delete task using keys: `d` and `D`;
- [ ] Change task name using keys: `F2`;
- [ ] Clone task using keys: `r` and `R`;
- [ ] Cleanup `draw_tui`:
- Selected and active tasks should be drawn after everything else.
- Try printing each row;
- Try printing headers and footers, then each row;
- Allow to repaint just certain parts of the TUI; this should allow to call `draw_tui` with a flag saying which parts need to be drawn;
- [ ] Improve total_times:
- Since we provide a way to recalculate the total values, we may just automatically recalculate them when we open the database and one of the totals has saturated?
- Create function to recalculate them. Shouldn't take so long, right?
- Decide when this will run.
- Check for overflow/underflow when adding/subtracting times;
- Only recalculate when we're potentially exiting a saturation point;
- [ ] Space invaders on konami code;
|