NCL Composer  0.1.5
 All Classes Functions Variables Pages
PropertyEditor.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 PROPERTYEDITOR_H
19 #define PROPERTYEDITOR_H
20 
21 #include <QObject>
22 #include <QString>
23 #include <QWidget>
24 
25 #include "ui_PropertyEditorWidget.h"
26 #include "QLineEditFilter.h"
27 
33 class PropertyEditor : public QWidget
34 {
35  Q_OBJECT
36 
37 private:
38  Ui::PropertyEditorWidget *ui;
39  QMap <QString, int> propertyToLine;
40  QMap <QString, QString> propertyToValue;
42  bool internalPropertyChange;
43 
44  QString currentTagname, currentName;
45  QString currentFilterString;
46 
47 public:
53  explicit PropertyEditor(QWidget *parent=0);
54 
58  virtual ~PropertyEditor();
68  void setTagname(QString tagname, QString name);
69 
73  QString getTagname() { return this->currentTagname; }
74 
78  void setCurrentName(QString name);
79 
84  void setErrorMessage(QString errorMessage);
85 
89  QString getCurrentName(){ return this->currentName; }
90 
97  void setAttributeValue(QString property, QString value);
98 
102  static bool isURL(const QString &tagname, const QString &attr);
103 
104  QSize sizeHint() const { return QSize(250, 400); }
105 
106 private slots:
112  void updateWithItemChanges(QTableWidgetItem *item);
113 
117  void filterProperties(const QString&);
118 
119 signals:
120  void propertyChanged(QString property, QString value);
121 };
122 
123 #endif // PROPERTYEDITOR_H