tangled
alpha
login
or
join now
dzming.li
/
noctalia-plugins
0
fork
atom
Personal noctalia plugins collection
0
fork
atom
overview
issues
pulls
pipelines
Make panel taller and compress hours to show evenings
Dzming Li
2 weeks ago
c0167bc6
45fa65b4
+20
-5
1 changed file
expand all
collapse all
unified
split
weekly-calendar
Panel.qml
+20
-5
weekly-calendar/Panel.qml
···
13
13
readonly property var mainInstance: pluginApi?.mainInstance
14
14
readonly property var geometryPlaceholder: panelContainer
15
15
property real contentPreferredWidth: 950 * Style.uiScaleRatio
16
16
-
property real contentPreferredHeight: 700 * Style.uiScaleRatio
16
16
+
property real contentPreferredHeight: 900 * Style.uiScaleRatio
17
17
property real topHeaderHeight: 60 * Style.uiScaleRatio
18
18
readonly property bool allowAttach: mainInstance ? mainInstance.panelModeSetting === "attached" : false
19
19
readonly property bool panelAnchorHorizontalCenter: mainInstance ? mainInstance.panelModeSetting === "centered" : false
···
23
23
property bool showCreateDialog: false
24
24
property bool showCreateTaskDialog: false
25
25
26
26
-
property real hourHeight: 50 * Style.uiScaleRatio
26
26
+
property real defaultHourHeight: 50 * Style.uiScaleRatio
27
27
+
property real minHourHeight: 32 * Style.uiScaleRatio
28
28
+
property real hourHeight: defaultHourHeight
27
29
property real timeColumnWidth: 65 * Style.uiScaleRatio
28
30
property real daySpacing: 1 * Style.uiScaleRatio
29
31
30
32
// Panel doesn't need its own CalendarService connection - Main.qml handles it.
31
33
// When panel opens, trigger a fresh load if needed.
32
32
-
Component.onCompleted: mainInstance?.initializePlugin()
34
34
+
Component.onCompleted: {
35
35
+
mainInstance?.initializePlugin()
36
36
+
Qt.callLater(root.adjustHourHeightForViewport)
37
37
+
}
33
38
onVisibleChanged: if (visible && mainInstance) {
34
39
mainInstance.refreshView()
35
40
mainInstance.goToToday()
36
41
Qt.callLater(root.scrollToCurrentTime)
37
42
mainInstance.loadTodos()
43
43
+
Qt.callLater(root.adjustHourHeightForViewport)
44
44
+
}
45
45
+
46
46
+
function adjustHourHeightForViewport() {
47
47
+
if (!calendarFlickable || calendarFlickable.height <= 0) return
48
48
+
// Target showing 08:30–24:00 (~15.5 hours) without scroll; fall back to min height if space is tight.
49
49
+
var target = calendarFlickable.height / 15.5
50
50
+
var newHeight = Math.max(minHourHeight, Math.min(defaultHourHeight, target))
51
51
+
if (Math.abs(newHeight - hourHeight) > 0.5) hourHeight = newHeight
38
52
}
39
53
40
54
// Scroll to time indicator position
···
615
629
clip: true
616
630
contentHeight: 24 * (root.hourHeight)
617
631
boundsBehavior: Flickable.DragOverBounds
632
632
+
onHeightChanged: Qt.callLater(root.adjustHourHeightForViewport)
618
633
619
634
Component.onCompleted: {
620
635
calendarFlickable.forceActiveFocus()
···
727
742
property real endHour: model.endTime.getHours() + model.endTime.getMinutes() / 60
728
743
property real duration: Math.max(0, (model.endTime - model.startTime) / 3600000)
729
744
730
730
-
property real exactHeight: Math.max(1, duration * (mainInstance?.hourHeight || 50) - 1)
745
745
+
property real exactHeight: Math.max(1, duration * (root.hourHeight) - 1)
731
746
property bool isCompact: exactHeight < 40
732
747
property var overlapInfo: mainInstance?.overlappingEventsData?.[index] ?? {
733
748
xOffset: 0, width: (mainInstance?.dayColumnWidth) - 8, lane: 0, totalLanes: 1
···
739
754
width: eventWidth
740
755
height: exactHeight
741
756
x: dayIndex * ((mainInstance?.dayColumnWidth) + (root.daySpacing)) + eventXOffset
742
742
-
y: startHour * (mainInstance?.hourHeight || 50)
757
757
+
y: startHour * (root.hourHeight)
743
758
z: 100 + overlapInfo.lane
744
759
745
760
property bool isTodoItem: model.isTodo || false