• Skip to content
  • Skip to link menu
KDE API Documentation - DialogHelp.qml Source File (GCompris-qt)
  • KDE Home
  • Contact Us
 

GCompris-qt

  • src
  • core
DialogHelp.qml
1 /* GCompris - DialogHelp.qml
2  *
3  * Copyright (C) 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
4  *
5  * Authors:
6  * Bruno Coudoin <bruno.coudoin@gcompris.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21 import QtQuick 2.2
22 import GCompris 1.0
23 
37 DialogBackground {
38  visible: false
39  title: activityInfo.title
40  titleIcon: activityInfo.difficulty != 0 ? "qrc:/gcompris/src/core/resource/difficulty" +
41  activityInfo.difficulty + ".svg" : ""
42  property QtObject activityInfo: ActivityInfoTree.currentActivity
43 
44  function getIcon() {
45  if(activityInfo.icon) {
46  return "<img align='right' width='" + 100 * ApplicationInfo.ratio +
47  "' height='" + 100 * ApplicationInfo.ratio + "' src='qrc:/gcompris/src/activities/" + activityInfo.icon + "'/>"
48  }
49  return ""
50  }
51 
52  function reformat(string) {
53  var text = string.replace(/^ (.*)\n/gm,'<ul><li>$1</li></ul>')
54  text = text.replace(/\n/gm,'<br/>')
55  return text
56  }
57 
58  function getContent() {
59  var contentText = getIcon()
60  contentText += "<b>" + activityInfo.description + "</b>"
61  contentText += "<br/><br/>"
62  if(activityInfo.author) {
63  contentText += "<b>" + qsTr("Author") + ": </b>" + activityInfo.author
64  contentText += "<br/><br/>"
65  }
66  if(activityInfo.prerequisite) {
67  contentText += "<b>" + qsTr("Prerequisite") + ": </b>" + activityInfo.prerequisite
68  contentText += "<br/><br/>"
69  }
70  if(activityInfo.goal) {
71  var goal = reformat(activityInfo.goal)
72  contentText += "<b>" + qsTr("Goal") + ": </b>" + goal
73  contentText += "<br/><br/>"
74  }
75  if(activityInfo.manual) {
76  var manual = reformat(activityInfo.manual)
77  contentText += "<b>" + qsTr("Manual") + ": </b>" + manual
78  contentText += "<br/><br/>"
79  }
80  if(activityInfo.credit) {
81  contentText += "<b>" + qsTr("Credit") + ": </b>" + activityInfo.credit
82  contentText += "<br/><br/>"
83  }
84  if(activityInfo.section) {
85  contentText += "<b>" + qsTr("Section: ") + "</b>" + activityInfo.section
86  contentText += " (" + activityInfo.name.split('/')[0] + ")"
87  contentText += "<br/><br/>"
88  }
89  return contentText
90  }
91 
92  content: getContent()
93 
94 }
QtQuick
GCompris
ApplicationInfo
A general purpose singleton that exposes miscellaneous native functions to the QML layer...
Definition: ApplicationInfo.h:43
ApplicationInfo::ratio
qreal ratio
Ratio factor used for scaling of sizes on high-dpi devices.
Definition: ApplicationInfo.h:91
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Jun 2 2015 21:47:47 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GCompris-qt

Skip menu "GCompris-qt"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Modules

Class Picker

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal