Warning, /education/minuet/src/app/qml/MinuetMenu.qml is written in an unsupported language. File is not indexed.
0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2016 by Sandro S. Andrade <sandroandrade@kde.org>
0004 **
0005 ** This program is free software; you can redistribute it and/or
0006 ** modify it under the terms of the GNU General Public License as
0007 ** published by the Free Software Foundation; either version 2 of
0008 ** the License or (at your option) version 3 or any later version
0009 ** accepted by the membership of KDE e.V. (or its successor approved
0010 ** by the membership of KDE e.V.), which shall act as a proxy
0011 ** defined in Section 14 of version 3 of the license.
0012 **
0013 ** This program is distributed in the hope that it will be useful,
0014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0016 ** GNU General Public License for more details.
0017 **
0018 ** You should have received a copy of the GNU General Public License
0019 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
0020 **
0021 ****************************************************************************/
0022
0023 import QtQuick 2.7
0024 import QtQuick.Controls 2.0
0025 import QtQuick.Layouts 1.3
0026
0027 Item {
0028 anchors.fill: parent
0029 //spacing: 0
0030
0031 property var currentExercise: undefined
0032
0033 signal backPressed
0034
0035 QtObject {
0036 id: internal
0037 property variant exercisePath: []
0038 }
0039
0040 Image {
0041 id: image
0042
0043 source: "qrc:/qml/images/minuet-drawer.png"
0044 width: parent.width; height: 0.53125 * width
0045 fillMode: Image.PreserveAspectFit
0046 }
0047
0048 Item {
0049 id: breadcrumb
0050
0051 width: parent.width; height: (stackView.depth > 1) ? 50:0
0052 anchors.top: image.bottom
0053 clip: true
0054 RowLayout {
0055 anchors.fill: parent
0056 Image {
0057 id: backButton
0058
0059 fillMode: Image.Pad
0060 width: 24; height: 24
0061 horizontalAlignment: Image.AlignHCenter
0062 verticalAlignment: Image.AlignVCenter
0063 source: "qrc:/keyboard_arrow_left.png"
0064 }
0065
0066 Label {
0067 id: currentExerciseParent
0068 text: ""
0069 elide: Label.ElideRight
0070 font { weight: Font.Bold; pixelSize: 12 }
0071 verticalAlignment: Qt.AlignVCenter
0072 Layout.fillWidth: true
0073 }
0074
0075 }
0076 MouseArea {
0077 anchors.fill: parent
0078 onClicked: {
0079 /*
0080 frame.visible = true
0081 stackView.currentExerciseMenuItem = null
0082 */
0083 currentExercise = undefined
0084 stackView.pop()
0085 internal.exercisePath.pop()
0086 currentExerciseParent.text = i18nc("technical term, do you have a musician friend?", internal.exercisePath.toString())
0087 backPressed()
0088 /*
0089 titleText = "Minuet"
0090 */
0091 }
0092 }
0093 }
0094
0095 StackView {
0096 id: stackView
0097
0098 width: parent.width; height: parent.height - image.height - breadcrumb.height
0099 anchors.top: breadcrumb.bottom
0100 clip: true
0101 focus: true
0102
0103 Component {
0104 id: categoryMenu
0105
0106 ListView {
0107 delegate: ImageItemDelegate {
0108 id: control
0109 width: parent.width; height: 50
0110 text: i18nc("technical term, do you have a musician friend?", modelData.name)
0111 onClicked: {
0112 exerciseView.resetTest()
0113 var children = modelData.children
0114 if (!children) {
0115 currentExercise = modelData
0116 }
0117 else {
0118 internal.exercisePath.push(modelData.name)
0119 stackView.push(categoryMenu.createObject(stackView, {model: children}))
0120 currentExerciseParent.text = i18nc("technical term, do you have a musician friend?", modelData.name)
0121 }
0122 }
0123 }
0124 ScrollIndicator.vertical: ScrollIndicator { }
0125 }
0126 }
0127
0128 Component.onCompleted: { stackView.push(categoryMenu.createObject(stackView, {model: core.exerciseController.exercises})) }
0129 }
0130 }