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

« back to all changes in this revision

Viewing changes to include/OpenMS/VISUAL/APPLICATIONS/TOPPViewBase.h

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2013-12-20 11:30:16 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131220113016-wre5g9bteeheq6he
Tags: 1.11.1-3
* remove version number from libbost development package names;
* ensure that AUTHORS is correctly shipped in all packages.

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
 
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.
22
29
//
23
30
// --------------------------------------------------------------------------
24
31
// $Maintainer: Timo Sachsenberg$
41
48
#include <OpenMS/VISUAL/TOPPViewSpectraViewBehavior.h>
42
49
#include <OpenMS/VISUAL/TOPPViewIdentificationViewBehavior.h>
43
50
 
44
 
#include <OpenMS/VISUAL/TOPPASWidget.h>
45
51
//STL
46
52
#include <map>
47
53
 
86
92
 
87
93
    @improvement Use DataRepository singleton to share data between TOPPView and the canvas classes (Hiwi)
88
94
 
89
 
                @improvement For painting single mass traces with no width we currently paint each line twice (once going down, and then coming back up).
90
 
                This could be more efficient...
 
95
        @improvement For painting single mass traces with no width we currently paint each line twice (once going down, and then coming back up).
 
96
        This could be more efficient...
91
97
 
92
98
    @improvement Keep spectrum browser widgets of all layers in memory in order to avoid rebuilding the entire tree view every time the active layer changes (Hiwi, Johannes)
93
99
 
94
 
        @todo Add TOPPView live-tutorial (Stephan, Marc)
 
100
    @todo Add TOPPView live-tutorial (Stephan, Marc)
95
101
 
96
102
    @ingroup TOPPView_elements
97
103
  */
98
 
  class OPENMS_GUI_DLLAPI TOPPViewBase
99
 
        : public QMainWindow,
100
 
                public DefaultParamHandler
 
104
  class OPENMS_GUI_DLLAPI TOPPViewBase :
 
105
    public QMainWindow,
 
106
    public DefaultParamHandler
101
107
  {
102
 
      Q_OBJECT
103
 
      
 
108
    Q_OBJECT
 
109
 
104
110
    friend class TestTOPPView;
105
 
      
106
 
    public:
107
 
        ///@name Type definitions
108
 
        //@{
109
 
        //Feature map type
110
 
        typedef LayerData::FeatureMapType FeatureMapType;
111
 
      //Feature map managed type
112
 
      typedef LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType;
113
 
 
114
 
        //Consensus feature map type
115
 
        typedef LayerData::ConsensusMapType ConsensusMapType;
116
 
      //Consensus  map managed type
117
 
      typedef LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType;
118
 
 
119
 
        //Peak map type
120
 
        typedef LayerData::ExperimentType ExperimentType;
121
 
      //Main managed data type (experiment)
122
 
      typedef LayerData::ExperimentSharedPtrType ExperimentSharedPtrType;
123
 
        ///Peak spectrum type
124
 
        typedef ExperimentType::SpectrumType SpectrumType;
125
 
        //@}
126
 
 
127
 
      ///Constructor
128
 
      TOPPViewBase(QWidget* parent=0);
129
 
      ///Destructor
130
 
      ~TOPPViewBase();
131
 
 
132
 
      /**
133
 
        @brief Opens and displays data from a file
134
 
 
135
 
        Loads the data and adds it to the application by calling addData_()
136
 
 
137
 
        @param filename The file to open
138
 
        @param show_options If the options dialog should be shown (otherwise the defaults are used)
139
 
        @param caption Sets the layer name and window caption of the data. If unset the file name is used.
140
 
        @param add_to_recent If the file should be added to the recent files after opening
141
 
        @param window_id in which window the file is opened if opened as a new layer (0 or default equals current window).
142
 
        @param spectrum_id determines the spectrum to show in 1D view.
143
 
      */
144
 
      void addDataFile(const String& filename, bool show_options, bool add_to_recent, String caption="", UInt window_id=0, Size spectrum_id=0);
145
 
      /**
146
 
        @brief Opens and displays a data from a database
147
 
 
148
 
        Loads the data and adds it to the application by calling addData_()
149
 
 
150
 
        @param db_id The id in the database
151
 
        @param show_options If the options dialog should be shown (otherwise the defaults are used)
152
 
        @param caption Sets the layer name and window caption of the data. If unset the file name is used.
153
 
        @param window_id in which window the file is opened if opened as a new layer (0 or default equals current window).
154
 
      */
155
 
      void addDataDB(UInt db_id, bool show_options, String caption="", UInt window_id=0);
156
 
 
157
 
      /**
158
 
        @brief Adds a peak or feature map to the viewer
159
 
 
160
 
        @param feature_map The feature data (empty if not feature data)
161
 
        @param consensus_map The consensus feature data (empty if not consensus feature data)
162
 
        @param peptides The peptide identifications (empty if not ID data)
163
 
        @param peak_map The peak data (empty if not peak data)
164
 
        @param data_type Type of the data
165
 
        @param show_as_1d Force dataset to be opened in 1D mode (even if it contains several spectra)
166
 
        @param show_options If the options dialog should be shown (otherwise the defaults are used)
167
 
        @param filename source file name (if the data came from a file)
168
 
        @param caption Sets the layer name and window caption of the data. If unset the file name is used. If set, the file is not monitored foro changes.
169
 
        @param window_id in which window the file is opened if opened as a new layer (0 or default equals current
170
 
        @param spectrum_id determines the spectrum to show in 1D view.
171
 
      */
172
 
      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);
173
 
 
174
 
      /// Opens all the files in the string list
175
 
      void loadFiles(const StringList& list, QSplashScreen* splash_screen);
176
 
 
177
 
      /**
178
 
        @brief Loads the preferences from the filename given.
179
 
 
180
 
        If the filename is empty, the application name + ".ini" is used as filename
181
 
      */
