mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 01:13:19 +00:00
45 lines
1.2 KiB
QML
45 lines
1.2 KiB
QML
/*
|
|
* Mirai. Copyright (C) 2024 Vyn
|
|
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
|
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
|
*/
|
|
|
|
import QtQuick
|
|
import QtQuick.Window
|
|
import QtQuick.Layouts
|
|
import Mirai
|
|
|
|
RowLayout {
|
|
id: control
|
|
property taskItem task
|
|
|
|
function getFormatedText() {
|
|
if (task?.time && task.time != "") {
|
|
return `<font color=\"${colorPalette.selected.textPlaceholder}\">${task.time} \></font> ${task.text}`
|
|
}
|
|
return task.text
|
|
}
|
|
|
|
AppCheckbox {
|
|
id: checkbox
|
|
text: control.getFormatedText()
|
|
checked: task.state === 'DONE'
|
|
textComponent.font.pointSize: 14
|
|
textComponent.color: task.date < internal.todayDate ? colorPalette.selected.red
|
|
// : task.date === internal.todayDate ? colorPalette.selected.palette.sapphire
|
|
: colorPalette.selected.text
|
|
onClicked: {
|
|
backend.updateTodo(index, modelData.state === 'DONE' ? "TODO" : "DONE", modelData.text, modelData.date)
|
|
}
|
|
}
|
|
|
|
Repeater {
|
|
model: task.tags
|
|
Tag {
|
|
Layout.alignment: Qt.AlignVCenter
|
|
text: modelData
|
|
backgroundColor: colorPalette.selected.fieldBackground
|
|
textColor: colorPalette.selected.accent
|
|
}
|
|
}
|
|
}
|