diff --git a/src/activities/server/Server.qml b/src/activities/server/Server.qml index d87e13128..fa5f4e5ab 100644 --- a/src/activities/server/Server.qml +++ b/src/activities/server/Server.qml @@ -1,222 +1,221 @@ /* 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 assets 1.0 import GCompris 1.0 import "../../core" import "server.js" as Activity 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 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") } Rectangle { id: navigationBar anchors { top: parent.top bottom: parent.bottom left: parent.left } width: 100 color: "#000000" Column { Button { text: "Dashboard" onClicked: masterController.ui_navigationController.goDashboardView() } Button { text: "New Client" onClicked: masterController.ui_navigationController.goCreateClientView() } Button { text: "Find Client" onClicked: masterController.ui_navigationController.goFindClientView() } Button { text: "Manage Pupils" onClicked: masterController.ui_navigationController.goManagePupilsView() } Button { text: "Manage Groups" onClicked: masterController.ui_navigationController.goManageGroupsView() } } } StackView { id: contentFrame anchors { top: parent.top bottom: parent.bottom right: parent.right left: navigationBar.right } 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/assets/qmldir b/src/activities/server/assets/qmldir deleted file mode 100644 index 47ec3b227..000000000 --- a/src/activities/server/assets/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module assets -singleton Style 1.0 Style.qml diff --git a/src/activities/server/views/CreateClientView.qml b/src/activities/server/views/CreateClientView.qml index 34eb9e76a..96a00d179 100644 --- a/src/activities/server/views/CreateClientView.qml +++ b/src/activities/server/views/CreateClientView.qml @@ -1,12 +1,13 @@ import QtQuick 2.0 +import "../../../core" Item { Rectangle { anchors.fill: parent - color: "#f4c842" + color: Style.colourBackground Text { anchors.centerIn: parent text: "Createclient View" } } } diff --git a/src/activities/server/views/DashboardView.qml b/src/activities/server/views/DashboardView.qml index 0a4614e87..5d9197b48 100644 --- a/src/activities/server/views/DashboardView.qml +++ b/src/activities/server/views/DashboardView.qml @@ -1,13 +1,14 @@ import QtQuick 2.0 -//import assets 1.0 +import "../../../core" + Item { Rectangle { anchors.fill: parent - color: "#f4c842" + color: Style.colourBackground Text { anchors.centerIn: parent text: "Dashboard View" } } } diff --git a/src/activities/server/views/EditClientView.qml b/src/activities/server/views/EditClientView.qml index 4159dcfa3..d9b01a2cc 100644 --- a/src/activities/server/views/EditClientView.qml +++ b/src/activities/server/views/EditClientView.qml @@ -1,12 +1,13 @@ import QtQuick 2.0 +import "../../../core" Item { Rectangle { anchors.fill: parent - color: "#f4c842" + color: Style.colourBackground Text { anchors.centerIn: parent text: "Edit Client View" } } } diff --git a/src/activities/server/views/FindClientView.qml b/src/activities/server/views/FindClientView.qml index 0e5586bdc..95f1fb3b0 100644 --- a/src/activities/server/views/FindClientView.qml +++ b/src/activities/server/views/FindClientView.qml @@ -1,12 +1,13 @@ import QtQuick 2.0 +import "../../../core" Item { Rectangle { anchors.fill: parent - color: "#f4c842" + color: Style.colourBackground Text { anchors.centerIn: parent text: "Find Client View" } } } diff --git a/src/activities/server/views/ManageGroupsView.qml b/src/activities/server/views/ManageGroupsView.qml index 4159dcfa3..f1435b834 100644 --- a/src/activities/server/views/ManageGroupsView.qml +++ b/src/activities/server/views/ManageGroupsView.qml @@ -1,12 +1,15 @@ import QtQuick 2.0 +import "../../../core" +color: Style.colourBackground + Item { Rectangle { anchors.fill: parent color: "#f4c842" Text { anchors.centerIn: parent text: "Edit Client View" } } } diff --git a/src/activities/server/views/ManagePupilsView.qml b/src/activities/server/views/ManagePupilsView.qml index 4159dcfa3..c1e2ee6e2 100644 --- a/src/activities/server/views/ManagePupilsView.qml +++ b/src/activities/server/views/ManagePupilsView.qml @@ -1,12 +1,14 @@ import QtQuick 2.0 +import "../../../core" + Item { Rectangle { anchors.fill: parent - color: "#f4c842" + color: Style.colourBackground Text { anchors.centerIn: parent text: "Edit Client View" } } } diff --git a/src/activities/server/views/SplashView.qml b/src/activities/server/views/SplashView.qml index 64e8c5a6e..a10f3a351 100644 --- a/src/activities/server/views/SplashView.qml +++ b/src/activities/server/views/SplashView.qml @@ -1,12 +1,13 @@ import QtQuick 2.0 +import "../../../core" Item { Rectangle { anchors.fill: parent - color: "#f4c842" + color: Style.colourBackground Text { anchors.centerIn: parent text: "Splash View" } } } diff --git a/src/activities/server/assets/Style.qml b/src/core/Style.qml similarity index 95% rename from src/activities/server/assets/Style.qml rename to src/core/Style.qml index 8b1a4267b..6fd4a845f 100644 --- a/src/activities/server/assets/Style.qml +++ b/src/core/Style.qml @@ -1,37 +1,37 @@ pragma Singleton import QtQuick 2.9 Item { property alias fontAwesome: fontAwesomeLoader.name readonly property color colourBackground: "#efefef" readonly property color colourNavigationBarBackground: "#000000" readonly property color colourNavigationBarFont: "#ffffff" readonly property int pixelSizeNavigationBarIcon: 42 readonly property int pixelSizeNavigationBarText: 22 readonly property real widthNavigationBarCollapsed: widthNavigationButtonIcon readonly property real heightNavigationBarExpanded: widthNavigationButton readonly property real widthNavigationButtonIcon: 80 readonly property real heightNavigationButtonIcon: widthNavigationButtonIcon readonly property real widthNavigationButtonDescription: 160 readonly property real heightNavigationButtonDescription: heightNavigationButtonIcon readonly property real widthNavigationButton: widthNavigationButtonIcon + widthNavigationButtonDescription readonly property real heightNavigationButton: Math.max(heightNavigationButtonIcon, heightNavigationButtonDescription) readonly property color colourCommandBarBackground: "#cecece" readonly property color colourCommandBarFont: "#131313" readonly property color colourCommandBarFontDisabled: "#636363" readonly property real heightCommandBar: heightCommandButton readonly property int pixelSizeCommandBarIcon: 32 readonly property int pixelSizeCommandBarText: 12 readonly property real widthCommandButton: 80 readonly property real heightCommandButton: widthCommandButton FontLoader { id: fontAwesomeLoader - source: "qrc:/assets/fontawesome.ttf" + source: "qrc:/gcompris/src/core/resource/fonts/fontawesome-webfont.ttf" } } diff --git a/src/core/qmldir b/src/core/qmldir index b1da79b4f..4e8390a4d 100644 --- a/src/core/qmldir +++ b/src/core/qmldir @@ -1,3 +1,4 @@ module GCompris singleton GCSingletonFontLoader GCSingletonFontLoader.qml +singleton Style Style.qml classname GComprisPlugin diff --git a/src/activities/server/assets/fontawesome-webfont.ttf b/src/core/resource/fonts/fontawesome-webfont.ttf similarity index 100% rename from src/activities/server/assets/fontawesome-webfont.ttf rename to src/core/resource/fonts/fontawesome-webfont.ttf