diff --git a/src/activities/color_mix/ColorChooser.qml b/src/activities/color_mix/ColorChooser.qml index 2d82bc01a..8d1c10cdf 100644 --- a/src/activities/color_mix/ColorChooser.qml +++ b/src/activities/color_mix/ColorChooser.qml @@ -1,104 +1,104 @@ /* GCompris - ColorChooser.qml * * Copyright (C) 2014 Stephane Mankowski * * Authors: * Matilda Bernard (GTK+ version) * Stephane Mankowski (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.6 import GCompris 1.0 import "colormix.js" as Activity import "." Image { id: chooser z: 1 property int maxSteps: 10 property int currentStep: 0 property string brushHue Image { id: intensityScreen - source: Activity.url + "flashlight2" + brushHue + ".svg" + source: activity.modeRGB ? Activity.url + "flashlight2" + brushHue + ".svg" : "qrc:/gcompris/src/core/resource/empty.svg" sourceSize.height: parent.sourceSize.height sourceSize.width: parent.sourceSize.width z: 2 opacity: currentStep / maxSteps visible: activity.modeRGB } Image { id: intensityBrush source: Activity.url + (activity.modeRGB ? "light" + brushHue + ".svg" : "brush" + brushHue + ".svg") sourceSize.height: parent.sourceSize.height * 0.25 + currentStep / maxSteps * 15 z: 2 anchors { left: parent.right leftMargin: activity.modeRGB ? -20 * ApplicationInfo.ratio : 0 verticalCenter: parent.verticalCenter } opacity: activity.modeRGB ? currentStep / maxSteps * 2 : 1 visible: currentStep > 0 fillMode: Image.PreserveAspectFit } ColorButton { source: Activity.url + "plus.svg" anchors { verticalCenter: parent.verticalCenter right: parent.right rightMargin: parent.width * 0.2 } } ColorButton { source: Activity.url + "minus.svg" anchors { verticalCenter: parent.verticalCenter left: parent.left leftMargin: parent.width * 0.3 } } MultiPointTouchArea { anchors.fill: parent touchPoints: [ TouchPoint { id: point1 } ] z: 4 property real startX property int initialStep: 0 onPressed: { startX = point1.x if(startX > parent.width / 2) currentStep = Math.max(currentStep + 1, 0) else currentStep = Math.max(currentStep - 1, 0) initialStep = currentStep } onTouchUpdated: { currentStep = initialStep + (point1.x - startX) / (20 * ApplicationInfo.ratio) currentStep = Math.min(currentStep, maxSteps) currentStep = Math.max(currentStep, 0) activity.audioEffects.play('qrc:/gcompris/src/activities/redraw/resource/brush.wav') } } } diff --git a/src/activities/digital_electricity/components/BCDToSevenSegment.qml b/src/activities/digital_electricity/components/BCDToSevenSegment.qml index 8ede68d9f..4844e9ef3 100644 --- a/src/activities/digital_electricity/components/BCDToSevenSegment.qml +++ b/src/activities/digital_electricity/components/BCDToSevenSegment.qml @@ -1,150 +1,150 @@ /* GCompris - BCDToSevenSegment.qml * * Copyright (C) 2016 Pulkit Gupta * * Authors: * Bruno Coudoin (GTK+ version) * Pulkit Gupta (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.6 import "../digital_electricity.js" as Activity import GCompris 1.0 ElectricalComponent { id: bcdTo7Segment terminalSize: 0.125 noOfInputs: 4 noOfOutputs: 7 property var inputTerminalPosY: [0.125, 0.375, 0.625, 0.875] property var outputTerminalPosY: [0.066, 0.211, 0.355, 0.5, 0.645, 0.789, 0.934] property var redChar: ["BCDTo7SegmentA_on.svg","BCDTo7SegmentB_on.svg","BCDTo7SegmentC_on.svg", "BCDTo7SegmentD_on.svg","BCDTo7SegmentE_on.svg","BCDTo7SegmentF_on.svg", "BCDTo7SegmentG_on.svg"] information: qsTr("BCD to 7 segment converter takes 4 binary inputs in its input terminals " + "and gives 7 binary outputs which allow to light BCD number segments (binary-coded decimal) " + "to display numbers between 0 and 9. The output for BCD To 7 Segment converted is:") truthTable: [['D','C','B','A','a','b','c','d','e','f','g'], ['0','0','0','0','1','1','1','1','1','1','0'], ['0','0','0','1','0','1','1','0','0','0','0'], ['0','0','1','0','1','1','0','1','1','0','1'], ['0','0','1','1','1','1','1','1','0','0','1'], ['0','1','0','0','0','1','1','0','0','1','1'], ['0','1','0','1','1','0','1','1','0','1','1'], ['0','1','1','0','1','0','1','1','1','1','1'], ['0','1','1','1','1','1','1','0','0','0','0'], ['1','0','0','0','1','1','1','1','1','1','1'], ['1','0','0','1','1','1','1','1','0','1','1']] property alias inputTerminals: inputTerminals property alias outputTerminals: outputTerminals Repeater { id: inputTerminals model: 4 delegate: inputTerminal Component { id: inputTerminal TerminalPoint { posX: 0.05 posY: inputTerminalPosY[index] type: "In" } } } Repeater { id: outputTerminals model: 7 delegate: outputTerminal Component { id: outputTerminal TerminalPoint { posX: 0.95 posY: outputTerminalPosY[index] type: "Out" } } } function updateOutput(wireVisited) { var i for(i = 1 ; i < truthTable.length ; ++i) { var j for(j = 0 ; j < noOfInputs; ++j) { if(inputTerminals.itemAt(j).value != truthTable[i][j]) break } if(j == noOfInputs) break } if(i == truthTable.length) { for(var j = 0 ; j < noOfOutputs ; ++j) { outputTerminals.itemAt(j).value = 0 - outputChar.itemAt(j).source = Activity.url + "empty.svg" + outputChar.itemAt(j).source = "qrc:/gcompris/src/core/resource/empty.svg" } } else { for(var j = 0 ; j < noOfOutputs ; ++j) { var terminal = outputTerminals.itemAt(j) terminal.value = truthTable[i][j + noOfInputs] - outputChar.itemAt(j).source = Activity.url + (terminal.value == 0 ? "empty.svg" : redChar[j]) + outputChar.itemAt(j).source = (terminal.value == 0 ? "qrc:/gcompris/src/core/resource/empty.svg" : Activity.url + redChar[j]) } } for(var i = 0 ; i < noOfOutputs ; ++i) { var terminal = outputTerminals.itemAt(i) for(var j = 0 ; j < terminal.wires.length ; ++j) terminal.wires[j].to.value = terminal.value } var componentVisited = [] for(var i = 0 ; i < noOfOutputs ; ++i) { var terminal = outputTerminals.itemAt(i) for(var j = 0 ; j < terminal.wires.length ; ++j) { var wire = terminal.wires[j] var component = wire.to.parent if(componentVisited[component] != true && wireVisited[wire] != true) { componentVisited[component] = true wireVisited[wire] = true component.updateOutput(wireVisited) } } } } Repeater { id: outputChar model: 7 delegate: outputCharImages Component { id: outputCharImages Image { source: "" anchors.centerIn: parent height: parent.height width: parent.width fillMode: Image.PreserveAspectFit mipmap: true antialiasing: true } } } } diff --git a/src/activities/digital_electricity/resource/empty.svg b/src/core/resource/empty.svg similarity index 100% rename from src/activities/digital_electricity/resource/empty.svg rename to src/core/resource/empty.svg