diff --git a/src/Project-Orion/DateRangeSelector.qml b/src/Project-Orion/DateRangeSelector.qml index 8375b48..7297d3b 100644 --- a/src/Project-Orion/DateRangeSelector.qml +++ b/src/Project-Orion/DateRangeSelector.qml @@ -6,61 +6,90 @@ Dialog { width: 300 height: 300 + id: dateRangeRootDialog + required property date currentDate required property SystemPalette calendarActivePalette; required property color disabledTextColor; - GridLayout { - columns: 1 + enum ViewMode + { + DAY = 0, + MONTH = 1, + YEAR = 2 + } - Label - { - font.pixelSize: 22 - text: getMyDate() - } + property int viewMode: Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY") + property date beginDate; + property date endDate; - DayOfWeekRow { - locale: grid.locale - Layout.fillWidth: true - } + Flickable + { + onMovementStarted: console.log("Flick started") + onMovementEnded: console.log("Flick ended") + anchors.fill: parent + contentHeight: myGridLayout.height - MonthGrid - { + GridLayout { + id: myGridLayout + columns: 1 - id: grid - month: Calendar.January - year: currentDate.getFullYear() - locale: Qt.locale("en_US") - - Layout.fillWidth: true - Layout.fillHeight: true - delegate: Rectangle { - border.color: model.day === currentDate.getDay() ? "green": "transparent" - border.width: 3 - width: 30 - height: 20 - - MouseArea { - anchors.fill: parent - onClicked: { - if (model.day === 11) - console.log(model.day) - } - } - - Text { - anchors.centerIn: parent - font.pixelSize: 12 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: model.day - color: model.month === currentDate.getMonth() ? calendarActivePalette.text : disabledTextColor - } - - required property var model + Label + { + font.pixelSize: 22 + text: getMyDate() } - property date currentlySelectedDate: currentDate; + DayOfWeekRow { + visible: dateRangeRootDialog.viewMode === Qt.enumStringToValue(DateRangeSelector.ViewMode, "DAY") + locale: grid.locale + Layout.fillWidth: true + } + + MonthGrid + { + + id: grid + month: currentDate.getMonth() + year: currentDate.getFullYear() + locale: Qt.locale("en_US") + + Layout.fillWidth: true + Layout.fillHeight: true + delegate: Rectangle { + border.color: model.day === currentDate.getDay() ? "green": "transparent" + border.width: 3 + width: 30 + height: 20 + color: calendarActivePalette.base + + + Text { + anchors.centerIn: parent + font.pixelSize: 12 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: model.day + color: model.month === currentDate.getMonth() ? calendarActivePalette.text : disabledTextColor + } + + required property var model + } + + property date currentlySelectedDate: currentDate; + } + Row + { + Button + { + text: "Month" + } + + Button + { + text: "Year" + } + } } } @@ -68,4 +97,6 @@ Dialog { { return Qt.formatDateTime(currentDate, "MMM yyyy"); } + + standardButtons: Dialog.Ok | Dialog.Cancel }