Date time is now visible on each task

This commit is contained in:
Vyn 2024-04-11 14:08:09 +02:00
parent 839109b77b
commit 317b515e22
4 changed files with 27 additions and 10 deletions

View file

@ -23,6 +23,13 @@ QString QMLTaskItem::getDate() {
return QString::fromStdString(taskItem->getDate());
}
QString QMLTaskItem::getTime() {
if (taskItem->getStartTime() != "" && taskItem->getEndTime() != "") {
return QString::fromStdString(taskItem->getStartTime() + "-" + taskItem->getEndTime());
}
return "";
}
QList<QString> QMLTaskItem::getTags() {
return tags;
}

View file

@ -23,6 +23,7 @@ struct QMLTaskItem {
Q_PROPERTY(QString date READ getDate)
Q_PROPERTY(QList<QString> tags READ getTags)
Q_PROPERTY(bool shouldShowDate READ getShouldShowDate)
Q_PROPERTY(QString time READ getTime)
QML_VALUE_TYPE(taskItem)
public:
@ -31,6 +32,7 @@ public:
QString getRawFormat();
QString getState();
QString getDate();
QString getTime();
QList<QString> getTags();
bool getShouldShowDate();

View file

@ -87,15 +87,15 @@ namespace mirai {
std::regex regex("- \\[(\\s|X)\\] (([0-9]{2}:[0-9]{2})-([0-9]{2}:[0-9]{2}) > )?(.*?)( -- (.*))?");
std::regex_match(str, matches, regex);
std::cout << "line " << str << std::endl;
std::cout << "M 0 " << matches[0] << std::endl;
std::cout << "M 1 " << matches[1] << std::endl;
std::cout << "M 2 " << matches[2] << std::endl;
std::cout << "M 3 " << matches[3] << std::endl;
std::cout << "M 4 " << matches[4] << std::endl;
std::cout << "M 5 " << matches[5] << std::endl;
std::cout << "M 6 " << matches[6] << std::endl;
std::cout << "M 7 " << matches[7] << std::endl;
/*std::cout << "line " << str << std::endl;*/
/*std::cout << "M 0 " << matches[0] << std::endl;*/
/*std::cout << "M 1 " << matches[1] << std::endl;*/
/*std::cout << "M 2 " << matches[2] << std::endl;*/
/*std::cout << "M 3 " << matches[3] << std::endl;*/
/*std::cout << "M 4 " << matches[4] << std::endl;*/
/*std::cout << "M 5 " << matches[5] << std::endl;*/
/*std::cout << "M 6 " << matches[6] << std::endl;*/
/*std::cout << "M 7 " << matches[7] << std::endl;*/
std::string text = matches[5];
trim(text);

View file

@ -10,11 +10,19 @@ import QtQuick.Layouts
import Mirai
RowLayout {
id: control
property taskItem task
function getFormatedText() {
if (task?.time && task.time != "") {
return `<font color=\"${colorPalette.selected.palette.overlay1}\">${task.time} \></font> ${task.text}`
}
return task.text
}
AppCheckbox {
id: checkbox
text: task.text
text: control.getFormatedText()
checked: task.state === 'DONE'
textComponent.color: task.date < internal.todayDate ? colorPalette.selected.palette.pink
// : task.date === internal.todayDate ? colorPalette.selected.palette.sapphire