Frapper  1.0a
PoemReaderPanel.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; either version 2 of the License, or (at your option) any later
12 version.
13 
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License along with
19 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21 http://www.gnu.org/copyleft/lesser.txt.
22 -----------------------------------------------------------------------------
23 */
24 
35 
36 #ifndef PoemReaderPanel_H
37 #define PoemReaderPanel_H
38 
39 #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
40 #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
41 
42 #include "FrapperPrerequisites.h"
43 #include "ViewPanel.h"
44 #include "Node.h"
45 #include "Parameter.h"
46 #include "NumberParameter.h"
47 #include "FilenameParameter.h"
48 #include "EnumerationParameter.h"
49 #include "ParameterPlugin.h"
50 //#include "TagCloudView.h"
51 
52 
53 
54 #include <math.h>
55 #include <QtGui>
56 
57 namespace Frapper {
58 
62 class PoemReaderPanel : public ViewPanel
63 
64 {
65 
66  Q_OBJECT
67 
68 public: // constructors and destructors
69 
76  PoemReaderPanel ( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
77 
85  virtual ~PoemReaderPanel ();
86 
87 
88 public slots: //
89 
93  void sendPoem(int buttonId);
97  void visualizeCloud();
98 
99  void clicked(int buttonId);
100 
101 
102 public: // functions
103 
104 
111  virtual void registerControl(NodeModel *nodeModel, SceneModel *sceneModel);
112 
120  QListWidgetItem* addItem(Parameter *parameter, bool groupElement);
121 
126  void createWordsTable(Node *selectedNode);
127 
128  // Added for word cloud generation
129 
130 
131 
132  bool findWord(QString word, int &listIndex);
133  bool obtainWord(QString word);
134 
135  void loadXmlFile();
136 
147  void renderWords(QGraphicsScene *scene, QString word, qreal size, int &posx, int &posy, int &gWordHeight);
148 
149  void clearLayout(QLayout* layout, bool deleteWidgets);
150 
151 
152 private slots: //
153 
159  void updateSelectedNode(Node * selectedNode);
160 
164  void update();
165 
169  void nodeSelected(QListWidgetItem * listItem);
170 
171 
172 private: // data
173 
174 
179 
184 
189 
193  QListWidget *m_ListNodes;
194 
198  QLineEdit *m_lineEdit;
199 
200  QTableWidget *m_wordsTable;
201 
202  QStringList m_poemsindex;
203 
205  QStringList poems;
206  bool done;
207 
208  QGraphicsScene *scene;
209  QGraphicsView *view;
210  QHBoxLayout *m_hboxLayout;
211  QVBoxLayout *m_leftvboxLayout;
212  QVBoxLayout *m_rightvboxLayout;
213  QPushButton *m_buttonSelector;
214  QPushButton *buttonCloudGenerator;
215  QTabWidget *m_tabWidget;
216  QSignalMapper* m_signalMapper;
217 
218  //TagCloudView *m_tagCloudView;
219 };
220 
221 
222 
223 } // end namespace Frapper
224 
225 #endif