tangled
alpha
login
or
join now
dzming.li
/
noctalia-plugins
0
fork
atom
Personal noctalia plugins collection
0
fork
atom
overview
issues
pulls
pipelines
Render timed todos as deadline bars
Dzming Li
2 weeks ago
a0207e99
363f8224
+27
-12
2 changed files
expand all
collapse all
unified
split
weekly-calendar
Main.qml
Panel.qml
+4
-1
weekly-calendar/Main.qml
···
294
294
if (!showCompletedTodos && todo.status === "COMPLETED") continue
295
295
296
296
var isDueAllDay = (dueDate.getHours() === 0 && dueDate.getMinutes() === 0)
297
297
+
// Render timed todos as short deadline markers (~8–10 px tall)
297
298
var endDate = isDueAllDay ? new Date(dueDate.getTime() + 86400000)
298
298
-
: new Date(dueDate.getTime() + 1800000)
299
299
+
: new Date(dueDate.getTime() + 5 * 60000)
299
300
300
301
var todoEvent = {
301
302
id: "todo-" + todo.uid,
···
312
313
calendarUid: todo.calendarUid,
313
314
todoStatus: todo.status,
314
315
todoPriority: todo.priority,
316
316
+
// Helper flags for compact rendering in Panel.qml
317
317
+
isDeadlineMarker: !isDueAllDay
315
318
}
316
319
317
320
if (isDueAllDay) {
+23
-11
weekly-calendar/Panel.qml
···
589
589
delegate: Item {
590
590
property var eventData: modelData
591
591
property bool isTodoItem: eventData.isTodo || false
592
592
+
property bool isDeadline: eventData.isDeadlineMarker || false
592
593
x: eventData.startDay * ((mainInstance?.dayColumnWidth) + (root.daySpacing))
593
594
y: eventData.lane * 25
594
595
width: (eventData.spanDays * ((mainInstance?.dayColumnWidth) + (root.daySpacing))) - (root.daySpacing)
595
595
-
height: 24
596
596
+
height: isDeadline ? 10 : 24
596
597
597
598
Rectangle {
598
599
anchors.fill: parent
599
599
-
color: isTodoItem ? Color.mSecondary : Color.mTertiary
600
600
+
color: isDeadline ? Color.mSecondary : (isTodoItem ? Color.mSecondary : Color.mTertiary)
600
601
radius: Style.radiusS
601
602
opacity: isTodoItem && eventData.todoStatus === "COMPLETED" ? 0.5 : 1.0
602
603
NText {
603
604
anchors.fill: parent; anchors.margins: 4
604
604
-
text: (isTodoItem ? (eventData.todoStatus === "COMPLETED" ? "\u2611 " : "\u2610 ") : "") + eventData.title
605
605
-
color: isTodoItem ? Color.mOnSecondary : Color.mOnTertiary
605
605
+
text: isDeadline ? "" : (isTodoItem ? (eventData.todoStatus === "COMPLETED" ? "\u2611 " : "\u2610 ") : "") + eventData.title
606
606
+
color: isDeadline ? Color.mOnSecondary : (isTodoItem ? Color.mOnSecondary : Color.mOnTertiary)
606
607
font.pointSize: Style.fontSizeXXS; font.weight: Font.Medium
607
608
font.strikeout: isTodoItem && eventData.todoStatus === "COMPLETED"
608
609
elide: Text.ElideRight; verticalAlignment: Text.AlignVCenter
···
767
768
property real eventWidth: overlapInfo.width - 1
768
769
property real eventXOffset: overlapInfo.xOffset
769
770
771
771
+
property bool isTodoItem: model.isTodo || false
772
772
+
property bool isDeadline: model.isDeadlineMarker || false
773
773
+
property color eventColor: isDeadline ? Color.mSecondary : (isTodoItem ? Color.mSecondary : Color.mPrimary)
774
774
+
property color eventTextColor: isDeadline ? Color.mOnSecondary : (isTodoItem ? Color.mOnSecondary : Color.mOnPrimary)
775
775
+
770
776
visible: dayIndex >= 0 && dayIndex < 7 && duration > 0
771
777
width: eventWidth
772
772
-
height: exactHeight
778
778
+
height: isDeadline ? Math.max(8, Math.min(12, exactHeight)) : exactHeight
773
779
x: dayIndex * ((mainInstance?.dayColumnWidth) + (root.daySpacing)) + eventXOffset
774
780
y: startHour * (root.hourHeight)
775
781
z: 100 + overlapInfo.lane
776
782
777
777
-
property bool isTodoItem: model.isTodo || false
778
778
-
property color eventColor: isTodoItem ? Color.mSecondary : Color.mPrimary
779
779
-
property color eventTextColor: isTodoItem ? Color.mOnSecondary : Color.mOnPrimary
780
780
-
781
783
Rectangle {
782
784
anchors.fill: parent
783
785
color: eventColor
784
786
radius: Style.radiusS
785
785
-
opacity: isTodoItem && model.todoStatus === "COMPLETED" ? 0.5 : 0.9
787
787
+
opacity: isDeadline ? 0.95 : (isTodoItem && model.todoStatus === "COMPLETED" ? 0.5 : 0.9)
786
788
clip: true
787
789
Rectangle {
788
790
visible: exactHeight < 5 && overlapInfo.lane > 0
···
796
798
anchors.fill: parent
797
799
anchors.margins: exactHeight < 10 ? 1 : Style.marginS
798
800
anchors.leftMargin: exactHeight < 10 ? 1 : Style.marginS + 3
799
799
-
sourceComponent: isCompact ? compactLayout : normalLayout
801
801
+
sourceComponent: isDeadline ? deadlineLayout : (isCompact ? compactLayout : normalLayout)
800
802
}
801
803
}
802
804
···
845
847
font.strikeout: isTodoItem && model.todoStatus === "COMPLETED"
846
848
elide: Text.ElideRight; verticalAlignment: Text.AlignVCenter
847
849
width: parent.width - 3
850
850
+
}
851
851
+
}
852
852
+
853
853
+
Component {
854
854
+
id: deadlineLayout
855
855
+
Rectangle {
856
856
+
anchors.fill: parent
857
857
+
color: eventColor
858
858
+
radius: parent.radius
859
859
+
opacity: 0.95
848
860
}
849
861
}
850
862