NCL Composer  0.1.5
 All Classes Functions Variables Pages
MessageControl.h
1 /* Copyright (c) 2011 Telemidia/PUC-Rio.
2  * All rights reserved. This program and the accompanying materials
3  * are made available under the terms of the Eclipse Public License v1.0
4  * which accompanies this distribution, and is available at
5  * http://www.eclipse.org/legal/epl-v10.html
6  *
7  * Contributors:
8  * Telemidia/PUC-Rio - initial API and implementation
9  */
10 #ifndef MESSAGECONTROL_H
11 #define MESSAGECONTROL_H
12 
13 #include <QObject>
14 #include <QDebug>
15 #include <QUndoStack>
16 
17 #include <exception>
18 using namespace std;
19 
20 #include "../util/ComposerCoreControl_global.h"
21 
22 #include "../extensions/IDocumentParser.h"
23 using namespace composer::extension;
24 
25 #include "../model/Entity.h"
26 #include "../model/Project.h"
27 using namespace composer::core::model;
28 
29 #include "../extensions/IPlugin.h"
30 using namespace composer::extension;
31 
32 namespace composer {
33 namespace core {
34 
39 class COMPOSERCORESHARED_EXPORT MessageControl : public QObject
40 {
41  Q_OBJECT
42 
43 private:
44  Project *project;
45  QMap <QString, QStringList> listenEntities;
46  QUndoStack *qUndoStack;
49 public:
55  MessageControl(Project *project);
59  ~MessageControl();
60 
61 private:
65  void sendEntityAddedMessageToPlugins( QString pluginInstanceId,
66  Entity *entity);
70  void sendEntityChangedMessageToPlugins( QString pluginInstanceId,
71  Entity *entity);
75  void sendEntityRemovedMessageToPlugins( QString pluginInstanceId,
76  Entity *entity);
77 
78 
82  bool pluginIsInterestedIn(IPlugin *plugin, Entity *entity);
83 
84 public slots:
93  void onAddEntity( QString type,
94  QString parentEntityId,
95  QMap<QString,QString>& atts,
96  bool force);
104  void onEditEntity(Entity *entity, QMap<QString,QString> atts, bool force);
111  void onRemoveEntity(Entity *, bool force);
115  void setListenFilter(QStringList list);
116 
120  void setPluginData(QByteArray data);
121 
125  void setCurrentProjectAsDirty();
126 
132  void anonymousAddEntity(QString type,
133  QString parentEntityId,
134  QMap<QString,QString>& atts,
135  bool force = false,
136  bool notifyPlugins = true);
137 
142  void anonymousAddEntity( Entity *entity,
143  QString parentEntityId,
144  bool force = false,
145  bool notifyPlugins = true);
146 
152  void anonymousRemoveEntity( QString entityUniqueId,
153  bool force = false,
154  bool notifyPlugins = true);
160  void anonymousUpdateFromModel();
161 
167  void anonymousChangeEntity( QString entityId,
168  QMap<QString,QString>& atts,
169  bool force = false,
170  bool notifyPlugins = true);
171 
172  void undo();
173  void redo();
174 
175 signals:
176  void entityAdded(QString, Entity*);
177 
178 };
179 } } //end namespace
180 #endif // MESSAGECONTROL_H