Warning, /education/gcompris/src/activities/gnumch-equality/TopPanel.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - TopPanel.qml
0002 *
0003 * SPDX-FileCopyrightText: 2014 Manuel Tondeur <manueltondeur@gmail.com>
0004 *
0005 * Authors:
0006 *   Joe Neeman (spuzzzzzzz@gmail.com) (GTK+ version)
0007 *   Manuel Tondeur <manueltondeur@gmail.com> (Qt Quick port)
0008 *
0009 *   SPDX-License-Identifier: GPL-3.0-or-later
0010 */
0011 import QtQuick 2.12
0012 import GCompris 1.0
0013 
0014 import "../../core"
0015 
0016 Item {
0017     property int goal
0018     property bool useMultipleDataset: activity.useMultipleDataset
0019     property var muncherLife: muncherLife
0020     property var life: life
0021     property var bar: bar
0022 
0023     width: background.width
0024     height: background.height / 3
0025     anchors.right: parent.right
0026     anchors.bottom: parent.bottom
0027 
0028     onGoalChanged: {
0029         goalText.text = goalText.setTextGoal(goal)
0030     }
0031 
0032     Rectangle {
0033         id: goalBg
0034         height: muncherLife.height
0035         width: parent.width - muncherLife.width * 2 - muncherLife.anchors.rightMargin * 2
0036         anchors.horizontalCenter: parent.horizontalCenter
0037         radius: 10
0038         color: "#373737"
0039         border.width: 2
0040         border.color: "#F2F2F2"
0041     }
0042 
0043     GCText {
0044         id: goalText
0045         parent: goalBg
0046         height: parent.height
0047         width: parent.width
0048         color: "white"
0049 
0050         function setTextGoal(goal) {
0051             if (activity.type === "equality") {
0052                 return qsTr("Equal to %1").arg(goal)
0053             } else if (activity.type === "inequality") {
0054                 return qsTr("Not equal to %1").arg(goal)
0055             } else if (activity.type === "factors") {
0056                 return qsTr("Factor of %1").arg(goal)
0057             } else if (activity.type === "multiples") {
0058                 return qsTr("Multiple of %1").arg(goal)
0059             } else if (activity.type === "primes") {
0060                 return qsTr("Primes less than %1").arg(goal)
0061             }
0062         }
0063 
0064         fontSizeMode: Text.Fit
0065         minimumPointSize: 7
0066         fontSize: hugeSize
0067         font.weight: Font.DemiBold
0068         maximumLineCount: 1
0069         verticalAlignment: Text.AlignTop
0070         horizontalAlignment: Text.AlignHCenter
0071         anchors.top: parent.top
0072         anchors.horizontalCenter: parent.horizontalCenter
0073     }
0074 
0075     Rectangle {
0076         id: muncherLife
0077 
0078         width: height
0079         height: (parent.height - bar.height) * 0.4
0080         anchors.right: parent.right
0081         anchors.top: goalText.bottom
0082         anchors.rightMargin: 5 * ApplicationInfo.ratio
0083         border.width: 2
0084         border.color: "#373737"
0085         radius: 5
0086         color: "#80ffffff"
0087 
0088         Image {
0089             id: life
0090             anchors.centerIn: parent
0091             source: "qrc:/gcompris/src/activities/gnumch-equality/resource/muncherIcon.svg"
0092             width: parent.width * 0.9
0093             height: width
0094             sourceSize.width: width
0095         }
0096     }
0097 
0098     // Show an hint to show that can move by swiping anywhere
0099     Image {
0100         anchors {
0101             left: parent.left
0102             verticalCenter: muncherLife.verticalCenter
0103             margins: 12
0104         }
0105         source: "qrc:/gcompris/src/core/resource/arrows_move.svg"
0106         sourceSize.height: muncherLife.height
0107         opacity: topPanel.bar.level == 1 && ApplicationInfo.isMobile ? 1 : 0
0108     }
0109 
0110     Bar {
0111         id: bar
0112         level: items.currentLevel + 1
0113 
0114         content: BarEnumContent {
0115               value: (useMultipleDataset) ? (help | home | level | activityConfig) : (help | home | level)
0116         }
0117         onHelpClicked: displayDialog(dialogHelp)
0118         onPreviousLevelClicked: background.previousLevel()
0119         onNextLevelClicked: background.nextLevel()
0120         onHomeClicked: activity.home()
0121         onActivityConfigClicked: displayDialog(dialogActivityConfig)
0122     }
0123 }