From 9f43833cb181e4c61659c98f9ecf21f40d398c15 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 16 Nov 2025 17:26:00 +0200 Subject: [PATCH] Added a new QML file for UserConfiguration and also the initial implementation for a CalendarGrid --- src/Project-Orion/Appheader.qml | 7 ++++ src/Project-Orion/CMakeLists.txt | 2 ++ src/Project-Orion/CalendarGrid.qml | 48 +++++++++++++++++++++++++ src/Project-Orion/UserConfiguration.qml | 44 +++++++++++++++++++++++ src/Project-Orion/resources.qrc | 1 + 5 files changed, 102 insertions(+) create mode 100644 src/Project-Orion/CalendarGrid.qml create mode 100644 src/Project-Orion/UserConfiguration.qml diff --git a/src/Project-Orion/Appheader.qml b/src/Project-Orion/Appheader.qml index e228d1f..c6b5ee4 100644 --- a/src/Project-Orion/Appheader.qml +++ b/src/Project-Orion/Appheader.qml @@ -30,6 +30,13 @@ Rectangle width: 50 height: parent.height - 4 anchors.right: parent.right + + onClicked: userConfiguration.open() + } + + UserConfiguration + { + id: userConfiguration } } diff --git a/src/Project-Orion/CMakeLists.txt b/src/Project-Orion/CMakeLists.txt index 375ac1f..3f43fb5 100644 --- a/src/Project-Orion/CMakeLists.txt +++ b/src/Project-Orion/CMakeLists.txt @@ -25,6 +25,8 @@ qt_add_qml_module(appProject-Orion QML_FILES CustomButton.qml QML_FILES Appheader.qml RESOURCES resources.qrc + QML_FILES CalendarGrid.qml + QML_FILES UserConfiguration.qml ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. diff --git a/src/Project-Orion/CalendarGrid.qml b/src/Project-Orion/CalendarGrid.qml new file mode 100644 index 0000000..2144a2e --- /dev/null +++ b/src/Project-Orion/CalendarGrid.qml @@ -0,0 +1,48 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls + +GridLayout { + columns: 2 + + DayOfWeekRow { + locale: grid.locale + + Layout.column: 1 + Layout.fillWidth: true + } + + WeekNumberColumn { + month: grid.month + year: grid.year + locale: grid.locale + Layout.fillHeight: true + delegate: Text { + text: weekNumber + font: control.font + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: myPalette.text + required property int weekNumber + } + } + + MonthGrid { + id: grid + month: Calendar.November + year: 2025 + locale: Qt.locale("en_US") + + Layout.fillWidth: true + Layout.fillHeight: true + delegate: Text { + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + opacity: model.month === monthGrid.month ? 1 : 0 + text: monthGrid.locale.toString(model.date, "d") + font: monthGrid.font + + required property var model + } + } +} diff --git a/src/Project-Orion/UserConfiguration.qml b/src/Project-Orion/UserConfiguration.qml new file mode 100644 index 0000000..2f0ef8c --- /dev/null +++ b/src/Project-Orion/UserConfiguration.qml @@ -0,0 +1,44 @@ +import QtQuick +import QtQuick.Controls + +Dialog { + id: dialog + modal: true + title: "Configure a new user" + width: 600 + height: 400 + + Row { + id: usernameRow + spacing: 100 + + Label { + id: nameFieldLabel + text: qsTr("Username:") + } + + TextField { + id: nameField + color: myPalette.text + width: 400 + placeholderText: "Enter the new user's username" + } + } + + Row { + id: dateOfBirthRow + anchors.top: usernameRow.bottom + spacing: 100 + + Label { + id: dateOfBirthLabel + text: qsTr("Date of birth:") + } + + CalendarGrid { + id: dateOfBirthGrid + } + } + + standardButtons: Dialog.Ok | Dialog.Cancel +} diff --git a/src/Project-Orion/resources.qrc b/src/Project-Orion/resources.qrc index bbd882d..6f1067b 100644 --- a/src/Project-Orion/resources.qrc +++ b/src/Project-Orion/resources.qrc @@ -3,4 +3,5 @@ user.svg tick.svg +