diff --git a/src/project.cpp b/src/project.cpp index 1cbfad7..7341882 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -109,6 +109,7 @@ void ProjectList::load(std::string file_name){ task.add_time(work_time); proj.add_task(task); } + // needed to get the active_task pointers right _after_ adding tasks to projetcs active_task_arr[i] = active_t; add_project(proj); } diff --git a/src/track.cpp b/src/track.cpp index 760a684..4d6c1bb 100644 --- a/src/track.cpp +++ b/src/track.cpp @@ -26,6 +26,6 @@ void track(Project *proj){ work_h = (worktime % 86400) / 3600; work_m = (worktime % 3600) / 60; work_s = worktime % 60; - // TODO: replace with proper cout call + printf("Time worked on project: %02d:%02d:%02d\n", work_h,work_m,work_s ); } diff --git a/src/track.h b/src/track.h index d38d4be..48677a3 100644 --- a/src/track.h +++ b/src/track.h @@ -1,7 +1,9 @@ #ifndef TRACK_H #define TRACK_H + #include "project.h" extern int sigint; void handler(int signum); void track (Project *proj); + #endif diff --git a/src/tt.cpp b/src/tt.cpp index 0070dfa..2050915 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -9,38 +9,6 @@ int main(){ signal(SIGINT, handler); - Task task("Test task"); - task.add_time(140); - std::cout << "Task name: " << task.name << ", Work Time: " << task.work_time << std::endl; - - Project proj("Test Project"); - proj.add_task(task); - std::cout << "Project name: " << proj.name << " No tasks:"<< proj.num_tasks <<" contains task 0: " << proj.tasks[0].name << " with work time " << proj.tasks[0].work_time << std::endl; - - /*std::cout << "Removing Task 0 from Project" << std::endl; - proj.remove_task(0); - std::cout << "Number of tasks in project: " << proj.num_tasks << std::endl; - */ - ProjectList proj_list; - proj_list.add_project(proj); - std::cout << "Project List no of projects: " << proj_list.num_projects << " Name of active proj: " << proj_list.projects[proj_list.active_project_id].name << std::endl; - - std::cout << "Write Project List to file" << std::endl; - std::cout << "Active Task: " << proj_list.active_project->active_task->name << std::endl; - proj_list.save("test.bin"); - - std::cout << "Read Project List from file" << std::endl; - ProjectList list2; - list2.load("test.bin"); - - std::cout << "Project List no of projects: " << list2.num_projects << std::endl; - std::cout << "active Project: " << list2.active_project_id << std::endl; - std::cout << "Name of active proj: " << list2.projects[list2.active_project_id].name << std::endl; - std::cout << list2.active_project->name << std::endl; - std::cout << list2.active_project->active_task->name << std::endl; - std::cout << list2.active_project->active_task->work_time << std::endl; - - track(list2.active_project); return 0; }