NCL Composer  0.1.5
 All Classes Functions Variables Pages
qnlycomposerplugin.h
1 /*
2  * Copyright 2011 TeleMidia/PUC-Rio.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18 #ifndef QNLYCOMPOSERPLUGIN_H
19 #define QNLYCOMPOSERPLUGIN_H
20 
21 #include <QString>
22 #include <QMap>
23 
24 #include <core/extensions/IPlugin.h>
25 using namespace composer::extension;
26 
27 #include "ui/view/qnlyview.h"
28 
30 {
31  Q_OBJECT
32 
33 public:
34  QnlyComposerPlugin(QObject* parent = 0);
35 
37 
38  virtual void init();
39 
40  virtual QWidget* getWidget();
41 
42  virtual bool saveSubsession();
43 
44 public slots:
45 
46  virtual void onEntityAdded(QString pluginID, Entity *entity);
47 
48  virtual void errorMessage(QString error);
49 
50  virtual void onEntityChanged(QString pluginID, Entity *entity);
51 
52  virtual void onEntityRemoved(QString pluginID, QString entityID);
53 
54  virtual void changeSelectedEntity(QString pluginID, void* entityUID);
55 
56  virtual void updateFromModel();
57 
58 protected slots:
59  void addRegionToView(Entity* entity);
60 
61  void removeRegionFromView(QString entityUID);
62 
63  void changeRegionInView(Entity* entity);
64 
65  void selectRegionInView(QString entityUID);
66 
67  void addRegionBaseToView(Entity* entity);
68 
69  void removeRegionBaseFromView(QString entityUID);
70 
71  void changeRegionBaseInView(Entity* entity);
72 
73  void selectRegionBaseInView(QString entityUID);
74 
75  void addRegion(const QString regionUID,
76  const QString parentUID,
77  const QString regionbaseUID,
78  const QMap<QString, QString> attributes);
79 
80  void removeRegion(const QString regionUID,
81  const QString regionbaseUID);
82 
83  void changeRegion(const QString regionUID,
84  const QString regionbaseUID,
85  const QMap<QString, QString> attributes);
86 
87  void selectRegion(const QString regionUID,
88  const QString regionbaseUID);
89 
90  void addRegionBase(const QString regionbaseUID,
91  const QMap<QString, QString> attributes);
92 
93  void removeRegionBase(const QString regionbaseUID);
94 
95  void changeRegionBase(const QString regionbaseUID,
96  const QMap<QString, QString> attributes);
97 
98  void selectRegionBase(const QString regionbaseUID);
99 
100  void performMediaOverRegionAction(const QString mediaId,
101  const QString regionUID);
102 
103 private:
104  void clear();
105 
106  void loadRegionbase();
107 
108  void loadRegion(Entity* region);
109 
114  QString getHeadUid();
115 
116  QMap <QString, QString> getRegionAttributes(Entity *region);
117 
118  void createView();
119 
120  void createConnections();
121 
122  QnlyView* view;
123 
124  QMap<QString, Entity*> regions;
125 
126  QMap<QString, Entity*> regionbases;
127 
128  QMap<QString, QString> relations;
129 
130  QString *selectedId;
131 };
132 
133 #endif // QNLYCOMPOSERPLUGIN_H