182
 
      void loadPreferences(String filename="");
183
 
 
184
 
      /// Stores the preferences (used when this window is closed)
185
 
      void savePreferences();
186
 
 
187
 
      /// Returns the parameters for a SpectrumCanvas of dimension @p dim
188
 
      Param getSpectrumParameters(UInt dim);
189
 
 
190
 
                        /// Returns the active Layer data (0 if no layer is active)
191
 
                        const LayerData* getCurrentLayer() const;
192
 
 
193
 
      //@name Accessors for the main gui components.
194
 
      //@brief The top level enhanced workspace and the EnhancedTabWidgets resing in the EnhancedTabBar.
195
 
      //@{
196
 
      /// returns a pointer to the EnhancedWorkspace containing SpectrumWidgets and TOPPASWidgets
197
 
      EnhancedWorkspace* getWorkspace() const;
198
 
 
199
 
      /// returns a pointer to the active SpectrumWidget (0 if none is active)
200
 
      SpectrumWidget*  getActiveSpectrumWidget() const;
201
 
 
202
 
      /// returns a pointer to the active TOPPAS widget (0 if none is active)
203
 
      TOPPASWidget* getActiveTOPPASWidget() const;
204
 
 
205
 
      /// returns a pointer to the active Spectrum1DWidget (0 the active window is no Spectrum1DWidget or there is no active window)
206
 
      Spectrum1DWidget* getActive1DWidget() const;
207
 
 
208
 
      /// returns a pointer to the active Spectrum2DWidget (0 the active window is no Spectrum2DWidget or there is no active window)
209
 
      Spectrum2DWidget* getActive2DWidget() const;
210
 
 
211
 
      /// returns a pointer to the active Spectrum3DWidget (0 the active window is no Spectrum2DWidget or there is no active window)
212
 
      Spectrum3DWidget* getActive3DWidget() const;
213
 
      //@}
214
 
 
215
 
      /// returns a pointer to the active SpectrumCanvas (0 if none is active)
216
 
      SpectrumCanvas*  getActiveCanvas() const;
217
 
 
218
 
 
219
 
      /// returns a pointer to the SpectraIdentificationViewWidget
220
 
      SpectraIdentificationViewWidget* getSpectraIdentificationViewWidget();
221
 
 
222
 
      /// Opens the provided spectrum widget in a new window
223
 
      void showSpectrumWidgetInWindow(SpectrumWidget* sw, const String& caption);
224
 
 
225
 
    public slots:
226
 
      /// changes the current path according to the currently active window/layer
227
 
      void updateCurrentPath();
228
 
      /// shows the URL stored in the data of the sender QAction
229
 
      void showURL();
230
 
      /// shows the file dialog for opening files
231
 
      void openFileDialog();
232
 
      /// shows the file dialog for opening example files
233
 
      void openExampleDialog();
234
 
      /// shows the DB dialog for opening files
235
 
      void openDatabaseDialog();
236
 
      /// shows the goto dialog
237
 
      void showGoToDialog();
238
 
      /// enable TOPPAS tab in the view dock widget
239
 
      void setTOPPASTabEnabled(bool enabled);
240
 
      /// shows the preferences dialog
241
 
      void preferencesDialog();
242
 
      /// Shows statistics (count,min,max,avg) about Intensity, Quality, Charge and meta data
243
 
      void layerStatistics();
244
 
      /// lets the user edit the meta data of a layer
245
 
      void editMetadata();
246
 
      /// get's called if a layer got activated
247
 
      void layerActivated();
248
 
      /// get's called if a layer got deactivated
249
 
      void layerDeactivated();
250
 
      /// Activation of 1D spectrum
251
 
      void activate1DSpectrum(int index);
252
 
      /// Deactivation of 1D spectrum
253
 
      void deactivate1DSpectrum(int index);
254
 
      /// closes the active window
255
 
      void closeFile();
256
 
      /// updates the toolbar
257
 
      void updateToolBar();
258
 
      /// adapts the layer bar to the active window
259
 
      void updateLayerBar();
260
 
      /// adapts view bar to the active window
261
 
      void updateViewBar();
262
 
      /// changes the behavior according to the selected view in the spectra view bar and calls updateSpectraViewBar()
263
 
      void viewChanged(int);
264
 
      /// adapts the filter bar to the active window
265
 
      void updateFilterBar();
266
 
      /// enabled/disabled menu entries depending on the current state
267
 
      void updateMenu();
268
 
      /// brings the tab corresponding to the active window in front
269
 
      void updateTabBar(QWidget* w);
270
 
      /// tile the open windows vertically
271
 
      void tileVertical();
272
 
      /// tile the open windows horizontally
273
 
      void tileHorizontal();
274
 
      /**
275
 
        @brief Shows a status message in the status bar.
276
 
 
277
 
        If @p time is 0 the status message is displayed until showStatusMessage is called with an empty message or a new message.
278
 
        Otherwise the message is displayed for @p time ms.
279
 
      */
280
 
      void showStatusMessage(std::string msg, OpenMS::UInt time);
281
 
      /// shows m/z and rt in the status bar
282
 
      void showCursorStatus(double mz, double rt);
283
 
      /// shows m/z and rt in the status bar (inverting RT and m/z)
284
 
      void showCursorStatusInvert(double mz, double rt);
285
 
      /// Apply TOPP tool
286
 
      void showTOPPDialog();
287
 
      /// Annotates current layer with ID data
288
 
      void annotateWithID();
289
 
      /// Shows the theoretical spectrum generation dialog
290
 
      void showSpectrumGenerationDialog();
291
 
      /// Shows the spectrum alignment dialog
292
 
      void showSpectrumAlignmentDialog();
293
 
      /// Shows the spectrum with index @p index of the active layer in 1D
