Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

ParamEditor.h (Maintainer: Marc Sturm)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 //
00024 // --------------------------------------------------------------------------
00025 // $Maintainer: Marc Sturm $
00026 // --------------------------------------------------------------------------
00027 
00028 #ifndef OPENMS_VISUAL_PARAMEDITOR_H
00029 #define OPENMS_VISUAL_PARAMEDITOR_H
00030 
00031 #include <OpenMS/CONCEPT/Types.h>
00032 
00033 #include <OpenMS/VISUAL/UIC/ParamEditorTemplate.h>
00034 
00035 
00036 #include <QtGui/QItemDelegate>
00037 #include <QtGui/QTreeWidget>
00038 
00039 class QModelIndex;
00040 class QStyleOptionViewItem;
00041 class QAbstractItemModel;
00042 class QStringList;
00043 class QString;
00044 
00045 namespace OpenMS
00046 {
00047   class String;
00048   class Param;
00049   class ParamEditor;
00054   namespace Internal
00055   {
00061     class ParamEditorDelegate 
00062       : public QItemDelegate
00063     {
00064       Q_OBJECT
00065 
00066       public:
00068         ParamEditorDelegate(QObject* parent);
00070         QWidget *createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
00072         void setEditorData(QWidget* editor, const QModelIndex& index) const;
00074         void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
00076         void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex &index) const;
00077         
00078       signals:
00080         void modified(bool) const;
00081 
00082       protected:
00084         bool exists_(QString name, QModelIndex index) const;
00085         
00086       private:
00088         ParamEditorDelegate();
00089     };
00090     
00092     class ParamTree
00093       : public QTreeWidget
00094     {
00095       Q_OBJECT
00096       
00097       public:
00099         ParamTree(QWidget* parent);
00101         bool edit(const QModelIndex& index, EditTrigger trigger, QEvent* event);
00102         
00103       signals:
00105         void selected(const QModelIndex& index);
00106         
00107       protected slots:    
00109         void selectionChanged(const QItemSelection& selected, const QItemSelection&);
00110     };
00111       
00112   }
00113   
00127   class ParamEditor  
00128     : public QWidget,
00129       public Ui::ParamEditorTemplate
00130   {
00131     Q_OBJECT
00132     
00133     public:
00135       enum
00136       {
00137         NODE,         
00138         NORMAL_ITEM,  
00139         ADVANCED_ITEM 
00140       };
00141 
00143       ParamEditor(QWidget* parent=0);
00145       void load(Param& param);
00147       void store();
00149       bool isModified() const;
00151       void clear();
00152 
00153     signals:
00155       void modified(bool);
00156       
00157     protected slots:
00160       void setModified(bool is_modified);
00162       void toggleAdvancedMode(bool advanced);
00164       void showDocumentation(const QModelIndex& index);
00165       
00166     protected:
00168       void storeRecursive_(QTreeWidgetItem* child, String path, std::map<String,String>& section_descriptions);
00169       
00171       Internal::ParamTree* tree_;
00173       Param* param_;    
00175       bool modified_;
00177       bool advanced_mode_;      
00178   };
00179 
00180 
00181 } // namespace OpenMS
00182 
00183 #endif // OPENMS_VISUAL_PARAMEDITOR_H

Generated Tue Apr 1 15:36:36 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1