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

GCompris-qt

  • src
  • core
ActivityInfo.cpp
1 /* GCompris - ActivityInfo.cpp
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 #include "ActivityInfo.h"
22 
23 #include <QtDebug>
24 #include <QQmlProperty>
25 #include <QQmlEngine>
26 #include <QQmlComponent>
27 
28 #include "ApplicationSettings.h"
29 
30 ActivityInfo::ActivityInfo(QObject *parent):
31  QObject(parent),
32  m_demo(true),
33  m_favorite(false),
34  m_enabled(true)
35 {
36 }
37 
38 QString ActivityInfo::name() const
39 {
40  return m_name;
41 }
42 void ActivityInfo::setName(const QString &name)
43 {
44  m_name = name;
45  // Once we are given a name, we can get the favorite property
46  // from the persistant configuration
47  if(!ApplicationSettings::getInstance()->isKioskMode())
48  m_favorite = ApplicationSettings::getInstance()->isFavorite(m_name);
49  emit nameChanged();
50 }
51 
52 QString ActivityInfo::section() const
53 {
54  return m_section;
55 }
56 void ActivityInfo::setSection(const QString &section)
57 {
58  m_section = section;
59  emit sectionChanged();
60 }
61 
62 int ActivityInfo::difficulty() const
63 {
64  return m_difficulty;
65 }
66 void ActivityInfo::setDifficulty(const int &difficulty)
67 {
68  m_difficulty = difficulty;
69  emit difficultyChanged();
70 }
71 
72 QString ActivityInfo::icon() const
73 {
74  return m_icon;
75 }
76 void ActivityInfo::setIcon(const QString &icon)
77 {
78  m_icon = icon;
79  emit iconChanged();
80 }
81 
82 QString ActivityInfo::author() const
83 {
84  return m_author;
85 }
86 void ActivityInfo::setAuthor(const QString &author)
87 {
88  m_author = author;
89  emit authorChanged();
90 }
91 
92 bool ActivityInfo::demo() const
93 {
94  return m_demo;
95 }
96 void ActivityInfo::setDemo(const bool &demo)
97 {
98  m_demo = demo;
99  emit demoChanged();
100 }
101 
102 QString ActivityInfo::title() const
103 {
104  return m_title;
105 }
106 void ActivityInfo::setTitle(const QString &title)
107 {
108  m_title = title;
109  emit titleChanged();
110 }
111 
112 QString ActivityInfo::description() const
113 {
114  return m_description;
115 }
116 void ActivityInfo::setDescription(const QString &description)
117 {
118  m_description = description;
119  emit descriptionChanged();
120 }
121 
122 QString ActivityInfo::goal() const
123 {
124  return m_goal;
125 }
126 void ActivityInfo::setGoal(const QString &goal)
127 {
128  m_goal = goal;
129  emit goalChanged();
130 }
131 
132 QString ActivityInfo::prerequisite() const
133 {
134  return m_prerequisite;
135 }
136 void ActivityInfo::setPrerequisite(const QString &prerequisite)
137 {
138  m_prerequisite = prerequisite;
139  emit prerequisiteChanged();
140 }
141 
142 QString ActivityInfo::manual() const
143 {
144  return m_manual;
145 }
146 void ActivityInfo::setManual(const QString &manual)
147 {
148  m_manual = manual;
149  emit manualChanged();
150 }
151 
152 QString ActivityInfo::credit() const
153 {
154  return m_credit;
155 }
156 void ActivityInfo::setCredit(const QString &credit)
157 {
158  m_credit = credit;
159  emit creditChanged();
160 }
161 
162 bool ActivityInfo::favorite() const
163 {
164  return m_favorite;
165 }
166 void ActivityInfo::setFavorite(const bool favorite)
167 {
168  m_favorite = favorite;
169  ApplicationSettings::getInstance()->setFavorite(m_name, m_favorite);
170  emit favoriteChanged();
171 }
172 
173 bool ActivityInfo::enabled() const
174 {
175  return m_enabled;
176 }
177 void ActivityInfo::setEnabled(const bool enabled)
178 {
179  m_enabled = enabled;
180  emit enabledChanged();
181 }
182 
183 QStringList ActivityInfo::getSectionPath()
184 {
185  QStringList path;
186  ActivityInfo *activity(this);
187  do {
188  path.prepend(activity->section());
189  } while( ( activity = qobject_cast<ActivityInfo*>(activity->parent()) ) );
190  return path;
191 }
ActivityInfo
A QML component holding meta information about an activity.
Definition: ActivityInfo.h:37
ActivityInfo::icon
QString icon
Relative path to the icon of the activity.
Definition: ActivityInfo.h:70
ActivityInfo::title
QString title
Title of the activity.
Definition: ActivityInfo.h:85
ActivityInfo::demo
bool demo
Whether the activity is part of the demo version of GCompris.
Definition: ActivityInfo.h:80
ActivityInfo::section
QString section
Section(s) this activity belongs to.
Definition: ActivityInfo.h:56
ActivityInfo::credit
QString credit
Credits to third parties.
Definition: ActivityInfo.h:110
ActivityInfo::goal
QString goal
Goal that this activity wants to achieve.
Definition: ActivityInfo.h:95
ActivityInfo::name
QString name
Name of the main activity QML file.
Definition: ActivityInfo.h:46
ActivityInfo::description
QString description
Description of the activity.
Definition: ActivityInfo.h:90
ActivityInfo::difficulty
int difficulty
Difficulty of the activity.
Definition: ActivityInfo.h:63
ActivityInfo::enabled
bool enabled
This activity is enabled.
Definition: ActivityInfo.h:117
ActivityInfo::author
QString author
Author of the activity.
Definition: ActivityInfo.h:75
ActivityInfo::prerequisite
QString prerequisite
Prerequisite for using this activity.
Definition: ActivityInfo.h:100
ActivityInfo::manual
QString manual
Manual describing the activity's usage.
Definition: ActivityInfo.h:105
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