2025-07-03 22:51:45 +02:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
|
|
|
|
* Copyright (C) 2025 Tom Zander <tom@flowee.org>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls.Basic as QQC2
|
|
|
|
|
import "../Flowee" as Flowee
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property date selected: new Date()
|
2025-08-03 20:35:31 +02:00
|
|
|
property alias oldCutoff: mini.oldCutoff
|
2025-07-03 22:51:45 +02:00
|
|
|
|
|
|
|
|
width: implicitWidth
|
|
|
|
|
height: implicitHeight
|
|
|
|
|
implicitWidth: mini.implicitWidth * mini.scale
|
|
|
|
|
implicitHeight: mini.implicitHeight * mini.scale
|
|
|
|
|
|
|
|
|
|
MiniCalendarWidget {
|
|
|
|
|
id: mini
|
|
|
|
|
y: 5
|
|
|
|
|
scale: 2
|
|
|
|
|
month: {
|
|
|
|
|
if (isNaN(root.selected))
|
|
|
|
|
root.selected = new Date();
|
|
|
|
|
var s = root.selected;
|
|
|
|
|
return new Date(s.getFullYear(), s.getMonth(), 1);
|
|
|
|
|
}
|
2025-08-03 20:35:31 +02:00
|
|
|
transformOrigin: Item.Top
|
2025-07-03 22:51:45 +02:00
|
|
|
x: (parent.width - width) / 2
|
|
|
|
|
monthFormat: "MMMM yyyy"
|
|
|
|
|
highlights: {
|
|
|
|
|
var day = [];
|
|
|
|
|
if (root.selected.getFullYear() == month.getFullYear()
|
|
|
|
|
&& root.selected.getMonth() == month.getMonth()) {
|
|
|
|
|
day.push(root.selected.getDate());
|
|
|
|
|
}
|
|
|
|
|
return day;
|
|
|
|
|
}
|
|
|
|
|
onSelectedChanged: {
|
|
|
|
|
if (selected !== 0) {
|
|
|
|
|
var m = month;
|
|
|
|
|
root.selected = new Date(m.getFullYear(), m.getMonth(), selected);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onMonthChanged: selected = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
text: "<"
|
|
|
|
|
y: 10
|
2025-07-08 17:42:52 +02:00
|
|
|
x: 15
|
2025-07-03 22:51:45 +02:00
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.margins: -8
|
|
|
|
|
onClicked: mini.month.setMonth(mini.month.getMonth() - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
text: ">"
|
2025-07-08 17:42:52 +02:00
|
|
|
x: parent.width - width - 15
|
2025-07-03 22:51:45 +02:00
|
|
|
y: 10
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.margins: -8
|
|
|
|
|
onClicked: mini.month.setMonth(mini.month.getMonth() + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|