294
 
      void showSpectrumAs1D(int index);
295
 
      /// Shows the current peak data of the active layer in 2D
296
 
      void showCurrentPeaksAs2D();
297
 
      /// Shows the current peak data of the active layer in 3D
298
 
      void showCurrentPeaksAs3D();
299
 
      /// Shows the 'About' dialog
300
 
      void showAboutDialog();
301
 
      /// Saves the whole current layer data
302
 
      void saveLayerAll();
303
 
      /// Saves the visible layer data
304
 
      void saveLayerVisible();
305
 
                        /// Toggles the grid lines
306
 
      void toggleGridLines();
307
 
        /// Toggles the axis legends
308
 
      void toggleAxisLegends();
309
 
                        /// Shows current layer preferences
310
 
      void showPreferences();
311
 
                        /// dialog for inspecting database meta data
312
 
                        void metadataDatabaseDialog();
313
 
                        /// dialog for inspecting file meta data
314
 
                        void metadataFileDialog();                            
315
 
 
316
 
      /** @name TOPPAS pipeline slots
317
 
        */
318
 
      //@{
319
 
      /**
320
 
        @brief Opens and displays a TOPP pipeline from a file.
321
 
        @param filename Name of the file to be opened
322
 
        @param in_new_window Indicates wether a new window should be created or merged with the opened one
323
 
      */
324
 
      void addTOPPASFile(const String& filename, bool in_new_window);
325
 
      /// adds toppas widget to the current workspace
326
 
      void showTOPPipelineInWindow_(TOPPASWidget* tw, const String& caption);
327
 
      /// creates a new TOPPAS pipeline
328
 
      void newPipeline();
329
 
      /// shows the dialog for saving the current TOPPAS pipeline and updates the current tab caption
330
 
      void saveCurrentPipelineAs();
331
 
      /// saves the pipeline (determined by qt's sender mechanism)
332
 
      void savePipeline();     
333
 
      /// paste pipeline into current pipeline
334
 
      void includePipeline();
335
 
      /// load toppas resource file
336
 
      void loadPipelineResourceFile();
337
 
      /// save toppas resource file
338
 
      void savePipelineResourceFile();
339
 
      /// refresh the toppas pipeline parameters
340
 
      void refreshPipelineParameters();
341
 
      /// runs the the toppas pipeline
342
 
      void runPipeline();
343
 
      /// aborts the the toppas pipeline
344
 
      void abortPipeline();
345
 
      /// message after successful completion of pipeline
346
 
      void showPipelineFinishedLogMessage();
347
 
      /// Saves @p scene to the clipboard
348
 
      void saveToClipboard(TOPPASScene* scene);
349
 
      /// Sends the clipboard content to the sender of the connected signal
350
 
      void sendClipboardContent();
351
 
      /// Called when a tool is started
352
 
      void toolStarted();
353
 
      /// Called when a tool is finished
354
 
      void toolFinished();
355
 
      /// Called when a tool crashes
356
 
      void toolCrashed();
357
 
      /// Called when a tool execution fails
358
 
      void toolFailed();
359
 
                        /// Called when a file was successfully written to an output vertex
360
 
      void outputVertexFinished(const String& file);
361
 
      /// Called when a TOPP tool produces (error) output.
362
 
      void updateTOPPOutputLog(const QString& out);
363
 
      /// Open files in this TOPPView instance (also updated 'recently opened files' list)
364
 
      void openFilesInTOPPView(QStringList all_files);
365
 
      //@}
366
 
 
367
 
      /** @name Toolbar slots
368
 
      */
369
 
      //@{
370
 
      void setDrawMode1D(int);
371
 
      void setIntensityMode(int);
372
 
      void changeLayerFlag(bool);
373
 
      void changeLabel(QAction*);
374
 
      void changeUnassigned(QAction*);
375
 
      void resetZoom();
376
 
      void toggleProjections();
377
 
      //@}
378
 
 
379
 
    protected slots:
380
 
      /** @name Layer manager and filter manager slots
381
 
      */
382
 
      //@{
383
 
        /// slot for layer manager selection change
384
 
        void layerSelectionChange(int);
385
 
        /// Enables/disables the data filters for the current layer
386
 
        void layerFilterVisibilityChange(bool);
387
 
        /// slot for layer manager context menu
388
 
        void layerContextMenu(const QPoint& pos);
389
 
        /// slot for log window context menu
390
 
        void logContextMenu(const QPoint& pos);
391
 
        /// slot for layer manager visibility change (check box)
392
 
        void layerVisibilityChange(QListWidgetItem* item);
393
 
        /// slot for filter manager context menu
394
 
        void filterContextMenu(const QPoint& pos);
395
 
        /// slot for editing a filter
396
 
        void filterEdit(QListWidgetItem* item);
397
 
        /// slot for editing the preferences of the current layer
398
 
        void layerEdit(QListWidgetItem* /*item*/);
399
 
      //@}
400
 
 
401
 
      /** @name TOPPAS protected slots
402
 
        */
403
 
      //@{
404
 
      /// Inserts a new TOPP tool in the current window at (x,y)
405
 
      void insertNewVertex_(double x, double y, QTreeWidgetItem* item = 0);
406
 
      /// Inserts a new TOPP tool at the center of the current window at (x,y)
407
 
      void insertNewVertexInCenter_(QTreeWidgetItem* item);
408
 
      //@}
409
 
 
410
 
        /// slot for the finished signal of the TOPP tools execution
411
 
        void finishTOPPToolExecution(int exitCode, QProcess::ExitStatus exitStatus);
412
 
        /// aborts the execution of a TOPP tool
413
 
        void abortTOPPTool();
414
 
        /// retuns the last invoked TOPP tool with the same parameters
415
 
                        void rerunTOPPTool();
416
 
        /// shows the spectrum browser and updates it
417
 
        void showSpectrumBrowser();
