mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Date time is now visible on each task
This commit is contained in:
parent
839109b77b
commit
317b515e22
4 changed files with 27 additions and 10 deletions
|
@ -23,6 +23,13 @@ QString QMLTaskItem::getDate() {
|
||||||
return QString::fromStdString(taskItem->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() {
|
QList<QString> QMLTaskItem::getTags() {
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ struct QMLTaskItem {
|
||||||
Q_PROPERTY(QString date READ getDate)
|
Q_PROPERTY(QString date READ getDate)
|
||||||
Q_PROPERTY(QList<QString> tags READ getTags)
|
Q_PROPERTY(QList<QString> tags READ getTags)
|
||||||
Q_PROPERTY(bool shouldShowDate READ getShouldShowDate)
|
Q_PROPERTY(bool shouldShowDate READ getShouldShowDate)
|
||||||
|
Q_PROPERTY(QString time READ getTime)
|
||||||
QML_VALUE_TYPE(taskItem)
|
QML_VALUE_TYPE(taskItem)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -31,6 +32,7 @@ public:
|
||||||
QString getRawFormat();
|
QString getRawFormat();
|
||||||
QString getState();
|
QString getState();
|
||||||
QString getDate();
|
QString getDate();
|
||||||
|
QString getTime();
|
||||||
QList<QString> getTags();
|
QList<QString> getTags();
|
||||||
bool getShouldShowDate();
|
bool getShouldShowDate();
|
||||||
|
|
||||||
|
|
|
@ -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 regex("- \\[(\\s|X)\\] (([0-9]{2}:[0-9]{2})-([0-9]{2}:[0-9]{2}) > )?(.*?)( -- (.*))?");
|
||||||
std::regex_match(str, matches, regex);
|
std::regex_match(str, matches, regex);
|
||||||
|
|
||||||
std::cout << "line " << str << std::endl;
|
/*std::cout << "line " << str << std::endl;*/
|
||||||
std::cout << "M 0 " << matches[0] << std::endl;
|
/*std::cout << "M 0 " << matches[0] << std::endl;*/
|
||||||
std::cout << "M 1 " << matches[1] << std::endl;
|
/*std::cout << "M 1 " << matches[1] << std::endl;*/
|
||||||
std::cout << "M 2 " << matches[2] << std::endl;
|
/*std::cout << "M 2 " << matches[2] << std::endl;*/
|
||||||
std::cout << "M 3 " << matches[3] << std::endl;
|
/*std::cout << "M 3 " << matches[3] << std::endl;*/
|
||||||
std::cout << "M 4 " << matches[4] << std::endl;
|
/*std::cout << "M 4 " << matches[4] << std::endl;*/
|
||||||
std::cout << "M 5 " << matches[5] << std::endl;
|
/*std::cout << "M 5 " << matches[5] << std::endl;*/
|
||||||
std::cout << "M 6 " << matches[6] << std::endl;
|
/*std::cout << "M 6 " << matches[6] << std::endl;*/
|
||||||
std::cout << "M 7 " << matches[7] << std::endl;
|
/*std::cout << "M 7 " << matches[7] << std::endl;*/
|
||||||
|
|
||||||
std::string text = matches[5];
|
std::string text = matches[5];
|
||||||
trim(text);
|
trim(text);
|
||||||
|
|
|
@ -10,11 +10,19 @@ import QtQuick.Layouts
|
||||||
import Mirai
|
import Mirai
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
id: control
|
||||||
property taskItem task
|
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 {
|
AppCheckbox {
|
||||||
id: checkbox
|
id: checkbox
|
||||||
text: task.text
|
text: control.getFormatedText()
|
||||||
checked: task.state === 'DONE'
|
checked: task.state === 'DONE'
|
||||||
textComponent.color: task.date < internal.todayDate ? colorPalette.selected.palette.pink
|
textComponent.color: task.date < internal.todayDate ? colorPalette.selected.palette.pink
|
||||||
// : task.date === internal.todayDate ? colorPalette.selected.palette.sapphire
|
// : task.date === internal.todayDate ? colorPalette.selected.palette.sapphire
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue