Frapper  1.0a
PoemReaderNode.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2009 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
33 
34 #ifndef POEMREADERNODE_H
35 #define POEMREADERNODE_H
36 
37 #include "Node.h"
38 #include "ImageNode.h"
39 #include "TagCloudView.h"
40 #include "FrapperPrerequisites.h"
41 #include "BaseGraphicsView.h"
42 
43 #include <QPointF>
44 #include <QtCore/QTimer>
45 #include <QtCore/QTime>
46 #include <QtGui>
47 #include <Ogre.h>
48 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
49 #include <windows.h>
50 #endif
51 
52 namespace PoemReaderNode {
53 using namespace Frapper;
54 
58 class PoemReaderNode : public ImageNode
59 {
60 
61  Q_OBJECT
62 
63 public: // constructors and destructors
64 
71  PoemReaderNode ( QString name, ParameterGroup *parameterRoot );
72 
80  virtual ~PoemReaderNode ();
81 
82 public: // functions
83 
84 
85  void createPoemsData();
86 
97  void renderWords(QGraphicsScene *scene, QString word, qreal size, int &posx, int &posy, int &gWordHeight);
98 
102  bool wordAccepted(QString word);
103 
107  QString removeWildCards(QString word);
108 
112  void replyFromCharacter(QString word);
113 
114 public:
116 
117 public slots:
118 
122  void loadXmlFile();
123 
127  void reloadXmlFile();
128 
129 
130 private: //methods
131 
132  bool findWord(QString str);
133  bool obtainWord(QString word);
134  void createWordsTable(QString word);
135  void setPoemSelected(QString name);
136 
137 
138 private slots: //
139 
143  //void processOutputParameter ();
144 
145  void reduceWordsCloud();
146 
147  void notifySelection();
148 
149  void updatePoemSelected();
150 
151  void triggerPoemLines();
152 
153  void updateFadingOutTimer();
154 
155  void updateFadingInTimer();
156 
157  void fadingOut();
158  void fadingIn();
159 
160  void readGrammar(QString grammar);
161 
162 signals:
163 
164  void emitGrammar(QString grammar);
165 
166 
167 private: // data
168 
169  QTableWidget *m_wordsTable;
171  QString poemsIndexStr;
172 
173  QStringList m_poemsindex;
174 
176  int poemLine;
177  QStringList poems;
178 
179  QTimer *m_foutTimer;
180  QTimer *m_finTimer;
181 
182  QWidget *parent;
183  ParameterGroup *parameterRoot; // pointer to this Parameter Root
184 
185 protected: // data
186 
190 
192 
197  //Parameter *m_numberWordsSelected;
201 
202 
203 
204 
205 };
206 
207 } // namespace PoemReaderNode
208 
209 #endif