Warning, /education/gcompris/src/core/DialogHelp.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - DialogHelp.qml
0002  *
0003  * SPDX-FileCopyrightText: 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
0004  *
0005  * Authors:
0006  *   Bruno Coudoin <bruno.coudoin@gcompris.net>
0007  *
0008  *   SPDX-License-Identifier: GPL-3.0-or-later
0009  */
0010 import QtQuick 2.12
0011 import GCompris 1.0
0012 
0013 /**
0014  * GCompris' full screen help dialog.
0015  * @ingroup infrastructure
0016  *
0017  * Used in Menu.qml as well as all activities to show more detailed
0018  * information like author, manual, difficulty etc. as defined in each
0019  * activities ActivityInfo.qml
0020  *
0021  * The help screens for the activities are generated automatically by
0022  * the core and are started via the 'help' button on the Bar.
0023  *
0024  * @sa Bar.helpClicked, BarEnumContent.help, DialogBackground, ActivityInfo
0025  */
0026 DialogBackground {
0027     visible: false
0028     title: activityInfo.title
0029 
0030     property QtObject activityInfo: ActivityInfoTree.currentActivity
0031 
0032     function getIcon() {
0033         if(activityInfo.icon) {
0034             return "qrc:/gcompris/src/activities/" + activityInfo.icon
0035         }
0036         return ""
0037     }
0038 
0039     function reformat(string) {
0040         var text = string.replace(/^    (.*)\n/gm,'<ul><li>$1</li></ul>')
0041         text = text.replace(/\n/gm,'<br/>')
0042         return text
0043     }
0044 
0045     function getContent() {
0046         var contentText = "<b>" + activityInfo.description + "</b>"
0047         contentText += "<br/><br/>"
0048         if(activityInfo.author) {
0049             contentText += "<b>" + qsTr("Author:") + " </b>" + activityInfo.author
0050             contentText += "<br/><br/>"
0051         }
0052         if(activityInfo.prerequisite) {
0053             contentText += "<b>" + qsTr("Prerequisite:") + " </b>" + activityInfo.prerequisite
0054             contentText += "<br/><br/>"
0055         }
0056         if(activityInfo.goal) {
0057             var goal = reformat(activityInfo.goal)
0058             contentText += "<b>" + qsTr("Goal:") + " </b>" + goal
0059             contentText += "<br/><br/>"
0060         }
0061         if(activityInfo.manual) {
0062             var manual = reformat(activityInfo.manual)
0063             contentText += "<b>" + qsTr("Manual:") + " </b>" + manual
0064             contentText += "<br/><br/>"
0065         }
0066         if(activityInfo.credit) {
0067             contentText += "<b>" + qsTr("Credit:") + " </b>" + activityInfo.credit
0068             contentText += "<br/><br/>"
0069         }
0070         if(activityInfo.section) {
0071             contentText += "<b>" + qsTr("Section:") + " </b>" + activityInfo.section
0072             contentText += " (" + activityInfo.name.split('/')[0] + ")"
0073             contentText += "<br/><br/>"
0074         }
0075         return contentText
0076     }
0077 
0078     contentIcon: getIcon()
0079     content: getContent()
0080 
0081 }