Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_VISUAL_PARAMEDITOR_H
00036 #define OPENMS_VISUAL_PARAMEDITOR_H
00037
00038 #include <OpenMS/CONCEPT/Types.h>
00039
00040 #include <OpenMS/VISUAL/UIC/ui_ParamEditor.h>
00041
00042
00043 #include <QtGui/QItemDelegate>
00044 #include <QtGui/QTreeWidget>
00045
00046 class QModelIndex;
00047 class QStyleOptionViewItem;
00048 class QAbstractItemModel;
00049 class QStringList;
00050 class QString;
00051
00052 namespace OpenMS
00053 {
00054 class String;
00055 class Param;
00056 class ParamEditor;
00061 namespace Internal
00062 {
00068 class OPENMS_GUI_DLLAPI ParamEditorDelegate :
00069 public QItemDelegate
00070 {
00071 Q_OBJECT
00072
00073 public:
00075 ParamEditorDelegate(QObject * parent);
00077 QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
00079 void setEditorData(QWidget * editor, const QModelIndex & index) const;
00081 void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
00083 void updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const;
00084
00085 signals:
00087 void modified(bool) const;
00088
00089 protected:
00091 bool exists_(QString name, QModelIndex index) const;
00092
00093 private slots:
00095 void commitAndCloseListEditor_();
00097 void commitAndCloseComboBox_();
00099 void closeListEditor_();
00100 private:
00102 ParamEditorDelegate();
00104 mutable QString fileName_;
00105 };
00106
00108 class OPENMS_GUI_DLLAPI ParamTree :
00109 public QTreeWidget
00110 {
00111 Q_OBJECT
00112
00113 public:
00115 ParamTree(QWidget * parent);
00117 bool edit(const QModelIndex & index, EditTrigger trigger, QEvent * event);
00118
00119 signals:
00121 void selected(const QModelIndex & index);
00122
00123 protected slots:
00125 void selectionChanged(const QItemSelection & selected, const QItemSelection &);
00126 };
00127
00128 }
00129
00141 class OPENMS_GUI_DLLAPI ParamEditor :
00142 public QWidget,
00143 public Ui::ParamEditorTemplate
00144 {
00145 Q_OBJECT
00146
00147 public:
00149 enum
00150 {
00151 NODE,
00152 NORMAL_ITEM,
00153 ADVANCED_ITEM
00154 };
00155
00157 ParamEditor(QWidget * parent = 0);
00159 void load(Param & param);
00161 void store();
00163 bool isModified() const;
00165 void clear();
00166
00167 public slots:
00170 void setModified(bool is_modified);
00171
00172 signals:
00174 void modified(bool);
00175
00176 protected slots:
00178 void toggleAdvancedMode(bool advanced);
00180 void showDocumentation(const QModelIndex & index);
00181
00182 protected:
00184 void storeRecursive_(QTreeWidgetItem * child, String path, std::map<String, String> & section_descriptions);
00185
00187 Internal::ParamTree * tree_;
00189 Param * param_;
00191 bool modified_;
00193 bool advanced_mode_;
00194 };
00195
00196
00197 }
00198
00199 #endif // OPENMS_VISUAL_PARAMEDITOR_H