418
 
      /// shows the spectrum metadata
419
 
      void showSpectrumMetaData(int spectrum_index);
420
 
 
421
 
      /** @name Tabbar slots
422
 
      */
423
 
      //@{
424
 
        /// Closes the window corresponding to the data of the tab with identifier @p id
425
 
      void closeByTab(int id);
426
 
      /// Raises the window corresponding to the data of the tab with identifier @p id
427
 
      void enhancedWorkspaceWindowChanged(int id);
428
 
      /// Opens a file from the recent files menu
429
 
      void openRecentFile();
430
 
                        /// Slot for drag-and-drop of layer manager to tabbar
431
 
                        void copyLayer(const QMimeData* data, QWidget* source, int id=-1);
432
 
      //@}
433
 
 
434
 
                        /// Appends process output to log window
435
 
                        void updateProcessLog();
436
 
 
437
 
      /// Called if a data file has been externally changed
438
 
      void fileChanged_(const String&);
439
 
 
440
 
    protected:
441
 
      /// Initializes the default parameters on TOPPView construction.
442
 
      void initializeDefaultParameters_();
443
 
 
444
 
      /// unique list of files referenced by all layers
445
 
       std::set<String> getFilenamesOfOpenFiles_();
446
 
 
447
 
        /// Tries to open a db connection (queries the user for the DB password)
448
 
        void connectToDB_(DBConnection& db);
449
 
        /**
450
 
                @brief Shows a dialog where the user can select files
451
 
        */
452
 
        QStringList getFileList_(const String& path_overwrite = "");
453
 
 
454
 
      /// Returns the enhanced tabbar widget with id @p id
455
 
      EnhancedTabBarWidgetInterface* window_(int id) const;
456
 
 
457
 
      ///@name dock widgets
458
 
      //@{
459
 
      QDockWidget* layer_dock_widget_;
460
 
      QDockWidget* views_dockwidget_;
461
 
      QDockWidget* filter_dock_widget_;
462
 
      //@}
463
 
 
464
 
      ///@name Spectrum selection widgets
465
 
      //@{
466
 
      SpectraViewWidget* spectra_view_widget_;
467
 
      SpectraIdentificationViewWidget* spectra_identification_view_widget_;
468
 
      //@}
469
 
 
470
 
      /// Layer management widget
471
 
      QListWidget* layer_manager_;
472
 
 
473
 
      ///@name Filter widgets
474
 
      //@{
475
 
      QListWidget* filters_;
476
 
      QCheckBox* filters_check_box_;
477
 
      //@}
478
 
 
479
 
      /// Watcher that tracks file changes (in order to update the data in the different views)
480
 
      FileWatcher* watcher_;
481
 
 
482
 
      /// Holds the messageboxes for each layer that are currently popped up (to avoid popping them up again, if file changes again before the messagebox is closed)
483
 
      bool watcher_msgbox_;
484
 
 
485
 
 
486
 
      /// Log output window
487
 
      QTextEdit* log_;
488
 
 
489
 
      /** @name Toolbar
490
 
      */
491
 
      //@{
492
 
      QToolBar* tool_bar_;
493
 
      //common intensity modes
494
 
 
495
 
      QButtonGroup* intensity_button_group_;
496
 
      //1D specific stuff
497
 
 
498
 
      QToolBar* tool_bar_1d_;
499
 
      QButtonGroup* draw_group_1d_;
500
 
 
501
 
      //2D specific stuff
502
 
      QToolBar* tool_bar_2d_peak_;
503
 
      QToolBar* tool_bar_2d_feat_;
504
 
      QToolBar* tool_bar_2d_cons_;
505
 
                        QToolBar* tool_bar_2d_ident_;
506
 
      QAction* dm_precursors_2d_;
507
 
      QAction* dm_hull_2d_;
508
 
      QAction* dm_hulls_2d_;
509
 
      QToolButton* dm_label_2d_;
510
 
                        QActionGroup* group_label_2d_;
511
 
      QToolButton* dm_unassigned_2d_;
512
 
                        QActionGroup* group_unassigned_2d_;
513
 
      QAction* dm_elements_2d_;
514
 
      QAction* projections_2d_;
515
 
                        QAction* dm_ident_2d_;
516
 
      //@}
517
 
 
518
 
      /// Main workspace
519
 
      EnhancedWorkspace* ws_;
520
 
 
521
 
      ///Tab bar. The address of the corresponding window to a tab is stored as an int in tabData()
522
 
      EnhancedTabBar* tab_bar_;
523
 
 
524
 
      /** @name Status bar
525
 
      */
526
 
      //@{
527
 
      /// Label for messages in the status bar
528
 
      QLabel* message_label_;
529
 
      /// m/z label for messages in the status bar
530
 
      QLabel* mz_label_;
531
 
      /// RT label for messages in the status bar
532
 
      QLabel* rt_label_;
533
 
                        //@}
534
 
 
535
 
      /// @name Recent files
536
 
      //@{
537
 
      ///adds a Filename to the recent files
538
 
      void addRecentFile_(const String& filename);
539
 
      ///update the recent files menu
540
 
      void updateRecentMenu_();
541
 
      /// list of the recently opened files
542
 
      QStringList recent_files_;
543
 
                        /// list of the recently opened files actions (menu entries)
544
 
                        std::vector<QAction*> recent_actions_;
545
 
                        //@}
546
 
 
547
 
 
548
 
      /// @name TOPP tool execution
549
 
      //@{
550
 
                        /// Runs the TOPP tool according to the information in topp_
551
 
                        void runTOPPTool_();
552
 
                        ///Information needed for execution of TOPP tools
553
 
                        struct
554
 
                        {
555
 
                                Param param;
556
 
                                String tool;
557
 
                                String in;
558
 
                                String out;
559
 
                                String file_name;
560
 
                                String layer_name;
561
 
                                UInt window_id;
562
 
                                Size spectrum_id;
563
 
                                QProcess* process;
564
 
                                bool visible;
565
 
                        } topp_;
