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-2015.
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_GUI config
40 
41 //OpenMS
49 
53 
54 //STL
55 #include <map>
56 
57 //QT
58 #include <QtGui/QMainWindow>
59 #include <QtGui/QButtonGroup>
60 #include <QtGui/QActionGroup>
61 #include <QtCore/QStringList>
62 #include <QtCore/QProcess>
63 
64 class QAction;
65 class QComboBox;
66 class QLabel;
67 class QLineEdit;
68 class QListWidget;
69 class QListWidgetItem;
70 class QTreeWidget;
71 class QTreeWidgetItem;
72 class QDockWidget;
73 class QToolButton;
74 class QCloseEvent;
75 class QTextEdit;
76 class QCheckBox;
77 class QSplashScreen;
78 class QToolButton;
79 class QWorkspace;
80 
81 namespace OpenMS
82 {
83  class EnhancedWorkspace;
84  class EnhancedTabBar;
85  class Spectrum1DWidget;
86  class Spectrum2DWidget;
87  class Spectrum3DWidget;
88  class ToolsDialog;
89  class MultiGradientSelector;
90  class FileWatcher;
91 
106  class OPENMS_GUI_DLLAPI TOPPViewBase :
107  public QMainWindow,
108  public DefaultParamHandler
109  {
110  Q_OBJECT
111 
112  friend class TestTOPPView;
113 
114 public:
116 
117  //Feature map type
119  //Feature map managed type
121 
122  //Consensus feature map type
124  //Consensus map managed type
126 
127  //Peak map type
129  //Main managed data type (experiment)
134 
136  TOPPViewBase(QWidget* parent = 0);
138  ~TOPPViewBase();
139 
152  void addDataFile(const String& filename, bool show_options, bool add_to_recent, String caption = "", UInt window_id = 0, Size spectrum_id = 0);
153 
169  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);
170 
172  void loadFiles(const StringList& list, QSplashScreen* splash_screen);
173 
179  void loadPreferences(String filename = "");
180 
182  void savePreferences();
183 
185  Param getSpectrumParameters(UInt dim);
186 
188  const LayerData* getCurrentLayer() const;
189 
190  //@name Accessors for the main gui components.
191  //@brief The top level enhanced workspace and the EnhancedTabWidgets resing in the EnhancedTabBar.
193  EnhancedWorkspace* getWorkspace() const;
195 
197  SpectrumWidget* getActiveSpectrumWidget() const;
198 
200  Spectrum1DWidget* getActive1DWidget() const;
201 
203  Spectrum2DWidget* getActive2DWidget() const;
204 
206  Spectrum3DWidget* getActive3DWidget() const;
208 
210  SpectrumCanvas* getActiveCanvas() const;
211 
212 
214  SpectraIdentificationViewWidget* getSpectraIdentificationViewWidget();
215 
217  void showSpectrumWidgetInWindow(SpectrumWidget* sw, const String& caption);
218 
219 public slots:
221  void updateCurrentPath();
223  void showURL();
225  void openFileDialog();
227  void openExampleDialog();
229  void showGoToDialog();
231  void preferencesDialog();
233  void layerStatistics();
235  void editMetadata();
237  void layerActivated();
239  void layerZoomChanged();
241  void linkZoom();
243  void layerDeactivated();
245  void activate1DSpectrum(int index);
247  void activate1DSpectrum(std::vector<int, std::allocator<int> > indices);
249  void deactivate1DSpectrum(int index);
251  void closeFile();
253  void updateToolBar();
255  void updateLayerBar();
257  void updateViewBar();
259  void viewChanged(int);
261  void updateFilterBar();
263  void updateMenu();
265  void updateTabBar(QWidget* w);
267  void tileVertical();
269  void tileHorizontal();
276  void showStatusMessage(std::string msg, OpenMS::UInt time);
278  void showCursorStatus(double mz, double rt);
280  void showCursorStatusInvert(double mz, double rt);
282  void showTOPPDialog();
284  void annotateWithID();
286  void showSpectrumGenerationDialog();
288  void showSpectrumAlignmentDialog();
290  void showSpectrumAs1D(int index);
291  void showSpectrumAs1D(std::vector<int, std::allocator<int> > indices);
293  void showCurrentPeaksAs2D();
295  void showCurrentPeaksAs3D();
297  void showAboutDialog();
299  void saveLayerAll();
301  void saveLayerVisible();
303  void toggleGridLines();
305  void toggleAxisLegends();
307  void showPreferences();
309  void metadataFileDialog();
310 
314  void setDrawMode1D(int);
315  void setIntensityMode(int);
316  void changeLayerFlag(bool);
317  void changeLabel(QAction*);
318  void changeUnassigned(QAction*);
319  void resetZoom();
320  void toggleProjections();
322 
324  void loadFile(QString);
325 
326 protected slots:
330  void layerSelectionChange(int);
333  void layerFilterVisibilityChange(bool);
335  void layerContextMenu(const QPoint& pos);
337  void logContextMenu(const QPoint& pos);
339  void layerVisibilityChange(QListWidgetItem* item);
341  void filterContextMenu(const QPoint& pos);
343  void filterEdit(QListWidgetItem* item);
345  void layerEdit(QListWidgetItem* /*item*/);
347 
349  void finishTOPPToolExecution(int exitCode, QProcess::ExitStatus exitStatus);
351  void abortTOPPTool();
353  void rerunTOPPTool();
355  void showSpectrumBrowser();
357  void showSpectrumMetaData(int spectrum_index);
358 
362  void closeByTab(int id);
365  void enhancedWorkspaceWindowChanged(int id);
367  void openRecentFile();
369  void copyLayer(const QMimeData* data, QWidget* source, int id = -1);
371 
373  void updateProcessLog();
374 
376  void fileChanged_(const String&);
377 protected:
379  void initializeDefaultParameters_();
380 
383  bool annotateMS1FromMassFingerprinting_(const FeatureMap& identifications);
384 
386  std::set<String> getFilenamesOfOpenFiles_();
387 
391  QStringList getFileList_(const String& path_overwrite = "");
392 
394  EnhancedTabBarWidgetInterface* window_(int id) const;
395 
397 
398  QDockWidget* layer_dock_widget_;
399  QDockWidget* views_dockwidget_;
400  QDockWidget* filter_dock_widget_;
402 
404 
408 
411 
413 
415  QCheckBox* filters_check_box_;
417 
420 
423 
426 
428 
431 
435  QToolBar* tool_bar_;
436  //common intensity modes
437 
438  QButtonGroup* intensity_button_group_;
439  //1D specific stuff
440 
441  QToolBar* tool_bar_1d_;
442  QButtonGroup* draw_group_1d_;
443 
444  //2D specific stuff
445  QToolBar* tool_bar_2d_peak_;
446  QToolBar* tool_bar_2d_feat_;
447  QToolBar* tool_bar_2d_cons_;
450  QAction* dm_hull_2d_;
451  QAction* dm_hulls_2d_;
452  QToolButton* dm_label_2d_;
453  QActionGroup* group_label_2d_;
454  QToolButton* dm_unassigned_2d_;
455  QActionGroup* group_unassigned_2d_;
456  QAction* dm_elements_2d_;
457  QAction* projections_2d_;
458  QAction* dm_ident_2d_;
460 
463 
466 
470  QLabel* message_label_;
473  QLabel* mz_label_;
475  QLabel* rt_label_;
477 
479 
480  void addRecentFile_(const String& filename);
483  void updateRecentMenu_();
485  QStringList recent_files_;
487  std::vector<QAction*> recent_actions_;
489 
490 
492 
493  void runTOPPTool_();
496  struct
497  {
507  QTime timer;
508  bool visible;
509  } topp_;
511 
513  void checkPreferences_();
515 
516  void closeEvent(QCloseEvent* event);
518 
520  enum LogState
521  {
524  LS_ERROR
525  };
527  void showLogMessage_(LogState state, const String& heading, const String& body);
528 
531 
533  void showTOPPDialog_(bool visible);
534 
538 
540  QTabWidget* views_tabwidget_;
547 
548  // static helper functions
549 public:
551  static bool containsMS1Scans(const ExperimentType& exp);
552 
554  float estimateNoiseFromRandomMS1Scans(const ExperimentType& exp, UInt n_scans = 10);
555 
557  static UInt countMS1Zeros(const ExperimentType& exp);
558 
560  static bool hasPeptideIdentifications(const ExperimentType& map);
561 
562 private:
565  }; //class
566 
567 } //namespace
568 
569 #endif
String layer_name
Definition: TOPPViewBase.h:503
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Definition: TOPPViewBase.h:125
QLabel * rt_label_
RT label for messages in the status bar.
Definition: TOPPViewBase.h:475
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:111
TOPPViewIdentificationViewBehavior * identificationview_behavior_
TOPPView behavior for the identification view.
Definition: TOPPViewBase.h:544
QDockWidget * filter_dock_widget_
Definition: TOPPViewBase.h:400
QAction * linkZoom_action_
Definition: TOPPViewBase.h:427
QButtonGroup * draw_group_1d_
Definition: TOPPViewBase.h:442
QToolBar * tool_bar_1d_
Definition: TOPPViewBase.h:441
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:487
A more convenient string class.
Definition: String.h:57
QAction * dm_hulls_2d_
Definition: TOPPViewBase.h:451
QToolBar * tool_bar_2d_ident_
Definition: TOPPViewBase.h:448
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Definition: TOPPViewBase.h:130
bool visible
Definition: TOPPViewBase.h:508
LayerData::ConsensusMapType ConsensusMapType
Definition: TOPPViewBase.h:123
QListWidget * filters_
Definition: TOPPViewBase.h:414
Hierarchical visualization and selection of spectra.
Definition: SpectraViewWidget.h:52
TOPPViewBehaviorInterface * view_behavior_
The current TOPPView view behavior.
Definition: TOPPViewBase.h:542
Main window of TOPPView tool.
Definition: TOPPViewBase.h:106
String tool
Definition: TOPPViewBase.h:499
String file_name
Definition: TOPPViewBase.h:502
QToolBar * tool_bar_2d_feat_
Definition: TOPPViewBase.h:446
DataType
Dataset types.
Definition: LayerData.h:67
A container for features.
Definition: FeatureMap.h:93
Widget for 2D-visualization of peak map and feature map data.
Definition: Spectrum2DWidget.h:64
QToolBar * tool_bar_2d_cons_
Definition: TOPPViewBase.h:447
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:96
A container for consensus elements.
Definition: ConsensusMap.h:72
QToolBar * tool_bar_2d_peak_
Definition: TOPPViewBase.h:445
SpectraIdentificationViewWidget * spectra_identification_view_widget_
Definition: TOPPViewBase.h:406
QAction * dm_elements_2d_
Definition: TOPPViewBase.h:456
QAction * dm_hull_2d_
Definition: TOPPViewBase.h:450
FileWatcher * watcher_
Watcher that tracks file changes (in order to update the data in the different views) ...
Definition: TOPPViewBase.h:419
String in
Definition: TOPPViewBase.h:500
bool zoom_together_
Stores whether the individual windows should zoom together (be linked) or not.
Definition: TOPPViewBase.h:425
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:123
QTime timer
Definition: TOPPViewBase.h:507
QDockWidget * layer_dock_widget_
Definition: TOPPViewBase.h:398
bool watcher_msgbox_
Holds the messageboxes for each layer that are currently popped up (to avoid popping them up again...
Definition: TOPPViewBase.h:422
QAction * dm_ident_2d_
Definition: TOPPViewBase.h:458
Size spectrum_id
Definition: TOPPViewBase.h:505
SpectraViewWidget * spectra_view_widget_
Definition: TOPPViewBase.h:405
QLabel * mz_label_
m/z label for messages in the status bar
Definition: TOPPViewBase.h:473
TOPPViewSpectraViewBehavior * spectraview_behavior_
TOPPView behavior for the spectra view.
Definition: TOPPViewBase.h:546
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Definition: TOPPViewBase.h:120
UInt window_id
Definition: TOPPViewBase.h:504
Param param
Definition: TOPPViewBase.h:498
QActionGroup * group_label_2d_
Definition: TOPPViewBase.h:453
Widget for visualization of several spectra.
Definition: Spectrum1DWidget.h:66
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:117
Base class for spectrum widgets.
Definition: SpectrumWidget.h:74
Warning.
Definition: TOPPViewBase.h:523
QTabWidget * views_tabwidget_
Tabwidget that hold the different views on the loaded data.
Definition: TOPPViewBase.h:540
static const String CAPTION_3D_SUFFIX_
Suffix appended to caption of tabs when layer is shown in 3D.
Definition: TOPPViewBase.h:564
Widget for 3D-visualization of map data.
Definition: Spectrum3DWidget.h:54
String out
Definition: TOPPViewBase.h:501
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
Management and storage of parameters / INI files.
Definition: Param.h:75
Behavior of TOPPView in spectra view mode.
Definition: TOPPViewSpectraViewBehavior.h:50
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:69
QButtonGroup * intensity_button_group_
Definition: TOPPViewBase.h:438
QToolButton * dm_unassigned_2d_
Definition: TOPPViewBase.h:454
QToolBar * tool_bar_
Definition: TOPPViewBase.h:435
Notice.
Definition: TOPPViewBase.h:522
QStringList recent_files_
list of the recently opened files
Definition: TOPPViewBase.h:485
Tabular visualization / selection of identified spectra.
Definition: SpectraIdentificationViewWidget.h:54
Definition: EnhancedWorkspace.h:50
Interface class to model different behaviors of TOPPView.
Definition: TOPPViewBehaviorInterface.h:47
LogState
Log message states.
Definition: TOPPViewBase.h:520
QDockWidget * views_dockwidget_
Definition: TOPPViewBase.h:399
Widgets that are placed into an EnhancedTabBar must implement this interface.
Definition: EnhancedTabBarWidgetInterface.h:47
LayerData::FeatureMapType FeatureMapType
Definition: TOPPViewBase.h:118
QTextEdit * log_
Log output window.
Definition: TOPPViewBase.h:430
QListWidget * layer_manager_
Layer management widget.
Definition: TOPPViewBase.h:410
QActionGroup * group_unassigned_2d_
Definition: TOPPViewBase.h:455
EnhancedWorkspace * ws_
Main workspace.
Definition: TOPPViewBase.h:462
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
String current_path_
Definition: TOPPViewBase.h:537
EnhancedTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData() ...
Definition: TOPPViewBase.h:465
Watcher that monitors file changes.
Definition: FileWatcher.h:66
QCheckBox * filters_check_box_
Definition: TOPPViewBase.h:415
QMenu * add_2d_context_
Additional context menu for 2D layers.
Definition: TOPPViewBase.h:530
QToolButton * dm_label_2d_
Definition: TOPPViewBase.h:452
QAction * dm_precursors_2d_
Definition: TOPPViewBase.h:449
QProcess * process
Definition: TOPPViewBase.h:506
Class that stores the data for one layer.
Definition: LayerData.h:61
LayerData::ExperimentType ExperimentType
Definition: TOPPViewBase.h:128
Convenience tab bar implementation.
Definition: EnhancedTabBar.h:61
QAction * projections_2d_
Definition: TOPPViewBase.h:457
ExperimentType::SpectrumType SpectrumType
Peak spectrum type.
Definition: TOPPViewBase.h:132

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:42 using doxygen 1.8.5