diff --git a/src/activities/server/Server.qml b/src/activities/server/Server.qml index 0fe161ac8..d42f4a0ed 100644 --- a/src/activities/server/Server.qml +++ b/src/activities/server/Server.qml @@ -1,195 +1,194 @@ /* GCompris - server.qml * * Copyright (C) 2018 YOUR NAME * * Authors: * (GTK+ version) * YOUR NAME (Qt Quick port) * * 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 . */ /*import QtQuick 2.2 import QtQuick.Controls 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Controls.Material 2.1*/ import QtQuick 2.0 import QtQuick.Controls 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Controls.Material 2.1 import GCompris 1.0 import "../../core" import "server.js" as Activity import "components" ActivityBase { id: activity onStart: focus = true onStop: {} pageComponent: Rectangle { id: background anchors.fill: parent color: "#ABCDEF" signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) contentFrame.replace("views/DashboardView.qml"); } // Add here the QML items you need to access in javascript QtObject { id: items property Item main: activity.main property alias background: background property alias bar: bar property alias bonus: bonus } onStart: { Activity.start(items) } onStop: { Activity.stop() } Connections { target: masterController.ui_navigationController onGoManagePupilsView: contentFrame.replace("views/ManagePupilsView.qml") onGoCreateClientView: contentFrame.replace("views/CreateClientView.qml") onGoDashboardView: contentFrame.replace("views/DashboardView.qml") onGoEditClientView: contentFrame.replace("views/EditClientView.qml", {selectedClient: client}) onGoFindClientView: contentFrame.replace("views/FindClientView.qml") - // onGoManagePupilsView: contentFrame.replace("views/ManagePupilsView.qml") - // onGoManageGroupsView: contentFrame.replace("views/ManageGroupsView.qml") + onGoManageWorkPlanView: contentFrame.replace("views/ManageWorkPlanView.qml") } NavigationBar { id: navigationBar } StackView { id: contentFrame anchors { top: parent.top bottom: ApplicationSettings.isBarHidden ? parent.bottom : bar.top right: navigationBar.left left: parent.left } initialItem: "qrc:/gcompris/src/activities/server/views/SplashView.qml" clip: true } /* Drawer { id: drawer width: Math.min(background.width, background.height) / 3 * 2 height: background.height ListView { focus: true currentIndex: -1 anchors.fill: parent delegate: ItemDelegate { width: parent.width text: model.text highlighted: ListView.isCurrentItem onClicked: { drawer.close() //model.triggered() } } model: ListModel { ListElement { text: qsTr("Open...") // triggered: { fileOpenDialog.open(); } } ListElement { text: qsTr("About...") // triggered: function(){ console.log("f"); } } } ScrollIndicator.vertical: ScrollIndicator { } } } ToolBar { Material.background: Material.Orange anchors.top: parent.top anchors.left: parent.left ToolButton { id: menuButton anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter icon.source: "resource/baseline-menu-24px.svg" onClicked: drawer.open() } Label { anchors.centerIn: parent text: "Image Viewer" font.pixelSize: 20 elide: Label.ElideRight } } FileDialog { id: fileOpenDialog title: "Select an image file" folder: shortcuts.documents nameFilters: [ "Image files (*.png *.jpeg *.jpg)", ] onAccepted: { image.source = fileOpenDialog.fileUrl } }*/ DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/server/components/GroupsNavigationBar.qml b/src/activities/server/components/GroupsNavigationBar.qml deleted file mode 100644 index a446f88e7..000000000 --- a/src/activities/server/components/GroupsNavigationBar.qml +++ /dev/null @@ -1,73 +0,0 @@ -import QtQuick 2.9 -import "../../../core" - -Item { - property bool isCollapsed: true - - anchors { - top: parent.top - bottom: parent.bottom - right: parent.right - } - width: isCollapsed ? Style.widthNavigationBarCollapsed : Style.heightNavigationBarExpanded - - Rectangle { - anchors.fill: parent - color: Style.colourNavigationBarBackground - - Column { - width: parent.width - - NavigationButton { - iconCharacter: "\uf0c9" - description: "" - hoverColour: "#993333" - onNavigationButtonClicked: isCollapsed = !isCollapsed - } - NavigationButton { - iconCharacter: "\uf1e6" - description: "Connecting devices" - hoverColour: "#dc8a00" - onNavigationButtonClicked: masterController.ui_navigationController.goDashboardView(); - } - NavigationButton { - iconCharacter: "\uf681" - description: "Follow results" - hoverColour: "#dccd00" - onNavigationButtonClicked: masterController.ui_navigationController.goCreateClientView(); - } - NavigationButton { - iconCharacter: "\uf0c0" - description: "Managing Pupils" - hoverColour: "#8aef63" - onNavigationButtonClicked: masterController.ui_navigationController.goManagePupilsView(); - } - NavigationButton { - iconCharacter: "\uf0ae" - description: "Manages Sequences" - hoverColour: "#8aef63" - onNavigationButtonClicked: masterController.ui_navigationController.goFindClientView(); - } - - - NavigationButton { - iconCharacter: "\uf015" - description: "Dashboard" - hoverColour: "#dc8a00" - onNavigationButtonClicked: masterController.ui_navigationController.goDashboardView(); - } - NavigationButton { - iconCharacter: "\uf0c0" - description: "New Client" - hoverColour: "#dccd00" - onNavigationButtonClicked: masterController.ui_navigationController.goCreateClientView(); - } - NavigationButton { - iconCharacter: "\uf002" - description: "Find Client" - hoverColour: "#8aef63" - onNavigationButtonClicked: masterController.ui_navigationController.goFindClientView(); - } - } - } -} diff --git a/src/activities/server/components/PupilsNavigationBar.qml b/src/activities/server/components/ManageGroupsBar.qml similarity index 68% rename from src/activities/server/components/PupilsNavigationBar.qml rename to src/activities/server/components/ManageGroupsBar.qml index a8c843005..a03967bc4 100644 --- a/src/activities/server/components/PupilsNavigationBar.qml +++ b/src/activities/server/components/ManageGroupsBar.qml @@ -1,183 +1,267 @@ import QtQuick 2.9 import QtQuick.Layouts 1.12 +//import QtQuick.Controls 1.4 import "../../../core" +import QtQuick.Dialogs 1.3 +import QtQuick.Controls 2.3 + +import "../components" + +import "../server.js" as Activity Item { + id: pupilsNavigationBarItem property bool isCollapsed: true property int groupTextMargin: 30 anchors { top: parent.top bottom: parent.bottom left: parent.left } width: Style.widthNavigationButton Rectangle { id: pupilsNavigationRectangle width: parent.width height: parent.height color: Style.colourBackground border.width: 1 border.color: "lightgrey" ColumnLayout{ id: groupNames spacing: 2 anchors.top: parent.top width: parent.width - 10 //groups header Rectangle { id: test height: 60 width: parent.width RowLayout { width: parent.width height: parent.height Rectangle { Layout.fillHeight: true Layout.minimumWidth: pupilsNavigationRectangle.width/5 Text { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter color: Style.colourNavigationBarBackground font { family: Style.fontAwesome pixelSize: Style.pixelSizeNavigationBarIcon/2 } text: "\uf0c0" font.bold: true leftPadding: 20 topPadding: 20 } } Rectangle { implicitHeight: 60 Layout.fillWidth: true Layout.fillHeight: true Text { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left leftPadding: 10 topPadding: 20 text: "Groups" font.bold: true color: Style.colourNavigationBarBackground } } } } //groups names Repeater { id: repeater - model: ["CP", "CE1", "CE2"] + model: Activity.groupsNamesArray Rectangle { width: groupNames.width Layout.preferredHeight: 40 RowLayout { width: pupilsNavigationRectangle.width - 10 height: 40 Rectangle { Layout.fillHeight: true Layout.minimumWidth: pupilsNavigationRectangle.width/5 Text { text: "\uf054" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter leftPadding: 20 color: "grey" font { family: Style.fontAwesome pixelSize: Style.pixelSizeNavigationBarIcon / 2 } } } Rectangle { Layout.fillWidth: true Layout.fillHeight: true height: 40 Text { text: modelData anchors.verticalCenter: parent.verticalCenter width: parent.width color: "grey" leftPadding: 5 elide: Text.ElideRight } } Rectangle { id: elipsis Layout.minimumWidth: pupilsNavigationRectangle.width/5 Layout.fillHeight: true height: 40 Text { id: elipsisText text: "\uf142" //elipsis-v anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter color: "grey" font { family: Style.fontAwesome pixelSize: Style.pixelSizeNavigationBarIcon / 2 //? see with style } } MouseArea { anchors.fill: parent hoverEnabled: true onClicked: { elipsisText.color = Style.colourNavigationBarBackground } onEntered: { elipsisText.color = Style.colourNavigationBarBackground } onExited: { elipsisText.color = "grey" } } } } } } } Rectangle { id: addAGroupLabelRectangle anchors.top: groupNames.bottom anchors.left: parent.left width: parent.width - 10 height: 40 Text { id: addAGroupText text: "\uf067" + qsTr(" Add a group") anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter leftPadding: 5 color: "grey" font { family: Style.fontAwesome pixelSize: Style.pixelSizeNavigationBarIcon / 3 //? see with style } onHoveredLinkChanged: { color = "blue" console.log("fffffffff") } } MouseArea { - anchors.fill: parent - hoverEnabled: true - onClicked: { addAGroupText.color = Style.colourNavigationBarBackground } - onEntered: { addAGroupText.color = Style.colourNavigationBarBackground } - onExited: { addAGroupText.color = "grey" } + anchors.fill: parent + hoverEnabled: true + onClicked: { + addAGroupText.color = Style.colourNavigationBarBackground + addGroupDialog.open() + console.log("clicked ...") + } + onEntered: { addAGroupText.color = Style.colourNavigationBarBackground } + onExited: { addAGroupText.color = "grey" } + } + + Popup { + id: addGroupDialog + + anchors.centerIn: Overlay.overlay + width: 600 + height: 200 + modal: true + focus: true + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + Text { + id: addGroupDialogText + + x: parent.width / 10 + y: parent.height / 8 + text: qsTr("Add a group name") + font.bold: true + font { + family: Style.fontAwesome + pixelSize: 20 + } + } + + TextInput { + id: groupNamesTextInput + + x: parent.width / 10 + y: parent.height / 3 + text: "Hello" + cursorVisible: false + font { + family: Style.fontAwesome + pixelSize: 20 + } + } + + Rectangle { + id: groupNameTextInputRectangle + + anchors.top: groupNamesTextInput.bottom + anchors.left: groupNamesTextInput.left + width: addGroupDialog.width * 4/6 + height: 3 + color: Style.colourNavigationBarBackground + } + + ViewButton { + id: saveButton + + anchors.right: parent.right + anchors.bottom: parent.bottom + text: qsTr("Save") + onClicked: { + console.log("save...") + Activity.groupsNamesArray.push("Musique") + addGroupDialog.close(); + } + } + + ViewButton { + id: cancelButton + + anchors.right: saveButton.left + anchors.bottom: parent.bottom + text: qsTr("Cancel") + + onClicked: { + console.log("cancel...") + addGroupDialog.close(); + } + } } } } } diff --git a/src/activities/server/components/NavigationBar.qml b/src/activities/server/components/NavigationBar.qml index a446f88e7..c6da52a6b 100644 --- a/src/activities/server/components/NavigationBar.qml +++ b/src/activities/server/components/NavigationBar.qml @@ -1,73 +1,79 @@ import QtQuick 2.9 import "../../../core" Item { property bool isCollapsed: true anchors { top: parent.top bottom: parent.bottom right: parent.right } width: isCollapsed ? Style.widthNavigationBarCollapsed : Style.heightNavigationBarExpanded Rectangle { anchors.fill: parent color: Style.colourNavigationBarBackground Column { width: parent.width NavigationButton { iconCharacter: "\uf0c9" description: "" hoverColour: "#993333" onNavigationButtonClicked: isCollapsed = !isCollapsed } NavigationButton { iconCharacter: "\uf1e6" description: "Connecting devices" hoverColour: "#dc8a00" onNavigationButtonClicked: masterController.ui_navigationController.goDashboardView(); } NavigationButton { iconCharacter: "\uf681" description: "Follow results" hoverColour: "#dccd00" onNavigationButtonClicked: masterController.ui_navigationController.goCreateClientView(); } NavigationButton { iconCharacter: "\uf0c0" description: "Managing Pupils" hoverColour: "#8aef63" onNavigationButtonClicked: masterController.ui_navigationController.goManagePupilsView(); } + NavigationButton { + iconCharacter: "\uf073" + description: "Manages Workplane" + hoverColour: "#8aef63" + onNavigationButtonClicked: masterController.ui_navigationController.goManageWorkPlanView(); + } NavigationButton { iconCharacter: "\uf0ae" description: "Manages Sequences" hoverColour: "#8aef63" onNavigationButtonClicked: masterController.ui_navigationController.goFindClientView(); } NavigationButton { iconCharacter: "\uf015" description: "Dashboard" hoverColour: "#dc8a00" onNavigationButtonClicked: masterController.ui_navigationController.goDashboardView(); } NavigationButton { iconCharacter: "\uf0c0" description: "New Client" hoverColour: "#dccd00" onNavigationButtonClicked: masterController.ui_navigationController.goCreateClientView(); } NavigationButton { iconCharacter: "\uf002" description: "Find Client" hoverColour: "#8aef63" onNavigationButtonClicked: masterController.ui_navigationController.goFindClientView(); } } } } diff --git a/src/activities/server/components/TopBanner.qml b/src/activities/server/components/TopBanner.qml index c817ed3aa..f3e0d4eba 100644 --- a/src/activities/server/components/TopBanner.qml +++ b/src/activities/server/components/TopBanner.qml @@ -1,31 +1,32 @@ import QtQuick 2.9 import "../../../core" Item { + property string text + anchors { top: parent.top left: parent.left right: parent.right } width: parent.width height: parent.height/13 Rectangle { anchors.fill: parent color: Style.colourNavigationBarBackground Text { - id: textIcon - width: Style.widthNavigationButtonIcon - height: Style.heightNavigationButtonIcon + id: topBanneTitleText + anchors.fill:parent leftPadding: 20 font { pixelSize: Style.pixelSizeTopBannerText } color: Style.colourNavigationBarFont - text: "Groups and pupils management" + text: topBanner.text verticalAlignment: Text.AlignVCenter } } } diff --git a/src/activities/server/components/ViewButton.qml b/src/activities/server/components/ViewButton.qml new file mode 100644 index 000000000..670536d15 --- /dev/null +++ b/src/activities/server/components/ViewButton.qml @@ -0,0 +1,30 @@ +import QtQuick 2.6 +import "../../../core" +import QtQuick.Controls 2.12 + +Button { + property bool buttonHovered: false + + contentItem: Text { + text: parent.text + opacity: parent.hovered ? 1.0 : 0.7 + color: Style.colourNavigationBarBackground + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + opacity: parent.hovered ? 0.1 : 1 + radius: 2 + color: parent.hovered ? Style.colourNavigationBarBackground : Style.colourBackground + } + + /* onClicked: { + returnValue = loader.myvalue; + mypopDialog.close(); + }*/ +} + diff --git a/src/activities/server/server.js b/src/activities/server/server.js index 9e6840322..49c33c412 100644 --- a/src/activities/server/server.js +++ b/src/activities/server/server.js @@ -1,54 +1,75 @@ /* GCompris - server.js * * Copyright (C) 2018 YOUR NAME * * Authors: * (GTK+ version) * "YOUR NAME" (Qt Quick port) * * 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 . */ .pragma library .import QtQuick 2.6 as Quick var currentLevel = 0 var numberOfLevel = 4 var items +var dataArray = [{"color":"red"},{"color":"blue"},{"color":"yellow"}] +var groupsNamesArray = [] + +groupsNamesArray = ["CP","CE1","CE2","Judo","Théâtre"] + + + +var pupilsNamesArray = [["Aurélien Richelieu","2004"], + ["Nadia Comtois","2003"], + ["Raphaël Thibault","2003"], + ["Anastasie Firmin","2001"], + ["Arianne Vincent","2001"], + ["Marlène Porcher","2001"], + ["Gervais Plourde","2001"], + ["Madeline François","2002"], + ["Solange Géroux","2003"], + ["Axel Deniau","2002"]] + + function start(items_) { items = items_ currentLevel = 0 initLevel() } function stop() { } function initLevel() { items.bar.level = currentLevel + 1 + + } function nextLevel() { if(numberOfLevel <= ++currentLevel) { currentLevel = 0 } initLevel(); } function previousLevel() { if(--currentLevel < 0) { currentLevel = numberOfLevel - 1 } initLevel(); } diff --git a/src/activities/server/views/ManagePupilsView.qml b/src/activities/server/views/ManagePupilsView.qml index 21efdab44..cb73f3c72 100644 --- a/src/activities/server/views/ManagePupilsView.qml +++ b/src/activities/server/views/ManagePupilsView.qml @@ -1,223 +1,227 @@ import QtQuick 2.12 import QtQuick.Layouts 1.12 +import QtQml.Models 2.12 import CM 1.0 import "../components" import "../../../core" import QtQuick.Controls 2.2 import "." +import "../server.js" as Activity Item { // property Client newClient: masterController.ui_newClient Rectangle { anchors.fill: parent color: Style.colourBackground Text { anchors.centerIn: parent text: "Manage Pupils View" } } TopBanner { id: topBanner + + text: "Groups and pupils management" } - PupilsNavigationBar { + ManageGroupsBar { id: pupilsNavigationBar anchors.top: topBanner.bottom - } Rectangle { id: managePupilsViewRectangle anchors.left: pupilsNavigationBar.right anchors.top: topBanner.bottom anchors.right: parent.right anchors.bottom: parent.bottom //color: "red" + ColumnLayout{ id: pupilsDetailsColumn spacing: 2 anchors.top: parent.top width: parent.width - 10 property int pupilNameColWidth : pupilsDetailsColumn.width/3 property int yearOfBirthColWidth : pupilsDetailsColumn.width/8 - //groups header + //pupils header Rectangle { id: test height: 60 width: parent.width RowLayout { width: managePupilsViewRectangle.width - 10 height: parent.height Rectangle { id: pupilNameHeader Layout.fillHeight: true Layout.minimumWidth: pupilsDetailsColumn.pupilNameColWidth Text { anchors.verticalCenter: parent.verticalCenter color: Style.colourNavigationBarBackground text: "Pupils Names" font.bold: true leftPadding: 20 topPadding: 20 } } Rectangle { id: yearOfBirthHeader Layout.fillHeight: true Layout.minimumWidth: pupilsDetailsColumn.yearOfBirthColWidth //any way to find "year of birth text width" if translations ? Text { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter text: "Year of Birth" font.bold: true color: Style.colourNavigationBarBackground topPadding: 20 } } Rectangle { Layout.fillWidth: true Layout.fillHeight: true Text { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left leftPadding: 10 text: "Groups" font.bold: true color: Style.colourNavigationBarBackground topPadding: 20 } } } } - //groups names + //pupils data Repeater { id: repeater - model: [["Thomas petit","2004","CP, CE1, CE2"],["Georges Grand","2007","CE1, CE2, CM1"]] + model: Activity.pupilsNamesArray Rectangle { width: parent.width Layout.preferredHeight: 40 RowLayout { width: managePupilsViewRectangle.width - 10 height: 40 Rectangle { id: pupilName Layout.fillHeight: true Layout.minimumWidth: pupilsDetailsColumn.pupilNameColWidth Text { text: modelData[0] //anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter leftPadding: 20 color: "grey" } } Rectangle { id: yearOfBirth Layout.fillHeight: true Layout.minimumWidth: pupilsDetailsColumn.yearOfBirthColWidth //any way to find "year of birth text width" if translations ? Text { id: yearText text: modelData[1] anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter color: "grey" } } Rectangle { id: groups Layout.fillWidth: true Layout.fillHeight: true height: 40 Text { id: elipsisText text: modelData[2] leftPadding: 10 anchors.verticalCenter: parent.verticalCenter color: "grey" } } } } } } } CommandBar { commandList: masterController.ui_commandController.ui_managePupilsViewContextCommands } /* ScrollView { id: scrollView anchors { left: parent.left right: parent.right top: parent.top //bottom: commandBar.top margins: Style.sizeScreenMargin } clip: true Column { spacing: Style.sizeScreenMargin width: scrollView.width Panel { headerText: "Client Details" contentComponent: Column { spacing: Style.sizeControlSpacing StringEditorSingleLine { stringDecorator: newClient.ui_reference anchors { left: parent.left right: parent.right } } StringEditorSingleLine { stringDecorator: newClient.ui_name anchors { left: parent.left right: parent.right } } } } AddressEditor { address: newClient.ui_supplyAddress headerText: "Supply Address" } AddressEditor { address: newClient.ui_billingAddress headerText: "Billing Address" } } } */ } diff --git a/src/activities/server/views/ManageWorkPlanView.qml b/src/activities/server/views/ManageWorkPlanView.qml new file mode 100644 index 000000000..9348eeafd --- /dev/null +++ b/src/activities/server/views/ManageWorkPlanView.qml @@ -0,0 +1,516 @@ +import QtQuick 2.12 +import QtQuick.Layouts 1.12 +import QtQml.Models 2.12 + +import CM 1.0 +import "../components" +import "../../../core" +import QtQuick.Controls 2.2 +import "." +import "../server.js" as Activity + + + + +Item { + + // property Client newClient: masterController.ui_newClient + + Rectangle { + anchors.fill: parent + color: Style.colourBackground + Text { + anchors.centerIn: parent + text: "Manage Xork Plan" + } + } + + ListView { + id: column1 + width: 320; height: 480 + //cellWidth: 80; cellHeight: 80 + + + displaced: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad } + } + + //! [0] + model: DelegateModel { + //! [0] + id: visualModel + model: ListModel { + id: colorModel + ListElement { color: "blue" } + ListElement { color: "green" } + ListElement { color: "red" } + ListElement { color: "yellow" } + ListElement { color: "orange" } + ListElement { color: "purple" } + ListElement { color: "cyan" } + ListElement { color: "magenta" } + ListElement { color: "chartreuse" } + ListElement { color: "aquamarine" } + ListElement { color: "indigo" } + ListElement { color: "black" } + ListElement { color: "lightsteelblue" } + ListElement { color: "violet" } + ListElement { color: "grey" } + ListElement { color: "springgreen" } + ListElement { color: "salmon" } + ListElement { color: "blanchedalmond" } + ListElement { color: "forestgreen" } + ListElement { color: "pink" } + ListElement { color: "navy" } + ListElement { color: "goldenrod" } + ListElement { color: "crimson" } + ListElement { color: "teal" } + } + //! [1] + delegate: DropArea { + id: delegateRoot + + width: 80; height: 80 + + onEntered: visualModel.items.move(drag.source.visualIndex, icon.visualIndex) + property int visualIndex: DelegateModel.itemsIndex + Binding { target: icon; property: "visualIndex"; value: visualIndex } + + Rectangle { + id: icon + property int visualIndex: 0 + width: 72; height: 72 + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter + } + radius: 3 + color: model.color + + Text { + anchors.centerIn: parent + color: "white" + text: parent.visualIndex + } + + DragHandler { + id: dragHandler + } + + Drag.active: dragHandler.active + Drag.source: icon + Drag.hotSpot.x: 36 + Drag.hotSpot.y: 36 + + states: [ + State { + when: icon.Drag.active + ParentChange { + target: icon + parent: root + } + + AnchorChanges { + target: icon + anchors.horizontalCenter: undefined + anchors.verticalCenter: undefined + } + } + ] + } + } + //! [1] + } + } + + ListView { + id: column2 + width: 320; height: 480 + anchors.left: column1.right + anchors.top: parent.top + //cellWidth: 80; cellHeight: 80 + + + displaced: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad } + } + + //! [0] + model: DelegateModel { + //! [0] + id: visualModel2 + model: ListModel { + id: colorModel2 + ListElement { color: "blue" } + ListElement { color: "green" } + ListElement { color: "red" } + ListElement { color: "yellow" } + ListElement { color: "orange" } + ListElement { color: "purple" } + ListElement { color: "cyan" } + ListElement { color: "magenta" } + ListElement { color: "chartreuse" } + ListElement { color: "aquamarine" } + ListElement { color: "indigo" } + ListElement { color: "black" } + ListElement { color: "lightsteelblue" } + ListElement { color: "violet" } + ListElement { color: "grey" } + ListElement { color: "springgreen" } + ListElement { color: "salmon" } + ListElement { color: "blanchedalmond" } + ListElement { color: "forestgreen" } + ListElement { color: "pink" } + ListElement { color: "navy" } + ListElement { color: "goldenrod" } + ListElement { color: "crimson" } + ListElement { color: "teal" } + } + //! [1] + delegate: DropArea { + id: delegateRoot2 + + width: 80; height: 80 + + onEntered: { + //visualModel2.items.move(drag.source.visualIndex, icon2.visualIndex) + console.log("---") + drag.source.color = "red" + drag.source.parent = delegateRoot2 + } + + property int visualIndex: DelegateModel.itemsIndex + Binding { target: icon2; property: "visualIndex"; value: visualIndex } + + Rectangle { + id: icon2 + property int visualIndex: 0 + width: 72; height: 72 + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter + } + radius: 3 + color: model.color + + Text { + anchors.centerIn: parent + color: "white" + text: parent.visualIndex + } + + DragHandler { + id: dragHandler2 + } + + Drag.active: dragHandler2.active + Drag.source: icon2 + Drag.hotSpot.x: 36 + Drag.hotSpot.y: 36 + + states: [ + State { + when: icon2.Drag.active + ParentChange { + target: icon2 + parent: root + } + + AnchorChanges { + target: icon2 + anchors.horizontalCenter: undefined + anchors.verticalCenter: undefined + } + } + ] + } + } + //! [1] + } + } + + GridView { + width: 300; height: 200 + cellWidth: 80; cellHeight: 80 + anchors.left: column2.right + anchors.top: parent.top + + model: Activity.dataArray + + Component { + id: contactsDelegate + Rectangle { + id: wrapper + width: 80 + height: 80 + color: Activity.dataArray[index].color + Text { + id: contactInfo + text: "oiu" + } + } + } + + /* ListView { + model: dataArray //the array from above + delegate: Label { + text: dataArray[index].name + } + } + + /* model: ListModel { + id: colorModel3 + ListElement { color: "blue" } + ListElement { color: "green" } + ListElement { color: "red" } + ListElement { color: "yellow" } + ListElement { color: "orange" } + ListElement { color: "purple" } + ListElement { color: "cyan" } + ListElement { color: "magenta" } + ListElement { color: "chartreuse" } + ListElement { color: "aquamarine" } + ListElement { color: "indigo" } + ListElement { color: "black" } + ListElement { color: "lightsteelblue" } + ListElement { color: "violet" } + ListElement { color: "grey" } + ListElement { color: "springgreen" } + ListElement { color: "salmon" } + ListElement { color: "blanchedalmond" } + ListElement { color: "forestgreen" } + ListElement { color: "pink" } + ListElement { color: "navy" } + ListElement { color: "goldenrod" } + ListElement { color: "crimson" } + ListElement { color: "teal" } + }*/ + delegate: contactsDelegate + focus: true + } + + + /* TopBanner { + id: topBanner + } + + PupilsNavigationBar { + id: pupilsNavigationBar + + anchors.top: topBanner.bottom + + } + + Rectangle { + id: managePupilsViewRectangle + + anchors.left: pupilsNavigationBar.right + anchors.top: topBanner.bottom + anchors.right: parent.right + anchors.bottom: parent.bottom + + //color: "red" + + Rectangle { + anchors.left: parent.left + anchors.top: parent.top + width: 200; height: 100 + + DelegateModel { + id: visualModel + model: ListModel { + ListElement { name: "Apple" } + ListElement { name: "Orange" } + } + delegate: Rectangle { + height: 25 + width: 100 + Text { text: "Name: " + name} + } + } + + ListView { + anchors.fill: parent + model: visualModel + } + z: 100 + } + + ColumnLayout{ + id: pupilsDetailsColumn + + spacing: 2 + anchors.top: parent.top + width: parent.width - 10 + + property int pupilNameColWidth : pupilsDetailsColumn.width/3 + property int yearOfBirthColWidth : pupilsDetailsColumn.width/8 + + + //groups header + Rectangle { + id: test + + height: 60 + width: parent.width + + + RowLayout { + width: managePupilsViewRectangle.width - 10 + height: parent.height + + Rectangle { + id: pupilNameHeader + Layout.fillHeight: true + Layout.minimumWidth: pupilsDetailsColumn.pupilNameColWidth + Text { + anchors.verticalCenter: parent.verticalCenter + color: Style.colourNavigationBarBackground + text: "Pupils Names" + font.bold: true + leftPadding: 20 + topPadding: 20 + } + } + Rectangle { + id: yearOfBirthHeader + Layout.fillHeight: true + Layout.minimumWidth: pupilsDetailsColumn.yearOfBirthColWidth //any way to find "year of birth text width" if translations ? + Text { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + text: "Year of Birth" + font.bold: true + color: Style.colourNavigationBarBackground + topPadding: 20 + } + } + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + Text { + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + leftPadding: 10 + text: "Groups" + font.bold: true + color: Style.colourNavigationBarBackground + topPadding: 20 + } + } + } + } + + //groups names + Repeater { + id: repeater + model: [["Thomas petit","2004","CP, CE1, CE2"],["Georges Grand","2007","CE1, CE2, CM1"]] + + Rectangle { + width: parent.width + Layout.preferredHeight: 40 + + RowLayout { + width: managePupilsViewRectangle.width - 10 + height: 40 + + Rectangle { + id: pupilName + Layout.fillHeight: true + Layout.minimumWidth: pupilsDetailsColumn.pupilNameColWidth + Text { + text: modelData[0] + //anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + leftPadding: 20 + color: "grey" + } + } + Rectangle { + id: yearOfBirth + Layout.fillHeight: true + Layout.minimumWidth: pupilsDetailsColumn.yearOfBirthColWidth //any way to find "year of birth text width" if translations ? + Text { + id: yearText + text: modelData[1] + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + color: "grey" + } + } + Rectangle { + id: groups + Layout.fillWidth: true + Layout.fillHeight: true + height: 40 + Text { + id: elipsisText + text: modelData[2] + leftPadding: 10 + anchors.verticalCenter: parent.verticalCenter + color: "grey" + } + } + } + } + } + } + + + } + + CommandBar { + commandList: masterController.ui_commandController.ui_managePupilsViewContextCommands + } + + + +/* ScrollView { + id: scrollView + anchors { + left: parent.left + right: parent.right + top: parent.top + //bottom: commandBar.top + margins: Style.sizeScreenMargin + } + clip: true + + Column { + spacing: Style.sizeScreenMargin + width: scrollView.width + + Panel { + headerText: "Client Details" + contentComponent: + Column { + spacing: Style.sizeControlSpacing + StringEditorSingleLine { + stringDecorator: newClient.ui_reference + anchors { + left: parent.left + right: parent.right + } + } + StringEditorSingleLine { + stringDecorator: newClient.ui_name + anchors { + left: parent.left + right: parent.right + } + } + } + } + AddressEditor { + address: newClient.ui_supplyAddress + headerText: "Supply Address" + } + AddressEditor { + address: newClient.ui_billingAddress + headerText: "Billing Address" + } + } + } +*/ + +} diff --git a/src/core/serverMasterController/controllers/navigation-controller.h b/src/core/serverMasterController/controllers/navigation-controller.h index 7938da957..022fb19e1 100644 --- a/src/core/serverMasterController/controllers/navigation-controller.h +++ b/src/core/serverMasterController/controllers/navigation-controller.h @@ -1,31 +1,32 @@ #ifndef NAVIGATIONCONTROLLER_H #define NAVIGATIONCONTROLLER_H #include #include #include namespace cm { namespace controllers { class CMLIBSHARED_EXPORT NavigationController : public QObject { Q_OBJECT public: explicit NavigationController(QObject* parent = nullptr) : QObject(parent){} signals: void goManagePupilsView(); void goCreateClientView(); void goDashboardView(); void goEditClientView(cm::models::Client* client); void goFindClientView(); + void goManageWorkPlanView(); }; } } #endif