566
 
                        //@}
567
 
 
568
 
      /// check if all avaiable preferences get set by the .ini file. If there are some missing entries fill them with default values.
569
 
      void checkPreferences_();
570
 
      ///@name reimplemented Qt events
571
 
      //@{
572
 
      void closeEvent(QCloseEvent* event);
573
 
                        //@}
574
 
 
575
 
                        ///Log message states
576
 
                        enum LogState
577
 
                        {
578
 
                                LS_NOTICE,   ///< Notice
579
 
                                LS_WARNING,  ///< Warning
580
 
                                LS_ERROR     ///< Fatal error
581
 
                        };
582
 
                        /// Shows a log message in the log_ window
583
 
      void showLogMessage_(LogState state, const String& heading, const String& body);
584
 
 
585
 
      ///Additional context menu for 2D layers
586
 
      QMenu* add_2d_context_;
587
 
 
588
 
                /// Apply TOPP tool. If @p visible is true, only the visible data is used, otherwise the whole layer is used.
589
 
      void showTOPPDialog_(bool visible);
590
 
 
591
 
      /// The current path (used for loading and storing).
592
 
      /// Depending on the preferences this is static or changes with the current window/layer.
593
 
      String current_path_;
594
 
 
595
 
      ///@name TOPPAS variables
596
 
      //@{
597
 
      /// Path to temporary directory used in TOPPAS
598
 
      QString toppas_tmp_path_;
599
 
 
600
 
      /// z-value counter for new inserted TOPPAS nodes
601
 
      static qreal toppas_z_value_;
602
 
 
603
 
      /// Offset counter for new inserted TOPPAS nodes (to avoid invisible stacking)
604
 
      static int toppas_node_offset_;
605
 
 
606
 
      /// The toppas clipboard
607
 
      TOPPASScene* toppas_clipboard_scene_;
608
 
      //@}
609
 
 
610
 
      /// Tabwidget that hold the different views on the loaded data
611
 
      QTabWidget* views_tabwidget_;
612
 
      /// The current TOPPView view behavior
613
 
      TOPPViewBehaviorInterface* view_behavior_;
614
 
      /// TOPPView behavior for the identification view
615
 
      TOPPViewIdentificationViewBehavior* identificationview_behavior_;
616
 
      /// TOPPView behavior for the spectra view
617
 
      TOPPViewSpectraViewBehavior* spectraview_behavior_;
618
 
 
619
 
      // static helper functions
620
 
      public:        
621
 
        /// Returns true if @p contains at least one MS1 spectrum
622
 
        static bool containsMS1Scans(const ExperimentType& exp);
623
 
        
624
 
        /// Estimates the noise by evaluating n_scans random scans of MS level 1. Assumes that 4/5 of intensities is noise.
625
 
        float estimateNoiseFromRandomMS1Scans(const ExperimentType& exp, UInt n_scans = 10);
626
 
 
627
 
        /// Counts the number of exact zero valued intensities in all MS1 spectra
628
 
        static UInt countMS1Zeros(const ExperimentType& exp);
629
 
 
630
 
        /// Returns true if the experiment map contains peptide identifications
631
 
        static bool hasPeptideIdentifications(const ExperimentType& map);
632
 
  }
633
 
  ; //class
 
111
 
 
112
public:
 
113
    ///@name Type definitions
 
114
    //@{
 
115
    //Feature map type
 
116
    typedef LayerData::FeatureMapType FeatureMapType;
 
117
    //Feature map managed type
 
118
    typedef LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType;
 
119
 
 
120
    //Consensus feature map type
 
121
    typedef LayerData::ConsensusMapType ConsensusMapType;
 
122
    //Consensus  map managed type
 
123
    typedef LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType;
 
124
 
 
125
    //Peak map type
 
126
    typedef LayerData::ExperimentType ExperimentType;
 
127
    //Main managed data type (experiment)
 
128
    typedef LayerData::ExperimentSharedPtrType ExperimentSharedPtrType;
 
129
    ///Peak spectrum type
 
130
    typedef ExperimentType::SpectrumType SpectrumType;
 
131
    //@}
 
132
 
 
133
    ///Constructor
 
134
    TOPPViewBase(QWidget* parent = 0);
 
135
    ///Destructor
 
136
    ~TOPPViewBase();
 
137
 
 
138
    /**
 
139
      @brief Opens and displays data from a file
 
140
 
 
141
      Loads the data and adds it to the application by calling addData_()
 
142
 
 
143
      @param filename The file to open
 
144
      @param show_options If the options dialog should be shown (otherwise the defaults are used)
 
145
      @param caption Sets the layer name and window caption of the data. If unset the file name is used.
 
146
      @param add_to_recent If the file should be added to the recent files after opening
 
147
      @param window_id in which window the file is opened if opened as a new layer (0 or default equals current window).
 
148
      @param spectrum_id determines the spectrum to show in 1D view.
 
149
    */
 
150
    void addDataFile(const String& filename, bool show_options, bool add_to_recent, String caption = "", UInt window_id = 0, Size spectrum_id = 0);
 
151
    /**
 
152
      @brief Opens and displays a data from a database
 
153
 
 
154
      Loads the data and adds it to the application by calling addData_()
 
155
 
 
156
      @param db_id The id in the database
 
157
      @param show_options If the options dialog should be shown (otherwise the defaults are used)
 
158
      @param caption Sets the layer name and window caption of the data. If unset the file name is used.
 
159
      @param window_id in which window the file is opened if opened as a new layer (0 or default equals current window).
 
160
    */
 
161
    void addDataDB(UInt db_id, bool show_options, String caption = "", UInt window_id = 0);
 
