diff --git a/CMakeLists.txt b/CMakeLists.txt index b12237c90..2afd0e3d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,238 +1,242 @@ -cmake_minimum_required(VERSION 2.8.12) +if(SAILFISHOS) + cmake_minimum_required(VERSION 2.8.11) +else(SAILfISHOS) + cmake_minimum_required(VERSION 2.8.12) +endif() project(gcompris C CXX) # Set c++11 support include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX11) set(my_cxx_flags "-std=c++11") elseif(COMPILER_SUPPORTS_CXX0X) set(my_cxx_flags "-std=c++0x") else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${my_cxx_flags}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${my_cxx_flags}") set(GCOMPRIS_MAJOR_VERSION 0) set(GCOMPRIS_MINOR_VERSION 35) set(GCOMPRIS_PATCH_VERSION 0) set(GCOMPRIS_VERSION ${GCOMPRIS_MAJOR_VERSION}.${GCOMPRIS_MINOR_VERSION}) # An integer value that represents the version of the application # Increase it at each release set(GCOMPRIS_VERSION_CODE ${GCOMPRIS_MINOR_VERSION}) # Set executable filename if(ANDROID) set(GCOMPRIS_EXECUTABLE_NAME GCompris) elseif(SAILFISHOS) set(GCOMPRIS_EXECUTABLE_NAME harbour-gcompris-qt) else() set(GCOMPRIS_EXECUTABLE_NAME gcompris-qt) endif() # cmake modules setup find_package(ECM 1.4.0 QUIET NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake/) set(CMAKE_PREFIX_PATH "${Qt5_DIR}/lib/cmake/Qt5") # KDE po to qm tools if(ECM_FOUND) include(ECMPoQmTools) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ecm_install_po_files_as_qm(po) endif() endif(ECM_FOUND) # prevent build in source directory if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") message(SEND_ERROR "Building in the source directory is not supported.") message(FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} \".") endif("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") # Sailfish does not provide a recent Qt version if(SAILFISHOS) set(QT_REQUIRED_VERSION 5.2.2) else() set(QT_REQUIRED_VERSION 5.3.0) endif() find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED Qml Quick Gui Multimedia Core Svg Xml XmlPatterns LinguistTools) find_package (KF5 QUIET COMPONENTS DocTools ) if(KF5_FOUND) include(KDEInstallDirs) endif(KF5_FOUND) #get_cmake_property(_variableNames VARIABLES) #foreach (_variableName ${_variableNames}) # message("${_variableName}=${${_variableName}}") #endforeach() option(WITH_ACTIVATION_CODE "Include the activation system" OFF) option(WITH_DEMO_ONLY "Include only demo activities" OFF) option(WITH_DOWNLOAD "Internal download" ON) if(WITH_DOWNLOAD) set(ANDROID_INTERNET_PERMISSION "") set(ANDROID_ACCESS_NETWORK_STATE_PERMISSION "") endif(WITH_DOWNLOAD) # Set output directory if(CMAKE_HOST_APPLE) set(_bundle_bin gcompris-qt.app/Contents/MacOS) set(_data_dest_dir bin/${_bundle_bin}) elseif(ANDROID) set(_data_dest_dir android/assets) else() set(_data_dest_dir share/${GCOMPRIS_EXECUTABLE_NAME}) endif() if(ANDROID) # Android .so output set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/android/libs/${ARM_TARGET}/) set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" FORCE) set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" FORCE) if(WITH_ACTIVATION_CODE) set(ANDROID_BILLING_PERMISSION "") set(ANDROID_PACKAGE "net.gcompris") else(WITH_ACTIVATION_CODE) set(ANDROID_PACKAGE "net.gcompris.full") endif() add_subdirectory(android) else(ANDROID) # Desktop build set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/translations CACHE INTERNAL "" FORCE) set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/rcc CACHE INTERNAL "" FORCE) endif(ANDROID) # Always create these folders add_custom_command( OUTPUT shareFolders COMMAND cmake -E make_directory ${GCOMPRIS_TRANSLATIONS_DIR} COMMAND cmake -E make_directory ${GCOMPRIS_RCC_DIR} ) add_custom_target( createShareFolders ALL DEPENDS shareFolders ) include(cmake/rcc.cmake) # Translations handling # Simple command calling the python script add_custom_command( OUTPUT retrievePoFilesFromSvn COMMAND python2 tools/l10n-fetch-po-files.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) # Install translations add_custom_target(getSvnTranslations DEPENDS retrievePoFilesFromSvn COMMENT "Re-run cmake after this to be able to run BuildTranslations with the latest files" ) # Get all po files in po/. You can get them doing : python2 tools/l10n-fetch-po-files.py file(GLOB TRANSLATIONS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "po/*.po") # Set the output dir for the translation files to /bin foreach(PoSource ${TRANSLATIONS_FILES}) # Changes the .po extension to .ts string(REPLACE ".po" ".ts" TsSource ${PoSource}) # Removes the po/ folder string(REPLACE "po/" "" TsSource ${TsSource}) # qm filename string(REPLACE ".ts" ".qm" QmOutput ${TsSource}) set(OutTsFile ${CMAKE_BINARY_DIR}/tmp/${TsSource}) add_custom_command( OUTPUT ${QmOutput} COMMAND cmake -E make_directory ${GCOMPRIS_TRANSLATIONS_DIR} COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/tmp # Remove the obsolete translations and set po in the ts output file COMMAND msgattrib --no-obsolete ${CMAKE_CURRENT_SOURCE_DIR}/${PoSource} -o ${OutTsFile} # Convert the po into ts COMMAND lconvert -if po -of ts -i ${OutTsFile} -o ${OutTsFile} # Convert the ts in qm removing non finished translations COMMAND lrelease -compress -nounfinished ${OutTsFile} -qm ${GCOMPRIS_TRANSLATIONS_DIR}/${QmOutput} ) list(APPEND QM_FILES ${QmOutput}) endforeach() # Install translations add_custom_target(BuildTranslations DEPENDS ${QM_FILES} COMMENT "If you don't have the .po, you need to run make getSvnTranslations first then re-run cmake" ) if(CMAKE_HOST_APPLE) install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION ${_bundle_bin}) else() install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION ${_data_dest_dir}) endif() # Build standalone package option -> if ON, we will copy the required Qt files in the build package. # If OFF, "make install" will not copy Qt files so only GCompris files will be packaged. # By default, it is true on Windows (as we deliver NSIS package), macOS (bundled), android (apk) and false on linux (to do make install) # If you want to create a STGZ package for linux (auto-extractible), override this variable by typing : cmake -DBUILD_STANDALONE=ON if(UNIX AND NOT ANDROID AND NOT APPLE) option(BUILD_STANDALONE "Build a standalone package when typing 'make package'" OFF) else() option(BUILD_STANDALONE "Build a standalone package when typing 'make package'" ON) endif() option(WITH_KIOSK_MODE "Set the kiosk mode by default" OFF) if(WIN32) set(COMPRESSED_AUDIO "ac3" CACHE STRING "Compressed Audio format [ogg|aac|ac3]") elseif(APPLE) set(COMPRESSED_AUDIO "aac" CACHE STRING "Compressed Audio format [ogg|aac|ac3]") else() set(COMPRESSED_AUDIO "ogg" CACHE STRING "Compressed Audio format [ogg|aac|ac3]") endif() file(GLOB_RECURSE OGG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/ "*.ogg") foreach(OGG_FILE ${OGG_FILES}) # This should only replace the extension string(REGEX REPLACE "ogg$" "aac" AAC_FILE ${OGG_FILE}) add_custom_command( OUTPUT ${AAC_FILE} # Put the good line depending on your installation COMMAND avconv -v warning -i ${OGG_FILE} -acodec libvo_aacenc ${AAC_FILE} #COMMAND ffmpeg -v warning -i ${OGG_FILE} -acodec aac -strict -2 ${AAC_FILE} ) list(APPEND AAC_FILES ${AAC_FILE}) endforeach() add_custom_target( createAacFromOgg DEPENDS ${AAC_FILES} ) set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${GCOMPRIS_VERSION}) add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_subdirectory(src) if(KF5_FOUND) add_subdirectory(docs/docbook) endif(KF5_FOUND) if(SAILFISHOS) # Need to be done at the end, after src add_subdirectory(platforms/sailfishOS) endif() diff --git a/src/activities/braille_alphabets/FirstScreen.qml b/src/activities/braille_alphabets/FirstScreen.qml index 77661ef3e..cf6ea8bf7 100644 --- a/src/activities/braille_alphabets/FirstScreen.qml +++ b/src/activities/braille_alphabets/FirstScreen.qml @@ -1,125 +1,124 @@ /* GCompris - FirstScreen.qml * * Copyright (C) 2014 Arkit Vora * * Authors: * Srishti Sethi (GTK+ version) * Arkit Vora (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.1 -import QtQuick.Layouts 1.1 import GCompris 1.0 import "../../core" import "braille_alphabets.js" as Activity Image { id: first_screen anchors.fill: parent fillMode: Image.PreserveAspectCrop source: Activity.url + "intro_bg.svg" sourceSize.width: parent.width GCText { id: heading text: qsTr("Braille : Unlocking the Code") fontSize: largeSize horizontalAlignment: Text.AlignHCenter font.weight: Font.DemiBold anchors.centerIn: parent.Center color: "#2a2a2a" width: parent.width wrapMode: Text.WordWrap } Image { id: introChar source: Activity.url + "intro_braille_char.svg" sourceSize.width: parent.width * 0.25 fillMode: Image.PreserveAspectFit verticalAlignment: Image.AlignTop anchors { top: heading.bottom topMargin: 30 * ApplicationInfo.ratio bottom: parent.bottom bottomMargin: 60 * ApplicationInfo.ratio left: parent.left leftMargin: 30 * ApplicationInfo.ratio } } GCText { id: body_text1 text: qsTr('The Braille system is a method that is used by blind people to read and write.') + "\n" + qsTr('Each Braille character, or cell, is made up of six dot positions, arranged in ' + 'a rectangle containing two columns of three dots each. As seen on the left, each ' + 'dot is referenced by a number from 1 to 6.') fontSize: regularSize font.weight: Font.DemiBold horizontalAlignment: Text.AlignJustify anchors { top: heading.bottom topMargin: 30 * ApplicationInfo.ratio right: parent.right rightMargin: 30 * ApplicationInfo.ratio left: introChar.right leftMargin: 30 * ApplicationInfo.ratio } color: "#2a2a2a" width: parent.width / 2 wrapMode: Text.WordWrap } GCText { id: bottom_text text: qsTr("When you are ready, click on me and try reproducing Braille characters.") fontSize: regularSize font.weight: Font.Bold width: parent.width * 0.3 color: "#2a2a2a" horizontalAlignment: Text.AlignJustify wrapMode: Text.WordWrap anchors { top: body_text1.bottom topMargin: 30 * ApplicationInfo.ratio left: introChar.right leftMargin: 30 * ApplicationInfo.ratio } } Image { id: introTux source: Activity.url + "tux_braille.svg" fillMode: Image.PreserveAspectFit sourceSize.width: parent.width * 0.2 anchors { top: bottom_text.top right: parent.right rightMargin: 30 * ApplicationInfo.ratio left: bottom_text.right leftMargin: 30 * ApplicationInfo.ratio } Behavior on scale { PropertyAnimation { duration: 100} } MouseArea { id: tux_click anchors.fill: parent hoverEnabled: true onClicked: first_screen.visible = false onEntered: introTux.scale = 1.1 onExited: introTux.scale = 1 } } } diff --git a/src/activities/braille_alphabets/Screen.qml b/src/activities/braille_alphabets/Screen.qml index 31dae1e1c..7872d3c49 100644 --- a/src/activities/braille_alphabets/Screen.qml +++ b/src/activities/braille_alphabets/Screen.qml @@ -1,314 +1,313 @@ /* GCompris - Screen.qml * * Copyright (C) 2014 Arkit Vora * * Authors: * Srishti Sethi (GTK+ version) * Arkit Vora (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.1 -import QtQuick.Layouts 1.1 import GCompris 1.0 import "../../core" import "braille_alphabets.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} property var dataset pageComponent: Image { id: background anchors.fill: parent fillMode: Image.PreserveAspectCrop source: Activity.url + "background.svg" sourceSize.width: parent.width signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) } Keys.onPressed: { if(first_screen.visible) { // If return, we hide the screen first_screen.visible = false return; } var keyValue; switch(event.key) { case Qt.Key_1: keyValue = 1; break; case Qt.Key_2: keyValue = 2; break; case Qt.Key_3: keyValue = 3; break; case Qt.Key_4: keyValue = 4; break; case Qt.Key_5: keyValue = 5; break; case Qt.Key_6: keyValue = 6; break; } if(keyValue) playableChar.switchState(keyValue) } // 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 property alias containerModel: containerModel property alias questionItem: questionItem property string instructions property alias playableChar: playableChar property alias score: score property bool brailleCodeSeen } onStart: { first_screen.visible = true Activity.start(items, dataset) } onStop: { Activity.stop() } ListModel { id: containerModel } Image { id: charList y: 20 * ApplicationInfo.ratio anchors.horizontalCenter: parent.horizontalCenter source: Activity.url + "top_back.svg" sourceSize.width: parent.width * 0.94 visible: items.brailleCodeSeen Row { id: row spacing: 10 * ApplicationInfo.ratio anchors.centerIn: charList anchors.horizontalCenterOffset: 5 Repeater { id: cardRepeater model: containerModel Item { id: inner height: charList.height * 0.9 width: (charList.width - containerModel.count * row.spacing)/ containerModel.count Rectangle { id: rect1 width: charList.width / 13 height: ins.height border.width: 0 border.color: "black" color: "#a5cbd9" BrailleChar { id: ins width: parent.width * 0.9 anchors.centerIn: parent clickable: false brailleChar: letter } } GCText { text: letter font.weight: Font.DemiBold color: "#2a2a2a" font.pointSize: NaN // need to clear font.pointSize explicitly font.pixelSize: Math.max(parent.width * 0.5, 24) anchors { top: rect1.bottom topMargin: 4 * ApplicationInfo.ratio horizontalCenter: rect1.horizontalCenter } } } } } } Image { id: playableCharBg anchors { top: charList.bottom topMargin: 10 * ApplicationInfo.ratio } verticalAlignment: Image.AlignTop x: 10 * ApplicationInfo.ratio source: Activity.url + "char_background.svg" sourceSize.width: playableChar.width * 1.8 height: (playableChar.height + playableCharDisplay.height) * 1.2 BrailleChar { id: playableChar clickable: true anchors { horizontalCenter: parent.horizontalCenter top: parent.top topMargin: 20 * ApplicationInfo.ratio } width: Math.min(background.width * 0.18, background.height * 0.2) isLetter: items.isLetter onBrailleCharChanged: { if(brailleChar === Activity.getCurrentLetter()) { particles.burst(40) Activity.nextQuestion() } } audioEffects: activity.audioEffects } GCText { id: playableCharDisplay font.pointSize: NaN // need to clear font.pointSize explicitly font.pixelSize: Math.max(playableChar.width * 0.4, 24) font.weight: Font.DemiBold color: "#2a2a2a" text: playableChar.brailleChar anchors { top: playableChar.bottom topMargin: 4 * ApplicationInfo.ratio horizontalCenter: playableChar.horizontalCenter } } } Rectangle { id: instructionsArea height: questionItem.height * 1.2 width: parent.width / 1.1 anchors { top: charList.bottom topMargin: 10 * ApplicationInfo.ratio left: playableCharBg.right leftMargin: 10 * ApplicationInfo.ratio right: parent.right rightMargin: 10 * ApplicationInfo.ratio } color: "#55333333" border.width: 0 radius: 5 GCText { id: questionItem anchors.centerIn: parent fontSize: largeSize horizontalAlignment: Text.AlignHCenter font.weight: Font.DemiBold style: Text.Outline styleColor: "black" color: "white" width: parent.width * 0.94 wrapMode: Text.WordWrap function initQuestion() { playableChar.clearLetter() text = Activity.getCurrentTextQuestion() if(items.instructions) text += "\n" + items.instructions opacity = 1.0 } onOpacityChanged: opacity == 0 ? initQuestion() : "" Behavior on opacity { PropertyAnimation { duration: 1000 } } } } ParticleSystemStarLoader { id: particles clip: false } FirstScreen { id: first_screen } Score { id: score anchors.bottom: background.bottom anchors.right: braille_map.left visible: !(dialogMap.visible || first_screen.visible) } DialogHelp { id: dialogHelp onClose: home() } BrailleMap { id: dialogMap // Make is non visible or we get some rendering artefacts before // until it is created visible: false onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } BarButton { id: braille_map source: Activity.url + "target.svg" anchors { right: parent.right bottom: parent.bottom } sourceSize.width: 66 * bar.barZoom visible: true onClicked: { dialogMap.visible = true displayDialog(dialogMap) } } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/braille_fun/BrailleFun.qml b/src/activities/braille_fun/BrailleFun.qml index 756256c4c..d17fd40d0 100644 --- a/src/activities/braille_fun/BrailleFun.qml +++ b/src/activities/braille_fun/BrailleFun.qml @@ -1,262 +1,261 @@ /* GCompris - braille_fun.qml * * Copyright (C) 2014 Arkit Vora * * Authors: * Srishti Sethi (GTK+ version) * Arkit Vora (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.1 -import QtQuick.Layouts 1.1 import GCompris 1.0 import "../../core" import "../braille_alphabets" import "braille_fun.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} pageComponent: Image { id: background anchors.fill: parent fillMode: Image.PreserveAspectCrop sourceSize.width: parent.width source: Activity.url + "hillside.svg" signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) } // 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 property alias questionItem: questionItem property alias score: score property alias cardRepeater: cardRepeater property alias animateX: animateX property alias charBg: charBg property string question } onStart: { Activity.start(items) } onStop: { Activity.stop() } Item { id: planeText width: plane.width height: plane.height x: - width anchors.top: parent.top anchors.topMargin: 20 * ApplicationInfo.ratio Image { id: plane anchors.centerIn: planeText anchors.top: parent.top source: Activity.url + "plane.svg" sourceSize.height: 90 * ApplicationInfo.ratio } GCText { id: questionItem anchors.right: planeText.right anchors.rightMargin: plane.width / 2 anchors.verticalCenter: planeText.verticalCenter fontSize: hugeSize font.weight: Font.DemiBold color: "#2a2a2a" text: items.question } PropertyAnimation { id: animateX target: planeText properties: "x" from: - planeText.width to: background.width duration: 11000 easing.type: Easing.OutInCirc onRunningChanged: { // @FIXME, in some case we are stopped before the end if(planeText.x >= background.width / 2 && running == false) { bonus.bad("tux") charBg.clickable(false) } } } } Rectangle { id: charBg anchors { horizontalCenter: parent.horizontalCenter verticalCenter: parent.verticalCenter rightMargin: 20 * ApplicationInfo.ratio } width: charWidth * cardRepeater.model height: charWidth * 1.5 color: "#AAFFFFFF" border.width: 0 radius: 5 property int charWidth: Math.min(120 * ApplicationInfo.ratio, parent.width * 0.3) function clickable(status) { for(var i=0 ; i < cardRepeater.model ; i++) { cardRepeater.itemAt(i).ins.clickable = status } } function clearAllLetters() { for(var i=0 ; i < cardRepeater.model ; i++) { cardRepeater.itemAt(i).ins.clearLetter() } } Row { id: row spacing: 5 * ApplicationInfo.ratio anchors.centerIn: parent Repeater { id: cardRepeater Item { id: inner height: charBg.height * 0.9 width: charBg.charWidth property string brailleChar: ins.brailleChar property alias ins: ins Rectangle { id: rect1 width: charBg.charWidth * 0.6 height: ins.height anchors.horizontalCenter: inner.horizontalCenter border.width: 0 color: ins.found ? '#FFa3f9a3' : "#ffef6949" BrailleChar { id: ins clickable: true anchors.centerIn: rect1 width: parent.width * 0.9 isLetter: true onBrailleCharChanged: { inner.brailleChar = ins.brailleChar var answerString = "" ; for(var i = 0 ; i < Activity.currentLevel + 1 ; i++ ) { answerString = answerString + cardRepeater.itemAt(i).brailleChar; } if(answerString === items.question) { charBg.clickable(false) bonus.good("tux") score.currentSubLevel ++; } } property string question: items.question[modelData] property bool found: question === brailleChar } } GCText { text: brailleChar font.weight: Font.DemiBold color: "#2a2a2a" fontSize: hugeSize anchors { top: rect1.bottom topMargin: 4 * ApplicationInfo.ratio horizontalCenter: rect1.horizontalCenter } } } } } } Score { id: score // @FIXME We have no way to get the real bar width, that would make this // calculation formal anchors.bottom: parent.width - bar.width * 6 > width ? parent.bottom : bar.top anchors.bottomMargin: 10 * ApplicationInfo.ratio anchors.rightMargin: 10 * ApplicationInfo.ratio anchors.right: parent.right } DialogHelp { id: dialogHelp onClose: home() } BrailleMap { id: dialogMap onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } BarButton { id: brailleMap source: Activity.url + "target.svg" anchors { right: score.left bottom: score.bottom } sourceSize.width: 66 * bar.barZoom visible: true onClicked: { dialogMap.visible = true displayDialog(dialogMap) } } Bonus { id: bonus Component.onCompleted: { win.connect(Activity.nextQuestion) loose.connect(Activity.initQuestion) } } } } diff --git a/src/activities/louis-braille/LouisBraille.qml b/src/activities/louis-braille/LouisBraille.qml index fd47e882a..366f78b46 100644 --- a/src/activities/louis-braille/LouisBraille.qml +++ b/src/activities/louis-braille/LouisBraille.qml @@ -1,289 +1,288 @@ /* GCompris - louis-braille.qml * * Copyright (C) 2014 Arkit Vora * * Authors: * (GTK+ version) * Arkit Vora (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.1 -import QtQuick.Layouts 1.1 import GCompris 1.0 import "../../core" import "../braille_alphabets" import "louis-braille.js" as Activity import "louis_braille_data.js" as Dataset import "qrc:/gcompris/src/core/core.js" as Core 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) } // 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 property int count: 0 property var dataset: Dataset.dataset } onStart: { Activity.start(items) } onStop: { Activity.stop() } Image { id: charList y: 20 * ApplicationInfo.ratio anchors.horizontalCenter: parent.horizontalCenter source: Activity.url + "top_back.svg" sourceSize.width: parent.width * 0.90 Row { id: row spacing: 10 * ApplicationInfo.ratio anchors.centerIn: charList anchors.horizontalCenterOffset: 5 width: parent.width Repeater { id: cardRepeater model: ["L","O","U","I","S"," ","B","R","A","I","L","L","E"] Item { id: inner height: charList.height * 0.95 width:(charList.width - 13 * row.spacing)/ 13 Rectangle { id: rect1 width: charList.width / 13 height: ins.height border.width: 3 opacity: index==5 ? 0 :1 border.color: "black" color: "white" BrailleChar { id: ins width: parent.width * 0.9 anchors.centerIn: parent clickable: false brailleChar: modelData } } GCText { text: modelData font.weight: Font.DemiBold style: Text.Outline styleColor: "white" color: "black" fontSize: regularSize anchors { top: rect1.bottom topMargin: 4 * ApplicationInfo.ratio horizontalCenter: rect1.horizontalCenter } } } } } } Keys.onRightPressed: background.next() Keys.onLeftPressed: background.previous() function previous() { if(items.count == 0) items.count = items.dataset.length - 1 else items.count-- } function next() { if(items.count == items.dataset.length - 1) { list.shuffle() items.count = 0 list.visible = true } else { items.count++ } } Image { id: previous anchors.right: img.left anchors.rightMargin: 20 * ApplicationInfo.ratio anchors.verticalCenter: img.verticalCenter source: "qrc:/gcompris/src/core/resource/bar_previous.svg" sourceSize.height: 80 * ApplicationInfo.ratio Behavior on scale { PropertyAnimation { duration: 100} } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: previous.scale = 1.1 onExited: previous.scale = 1 onClicked: background.previous() } } // The image description Rectangle { id: info_rect border.color: "black" border.width: 1 * ApplicationInfo.ratio color: "white" width: parent.width * 0.9 height:info.height * 1.3 anchors.top: charList.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.topMargin: 5 * ApplicationInfo.ratio GCText { id:info color: "black" anchors.centerIn: parent horizontalAlignment: Text.AlignHCenter width: parent.width * 0.94 wrapMode: Text.WordWrap fontSize: regularSize text: items.dataset[items.count].text } } // Image and date Image { id: img anchors.top: info_rect.bottom anchors.topMargin: 10 * ApplicationInfo.ratio anchors.horizontalCenter: parent.horizontalCenter sourceSize.height: parent.height - (charList.height + info_rect.height + bar.height) height: (parent.height - (charList.height + info_rect.height + bar.height)) * 0.8 width: parent.width * 0.7 source: items.dataset[items.count].img fillMode: Image.PreserveAspectFit Rectangle { id: year_rect border.color: "black" border.width: 1 color: "white" width: year.width * 1.1 height: year.height * 1.1 anchors { bottom: img.bottom horizontalCenter: img.horizontalCenter bottomMargin: 5 * ApplicationInfo.ratio } GCText { id: year color: "black" fontSize: regularSize anchors.centerIn: year_rect text: items.dataset[items.count].year } } MouseArea { anchors.fill: parent onClicked: background.next() } } Image { id: next anchors.left: img.right anchors.leftMargin: 20 * ApplicationInfo.ratio anchors.verticalCenter: img.verticalCenter source: "qrc:/gcompris/src/core/resource/bar_next.svg" sourceSize.height: 80 * ApplicationInfo.ratio Behavior on scale { PropertyAnimation { duration: 100} } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: next.scale = 1.1 onExited: next.scale = 1 onClicked: background.next() } } Keys.onUpPressed: list.up() Keys.onDownPressed: list.down() Keys.onEnterPressed: list.space() Keys.onReturnPressed: list.space() Keys.onSpacePressed: list.space() ReorderList { id: list visible: false bonus: bonus signal shuffle onShuffle: { containerModel.clear() var dataitems = Object.create(items.dataset) dataitems = Core.shuffle(dataitems) for(var i = 0 ; i < dataitems.length ; i++) { containerModel.append(dataitems[i]); } } } DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | reload } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() onReloadClicked: { items.count = 0 list.visible = false } } Bonus { id: bonus Component.onCompleted: win.connect(list.shuffle) } } } diff --git a/src/activities/louis-braille/ReorderList.qml b/src/activities/louis-braille/ReorderList.qml index d265d1155..2ac8b8d07 100644 --- a/src/activities/louis-braille/ReorderList.qml +++ b/src/activities/louis-braille/ReorderList.qml @@ -1,193 +1,191 @@ /* GCompris - List.qml * * Copyright (C) 2014 Arkit Vora * * Authors: * (GTK+ version) * Arkit Vora (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.1 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.0 import GCompris 1.0 import "../../core" import "louis-braille.js" as Activity Rectangle { id: wholeBody width: parent.width height: parent.height color: "#ff55afad" property color goodColor: colorMode ? "#ffc1ffb4" : "#FFF" property color badColor: colorMode ? "#FFF" : "#FFF" property bool colorMode: true property Item bonus property int selectedIndex: -1 property alias containerModel: list.model signal up signal down signal space onUp: list.decrementCurrentIndex() onDown: list.incrementCurrentIndex() onSpace: { if(list.currentIndex == selectedIndex) { selectedIndex = -1 } else if(selectedIndex != -1) { containerModel.move(selectedIndex, list.currentIndex, 1) list.currentIndex -= 1 selectedIndex = -1 } else { selectedIndex = list.currentIndex } } function checkWin() { var win = true // The shifted numbering comes from the header in the List for(var i = 1; i < list.count + 1; i++) { if(!list.contentItem.children[i] || list.contentItem.children[i].placed === false) win = false } if(win) { list.currentIndex = -1 bonus.good("tux") } } Component { id: listElement Rectangle { id: listRect color: wholeBody.selectedIndex == index ? "#b5b9ff" : (placed ? goodColor : badColor) border.width: list.currentIndex == index ? 0 : 1 border.color: "#ff525c5c" radius: 3 width: list.width height: Math.max(textinfo.height * 1.3, 50 * ApplicationInfo.ratio) property int sequence: model.sequence property bool placed: model.sequence === index property string text: model.text SequentialAnimation { id: borderAnim running: list.currentIndex == index loops: Animation.Infinite NumberAnimation { target: listRect property: "border.width" to: 5; duration: 500 easing.type: Easing.InOutQuad } NumberAnimation { target: listRect property: "border.width" to: 0; duration: 500 easing.type: Easing.InOutQuad } } GCText { id: textinfo text: listRect.text anchors.centerIn: parent horizontalAlignment: Text.AlignHCenter width: parent.width * 0.94 wrapMode: Text.WordWrap fontSize: regularSize } MouseArea { id: dragArea anchors.fill: parent onClicked: { wholeBody.selectedIndex = -1 if(list.currentIndex == index) { list.currentIndex = -1 } else if(list.currentIndex == -1) { list.currentIndex = index } else { containerModel.move(list.currentIndex, index, 1) list.currentIndex = -1 } } } Behavior on color { ColorAnimation { duration: 200 } } } } ListModel { id: containerModel } ListView { id: list anchors { fill: parent bottomMargin: bar.height leftMargin: 30 * ApplicationInfo.ratio rightMargin: 30 * ApplicationInfo.ratio topMargin: 10 * ApplicationInfo.ratio } width: parent.width * 0.7 model: containerModel spacing: 5 * ApplicationInfo.ratio delegate: listElement interactive: true header: Rectangle { width: parent.width height: heading.height + 10 color: "#cceaeaea" GCText { id: heading text: qsTr("Arrange the events in the order in which they happened. " + "Select the line to move then touch it's target position.") width: parent.width - 4 wrapMode: Text.WordWrap fontSize: regularSize } } onCurrentIndexChanged: timer.restart() displaced: Transition { NumberAnimation { properties: "y"; duration: 500 } } move: Transition { NumberAnimation { properties: "y"; duration: 500 } } Component.onCompleted: currentIndex = -1 } Timer { id: timer interval: 1000 running: false repeat: false onTriggered: wholeBody.checkWin() } } diff --git a/src/activities/louis-braille/louis_braille-activity.svg b/src/activities/louis-braille/louis_braille-activity.svg deleted file mode 100644 index 9343456dc..000000000 --- a/src/activities/louis-braille/louis_braille-activity.svg +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/src/activities/louis-braille/resource/background.svg b/src/activities/louis-braille/resource/background.svg deleted file mode 100644 index da2d40193..000000000 --- a/src/activities/louis-braille/resource/background.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/src/activities/magic-hat-plus/MagicHatPlus.qml b/src/activities/magic-hat-plus/MagicHatPlus.qml index 46231d3b0..d73f6294a 100644 --- a/src/activities/magic-hat-plus/MagicHatPlus.qml +++ b/src/activities/magic-hat-plus/MagicHatPlus.qml @@ -1,30 +1,29 @@ /* GCompris - MagicHat.qml * * Copyright (C) 2014 Thibaut ROMAIN * * Authors: * (GTK+ version) * Thibaut ROMAIN (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.1 -import QtQuick.Layouts 1.1 import "../../core" import "../magic-hat-minus/" MagicHat{ mode: "plus" } diff --git a/src/activities/menu/ConfigurationItem.qml b/src/activities/menu/ConfigurationItem.qml index 113287d13..b38cf57ec 100644 --- a/src/activities/menu/ConfigurationItem.qml +++ b/src/activities/menu/ConfigurationItem.qml @@ -1,571 +1,571 @@ /* GCompris - ConfigurationItem.qml * * Copyright (C) 2014 Johnny Jazeix * * Authors: * Johnny Jazeix * * 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 1.0 import QtQuick.Controls.Styles 1.0 import GCompris 1.0 -import QtQuick.Layouts 1.1 + import "../../core" import "qrc:/gcompris/src/core/core.js" as Core Item { property var languages: allLangs.languages id: dialogConfig height: column.height LanguageList { id: allLangs } Column { id: column spacing: 10 width: parent.width // Put configuration here Row { id: demoModeBox width: parent.width spacing: 10 property bool checked: !ApplicationSettings.isDemoMode Image { sourceSize.height: 50 * ApplicationInfo.ratio source: demoModeBox.checked ? "qrc:/gcompris/src/core/resource/apply.svg" : "qrc:/gcompris/src/core/resource/cancel.svg" MouseArea { anchors.fill: parent onClicked: { if(ApplicationSettings.isDemoMode) ApplicationSettings.isDemoMode = false } } } Button { width: parent.parent.width - 50 * ApplicationInfo.ratio - 10 * 2 height: parent.height enabled: ApplicationSettings.isDemoMode anchors.leftMargin: 10 anchors.verticalCenter: parent.verticalCenter text: demoModeBox.checked ? qsTr("You have the full version") : qsTr("Buy the full version").toUpperCase() style: ButtonStyle { background: Rectangle { implicitWidth: 100 implicitHeight: 25 border.width: control.activeFocus ? 4 : 2 border.color: "black" radius: 10 gradient: Gradient { GradientStop { position: 0 ; color: control.pressed ? "#87ff5c" : ApplicationSettings.isDemoMode ? "#ffe85c" : "#EEEEEE"} GradientStop { position: 1 ; color: control.pressed ? "#44ff00" : ApplicationSettings.isDemoMode ? "#f8d600" : "#AAAAAA"} } } label: GCText { text: control.text horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter wrapMode: Text.WordWrap } } onClicked: { if(ApplicationSettings.isDemoMode) ApplicationSettings.isDemoMode = false } } } GCDialogCheckBox { id: displayLockedActivitiesBox text: qsTr("Show locked activities") visible: ApplicationSettings.isDemoMode checked: showLockedActivities onCheckedChanged: { showLockedActivities = checked; } } GCDialogCheckBox { id: enableAudioVoicesBox text: qsTr("Enable audio voices") checked: isAudioVoicesEnabled onCheckedChanged: { isAudioVoicesEnabled = checked; } } GCDialogCheckBox { id: enableAudioEffectsBox text: qsTr("Enable audio effects") checked: isAudioEffectsEnabled onCheckedChanged: { isAudioEffectsEnabled = checked; } } GCDialogCheckBox { id: enableFullscreenBox text: qsTr("Fullscreen") checked: isFullscreen onCheckedChanged: { isFullscreen = checked; } } GCDialogCheckBox { id: enableVirtualKeyboardBox text: qsTr("Virtual Keyboard") checked: isVirtualKeyboard onCheckedChanged: { isVirtualKeyboard = checked; } } GCDialogCheckBox { id: enableAutomaticDownloadsBox checked: isAutomaticDownloadsEnabled text: qsTr("Enable automatic downloads/updates of sound files") onCheckedChanged: { isAutomaticDownloadsEnabled = checked; } } GCDialogCheckBox { id: sectionVisibleBox checked: sectionVisible text: qsTr("The activity section menu is visible") onCheckedChanged: { sectionVisible = checked; } } Flow { spacing: 5 width: parent.width GCComboBox { id: fontBox model: fonts width: 250 * ApplicationInfo.ratio background: dialogActivityConfig label: qsTr("Font selector") } } Flow { spacing: 5 width: parent.width Slider { id: baseFontSizeSlider width: 250 * ApplicationInfo.ratio style: GCSliderStyle {} maximumValue: ApplicationSettings.baseFontSizeMax minimumValue: ApplicationSettings.baseFontSizeMin stepSize: 1.0 tickmarksEnabled: true updateValueWhileDragging: true value: baseFontSize onValueChanged: ApplicationSettings.baseFontSize = value; } GCText { id: baseFontSizeText text: qsTr("Font size") fontSize: mediumSize wrapMode: Text.WordWrap } Button { height: 30 * ApplicationInfo.ratio text: qsTr("Default"); style: GCButtonStyle {} onClicked: baseFontSizeSlider.value = 0.0 } } Flow { spacing: 5 width: parent.width GCComboBox { id: fontCapitalizationBox model: fontCapitalizationModel width: 250 * ApplicationInfo.ratio background: dialogActivityConfig label: qsTr("Font Capitalization") } } Flow { spacing: 5 width: parent.width GCComboBox { id: languageBox model: dialogConfig.languages width: 300 * ApplicationInfo.ratio background: dialogActivityConfig onCurrentIndexChanged: voicesRow.localeChanged(); label: qsTr("Language selector") } } Flow { id: voicesRow width: parent.width spacing: 5 * ApplicationInfo.ratio property bool haveLocalResource: false function localeChanged() { var language = dialogConfig.languages[languageBox.currentIndex].text; voicesRow.haveLocalResource = DownloadManager.isDataRegistered( "voices-" + ApplicationInfo.CompressedAudio + "/" + ApplicationInfo.getVoicesLocale(dialogConfig.languages[languageBox.currentIndex].locale) ) } Connections { target: DownloadManager onDownloadFinished: voicesRow.localeChanged() } GCText { id: voicesText text: qsTr("Localized voices") } Image { id: voicesImage sourceSize.height: 30 * ApplicationInfo.ratio source: voicesRow.haveLocalResource ? "qrc:/gcompris/src/core/resource/apply.svg" : "qrc:/gcompris/src/core/resource/cancel.svg" } Button { id: voicesButton height: 30 * ApplicationInfo.ratio visible: ApplicationInfo.isDownloadAllowed text: voicesRow.haveLocalResource ? qsTr("Check for updates") : qsTr("Download") style: GCButtonStyle {} onClicked: { if (DownloadManager.downloadResource( DownloadManager.getVoicesResourceForLocale(dialogConfig.languages[languageBox.currentIndex].locale))) { var downloadDialog = Core.showDownloadDialog(dialogConfig.parent.rootItem, {}); } } } } Flow { width: parent.width spacing: 5 * ApplicationInfo.ratio GCText { text: qsTr("Difficulty filter:") fontSize: mediumSize height: 50 * ApplicationInfo.ratio } // Padding Item { height: 1 width: 10 * ApplicationInfo.ratio } Image { source: "qrc:/gcompris/src/core/resource/bar_next.svg" sourceSize.height: Math.min(50 * ApplicationInfo.ratio, parent.width / 8) MouseArea { anchors.fill: parent onClicked: { filterRepeater.setMin(filterRepeater.min + 1) } } } // Padding Item { height: 1 width: 5 * ApplicationInfo.ratio } // Level filtering Repeater { id: filterRepeater model: 6 property int min: ApplicationSettings.filterLevelMin property int max: ApplicationSettings.filterLevelMax function setMin(value) { var newMin if(min < 1) newMin = 1 else if(min > 6) newMin = 6 else if(max >= value) newMin = value if(newMin) ApplicationSettings.filterLevelMin = newMin } function setMax(value) { var newMax if(max < 1) newMax = 1 else if(max > 6) newMax = 6 else if(min <= value) newMax = value if(newMax) ApplicationSettings.filterLevelMax = newMax } Image { source: "qrc:/gcompris/src/core/resource/difficulty" + (modelData + 1) + ".svg"; sourceSize.width: Math.min(50 * ApplicationInfo.ratio, parent.width / 8) opacity: modelData + 1 >= filterRepeater.min && modelData + 1 <= filterRepeater.max ? 1 : 0.4 property int value: modelData + 1 MouseArea { anchors.fill: parent onClicked: { if(parent.value < filterRepeater.max) { if(parent.opacity == 1) filterRepeater.setMin(parent.value + 1) else filterRepeater.setMin(parent.value) } else if(parent.value > filterRepeater.min) { if(parent.opacity == 1) filterRepeater.setMax(parent.value - 1) else filterRepeater.setMax(parent.value) } } } } } // Padding Item { height: 1 width: 5 * ApplicationInfo.ratio } Image { source: "qrc:/gcompris/src/core/resource/bar_previous.svg" sourceSize.height: Math.min(50 * ApplicationInfo.ratio, parent.width / 8) MouseArea { anchors.fill: parent onClicked: { filterRepeater.setMax(filterRepeater.max - 1) } } } } } property bool showLockedActivities: ApplicationSettings.showLockedActivities property bool isAudioVoicesEnabled: ApplicationSettings.isAudioVoicesEnabled property bool isAudioEffectsEnabled: ApplicationSettings.isAudioEffectsEnabled property bool isFullscreen: ApplicationSettings.isFullscreen property bool isVirtualKeyboard: ApplicationSettings.isVirtualKeyboard property bool isAutomaticDownloadsEnabled: ApplicationSettings.isAutomaticDownloadsEnabled property bool sectionVisible: ApplicationSettings.sectionVisible property int baseFontSize // don't bind to ApplicationSettings.baseFontSize // or we get a binding loop warning function loadFromConfig() { // Synchronize settings with data showLockedActivities = ApplicationSettings.showLockedActivities isAudioVoicesEnabled = ApplicationSettings.isAudioVoicesEnabled enableAudioVoicesBox.checked = isAudioVoicesEnabled isAudioEffectsEnabled = ApplicationSettings.isAudioEffectsEnabled enableAudioEffectsBox.checked = isAudioEffectsEnabled isFullscreen = ApplicationSettings.isFullscreen enableFullscreenBox.checked = isFullscreen isVirtualKeyboard = ApplicationSettings.isVirtualKeyboard enableVirtualKeyboardBox.checked = isVirtualKeyboard isAutomaticDownloadsEnabled = ApplicationSettings.isAutomaticDownloadsEnabled enableAutomaticDownloadsBox.checked = isAutomaticDownloadsEnabled sectionVisible = ApplicationSettings.sectionVisible sectionVisibleBox.checked = sectionVisible baseFontSize = ApplicationSettings.baseFontSize; // Set locale for(var i = 0 ; i < dialogConfig.languages.length ; i ++) { if(dialogConfig.languages[i].locale === ApplicationSettings.locale) { languageBox.currentIndex = i; break; } } // Set font for(var i = 0 ; i < fonts.count ; i ++) { if(fonts.get(i).text == ApplicationSettings.font) { fontBox.currentIndex = i; break; } } // Set font capitalization for(var i = 0 ; i < fontCapitalizationModel.length ; i ++) { if(fontCapitalizationModel[i].value == ApplicationSettings.fontCapitalization) { fontCapitalizationBox.currentIndex = i; break; } } } function save() { ApplicationSettings.showLockedActivities = showLockedActivities ApplicationSettings.isAudioVoicesEnabled = isAudioVoicesEnabled ApplicationSettings.isAudioEffectsEnabled = isAudioEffectsEnabled ApplicationSettings.isFullscreen = isFullscreen ApplicationSettings.isVirtualKeyboard = isVirtualKeyboard ApplicationSettings.isAutomaticDownloadsEnabled = isAutomaticDownloadsEnabled ApplicationSettings.sectionVisible = sectionVisible ApplicationSettings.isEmbeddedFont = fonts.get(fontBox.currentIndex).isLocalResource; ApplicationSettings.font = fonts.get(fontBox.currentIndex).text ApplicationSettings.fontCapitalization = fontCapitalizationModel[fontCapitalizationBox.currentIndex].value ApplicationSettings.saveBaseFontSize(); if (ApplicationSettings.locale != dialogConfig.languages[languageBox.currentIndex].locale) { ApplicationSettings.locale = dialogConfig.languages[languageBox.currentIndex].locale if(!DownloadManager.isDataRegistered( "voices-" + ApplicationInfo.CompressedAudio + "/" + ApplicationInfo.getVoicesLocale(dialogConfig.languages[languageBox.currentIndex].locale) )) { // ask for downloading new voices Core.showMessageDialog(main, qsTr("You selected a new locale") + '\n' + qsTr("Do you want to download the corresponding sound files now?"), qsTr("Yes"), function() { // yes -> start download if (DownloadManager.downloadResource( DownloadManager.getVoicesResourceForLocale(ApplicationInfo.localeShort))) var downloadDialog = Core.showDownloadDialog(main, {}); }, qsTr("No"), null, null ); } else // check for updates or/and register new voices DownloadManager.updateResource( DownloadManager.getVoicesResourceForLocale(ApplicationSettings.locale)) } } function reset() { ApplicationSettings.baseFontSize = baseFontSize; } ListModel { id: fonts Component.onCompleted: { var systemFonts = Qt.fontFamilies(); var rccFonts = ApplicationInfo.getFontsFromRcc(); // Remove explicitly all *symbol* and *ding* fonts var excludedFonts = ApplicationInfo.getSystemExcludedFonts(); excludedFonts.push("ding"); excludedFonts.push("symbol"); for(var i = 0 ; i < systemFonts.length ; ++ i) { var isExcluded = false; // Remove symbol fonts for(var j = 0 ; j < excludedFonts.length ; ++ j) { if(systemFonts[i].toLowerCase().indexOf(excludedFonts[j].toLowerCase()) != -1) { isExcluded = true; break; } } // Remove fonts from rcc (if you have a default font from rcc, Qt will add it to systemFonts) for(var j = 0 ; j < rccFonts.length ; ++ j) { if(rccFonts[j].toLowerCase().indexOf(systemFonts[i].toLowerCase()) != -1) { isExcluded = true; break; } } // Finally, we know if we add this font or not if(!isExcluded) { fonts.append({ "text": systemFonts[i], "isLocalResource": false }); } } for(var i = 0 ; i < rccFonts.length ; ++ i) { // Append fonts from resources fonts.append({ "text": rccFonts[i], "isLocalResource": true }); } } } property variant fontCapitalizationModel: [ { text: qsTr("Mixed case (default)"), value: Font.MixedCase }, { text: qsTr("All uppercase"), value: Font.AllUppercase }, { text: qsTr("All lowercase"), value: Font.AllLowercase } ] function hasConfigChanged() { return (ApplicationSettings.locale !== dialogConfig.languages[languageBox.currentIndex].locale || (ApplicationSettings.sectionVisible != sectionVisible) || (ApplicationSettings.font != fonts.get(fontBox.currentIndex).text) || (ApplicationSettings.isEmbeddedFont != fonts.get(fontBox.currentIndex).isLocalResource) || (ApplicationSettings.isEmbeddedFont != fonts.get(fontBox.currentIndex).isLocalResource) || (ApplicationSettings.fontCapitalization != fontCapitalizationModel[(fontcapitalizationBox.currentIndex)].value) || (ApplicationSettings.isAudioVoicesEnabled != isAudioVoicesEnabled) || (ApplicationSettings.isAudioEffectsEnabled != isAudioEffectsEnabled) || (ApplicationSettings.isFullscreen != isFullscreen) || (ApplicationSettings.isVirtualKeyboard != isVirtualKeyboard) || (ApplicationSettings.isAutomaticDownloadsEnabled != isAutomaticDownloadsEnabled) || (ApplicationSettings.baseFontSize != baseFontSize) || (ApplicationSettings.showLockedActivities != showLockedActivities) ); } } diff --git a/src/core/DialogAbout.qml b/src/core/DialogAbout.qml index 759ab3f7e..96246c46f 100644 --- a/src/core/DialogAbout.qml +++ b/src/core/DialogAbout.qml @@ -1,129 +1,129 @@ /* GCompris - DialogAbout.qml * - * Copyright (C) 2014 Bruno Coudoin + * Copyright (C) 2015 Bruno Coudoin * * Authors: * Bruno Coudoin * * 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 /** * GCompris' full screen about dialog. * @ingroup infrastructure * * @sa DialogBackground */ DialogBackground { visible: false title: qsTr("About GCompris") //: Replace this string with your names, one name per line. property string translators: qsTr("translator-credits") === "translator-credits" ? "" : qsTr("translator-credits") + "
" // Let's try to maitain here the contributor list sorted by number of commits // git shortlog -se | sort -nr | cut -c8- | sed 's/ <.*>/,/' | xargs property string developers: "Bruno Coudoin, Johnny Jazeix, Holger Kaelberer, Aruna Sankaranarayanan, Stephane Mankowski, Thibaut ROMAIN, Manuel Tondeur, Bharath M S, Yuri Chornoivan, JB BUTET, Emmanuel Charruau, Arkit Vora, Luigi Toscano, Amit Tomar" property string gcVersion: ApplicationInfo.GCVersion property string qtVersion: ApplicationInfo.QTVersion property string gcVersionTxt: qsTr("GCompris %1").arg(gcVersion) property string qtVersionTxt: qsTr("Based on Qt %1").arg(qtVersion) content: "
" + "" + qsTr("GCompris Home Page: http://gcompris.net") + "" + "
" + "
" + gcVersionTxt + " " + qtVersionTxt + "
" + "
" + "" + qsTr("GCompris is a Free Software developed within the KDE community.") + "

