~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to include/OpenMS/VISUAL/VISUALIZER/MetaInfoVisualizer.h

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-vr15wtg9b50cuesg
Tags: upstream-1.9.0
ImportĀ upstreamĀ versionĀ 1.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: C++; tab-width: 2; -*-
 
2
// vi: set ts=2:
 
3
//
 
4
// --------------------------------------------------------------------------
 
5
//                   OpenMS Mass Spectrometry Framework
 
6
// --------------------------------------------------------------------------
 
7
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
 
8
//
 
9
//  This library is free software; you can redistribute it and/or
 
10
//  modify it under the terms of the GNU Lesser General Public
 
11
//  License as published by the Free Software Foundation; either
 
12
//  version 2.1 of the License, or (at your option) any later version.
 
13
//
 
14
//  This library is distributed in the hope that it will be useful,
 
15
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
//  Lesser General Public License for more details.
 
18
//
 
19
//  You should have received a copy of the GNU Lesser General Public
 
20
//  License along with this library; if not, write to the Free Software
 
21
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
//
 
23
// --------------------------------------------------------------------------
 
24
// $Maintainer:Timo Sachsenberg $
 
25
// $Authors: Marc Sturm $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#ifndef OPENMS_VISUAL_VISUALIZER_METAINFOVISUALIZER_H
 
29
#define OPENMS_VISUAL_VISUALIZER_METAINFOVISUALIZER_H
 
30
 
 
31
//OpenMS
 
32
#include <OpenMS/VISUAL/VISUALIZER/BaseVisualizer.h>
 
33
#include <OpenMS/VISUAL/VISUALIZER/BaseVisualizerGUI.h>
 
34
#include <OpenMS/METADATA/MetaInfoInterface.h>
 
35
 
 
36
//STL
 
37
#include <vector>
 
38
#include <utility>
 
39
 
 
40
class QAbstractButton;
 
41
class QButtonGroup;
 
42
 
 
43
namespace OpenMS
 
44
{
 
45
        /**
 
46
                @brief MetaInfoVisualizer is a visualizer class for all classes that use one MetaInfo object as member.
 
47
                
 
48
                Meta information is an array of Type-Name-Value tupels. Classes that have a MetaInfo objects as a member can use this class to edit the MetaInfo object.
 
49
        */
 
50
        class OPENMS_GUI_DLLAPI MetaInfoVisualizer
 
51
                : public BaseVisualizerGUI,
 
52
                        public BaseVisualizer<MetaInfoInterface>
 
53
        {
 
54
                Q_OBJECT
 
55
 
 
56
                public:
 
57
                  ///Constructor
 
58
                        MetaInfoVisualizer(bool editable = false, QWidget* parent = 0);
 
59
                        
 
60
                        //Docu in base class
 
61
                        void load(MetaInfoInterface& m);
 
62
 
 
63
                public slots:
 
64
                        
 
65
                        //Docu in base class
 
66
                        void store();
 
67
 
 
68
                protected slots:
 
69
                        
 
70
                  /// Adds a new Type-Value pair to the MetaInfo Object.
 
71
                        void add_();
 
72
                        /// Clears out all fields.
 
73
                        void clear_();
 
74
                        /// Removes a selected Type-Value pair from the MetaInfo Object.
 
75
                        void remove_(int);
 
76
                        ///Undo the changes made in the GUI.
 
77
                        void undo_();
 
78
                        
 
79
                protected: 
 
80
                  /// Loads all Type-Value pairs one after another. 
 
81
                        void loadData_(UInt index);     
 
82
                                
 
83
                  /** @name Edit fields for new Type-Value pair.
 
84
                        */
 
85
            //@{
 
86
                        QLineEdit* newkey_;
 
87
                        QLineEdit* newvalue_;
 
88
                        QLineEdit* newdescription_;
 
89
                        //@}
 
90
                        
 
91
                        ///@name Arrays of pointers to objects for temporary metaInfo data
 
92
                        //@{
 
93
                        std::vector< std::pair<UInt,QLineEdit*> > metainfoptr_;
 
94
                        std::vector< std::pair<UInt,QLabel*> > metalabels_;
 
95
                        std::vector< std::pair<UInt,QAbstractButton*> > metabuttons_;
 
96
                        //@}            
 
97
 
 
98
                        ///@name Edit fields and buttons
 
99
            //@{
 
100
                        QPushButton* addbutton_;
 
101
                        QPushButton* clearbutton_;
 
102
                        QButtonGroup* buttongroup_;
 
103
                        //@}
 
104
                        
 
105
                        /// Counter to keep track of the actual row in the layout.
 
106
                        int nextrow_;
 
107
                        
 
108
                        /// The layout to display the Type-Value pairs.
 
109
                        QGridLayout* viewlayout_;               
 
110
                        
 
111
                        /// Container for metainfo data.
 
112
                        std::vector<UInt> keys_;
 
113
        };
 
114
 
 
115
 
 
116
}
 
117
#endif