162
 
 
163
    /**
 
164
      @brief Adds a peak or feature map to the viewer
 
165
 
 
166
      @param feature_map The feature data (empty if not feature data)
 
167
      @param consensus_map The consensus feature data (empty if not consensus feature data)
 
168
      @param peptides The peptide identifications (empty if not ID data)
 
169
      @param peak_map The peak data (empty if not peak data)
 
170
      @param data_type Type of the data
 
171
      @param show_as_1d Force dataset to be opened in 1D mode (even if it contains several spectra)
 
172
      @param show_options If the options dialog should be shown (otherwise the defaults are used)
 
173
      @param filename source file name (if the data came from a file)
 
174
      @param caption Sets the layer name and window caption of the data. If unset the file name is used. If set, the file is not monitored foro changes.
 
175
      @param window_id in which window the file is opened if opened as a new layer (0 or default equals current
 
176
      @param spectrum_id determines the spectrum to show in 1D view.
 
177
    */
 
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
 
 
180
    /// Opens all the files in the string list
 
181
    void loadFiles(const StringList& list, QSplashScreen* splash_screen);
 
182
 
 
183
    /**
 
184
      @brief Loads the preferences from the filename given.
 
185
 
 
186
      If the filename is empty, the application name + ".ini" is used as filename
 
187
    */
 
188
    void loadPreferences(String filename = "");
 
189
 
 
190
    /// Stores the preferences (used when this window is closed)
 
191
    void savePreferences();
 
192
 
 
193
    /// Returns the parameters for a SpectrumCanvas of dimension @p dim
 
194
    Param getSpectrumParameters(UInt dim);
 
195
 
 
196
    /// Returns the active Layer data (0 if no layer is active)
 
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.
 
201
    //@{
 
202
    /// returns a pointer to the EnhancedWorkspace containing SpectrumWidgets
 
203
    EnhancedWorkspace* getWorkspace() const;
 
204
 
 
205
    /// returns a pointer to the active SpectrumWidget (0 if none is active)
 
206
    SpectrumWidget* getActiveSpectrumWidget() const;
 
207
 
 
208
    /// returns a pointer to the active Spectrum1DWidget (0 the active window is no Spectrum1DWidget or there is no active window)
 
209
    Spectrum1DWidget* getActive1DWidget() const;
 
210
 
 
211
    /// returns a pointer to the active Spectrum2DWidget (0 the active window is no Spectrum2DWidget or there is no active window)
 
212
    Spectrum2DWidget* getActive2DWidget() const;
 
213
 
 
214
    /// returns a pointer to the active Spectrum3DWidget (0 the active window is no Spectrum2DWidget or there is no active window)
 
215
    Spectrum3DWidget* getActive3DWidget() const;
 
216
    //@}
 
217
 
 
218
    /// returns a pointer to the active SpectrumCanvas (0 if none is active)
 
219
    SpectrumCanvas* getActiveCanvas() const;
 
220
 
 
221
 
 
222
    /// returns a pointer to the SpectraIdentificationViewWidget
 
223
    SpectraIdentificationViewWidget* getSpectraIdentificationViewWidget();
 
224
 
 
225
    /// Opens the provided spectrum widget in a new window
 
226
    void showSpectrumWidgetInWindow(SpectrumWidget* sw, const String& caption);
 
227
 
 
228
public slots:
 
229
    /// changes the current path according to the currently active window/layer
 
230
    void updateCurrentPath();
 
231
    /// shows the URL stored in the data of the sender QAction
 
232
    void showURL();
 
233
    /// shows the file dialog for opening files
 
234
    void openFileDialog();
 
235
    /// shows the file dialog for opening example files
 
236
    void openExampleDialog();
 
237
    /// shows the DB dialog for opening files
 
238
    void openDatabaseDialog();
 
239
    /// shows the goto dialog
 
240
    void showGoToDialog();
 
241
    /// shows the preferences dialog
 
242
    void preferencesDialog();
 
243
    /// Shows statistics (count,min,max,avg) about Intensity, Quality, Charge and meta data
 
244
    void layerStatistics();
 
245
    /// lets the user edit the meta data of a layer
 
246
    void editMetadata();
 
247
    /// get's called if a layer got activated
 
248
    void layerActivated();
 
249
    /// gets called when a layer changes in zoom
 
250
    void layerZoomChanged();
 
251
    /// link the zoom of individual windows
 
252
    void linkZoom();
 
253
    /// get's called if a layer got deactivated
 
254
    void layerDeactivated();
 
255
    /// Activation of 1D spectrum
 
256
    void activate1DSpectrum(int index);
 
257
    /// Activation of 1D with multiple entries (e.g. chromatograms)
 
258
    void activate1DSpectrum(std::vector<int, std::allocator<int> > indices);
 
259
    /// Deactivation of 1D spectrum
 
260
    void deactivate1DSpectrum(int index);
 
261
    /// closes the active window
 
262
    void closeFile();
 
263
    /// updates the toolbar
 
264
    void updateToolBar();
 
265
    /// adapts the layer bar to the active window
 
266
    void updateLayerBar();
 
267
    /// adapts view bar to the active window
 
268
    void updateViewBar();
 
269
    /// changes the behavior according to the selected view in the spectra view bar and calls updateSpectraViewBar()
 
270
    void viewChanged(int);
 
271
    /// adapts the filter bar to the active window
 
272
    void updateFilterBar();
 
273
    /// enabled/disabled menu entries depending on the current state
 
274
    void updateMenu();
 
275
    /// brings the tab corresponding to the active window in front
 
276
    void updateTabBar(QWidget* w);
 
277
    /// tile the open windows vertically
 
278
    void tileVertical();
 
279
    /// tile the open windows horizontally
 
280
    void tileHorizontal();
 
