/* GCompris - DialogHelp.qml * * Copyright (C) 2014 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 QtQuick 2.2 import GCompris 1.0 /** * GCompris' full screen help dialog. * @ingroup infrastructure * * Used in Menu.qml as well as all activities to show more detailed * information like author, manual, difficulty etc. as defined in each * activities ActivityInfo.qml * * The help screens for the activities are generated automatically by * the core and are started via the 'help' button on the Bar. * * @sa Bar.helpClicked, BarEnumContent.help, DialogBackground, ActivityInfo */ DialogBackground { visible: false title: activityInfo.title titleIcon: activityInfo.difficulty != 0 ? "qrc:/gcompris/src/core/resource/difficulty" + activityInfo.difficulty + ".svg" : "" property QtObject activityInfo: ActivityInfoTree.currentActivity function getIcon() { if(activityInfo.icon) { return "" } return "" } function reformat(string) { var text = string.replace(/^ (.*)\n/gm,'
  • $1
') text = text.replace(/\n/gm,'
') return text } function getContent() { var contentText = getIcon() contentText += "" + activityInfo.description + "" contentText += "

" if(activityInfo.author) { contentText += "" + qsTr("Author") + ": " + activityInfo.author contentText += "

" } if(activityInfo.prerequisite) { contentText += "" + qsTr("Prerequisite") + ": " + activityInfo.prerequisite contentText += "

" } if(activityInfo.goal) { var goal = reformat(activityInfo.goal) contentText += "" + qsTr("Goal") + ": " + goal contentText += "

" } if(activityInfo.manual) { var manual = reformat(activityInfo.manual) contentText += "" + qsTr("Manual") + ": " + manual contentText += "

" } if(activityInfo.credit) { contentText += "" + qsTr("Credit") + ": " + activityInfo.credit contentText += "

" } if(activityInfo.section) { contentText += "" + qsTr("Section: ") + "" + activityInfo.section contentText += " (" + activityInfo.name.split('/')[0] + ")" contentText += "

" } return contentText } content: getContent() }