Add 'Time' and 'Tags' as proper task's properties, also add raw format handling

This commit is contained in:
Vyn 2024-04-11 11:42:13 +02:00
parent 3e7d8b4b70
commit bae67e6851
15 changed files with 142 additions and 49 deletions

View file

@ -5,6 +5,8 @@
*/
#include "Mirai.h"
#include "TaskItem.h"
#include <algorithm>
namespace mirai {
@ -12,9 +14,11 @@ namespace mirai {
auto tasksFile = TodoMdFormat::readFile(path);
files->push_back(std::move(tasksFile));
tags.clear();
for (auto& file : *files) {
for (auto& tag : file.getTags()) {
tags.push_back(tag);
for (auto& task : (*files)[0].getTasks()) {
for (auto& tag : task->getTags()) {
if (std::find(tags.begin(), tags.end(), tag) == tags.end()) {
tags.push_back(tag);
}
}
}
}
@ -25,6 +29,13 @@ namespace mirai {
}
}
void Mirai::addTask(TaskItem taskItem) {
(*files)[0].addTask(taskItem);
for (auto& view : views) {
view->update();
}
}
void Mirai::addTask(std::string text, std::string date) {
/*std::time_t t = std::time(nullptr);*/
/*std::tm tm = *std::localtime(&t);*/