281
    /**
 
282
      @brief Shows a status message in the status bar.
 
283
 
 
284
      If @p time is 0 the status message is displayed until showStatusMessage is called with an empty message or a new message.
 
285
      Otherwise the message is displayed for @p time ms.
 
286
    */
 
287
    void showStatusMessage(std::string msg, OpenMS::UInt time);
 
288
    /// shows m/z and rt in the status bar
 
289
    void showCursorStatus(double mz, double rt);
 
290
    /// shows m/z and rt in the status bar (inverting RT and m/z)
 
291
    void showCursorStatusInvert(double mz, double rt);
 
292
    /// Apply TOPP tool
 
293
    void showTOPPDialog();
 
294
    /// Annotates current layer with ID data
 
295
    void annotateWithID();
 
296
    /// Shows the theoretical spectrum generation dialog
 
297
    void showSpectrumGenerationDialog();
 
298
    /// Shows the spectrum alignment dialog
 
299
    void showSpectrumAlignmentDialog();
 
300
    /// Shows the spectrum with index @p index of the active layer in 1D
 
301
    void showSpectrumAs1D(int index);
 
302
    void showSpectrumAs1D(std::vector<int, std::allocator<int> > indices);
 
303
    /// Shows the current peak data of the active layer in 2D
 
304
    void showCurrentPeaksAs2D();
 
305
    /// Shows the current peak data of the active layer in 3D
 
306
    void showCurrentPeaksAs3D();
 
307
    /// Shows the 'About' dialog
 
308
    void showAboutDialog();
 
309
    /// Saves the whole current layer data
 
310
    void saveLayerAll();
 
311
    /// Saves the visible layer data
 
312
    void saveLayerVisible();
 
313
    /// Toggles the grid lines
 
314
    void toggleGridLines();
 
315
    /// Toggles the axis legends
 
316
    void toggleAxisLegends();
 
317
    /// Shows current layer preferences
 
318
    void showPreferences();
 
319
    /// dialog for inspecting database meta data
 
320
    void metadataDatabaseDialog();
 
321
    /// dialog for inspecting file meta data
 
322
    void metadataFileDialog();
 
323
 
 
324
    /** @name Toolbar slots
 
325
    */
 
326
    //@{
 
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();
 
334
    //@}
 
335
 
 
336
    /// Loads a file given by the passed string
 
337
    void loadFile(QString);
 
338
 
 
339
protected slots:
 
340
    /** @name Layer manager and filter manager slots
 
341
    */
 
342
    //@{
 
343
    /// slot for layer manager selection change
 
344
    void layerSelectionChange(int);
 
345
    /// Enables/disables the data filters for the current layer
 
346
    void layerFilterVisibilityChange(bool);
 
347
    /// slot for layer manager context menu
 
348
    void layerContextMenu(const QPoint& pos);
 
349
    /// slot for log window context menu
 
350
    void logContextMenu(const QPoint& pos);
 
351
    /// slot for layer manager visibility change (check box)
 
352
    void layerVisibilityChange(QListWidgetItem* item);
 
353
    /// slot for filter manager context menu
 
354
    void filterContextMenu(const QPoint& pos);
 
355
    /// slot for editing a filter
 
356
    void filterEdit(QListWidgetItem* item);
 
357
    /// slot for editing the preferences of the current layer
 
358
    void layerEdit(QListWidgetItem* /*item*/);
 
359
    //@}
 
360
 
 
361
    /// slot for the finished signal of the TOPP tools execution
 
362
    void finishTOPPToolExecution(int exitCode, QProcess::ExitStatus exitStatus);
 
363
    /// aborts the execution of a TOPP tool
 
364
    void abortTOPPTool();
 
365
    /// retuns the last invoked TOPP tool with the same parameters
 
366
    void rerunTOPPTool();
 
367
    /// shows the spectrum browser and updates it
 
368
    void showSpectrumBrowser();
 
369
    /// shows the spectrum metadata
 
370
    void showSpectrumMetaData(int spectrum_index);
 
371
 
 
372
    /** @name Tabbar slots
 
373
    */
 
374
    //@{
 
375
    /// Closes the window corresponding to the data of the tab with identifier @p id
 
376
    void closeByTab(int id);
 
377
    /// Raises the window corresponding to the data of the tab with identifier @p id
 
378
    void enhancedWorkspaceWindowChanged(int id);
 
379
    /// Opens a file from the recent files menu
 
380
    void openRecentFile();
 
381
    /// Slot for drag-and-drop of layer manager to tabbar
 
382
    void copyLayer(const QMimeData* data, QWidget* source, int id = -1);
 
383
    //@}
 
384
 
 
385
    /// Appends process output to log window
 
386
    void updateProcessLog();
 
387
 
 
388
    /// Called if a data file has been externally changed
 
389
    void fileChanged_(const String&);
 
390
protected:
 
391
    /// Initializes the default parameters on TOPPView construction.
 
392
    void initializeDefaultParameters_();
 
393
 
 
394
    /// unique list of files referenced by all layers
 
395
    std::set<String> getFilenamesOfOpenFiles_();
 
396
 
 
397
    /// Tries to open a db connection (queries the user for the DB password)
 
398
    void connectToDB_(DBConnection& db);
 
399
    /**
 
400
        @brief Shows a dialog where the user can select files
 
401
    */
 
402
    QStringList getFileList_(const String& path_overwrite = "");
 
403
 
 
404
    /// Returns the enhanced tabbar widget with id @p id
 
405
    EnhancedTabBarWidgetInterface* window_(int id) const;
 
406
 
 
407
    ///@name dock widgets
 
408
    //@{
 
409
    QDockWidget* layer_dock_widget_;
 
410
    QDockWidget* views_dockwidget_;
 
411
    QDockWidget* filter_dock_widget_;
 
412
    //@}
 
413
 
 
414
    ///@name Spectrum selection widgets
 
415
    //@{
 
