diff --git a/src/activities/computer/ActivityInfo.qml b/src/activities/computer/ActivityInfo.qml index d01a0362b..7482c9582 100644 --- a/src/activities/computer/ActivityInfo.qml +++ b/src/activities/computer/ActivityInfo.qml @@ -1,34 +1,34 @@ /* GCompris - ActivityInfo.qml * * Copyright (C) 2015 Sagar Chand Agarwal * * 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 GCompris 1.0 ActivityInfo { name: "computer/Computer.qml" difficulty: 1 icon: "computer/computer.svg" author: "Sagar Chand Agarwal <atomsagar@gmail.com>" demo: true title: qsTr("Know your Computer") description: qsTr("Test your knowledge about the external and internal parts of computer, followed by virtual setting of a computer and quiz to test your knowledge about parts. ") //intro: "put here in comment the text for the intro voice" goal: "Learning" prerequisite: "" manual: "" - credit: "Images by OpenClipart" + credit: qsTr("Images by OpenClipart") section: "fun" } diff --git a/src/activities/computer/computer.js b/src/activities/computer/computer.js index 5aeb356e2..e3f0cebc7 100644 --- a/src/activities/computer/computer.js +++ b/src/activities/computer/computer.js @@ -1,216 +1,160 @@ /* GCompris - computer.js * * Copyright (C) 2015 Sagar Chand Agarwal * * Authors: * * Sagar Chand Agarwal (Qt Quick) * * 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.0 as Quick .import GCompris 1.0 as GCompris //for Applicationdataset .import "qrc:/gcompris/src/core/core.js" as Core var url = "qrc:/gcompris/src/activities/computer/resource/" // number of levels var dataset = [ [ { - desc : qsTr("A monitor or a display is an electronic visual display for computers. The monitor comprises the display device, circuitry and an enclosure."), - name : "Monitor", - id : "monitor", + desc : "A monitor or a display is an electronic visual display for computers. The monitor comprises the display device, circuitry and an enclosure.", + name : qsTr("Monitor"), img : url + "images/monitor_off.svg" }, { - desc : qsTr(" central processing unit (CPU) is the electronic circuitry within a computer that carries out the instructions of a computer program by performing the basic arithmetic, logical, control and input/output (I/O) operations specified by the instructions. "), - name : "CPU", - id :"cpu", + desc : " central processing unit (CPU) is the electronic circuitry within a computer that carries out the instructions of a computer program by performing the basic arithmetic, logical, control and input/output (I/O) operations specified by the instructions. ", + name : qsTr("CPU"), img : url + "images/cpu.svg" }, { - desc : qsTr(" the keyboard is used as a text entry interface to type text and numbers into a word processor, text editor or other programs.A keyboard is also used to give commands to the operating system of a computer"), - name : "Keyboard", - id :"keyboard", + desc : " the keyboard is used as a text entry interface to type text and numbers into a word processor, text editor or other programs.A keyboard is also used to give commands to the operating system of a computer", + name : qsTr("Keyboard"), img : url + "images/keyboard.svg" }, { - desc : qsTr("In computing, a mouse is a pointing device that detects two-dimensional motion relative to a surface. This motion is typically translated into the motion of a pointer on a display, which allows for fine control of a graphical user interface."), - name : "Mouse", - id :"mouse", + desc : "In computing, a mouse is a pointing device that detects two-dimensional motion relative to a surface. This motion is typically translated into the motion of a pointer on a display, which allows for fine control of a graphical user interface.", + name : qsTr("Mouse"), img : url + "images/mouse.svg" } - ], - [ - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - }, - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - }, - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - }, - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - } - ], - [ - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - }, - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - }, - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - }, - { - desc : qsTr(""), - name : "", - id : "", - img : url + "images/" - } ] ] var currentLevel = 0 var numberOfLevel = 0 var items var count = 0 var level = 0 var quiz var index = 0 function start(items_,quiz_) { items = items_ currentLevel = 0 initLevel() count = 0 level = 0 quiz = quiz_ index = 0 } function stop() { } function initLevel() { items.bar.level = currentLevel + 1 } function previous() { display() if(count == 0) count = dataset[level].length - 1 else count-- } function next() { display() if( count == dataset[level].length - 1) { items.proceed.visible = true count = 0 } else { count++ } } function nextLevel() { if(numberOfLevel <= ++currentLevel ) { currentLevel = 0 } initLevel(); } function previousLevel() { if(--currentLevel < 0) { currentLevel = numberOfLevel - 1 } initLevel(); } function display() { items.img.source = dataset[level][count].img items.name.text = dataset[level][count].name items.info.text = dataset[level][count].desc } function nextQuestion() { items.answers.model = [] var answerModel = new Array() - for (var i = 0 ;i < dataset[level].length ; ++i) + for (var i = 0 ;i < dataset[level].length; i++) { answerModel.push(dataset[level][i].name) } - items.name.text = dataset[level][index].name + items.img.source = dataset[level][index].img items.answers.model = answerModel } function getCorrectAnswer() { return dataset[level][index].name } function showAnswer() { console.log(dataset[level][index].name) items.name.visible = true win() } function win () { items.bonus.good("flower") items.name.visible = false - if(index != dataset[level].length) + if(index < dataset[level].length) { index++ nextQuestion() } else { nextLevel() } } function sublevel() { items.proceed.visible = true } diff --git a/src/activities/computer/resource/images/cpu.svg b/src/activities/computer/resource/images/cpu.svg index ac0ce6be3..00fb304b5 100755 --- a/src/activities/computer/resource/images/cpu.svg +++ b/src/activities/computer/resource/images/cpu.svg @@ -1,815 +1,815 @@ Plc Cpu Card image/svg+xml Openclipart Plc Cpu Card 2011-08-24T18:15:24 Plc cpu device https://openclipart.org/detail/157987/plc-cpu-by-marcoqf73 marcoqf73 Ethernet automation bus card device dp electric led logic modbus mpi plc