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

GCompris-qt

  • src
  • core
ActivityInfoTree.h
1 /* GCompris - ActivityInfoTree.h
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 #ifndef ACTIVITYINFOTREE_H
22 #define ACTIVITYINFOTREE_H
23 
24 #include <qqml.h>
25 #include "ActivityInfo.h"
26 #include <QQmlEngine>
27 #include <QDir>
28 
29 class ActivityInfoTree : public QObject
30 {
31  Q_OBJECT
32  Q_PROPERTY(ActivityInfo* rootMenu READ getRootMenu CONSTANT)
33  Q_PROPERTY(QQmlListProperty<ActivityInfo> menuTree READ menuTree NOTIFY menuTreeChanged)
34  Q_PROPERTY(ActivityInfo* currentActivity READ getCurrentActivity WRITE setCurrentActivity NOTIFY currentActivityChanged)
35 
36 public:
37  explicit ActivityInfoTree(QObject *parent = 0);
38  QQmlListProperty<ActivityInfo> menuTree();
39  ActivityInfo *getRootMenu() const;
40  void setRootMenu(ActivityInfo *rootMenu);
41  ActivityInfo *menuTree(int) const;
42  void setCurrentActivity(ActivityInfo *currentActivity);
43  ActivityInfo *getCurrentActivity() const;
44  ActivityInfo *getParentActivity(ActivityInfo *root, ActivityInfo *menu);
45  void menuTreeAppend(ActivityInfo *menu);
46  void menuTreeAppend(QQmlEngine *engine,
47  const QDir &menuDir, const QString &menuFile);
48  void sortByDifficulty();
49  void sortByName();
50 
51 protected slots:
52  Q_INVOKABLE void filterByTag(const QString &tag);
53  Q_INVOKABLE void filterLockedActivities();
54  Q_INVOKABLE void filterEnabledActivities();
55 
56 signals:
57  void menuTreeChanged();
58  void currentActivityChanged();
59 
60 private:
61  // this is the full activity list, it never changes
62  QList<ActivityInfo *> m_menuTreeFull;
63  // represents the Menu view and can be filtered
64  QList<ActivityInfo *> m_menuTree;
65  ActivityInfo *m_rootMenu;
66  ActivityInfo *m_currentActivity;
67  static int menuTreeCount(QQmlListProperty<ActivityInfo> *property);
68  static ActivityInfo *menuTreeAt(QQmlListProperty<ActivityInfo> *property, int index);
69 
70  struct SortByDifficulty
71  {
72  bool operator()(const ActivityInfo *a, const ActivityInfo *b) const
73  {
74  return a->difficulty() < b->difficulty();
75  }
76  };
77 
78  struct SortByName
79  {
80  bool operator()(const ActivityInfo *a, const ActivityInfo *b) const
81  {
82  return a->name() < b->name();
83  }
84  };
85 
86 public:
87  static void init();
88  static QObject *menuTreeProvider(QQmlEngine *engine, QJSEngine *scriptEngine);
89  void exportAsSQL();
90 
91 };
92 
93 #endif // ACTIVITYINFOTREE_H
ActivityInfo
A QML component holding meta information about an activity.
Definition: ActivityInfo.h:37
ActivityInfo::name
QString name
Name of the main activity QML file.
Definition: ActivityInfo.h:46
ActivityInfo::difficulty
int difficulty
Difficulty of the activity.
Definition: ActivityInfo.h:63
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