416
    SpectraViewWidget* spectra_view_widget_;
 
417
    SpectraIdentificationViewWidget* spectra_identification_view_widget_;
 
418
    //@}
 
419
 
 
420
    /// Layer management widget
 
421
    QListWidget* layer_manager_;
 
422
 
 
423
    ///@name Filter widgets
 
424
    //@{
 
425
    QListWidget* filters_;
 
426
    QCheckBox* filters_check_box_;
 
427
    //@}
 
428
 
 
429
    /// Watcher that tracks file changes (in order to update the data in the different views)
 
430
    FileWatcher* watcher_;
 
431
 
 
432
    /// Holds the messageboxes for each layer that are currently popped up (to avoid popping them up again, if file changes again before the messagebox is closed)
 
433
    bool watcher_msgbox_;
 
434
 
 
435
    /// Stores whether the individual windows should zoom together (be linked) or not
 
436
    bool zoom_together_;
 
437
 
 
438
    QAction* linkZoom_action_;
 
439
 
 
440
    /// Log output window
 
441
    QTextEdit* log_;
 
442
 
 
443
    /** @name Toolbar
 
444
    */
 
445
    //@{
 
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_;
 
459
    QToolBar* tool_bar_2d_ident_;
 
460
    QAction* dm_precursors_2d_;
 
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_;
 
470
    //@}
 
471
 
 
472
    /// Main workspace
 
473
    EnhancedWorkspace* ws_;
 
474
 
 
475
    ///Tab bar. The address of the corresponding window to a tab is stored as an int in tabData()
 
476
    EnhancedTabBar* tab_bar_;
 
477
 
 
478
    /** @name Status bar
 
479
    */
 
480
    //@{
 
481
    /// Label for messages in the status bar
 
482
    QLabel* message_label_;
 
483
    /// m/z label for messages in the status bar
 
484
    QLabel* mz_label_;
 
485
    /// RT label for messages in the status bar
 
486
    QLabel* rt_label_;
 
487
    //@}
 
488
 
 
489
    /// @name Recent files
 
490
    //@{
 
491
    ///adds a Filename to the recent files
 
492
    void addRecentFile_(const String& filename);
 
493
    ///update the recent files menu
 
494
    void updateRecentMenu_();
 
495
    /// list of the recently opened files
 
496
    QStringList recent_files_;
 
497
    /// list of the recently opened files actions (menu entries)
 
498
    std::vector<QAction*> recent_actions_;
 
499
    //@}
 
500
 
 
501
 
 
502
    /// @name TOPP tool execution
 
503
    //@{
 
504
    /// Runs the TOPP tool according to the information in topp_
 
505
    void runTOPPTool_();
 
506
    ///Information needed for execution of TOPP tools
 
507
    struct
 
508
    {
 
509
      Param param;
 
510
      String tool;
 
511
      String in;
 
512
      String out;
 
513
      String file_name;
 
514
      String layer_name;
 
515
      UInt window_id;
 
516
      Size spectrum_id;
 
517
      QProcess* process;
 
518
      QTime timer;
 
519
      bool visible;
 
520
    } topp_;
 
521
    //@}
 
522
 
 
523
    /// check if all available preferences get set by the .ini file. If there are some missing entries fill them with default values.
 
524
    void checkPreferences_();
 
525
    ///@name reimplemented Qt events
 
526
    //@{
 
527
    void closeEvent(QCloseEvent* event);
 
528
    //@}
 
529
 
 
530
    ///Log message states
 
531
    enum LogState
 
532
    {
 
533
      LS_NOTICE, ///< Notice
 
534
      LS_WARNING, ///< Warning
 
535
      LS_ERROR ///< Fatal error
 
536
    };
 
537
    /// Shows a log message in the log_ window
 
538
    void showLogMessage_(LogState state, const String& heading, const String& body);
 
539
 
 
540
    ///Additional context menu for 2D layers
 
541
    QMenu* add_2d_context_;
 
542
 
 
543
    /// Apply TOPP tool. If @p visible is true, only the visible data is used, otherwise the whole layer is used.
 
544
    void showTOPPDialog_(bool visible);
 
545
 
 
546
    /// The current path (used for loading and storing).
 
547
    /// Depending on the preferences this is static or changes with the current window/layer.
 
548
    String current_path_;
 
549
 
 
550
    /// Tabwidget that hold the different views on the loaded data
 
551
    QTabWidget* views_tabwidget_;
 
552
    /// The current TOPPView view behavior
 
553
    TOPPViewBehaviorInterface* view_behavior_;
 
554
    /// TOPPView behavior for the identification view
 
555
    TOPPViewIdentificationViewBehavior* identificationview_behavior_;
 
556
    /// TOPPView behavior for the spectra view
 
557
    TOPPViewSpectraViewBehavior* spectraview_behavior_;
 
558
 
 
559
    // static helper functions
 
560
public:
 
561
    /// Returns true if @p contains at least one MS1 spectrum
 
562
    static bool containsMS1Scans(const ExperimentType& exp);
 
563
 
 
564
    /// Estimates the noise by evaluating n_scans random scans of MS level 1. Assumes that 4/5 of intensities is noise.
 
565
    float estimateNoiseFromRandomMS1Scans(const ExperimentType& exp, UInt n_scans = 10);
 
566
 
 
567
    /// Counts the number of exact zero valued intensities in all MS1 spectra
 
568
    static UInt countMS1Zeros(const ExperimentType& exp);
 
569
 
 
570
    /// Returns true if the experiment map contains peptide identifications
 
571
    static bool hasPeptideIdentifications(const ExperimentType& map);
 
572
 
 
573
private:
 
574
    /// Suffix appended to caption of tabs when layer is shown in 3D
 
575
    static const String CAPTION_3D_SUFFIX_;
 
576
  }; //class
634
577
 
635
578
} //namespace
636
579