" + qsTr("KDE is a world-wide network of software engineers, artists, writers, translators and facilitators " + "who are committed to Free Software development. " + "This community has created hundreds of Free Software applications as part of the KDE " + "frameworks, workspaces and applications.

" + "KDE is a cooperative enterprise in which no single entity controls the " + "efforts or products of KDE to the exclusion of others. Everyone is welcome to join and " + "contribute to KDE, including you.

" + "Visit %2 for " + "more information about the KDE community and the software we produce.") .arg("http://www.gnu.org/philosophy/free-sw.html") .arg("http://www.kde.org/") + "" + "

" + qsTr("Software can always be improved, and the KDE team is ready to " + "do so. However, you - the user - must tell us when " + "something does not work as expected or could be done better.

" + "KDE has a bug tracking system. Visit " + "%1 to report a bug.

" + "If you have a suggestion for improvement then you are welcome to use " + "the bug tracking system to register your wish. Make sure you use the " + "severity called \"Wishlist\".") .arg("https://bugs.kde.org/") + "

" + qsTr("You do not have to be a software developer to be a member of the " + "KDE team. You can join the national teams that translate " + "program interfaces. You can provide graphics, themes, sounds, and " + "improved documentation. You decide!" + "

" + "Visit " + "%1 " + "for information on some projects in which you can participate." + "

" + "If you need more information or documentation, then a visit to " + "%2 " + "will provide you with what you need.") .arg("http://www.kde.org/community/getinvolved/") .arg("http://techbase.kde.org/") + "

" + qsTr("To support development the KDE community has formed the KDE e.V., a non-profit organization " + "legally founded in Germany. KDE e.V. represents the KDE community in legal and financial matters. " + "See %1" + " for information on KDE e.V.

" + "KDE benefits from many kinds of contributions, including financial. " + "We use the funds to reimburse members and others for expenses " + "they incur when contributing. Further funds are used for legal " + "support and organizing conferences and meetings.

" + "We would like to encourage you to support our efforts with a " + "financial donation, using one of the ways described at " + "%2." + "

Thank you very much in advance for your support.") .arg("http://ev.kde.org/") .arg("http://www.kde.org/community/donations/") + "

" + qsTr("A big thanks to the development team: %1").arg(developers) + "

" + qsTr("A big thanks to the translation team: %1") .arg(translators) + - "
" + "Copyright 2000-2014 Bruno Coudoin and Others" + "
" + "
" + "
" + "Copyright 2000-2015 Bruno Coudoin and Others" + "
" + "
" }