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

« back to all changes in this revision

Viewing changes to source/VISUAL/VISUALIZER/InstrumentSettingsVisualizer.C

  • 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
//  Copymain (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
// --------------------------------------------------------------------------s
 
27
 
 
28
#include <OpenMS/VISUAL/VISUALIZER/InstrumentSettingsVisualizer.h>
 
29
 
 
30
//QT
 
31
#include <QtGui/QLineEdit>
 
32
#include <QtGui/QComboBox>
 
33
 
 
34
//STL
 
35
#include <iostream>
 
36
 
 
37
using namespace std;
 
38
 
 
39
namespace OpenMS
 
40
{
 
41
        
 
42
        InstrumentSettingsVisualizer::InstrumentSettingsVisualizer(bool editable, QWidget* parent) 
 
43
                : BaseVisualizerGUI(editable, parent),
 
44
                        BaseVisualizer<InstrumentSettings>()
 
45
        {
 
46
                addLabel_("Modify the settings of the instrument.");    
 
47
                addSeparator_();  
 
48
                addComboBox_(instrumentsettings_scan_mode_, "Scan mode");
 
49
                addBooleanComboBox_(zoom_scan_,"Zoom scan"); 
 
50
                addComboBox_(instrumentsettings_polarity_, "Polarity");
 
51
                        
 
52
                finishAdding_();
 
53
        }
 
54
 
 
55
        void InstrumentSettingsVisualizer::update_()
 
56
        {
 
57
                if(! isEditable())
 
58
                {
 
59
                        fillComboBox_(instrumentsettings_scan_mode_,& temp_.NamesOfScanMode[temp_.getScanMode()] , 1);
 
60
                        fillComboBox_(instrumentsettings_polarity_,& IonSource::NamesOfPolarity[temp_.getPolarity()] , 1);
 
61
 
 
62
                }
 
63
                else
 
64
                {
 
65
                        fillComboBox_(instrumentsettings_scan_mode_, InstrumentSettings::NamesOfScanMode , InstrumentSettings::SIZE_OF_SCANMODE);
 
66
                        fillComboBox_(instrumentsettings_polarity_, IonSource::NamesOfPolarity , IonSource::SIZE_OF_POLARITY);
 
67
                        
 
68
 
 
69
                        instrumentsettings_scan_mode_->setCurrentIndex(temp_.getScanMode()); 
 
70
                        zoom_scan_->setCurrentIndex(temp_.getZoomScan());
 
71
                        instrumentsettings_polarity_->setCurrentIndex(temp_.getPolarity()); 
 
72
                }
 
73
        }
 
74
        
 
75
        void InstrumentSettingsVisualizer::store()
 
76
        {
 
77
                ptr_->setScanMode((InstrumentSettings::ScanMode)instrumentsettings_scan_mode_->currentIndex());
 
78
                ptr_->setZoomScan(zoom_scan_->currentIndex());          
 
79
                ptr_->setPolarity((IonSource::Polarity)instrumentsettings_polarity_->currentIndex());           
 
80
                
 
81
                temp_=(*ptr_);
 
82
        }
 
83
        
 
84
        void InstrumentSettingsVisualizer::undo_()
 
85
        {
 
86
                update_();
 
87
        }
 
88
 
 
89
}