Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_VISUAL_APPLICATIONS_TOPPVIEWBASE_H
00036 #define OPENMS_VISUAL_APPLICATIONS_TOPPVIEWBASE_H
00037
00038
00039 #include <OpenMS/KERNEL/StandardTypes.h>
00040 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
00041 #include <OpenMS/VISUAL/SpectrumCanvas.h>
00042 #include <OpenMS/VISUAL/SpectrumWidget.h>
00043 #include <OpenMS/SYSTEM/FileWatcher.h>
00044 #include <OpenMS/VISUAL/SpectraViewWidget.h>
00045 #include <OpenMS/VISUAL/SpectraIdentificationViewWidget.h>
00046
00047 #include <OpenMS/VISUAL/TOPPViewBehaviorInterface.h>
00048 #include <OpenMS/VISUAL/TOPPViewSpectraViewBehavior.h>
00049 #include <OpenMS/VISUAL/TOPPViewIdentificationViewBehavior.h>
00050
00051
00052 #include <map>
00053
00054
00055 #include <QtGui/QMainWindow>
00056 #include <QtGui/QButtonGroup>
00057 #include <QtGui/QActionGroup>
00058 #include <QtCore/QStringList>
00059 #include <QtCore/QProcess>
00060
00061 class QAction;
00062 class QComboBox;
00063 class QLabel;
00064 class QLineEdit;
00065 class QListWidget;
00066 class QListWidgetItem;
00067 class QTreeWidget;
00068 class QTreeWidgetItem;
00069 class QDockWidget;
00070 class QToolButton;
00071 class QCloseEvent;
00072 class QTextEdit;
00073 class QCheckBox;
00074 class QSplashScreen;
00075 class QToolButton;
00076 class QWorkspace;
00077
00078 namespace OpenMS
00079 {
00080 class EnhancedWorkspace;
00081 class EnhancedTabBar;
00082 class Spectrum1DWidget;
00083 class Spectrum2DWidget;
00084 class Spectrum3DWidget;
00085 class ToolsDialog;
00086 class MultiGradientSelector;
00087 class DBConnection;
00088 class FileWatcher;
00089
00104 class OPENMS_GUI_DLLAPI TOPPViewBase :
00105 public QMainWindow,
00106 public DefaultParamHandler
00107 {
00108 Q_OBJECT
00109
00110 friend class TestTOPPView;
00111
00112 public:
00114
00115
00116 typedef LayerData::FeatureMapType FeatureMapType;
00117
00118 typedef LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType;
00119
00120
00121 typedef LayerData::ConsensusMapType ConsensusMapType;
00122
00123 typedef LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType;
00124
00125
00126 typedef LayerData::ExperimentType ExperimentType;
00127
00128 typedef LayerData::ExperimentSharedPtrType ExperimentSharedPtrType;
00130 typedef ExperimentType::SpectrumType SpectrumType;
00132
00134 TOPPViewBase(QWidget* parent = 0);
00136 ~TOPPViewBase();
00137
00150 void addDataFile(const String& filename, bool show_options, bool add_to_recent, String caption = "", UInt window_id = 0, Size spectrum_id = 0);
00161 void addDataDB(UInt db_id, bool show_options, String caption = "", UInt window_id = 0);
00162
00178 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);
00179
00181 void loadFiles(const StringList& list, QSplashScreen* splash_screen);
00182
00188 void loadPreferences(String filename = "");
00189
00191 void savePreferences();
00192
00194 Param getSpectrumParameters(UInt dim);
00195
00197 const LayerData* getCurrentLayer() const;
00198
00199
00200
00202
00203 EnhancedWorkspace* getWorkspace() const;
00204
00206 SpectrumWidget* getActiveSpectrumWidget() const;
00207
00209 Spectrum1DWidget* getActive1DWidget() const;
00210
00212 Spectrum2DWidget* getActive2DWidget() const;
00213
00215 Spectrum3DWidget* getActive3DWidget() const;
00217
00219 SpectrumCanvas* getActiveCanvas() const;
00220
00221
00223 SpectraIdentificationViewWidget* getSpectraIdentificationViewWidget();
00224
00226 void showSpectrumWidgetInWindow(SpectrumWidget* sw, const String& caption);
00227
00228 public slots:
00230 void updateCurrentPath();
00232 void showURL();
00234 void openFileDialog();
00236 void openExampleDialog();
00238 void openDatabaseDialog();
00240 void showGoToDialog();
00242 void preferencesDialog();
00244 void layerStatistics();
00246 void editMetadata();
00248 void layerActivated();
00250 void layerZoomChanged();
00252 void linkZoom();
00254 void layerDeactivated();
00256 void activate1DSpectrum(int index);
00258 void activate1DSpectrum(std::vector<int, std::allocator<int> > indices);
00260 void deactivate1DSpectrum(int index);
00262 void closeFile();
00264 void updateToolBar();
00266 void updateLayerBar();
00268 void updateViewBar();
00270 void viewChanged(int);
00272 void updateFilterBar();
00274 void updateMenu();
00276 void updateTabBar(QWidget* w);
00278 void tileVertical();
00280 void tileHorizontal();
00287 void showStatusMessage(std::string msg, OpenMS::UInt time);
00289 void showCursorStatus(double mz, double rt);
00291 void showCursorStatusInvert(double mz, double rt);
00293 void showTOPPDialog();
00295 void annotateWithID();
00297 void showSpectrumGenerationDialog();
00299 void showSpectrumAlignmentDialog();
00301 void showSpectrumAs1D(int index);
00302 void showSpectrumAs1D(std::vector<int, std::allocator<int> > indices);
00304 void showCurrentPeaksAs2D();
00306 void showCurrentPeaksAs3D();
00308 void showAboutDialog();
00310 void saveLayerAll();
00312 void saveLayerVisible();
00314 void toggleGridLines();
00316 void toggleAxisLegends();
00318 void showPreferences();
00320 void metadataDatabaseDialog();
00322 void metadataFileDialog();
00323
00327 void setDrawMode1D(int);
00328 void setIntensityMode(int);
00329 void changeLayerFlag(bool);
00330 void changeLabel(QAction*);
00331 void changeUnassigned(QAction*);
00332 void resetZoom();
00333 void toggleProjections();
00335
00337 void loadFile(QString);
00338
00339 protected slots:
00343
00344 void layerSelectionChange(int);
00346 void layerFilterVisibilityChange(bool);
00348 void layerContextMenu(const QPoint& pos);
00350 void logContextMenu(const QPoint& pos);
00352 void layerVisibilityChange(QListWidgetItem* item);
00354 void filterContextMenu(const QPoint& pos);
00356 void filterEdit(QListWidgetItem* item);
00358 void layerEdit(QListWidgetItem* );
00360
00362 void finishTOPPToolExecution(int exitCode, QProcess::ExitStatus exitStatus);
00364 void abortTOPPTool();
00366 void rerunTOPPTool();
00368 void showSpectrumBrowser();
00370 void showSpectrumMetaData(int spectrum_index);
00371
00375
00376 void closeByTab(int id);
00378 void enhancedWorkspaceWindowChanged(int id);
00380 void openRecentFile();
00382 void copyLayer(const QMimeData* data, QWidget* source, int id = -1);
00384
00386 void updateProcessLog();
00387
00389 void fileChanged_(const String&);
00390 protected:
00392 void initializeDefaultParameters_();
00393
00395 std::set<String> getFilenamesOfOpenFiles_();
00396
00398 void connectToDB_(DBConnection& db);
00402 QStringList getFileList_(const String& path_overwrite = "");
00403
00405 EnhancedTabBarWidgetInterface* window_(int id) const;
00406
00408
00409 QDockWidget* layer_dock_widget_;
00410 QDockWidget* views_dockwidget_;
00411 QDockWidget* filter_dock_widget_;
00413
00415
00416 SpectraViewWidget* spectra_view_widget_;
00417 SpectraIdentificationViewWidget* spectra_identification_view_widget_;
00419
00421 QListWidget* layer_manager_;
00422
00424
00425 QListWidget* filters_;
00426 QCheckBox* filters_check_box_;
00428
00430 FileWatcher* watcher_;
00431
00433 bool watcher_msgbox_;
00434
00436 bool zoom_together_;
00437
00438 QAction* linkZoom_action_;
00439
00441 QTextEdit* log_;
00442
00446 QToolBar* tool_bar_;
00447
00448
00449 QButtonGroup* intensity_button_group_;
00450
00451
00452 QToolBar* tool_bar_1d_;
00453 QButtonGroup* draw_group_1d_;
00454
00455
00456 QToolBar* tool_bar_2d_peak_;
00457 QToolBar* tool_bar_2d_feat_;
00458 QToolBar* tool_bar_2d_cons_;
00459 QToolBar* tool_bar_2d_ident_;
00460 QAction* dm_precursors_2d_;
00461 QAction* dm_hull_2d_;
00462 QAction* dm_hulls_2d_;
00463 QToolButton* dm_label_2d_;
00464 QActionGroup* group_label_2d_;
00465 QToolButton* dm_unassigned_2d_;
00466 QActionGroup* group_unassigned_2d_;
00467 QAction* dm_elements_2d_;
00468 QAction* projections_2d_;
00469 QAction* dm_ident_2d_;
00471
00473 EnhancedWorkspace* ws_;
00474
00476 EnhancedTabBar* tab_bar_;
00477
00481
00482 QLabel* message_label_;
00484 QLabel* mz_label_;
00486 QLabel* rt_label_;
00488
00490
00491
00492 void addRecentFile_(const String& filename);
00494 void updateRecentMenu_();
00496 QStringList recent_files_;
00498 std::vector<QAction*> recent_actions_;
00500
00501
00503
00504
00505 void runTOPPTool_();
00507 struct
00508 {
00509 Param param;
00510 String tool;
00511 String in;
00512 String out;
00513 String file_name;
00514 String layer_name;
00515 UInt window_id;
00516 Size spectrum_id;
00517 QProcess* process;
00518 QTime timer;
00519 bool visible;
00520 } topp_;
00522
00524 void checkPreferences_();
00526
00527 void closeEvent(QCloseEvent* event);
00529
00531 enum LogState
00532 {
00533 LS_NOTICE,
00534 LS_WARNING,
00535 LS_ERROR
00536 };
00538 void showLogMessage_(LogState state, const String& heading, const String& body);
00539
00541 QMenu* add_2d_context_;
00542
00544 void showTOPPDialog_(bool visible);
00545
00548 String current_path_;
00549
00551 QTabWidget* views_tabwidget_;
00553 TOPPViewBehaviorInterface* view_behavior_;
00555 TOPPViewIdentificationViewBehavior* identificationview_behavior_;
00557 TOPPViewSpectraViewBehavior* spectraview_behavior_;
00558
00559
00560 public:
00562 static bool containsMS1Scans(const ExperimentType& exp);
00563
00565 float estimateNoiseFromRandomMS1Scans(const ExperimentType& exp, UInt n_scans = 10);
00566
00568 static UInt countMS1Zeros(const ExperimentType& exp);
00569
00571 static bool hasPeptideIdentifications(const ExperimentType& map);
00572
00573 private:
00575 static const String CAPTION_3D_SUFFIX_;
00576 };
00577
00578 }
00579
00580 #endif