Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
TOPPViewBase.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2013.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg$
32 // $Authors: Marc Sturm, Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_APPLICATIONS_TOPPVIEWBASE_H
36 #define OPENMS_VISUAL_APPLICATIONS_TOPPVIEWBASE_H
37 
38 //OpenMS
46 
50 
51 //STL
52 #include <map>
53 
54 //QT
55 #include <QtGui/QMainWindow>
56 #include <QtGui/QButtonGroup>
57 #include <QtGui/QActionGroup>
58 #include <QtCore/QStringList>
59 #include <QtCore/QProcess>
60 
61 class QAction;
62 class QComboBox;
63 class QLabel;
64 class QLineEdit;
65 class QListWidget;
66 class QListWidgetItem;
67 class QTreeWidget;
68 class QTreeWidgetItem;
69 class QDockWidget;
70 class QToolButton;
71 class QCloseEvent;
72 class QTextEdit;
73 class QCheckBox;
74 class QSplashScreen;
75 class QToolButton;
76 class QWorkspace;
77 
78 namespace OpenMS
79 {
80  class EnhancedWorkspace;
81  class EnhancedTabBar;
82  class Spectrum1DWidget;
83  class Spectrum2DWidget;
84  class Spectrum3DWidget;
85  class ToolsDialog;
86  class MultiGradientSelector;
87  class DBConnection;
88  class FileWatcher;
89 
104  class OPENMS_GUI_DLLAPI TOPPViewBase :
105  public QMainWindow,
106  public DefaultParamHandler
107  {
108  Q_OBJECT
109 
110  friend class TestTOPPView;
111 
112 public:
114 
115  //Feature map type
117  //Feature map managed type
119 
120  //Consensus feature map type
122  //Consensus map managed type
124 
125  //Peak map type
127  //Main managed data type (experiment)
132 
134  TOPPViewBase(QWidget* parent = 0);
136  ~TOPPViewBase();
137 
150  void addDataFile(const String& filename, bool show_options, bool add_to_recent, String caption = "", UInt window_id = 0, Size spectrum_id = 0);
161  void addDataDB(UInt db_id, bool show_options, String caption = "", UInt window_id = 0);
162 
178  void addData(FeatureMapSharedPtrType feature_map, ConsensusMapSharedPtrType consensus_map, std::vector<PeptideIdentification>& peptides, ExperimentSharedPtrType peak_map, LayerData::DataType data_type, bool show_as_1d, bool show_options, bool as_new_window = true, const String& filename = "", const String& caption = "", UInt window_id = 0, Size spectrum_id = 0);
179 
181  void loadFiles(const StringList& list, QSplashScreen* splash_screen);
182 
188  void loadPreferences(String filename = "");
189 
191  void savePreferences();
192 
194  Param getSpectrumParameters(UInt dim);
195 
197  const LayerData* getCurrentLayer() const;
198 
199  //@name Accessors for the main gui components.
200  //@brief The top level enhanced workspace and the EnhancedTabWidgets resing in the EnhancedTabBar.
202  EnhancedWorkspace* getWorkspace() const;
204 
206  SpectrumWidget* getActiveSpectrumWidget() const;
207 
209  Spectrum1DWidget* getActive1DWidget() const;
210 
212  Spectrum2DWidget* getActive2DWidget() const;
213 
215  Spectrum3DWidget* getActive3DWidget() const;
217 
219  SpectrumCanvas* getActiveCanvas() const;
220 
221 
223  SpectraIdentificationViewWidget* getSpectraIdentificationViewWidget();
224 
226  void showSpectrumWidgetInWindow(SpectrumWidget* sw, const String& caption);
227 
228 public slots:
230  void updateCurrentPath();
232  void showURL();
234  void openFileDialog();
236  void openExampleDialog();
238  void openDatabaseDialog();
240  void showGoToDialog();
242  void preferencesDialog();
244  void layerStatistics();
246  void editMetadata();
248  void layerActivated();
250  void layerZoomChanged();
252  void linkZoom();
254  void layerDeactivated();
256  void activate1DSpectrum(int index);
258  void activate1DSpectrum(std::vector<int, std::allocator<int> > indices);
260  void deactivate1DSpectrum(int index);
262  void closeFile();
264  void updateToolBar();
266  void updateLayerBar();
268  void updateViewBar();
270  void viewChanged(int);
272  void updateFilterBar();
274  void updateMenu();
276  void updateTabBar(QWidget* w);
278  void tileVertical();
280  void tileHorizontal();
287  void showStatusMessage(std::string msg, OpenMS::UInt time);
289  void showCursorStatus(double mz, double rt);
291  void showCursorStatusInvert(double mz, double rt);
293  void showTOPPDialog();
295  void annotateWithID();
297  void showSpectrumGenerationDialog();
299  void showSpectrumAlignmentDialog();
301  void showSpectrumAs1D(int index);
302  void showSpectrumAs1D(std::vector<int, std::allocator<int> > indices);
304  void showCurrentPeaksAs2D();
306  void showCurrentPeaksAs3D();
308  void showAboutDialog();
310  void saveLayerAll();
312  void saveLayerVisible();
314  void toggleGridLines();
316  void toggleAxisLegends();
318  void showPreferences();
320  void metadataDatabaseDialog();
322  void metadataFileDialog();
323 
327  void setDrawMode1D(int);
328  void setIntensityMode(int);
329  void changeLayerFlag(bool);
330  void changeLabel(QAction*);
331  void changeUnassigned(QAction*);
332  void resetZoom();
333  void toggleProjections();
335 
337  void loadFile(QString);
338 
339 protected slots:
343  void layerSelectionChange(int);
346  void layerFilterVisibilityChange(bool);
348  void layerContextMenu(const QPoint& pos);
350  void logContextMenu(const QPoint& pos);
352  void layerVisibilityChange(QListWidgetItem* item);
354  void filterContextMenu(const QPoint& pos);
356  void filterEdit(QListWidgetItem* item);
358  void layerEdit(QListWidgetItem* /*item*/);
360 
362  void finishTOPPToolExecution(int exitCode, QProcess::ExitStatus exitStatus);
364  void abortTOPPTool();
366  void rerunTOPPTool();
368  void showSpectrumBrowser();
370  void showSpectrumMetaData(int spectrum_index);
371 
375  void closeByTab(int id);
378  void enhancedWorkspaceWindowChanged(int id);
380  void openRecentFile();
382  void copyLayer(const QMimeData* data, QWidget* source, int id = -1);
384 
386  void updateProcessLog();
387 
389  void fileChanged_(const String&);
390 protected:
392  void initializeDefaultParameters_();
393 
395  std::set<String> getFilenamesOfOpenFiles_();
396 
398  void connectToDB_(DBConnection& db);
402  QStringList getFileList_(const String& path_overwrite = "");
403 
405  EnhancedTabBarWidgetInterface* window_(int id) const;
406 
408 
409  QDockWidget* layer_dock_widget_;
410  QDockWidget* views_dockwidget_;
411  QDockWidget* filter_dock_widget_;
413 
415 
419 
422 
424 
426  QCheckBox* filters_check_box_;
428 
431 
434 
437 
439 
442 
446  QToolBar* tool_bar_;
447  //common intensity modes
448 
449  QButtonGroup* intensity_button_group_;
450  //1D specific stuff
451 
452  QToolBar* tool_bar_1d_;
453  QButtonGroup* draw_group_1d_;
454 
455  //2D specific stuff
456  QToolBar* tool_bar_2d_peak_;
457  QToolBar* tool_bar_2d_feat_;
458  QToolBar* tool_bar_2d_cons_;
461  QAction* dm_hull_2d_;
462  QAction* dm_hulls_2d_;
463  QToolButton* dm_label_2d_;
464  QActionGroup* group_label_2d_;
465  QToolButton* dm_unassigned_2d_;
466  QActionGroup* group_unassigned_2d_;
467  QAction* dm_elements_2d_;
468  QAction* projections_2d_;
469  QAction* dm_ident_2d_;
471 
474 
477 
481  QLabel* message_label_;
484  QLabel* mz_label_;
486  QLabel* rt_label_;
488 
490 
491  void addRecentFile_(const String& filename);
494  void updateRecentMenu_();
496  QStringList recent_files_;
498  std::vector<QAction*> recent_actions_;
500 
501 
503 
504  void runTOPPTool_();
507  struct
508  {
518  QTime timer;
519  bool visible;
520  } topp_;
522 
524  void checkPreferences_();
526 
527  void closeEvent(QCloseEvent* event);
529 
531  enum LogState
532  {
535  LS_ERROR
536  };
538  void showLogMessage_(LogState state, const String& heading, const String& body);
539 
542 
544  void showTOPPDialog_(bool visible);
545 
549 
551  QTabWidget* views_tabwidget_;
558 
559  // static helper functions
560 public:
562  static bool containsMS1Scans(const ExperimentType& exp);
563 
565  float estimateNoiseFromRandomMS1Scans(const ExperimentType& exp, UInt n_scans = 10);
566 
568  static UInt countMS1Zeros(const ExperimentType& exp);
569 
571  static bool hasPeptideIdentifications(const ExperimentType& map);
572 
573 private:
576  }; //class
577 
578 } //namespace
579 
580 #endif
String layer_name
Definition: TOPPViewBase.h:514
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Definition: TOPPViewBase.h:123
QLabel * rt_label_
RT label for messages in the status bar.
Definition: TOPPViewBase.h:486
TOPPViewIdentificationViewBehavior * identificationview_behavior_
TOPPView behavior for the identification view.
Definition: TOPPViewBase.h:555
QDockWidget * filter_dock_widget_
Definition: TOPPViewBase.h:411
QAction * linkZoom_action_
Definition: TOPPViewBase.h:438
QButtonGroup * draw_group_1d_
Definition: TOPPViewBase.h:453
QToolBar * tool_bar_1d_
Definition: TOPPViewBase.h:452
Behavior of TOPPView in identification mode.
Definition: TOPPViewIdentificationViewBehavior.h:50
std::vector< QAction * > recent_actions_
list of the recently opened files actions (menu entries)
Definition: TOPPViewBase.h:498
A more convenient string class.
Definition: String.h:56
QAction * dm_hulls_2d_
Definition: TOPPViewBase.h:462
QToolBar * tool_bar_2d_ident_
Definition: TOPPViewBase.h:459
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Definition: TOPPViewBase.h:128
bool visible
Definition: TOPPViewBase.h:519
LayerData::ConsensusMapType ConsensusMapType
Definition: TOPPViewBase.h:121
QListWidget * filters_
Definition: TOPPViewBase.h:425
Hierarchical visualization and selection of spectra.
Definition: SpectraViewWidget.h:52
TOPPViewBehaviorInterface * view_behavior_
The current TOPPView view behavior.
Definition: TOPPViewBase.h:553
Main window of TOPPView tool.
Definition: TOPPViewBase.h:104
String tool
Definition: TOPPViewBase.h:510
String file_name
Definition: TOPPViewBase.h:513
QToolBar * tool_bar_2d_feat_
Definition: TOPPViewBase.h:457
DataType
Dataset types.
Definition: LayerData.h:64
A container for features.
Definition: FeatureMap.h:111
Widget for 2D-visualization of peak map and feature map data.
Definition: Spectrum2DWidget.h:61
QToolBar * tool_bar_2d_cons_
Definition: TOPPViewBase.h:458
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:94
A container for consensus elements.
Definition: ConsensusMap.h:60
QToolBar * tool_bar_2d_peak_
Definition: TOPPViewBase.h:456
SpectraIdentificationViewWidget * spectra_identification_view_widget_
Definition: TOPPViewBase.h:417
QAction * dm_elements_2d_
Definition: TOPPViewBase.h:467
QAction * dm_hull_2d_
Definition: TOPPViewBase.h:461
FileWatcher * watcher_
Watcher that tracks file changes (in order to update the data in the different views) ...
Definition: TOPPViewBase.h:430
String in
Definition: TOPPViewBase.h:511
bool zoom_together_
Stores whether the individual windows should zoom together (be linked) or not.
Definition: TOPPViewBase.h:436
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:120
QTime timer
Definition: TOPPViewBase.h:518
QDockWidget * layer_dock_widget_
Definition: TOPPViewBase.h:409
bool watcher_msgbox_
Holds the messageboxes for each layer that are currently popped up (to avoid popping them up again...
Definition: TOPPViewBase.h:433
QAction * dm_ident_2d_
Definition: TOPPViewBase.h:469
Size spectrum_id
Definition: TOPPViewBase.h:516
SpectraViewWidget * spectra_view_widget_
Definition: TOPPViewBase.h:416
QLabel * mz_label_
m/z label for messages in the status bar
Definition: TOPPViewBase.h:484
TOPPViewSpectraViewBehavior * spectraview_behavior_
TOPPView behavior for the spectra view.
Definition: TOPPViewBase.h:557
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Definition: TOPPViewBase.h:118
UInt window_id
Definition: TOPPViewBase.h:515
Param param
Definition: TOPPViewBase.h:509
QActionGroup * group_label_2d_
Definition: TOPPViewBase.h:464
Widget for visualization of several spectra.
Definition: Spectrum1DWidget.h:63
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:114
Base class for spectrum widgets.
Definition: SpectrumWidget.h:71
Warning.
Definition: TOPPViewBase.h:534
QTabWidget * views_tabwidget_
Tabwidget that hold the different views on the loaded data.
Definition: TOPPViewBase.h:551
A class for connecting to a SQL database.
Definition: DBConnection.h:60
static const String CAPTION_3D_SUFFIX_
Suffix appended to caption of tabs when layer is shown in 3D.
Definition: TOPPViewBase.h:575
boost::shared_ptr< FeatureMap<> > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:108
Widget for 3D-visualization of map data.
Definition: Spectrum3DWidget.h:51
String out
Definition: TOPPViewBase.h:512
Management and storage of parameters / INI files.
Definition: Param.h:69
Behavior of TOPPView in spectra view mode.
Definition: TOPPViewSpectraViewBehavior.h:50
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
QButtonGroup * intensity_button_group_
Definition: TOPPViewBase.h:449
QToolButton * dm_unassigned_2d_
Definition: TOPPViewBase.h:465
QToolBar * tool_bar_
Definition: TOPPViewBase.h:446
Notice.
Definition: TOPPViewBase.h:533
String list.
Definition: StringList.h:56
QStringList recent_files_
list of the recently opened files
Definition: TOPPViewBase.h:496
Tabular visualization / selection of identified specra.
Definition: SpectraIdentificationViewWidget.h:53
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Definition: EnhancedWorkspace.h:49
Interface class to model different behaviors of TOPPView.
Definition: TOPPViewBehaviorInterface.h:47
LogState
Log message states.
Definition: TOPPViewBase.h:531
QDockWidget * views_dockwidget_
Definition: TOPPViewBase.h:410
Widgets that are placed into an EnhancedTabBar must implement this interface.
Definition: EnhancedTabBarWidgetInterface.h:47
LayerData::FeatureMapType FeatureMapType
Definition: TOPPViewBase.h:116
QTextEdit * log_
Log output window.
Definition: TOPPViewBase.h:441
QListWidget * layer_manager_
Layer management widget.
Definition: TOPPViewBase.h:421
QActionGroup * group_unassigned_2d_
Definition: TOPPViewBase.h:466
EnhancedWorkspace * ws_
Main workspace.
Definition: TOPPViewBase.h:473
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
String current_path_
Definition: TOPPViewBase.h:548
EnhancedTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData() ...
Definition: TOPPViewBase.h:476
Watcher that monitors file changes.
Definition: FileWatcher.h:66
QCheckBox * filters_check_box_
Definition: TOPPViewBase.h:426
QMenu * add_2d_context_
Additional context menu for 2D layers.
Definition: TOPPViewBase.h:541
QToolButton * dm_label_2d_
Definition: TOPPViewBase.h:463
QAction * dm_precursors_2d_
Definition: TOPPViewBase.h:460
QProcess * process
Definition: TOPPViewBase.h:517
Class that stores the data for one layer.
Definition: LayerData.h:58
LayerData::ExperimentType ExperimentType
Definition: TOPPViewBase.h:126
Convenience tab bar implementation.
Definition: EnhancedTabBar.h:60
QAction * projections_2d_
Definition: TOPPViewBase.h:468
ExperimentType::SpectrumType SpectrumType
Peak spectrum type.
Definition: TOPPViewBase.h:130

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:22 using doxygen 1.8.5