Frapper  1.0a
ParameterPanel.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-2010 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 
34 
35 #ifndef PARAMETERPANEL_H
36 #define PARAMETERPANEL_H
37 
38 #include "FrapperPrerequisites.h"
39 #include "ViewPanel.h"
40 #include "ui_ParameterPanel.h"
41 #include "Node.h"
42 #include "Parameter.h"
43 #include "NumberParameter.h"
44 #include "GenericParameter.h"
45 #include "FilenameParameter.h"
46 #include "EnumerationParameter.h"
47 #include <QtGui/QItemSelection>
48 #include <QtGui/QLabel>
49 #include <QtGui/QLineEdit>
50 
51 
52 namespace Frapper {
53 
57 class FRAPPER_GUI_EXPORT ParameterPanel : public ViewPanel, protected Ui::ParameterPanel
58 {
59 
60  Q_OBJECT
61 
62 public: // constructors and destructors
63 
70  ParameterPanel ( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
71 
79  virtual ~ParameterPanel ();
80 
81 public slots: //
82 
88  void showParameters ( Node *node );
89 
95  void updateParameters ( bool objectsSelected );
96 
97 public: // functions
98 
105  virtual void fillToolBars ( QToolBar *mainToolBar, QToolBar *panelToolBar );
106 
107 signals: //
108 
116  void objectNameChangeRequested ( const QString &oldName, const QString &newName );
117 
127  void parameterChangeRequested ( const QString &objectName, const QString &parameterName, const QVariant &value );
128 
129 protected: // events
130 
136  virtual void timerEvent ( QTimerEvent *event );
137 
144  virtual bool eventFilter(QObject *object, QEvent *event);
145 
146 private slots: //
147 
154  void on_m_nodeNameEdit_editingFinished ();
155 
164  void on_m_searchEdit_textChanged ( const QString &text );
165 
174  void on_ui_resetSearchAction_triggered ( bool checked = false );
175 
185  void loadTabPage ( int index );
186 
194  void labelContextMenuRequested ( const QPoint &position );
195 
196 private slots: // for updating parameter values when widgets change
197 
206  void checkBoxToggled ( bool checked );
207 
215  void spinBoxEditingFinished ();
216 
224  void sliderValueChanged ();
225 
233  void doubleSpinBoxEditingFinished ();
234 
242  void doubleSliderValueChanged ();
243 
251  void lineEditEditingFinished ();
252 
259  void browseButtonClicked ();
260 
267  void reloadButtonClicked ();
268 
275  void selectColor ();
276 
285  void comboBoxIndexChanged ( int index );
286 
293  void commandButtonClicked ();
294 
295 private slots: // for updating widgets when parameter values change
296 
302  void updateBooleanWidget ();
303 
309  void updateIntegerWidgets ();
310 
320  void updateIntegerWidgets ( int index );
321 
329  void updateUnsignedIntegerWidgets ();
330 
340  void updateUnsignedIntegerWidgets ( int index );
341 
348  void updateFloatingPointWidgets ();
349 
359  void updateFloatingPointWidgets ( int index );
360 
366  void updateStringWidget ();
367 
373  void updateFilenameWidgets ();
374 
380  void updateColorWidget ();
381 
387  void updateEnumerationWidget ();
388 
394  void updateTextInfoWidget ();
395 
401  void updateImageWidget ();
402 
403 
404 private: // functions
405 
411  void activateCustomContextMenu ( QLabel *label );
412 
419  void grayOut ( QWidget *widget );
420 
424  void clear ();
425 
433  void addRows ( ParameterGroup *parameterGroup, QFormLayout *formLayout );
434 
441  void addRows ( Parameter *parameter, QFormLayout *formLayout );
442 
449  QWidget * createBooleanWidget ( Parameter *parameter );
450 
458  QLayout * createIntegerLayout ( NumberParameter *numberParameter, int index = 0 );
459 
468  QLayout * createUnsignedIntegerLayout ( NumberParameter *numberParameter, int index = 0 );
469 
477  QLayout * createFloatingPointLayout ( NumberParameter *numberParameter, int index = 0 );
478 
486  QWidget * createStringWidget ( Parameter *parameter );
487 
494  QLayout * createFilenameLayout ( FilenameParameter *filenameParameter );
495 
502  QWidget * createColorWidget ( Parameter *parameter );
503 
510  QWidget * createEnumerationWidget ( EnumerationParameter *enumerationParameter );
511 
519  QWidget * createTextInfoWidget ( Parameter *parameter );
520 
528  QWidget * createGenericWidget ( Parameter *parameter );
529 
537  QWidget * createCommandWidget ( Parameter *parameter );
538 
546  QWidget * createImageWidget ( Parameter *parameter );
547 
555  QLayout * createVectorLayout ( Parameter *parameter );
556 
564  void requestParameterChange ( const QString &name, const QVariant &value );
565 
570  void filterParameters ();
571 
578  QWidget * createPluginWidget ( Parameter *parameter);
579 
580 private: // data
581 
586 
593  QObject *m_editedWidget;
594 
599  QMultiMap<QString, QWidget *> m_widgetMap;
600 
605 
611 
615  QLineEdit *m_nodeNameEdit;
616 
622 
626  QLineEdit *m_searchEdit;
627 
633 
634 };
635 
636 } // end namespace Frapper
637 
638 #endif