124
124
using namespace Internal;
125
using namespace Math;
127
qreal TOPPViewBase::toppas_z_value_ = 42.0;
128
Int TOPPViewBase::toppas_node_offset_ = 0;
130
TOPPViewBase::TOPPViewBase(QWidget* parent):
132
DefaultParamHandler("TOPPViewBase"),
134
watcher_msgbox_(false),
135
toppas_clipboard_scene_(0)
137
setWindowTitle("TOPPView");
138
setWindowIcon(QIcon(":/TOPPView.png"));
140
//prevents errors caused by too small width,height values
141
setMinimumSize(400,400);
143
//enable drag-and-drop
144
setAcceptDrops(true);
146
// get geometry of first screen
147
QRect screen_geometry = QApplication::desktop()->screenGeometry();
148
// center main window
150
(int)(0.1 * screen_geometry.width()),
151
(int)(0.1 * screen_geometry.height()),
152
(int)(0.8 * screen_geometry.width()),
153
(int)(0.8 * screen_geometry.height())
156
//set & create temporary path -- make sure its a new subdirectory, as TOPPASScene will delete it when its done
157
toppas_tmp_path_ = (File::getTempDirectory() + String(QDir::separator()) + File::getUniqueName()).toQString();
159
qd.mkpath(toppas_tmp_path_);
161
// create dummy widget (to be able to have a layout), Tab bar and workspace
162
QWidget* dummy = new QWidget(this);
163
setCentralWidget(dummy);
164
QVBoxLayout* box_layout = new QVBoxLayout(dummy);
166
// create empty tab bar and workspace which will hold the main visualization widgets (e.g. spectra widgets...)
167
tab_bar_ = new EnhancedTabBar(dummy);
168
tab_bar_->setWhatsThis("Tab bar<BR><BR>Close tabs through the context menu or by double-clicking them.<BR>The tab bar accepts drag-and-drop from the layer bar.");
169
tab_bar_->addTab("dummy",4710);
170
tab_bar_->setMinimumSize(tab_bar_->sizeHint());
171
tab_bar_->removeId(4710);
173
connect(tab_bar_,SIGNAL(currentIdChanged(int)),this,SLOT(enhancedWorkspaceWindowChanged(int)));
174
connect(tab_bar_,SIGNAL(aboutToCloseId(int)),this,SLOT(closeByTab(int)));
176
//connect signals ans slots for drag-and-drop
177
connect(tab_bar_,SIGNAL(dropOnWidget(const QMimeData*,QWidget*)),this,SLOT(copyLayer(const QMimeData*,QWidget*)));
178
connect(tab_bar_,SIGNAL(dropOnTab(const QMimeData*,QWidget*,int)),this,SLOT(copyLayer(const QMimeData*,QWidget*,int)));
179
box_layout->addWidget(tab_bar_);
181
ws_= new EnhancedWorkspace(dummy);
182
connect(ws_,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateToolBar()));
183
connect(ws_,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateTabBar(QWidget*)));
184
connect(ws_,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateLayerBar()));
185
connect(ws_,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateViewBar()));
186
connect(ws_,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateFilterBar()));
187
connect(ws_,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateMenu()));
188
connect(ws_,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateCurrentPath()));
189
connect(ws_,SIGNAL(dropReceived(const QMimeData*,QWidget*,int)),this,SLOT(copyLayer(const QMimeData*,QWidget*,int)));
191
box_layout->addWidget(ws_);
193
//################## MENUS #################
195
QMenu* file = new QMenu("&File",this);
196
menuBar()->addMenu(file);
197
file->addAction("&Open file",this,SLOT(openFileDialog()), Qt::CTRL+Qt::Key_O);
198
file->addAction("Open from &database",this,SLOT(openDatabaseDialog()), Qt::CTRL+Qt::Key_D);
199
file->addAction("Open &example file",this,SLOT(openExampleDialog()));
200
file->addAction("&Close",this,SLOT(closeFile()), Qt::CTRL+Qt::Key_W);
201
file->addSeparator();
203
// File menu: TOPPAS section
204
file->addAction("&New TOPPAS pipeline",this,SLOT(newPipeline()), Qt::CTRL+Qt::Key_N);
205
file->addAction("&Include TOPPAS pipeline",this,SLOT(includePipeline()), Qt::CTRL+Qt::Key_I);
206
file->addAction("&Save TOPPAS pipeline",this,SLOT(savePipeline()), Qt::CTRL+Qt::Key_S);
207
file->addAction("Save TOPPAS pipeline &As",this,SLOT(saveCurrentPipelineAs()), Qt::CTRL+Qt::SHIFT+Qt::Key_S);
208
file->addAction("&Load TOPPAS resource file",this,SLOT(loadPipelineResourceFile()));
209
file->addAction("Save TOPPAS &resource file",this,SLOT(savePipelineResourceFile()));
210
file->addAction("Refresh TOPPAS ¶meters",this,SLOT(refreshPipelineParameters()), Qt::CTRL+Qt::SHIFT+Qt::Key_P);
211
file->addSeparator();
214
file->addAction("&Show meta data (file)",this,SLOT(metadataFileDialog()));
215
file->addAction("&Show meta data (database)",this,SLOT(metadataDatabaseDialog()));
216
file->addSeparator();
219
QMenu* recent_menu = new QMenu("&Recent files", this);
220
recent_actions_.resize(20);
221
for (Size i = 0; i<20; ++i)
223
recent_actions_[i] = recent_menu->addAction("",this,SLOT(openRecentFile()));
224
recent_actions_[i]->setVisible(false);
226
file->addMenu(recent_menu);
228
file->addSeparator();
229
file->addAction("&Preferences",this, SLOT(preferencesDialog()));
230
file->addAction("&Quit",qApp,SLOT(quit()));
233
QMenu* tools = new QMenu("&Tools",this);
234
menuBar()->addMenu(tools);
235
tools->addAction("&Go to",this,SLOT(showGoToDialog()), Qt::CTRL+Qt::Key_G);
236
tools->addAction("&Edit meta data",this,SLOT(editMetadata()), Qt::CTRL+Qt::Key_M);
237
tools->addAction("&Statistics",this,SLOT(layerStatistics()));
238
tools->addSeparator();
240
tools->addAction("Apply TOPP tool (whole layer)", this, SLOT(showTOPPDialog()), Qt::CTRL+Qt::Key_T)->setData(false);
241
tools->addAction("Apply TOPP tool (visible layer data)", this, SLOT(showTOPPDialog()), Qt::CTRL+Qt::SHIFT+Qt::Key_T)->setData(true);
242
tools->addAction("Rerun TOPP tool", this, SLOT(rerunTOPPTool()),Qt::Key_F4);
243
tools->addSeparator();
244
tools->addAction("&Annotate with identification", this, SLOT(annotateWithID()), Qt::CTRL+Qt::Key_I);
245
tools->addAction("Align spectra", this, SLOT(showSpectrumAlignmentDialog()));
246
tools->addAction("Generate theoretical spectrum", this, SLOT(showSpectrumGenerationDialog()));
249
// pipeline menu (TOPPAS pipeline)
250
QMenu* toppas_pipeline = new QMenu("TOPPAS &Pipeline", this);
251
toppas_pipeline->addAction("&Run (F5)",this,SLOT(runPipeline()));
252
toppas_pipeline->addAction("&Abort",this,SLOT(abortPipeline()));
253
menuBar()->addMenu(toppas_pipeline);
256
QMenu* layer = new QMenu("&Layer",this);
257
menuBar()->addMenu(layer);
258
layer->addAction("Save all data", this, SLOT(saveLayerAll()), Qt::CTRL+Qt::Key_S);
259
layer->addAction("Save visible data", this, SLOT(saveLayerVisible()), Qt::CTRL+Qt::SHIFT+Qt::Key_S);
260
layer->addSeparator();
261
layer->addAction("Show/hide grid lines", this, SLOT(toggleGridLines()), Qt::CTRL+Qt::Key_R);
262
layer->addAction("Show/hide axis legends", this, SLOT(toggleAxisLegends()), Qt::CTRL+Qt::Key_L);
263
layer->addSeparator();
264
layer->addAction("Preferences", this, SLOT(showPreferences()));
267
QMenu* windows = new QMenu("&Windows", this);
268
menuBar()->addMenu(windows);
269
windows->addAction("&Cascade",this->ws_,SLOT(cascade()));
270
windows->addAction("&Tile automatic",this->ws_,SLOT(tile()));
271
windows->addAction(QIcon(":/tile_horizontal.png"),"Tile &vertical",this,SLOT(tileHorizontal()));
272
windows->addAction(QIcon(":/tile_vertical.png"),"Tile &horizontal",this,SLOT(tileVertical()));
273
windows->addSeparator();
276
QMenu* help = new QMenu("&Help", this);
277
menuBar()->addMenu(help);
278
help->addAction(QWhatsThis::createAction(help));
279
help->addSeparator();
280
QAction* action = help->addAction("OpenMS website",this,SLOT(showURL()));
281
action->setData("http://www.OpenMS.de");
282
action = help->addAction("Tutorials and documentation",this,SLOT(showURL()), Qt::Key_F1);
283
action->setData(String(File::getOpenMSDocPath() + "/html/index.html").toQString());
285
help->addSeparator();
286
help->addAction("&About",this,SLOT(showAboutDialog()));
289
message_label_ = new QLabel(statusBar());
290
statusBar()->addWidget(message_label_,1);
292
rt_label_ = new QLabel("RT: 12345678", statusBar());
293
rt_label_->setMinimumSize(rt_label_->sizeHint());
294
rt_label_->setText("");
295
statusBar()->addPermanentWidget(rt_label_,0);
296
mz_label_ = new QLabel("m/z: 123456780912", statusBar());
297
mz_label_->setMinimumSize(mz_label_->sizeHint());
298
mz_label_->setText("");
299
statusBar()->addPermanentWidget(mz_label_,0);
301
//################## TOOLBARS #################
302
//create toolbars and connect signals
305
//--Basic tool bar for all views--
306
tool_bar_ = addToolBar("Basic tool bar");
309
intensity_button_group_ = new QButtonGroup(tool_bar_);
310
intensity_button_group_->setExclusive(true);
312
b = new QToolButton(tool_bar_);
313
b->setIcon(QIcon(":/lin.png"));
314
b->setToolTip("Intensity: Normal");
315
b->setShortcut(Qt::Key_N);
316
b->setCheckable(true);
317
b->setWhatsThis("Intensity: Normal<BR><BR>Intensity is displayed unmodified.<BR>(Hotkey: N)");
318
intensity_button_group_->addButton(b,SpectrumCanvas::IM_NONE);
319
tool_bar_->addWidget(b);
321
b = new QToolButton(tool_bar_);
322
b->setIcon(QIcon(":/percentage.png"));
323
b->setToolTip("Intensity: Percentage");
324
b->setShortcut(Qt::Key_P);
325
b->setCheckable(true);
326
b->setWhatsThis("Intensity: Percentage<BR><BR>Intensity is displayed as a percentage of the layer"
327
" maximum intensity. If only one layer is displayed this mode behaves like the"
328
" normal mode. If more than one layer is displayed intensities are aligned."
330
intensity_button_group_->addButton(b,SpectrumCanvas::IM_PERCENTAGE);
331
tool_bar_->addWidget(b);
333
b = new QToolButton(tool_bar_);
334
b->setIcon(QIcon(":/snap.png"));
335
b->setToolTip("Intensity: Snap to maximum displayed intensity");
336
b->setShortcut(Qt::Key_S);
337
b->setCheckable(true);
338
b->setWhatsThis("Intensity: Snap to maximum displayed intensity<BR><BR> In this mode the"
339
" color gradient is adapted to the maximum currently displayed intensity."
341
intensity_button_group_->addButton(b,SpectrumCanvas::IM_SNAP);
342
tool_bar_->addWidget(b);
344
b = new QToolButton(tool_bar_);
345
b->setIcon(QIcon(":/log.png"));
346
b->setToolTip("Intensity: Use log scaling for colors");
347
b->setCheckable(true);
348
b->setWhatsThis("Intensity: Logarithmic scaling of intensities for color calculation");
349
intensity_button_group_->addButton(b,SpectrumCanvas::IM_LOG);
350
tool_bar_->addWidget(b);
352
connect(intensity_button_group_,SIGNAL(buttonClicked(int)),this,SLOT(setIntensityMode(int)));
353
tool_bar_->addSeparator();
356
QAction* reset_zoom_button = tool_bar_->addAction(QIcon(":/reset_zoom.png"), "Reset Zoom", this, SLOT(resetZoom()));
357
reset_zoom_button->setWhatsThis("Reset zoom: Zooms out as far as possible and resets the zoom history.<BR>(Hotkey: Backspace)");
362
tool_bar_1d_ = addToolBar("1D tool bar");
365
draw_group_1d_ = new QButtonGroup(tool_bar_1d_);
366
draw_group_1d_->setExclusive(true);
368
b = new QToolButton(tool_bar_1d_);
369
b->setIcon(QIcon(":/peaks.png"));
370
b->setToolTip("Peak mode");
371
b->setShortcut(Qt::Key_I);
372
b->setCheckable(true);
373
b->setWhatsThis("1D Draw mode: Peaks<BR><BR>Peaks are diplayed as sticks.");
374
draw_group_1d_->addButton(b,Spectrum1DCanvas::DM_PEAKS);
375
tool_bar_1d_->addWidget(b);
377
b = new QToolButton(tool_bar_1d_);
378
b->setIcon(QIcon(":/lines.png"));
379
b->setToolTip("Raw data mode");
380
b->setShortcut(Qt::Key_R);
381
b->setCheckable(true);
382
b->setWhatsThis("1D Draw mode: Raw data<BR><BR>Peaks are diplayed as a continous line.");
383
draw_group_1d_->addButton(b,Spectrum1DCanvas::DM_CONNECTEDLINES);
384
tool_bar_1d_->addWidget(b);
386
connect(draw_group_1d_,SIGNAL(buttonClicked(int)),this,SLOT(setDrawMode1D(int)));
387
tool_bar_->addSeparator();
389
//--2D peak toolbar--
390
tool_bar_2d_peak_ = addToolBar("2D peak tool bar");
392
dm_precursors_2d_ = tool_bar_2d_peak_->addAction(QIcon(":/precursors.png"),"Show fragment scan precursors");
393
dm_precursors_2d_->setCheckable(true);
394
dm_precursors_2d_->setWhatsThis("2D peak draw mode: Precursors<BR><BR>fragment scan precursor peaks are marked.<BR>(Hotkey: 1)");
395
dm_precursors_2d_->setShortcut(Qt::Key_1);
397
connect(dm_precursors_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
399
projections_2d_ = tool_bar_2d_peak_->addAction(QIcon(":/projections.png"), "Show Projections" ,this, SLOT(toggleProjections()));
400
projections_2d_->setWhatsThis("Projections: Shows projections of peak data along RT and MZ axis.<BR>(Hotkey: 2)");
401
projections_2d_->setShortcut(Qt::Key_2);
403
//--2D feature toolbar--
404
tool_bar_2d_feat_ = addToolBar("2D feature tool bar");
406
dm_hull_2d_ = tool_bar_2d_feat_->addAction(QIcon(":/convexhull.png"),"Show feature convex hull");
407
dm_hull_2d_->setCheckable(true);
408
dm_hull_2d_->setWhatsThis("2D feature draw mode: Convex hull<BR><BR>The convex hull of the feature is displayed.<BR>(Hotkey: 5)");
409
dm_hull_2d_->setShortcut(Qt::Key_5);
410
connect(dm_hull_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
412
dm_hulls_2d_ = tool_bar_2d_feat_->addAction(QIcon(":/convexhulls.png"),"Show feature convex hulls");
413
dm_hulls_2d_->setCheckable(true);
414
dm_hulls_2d_->setWhatsThis("2D feature draw mode: Convex hulls<BR><BR>The convex hulls of the feature are displayed: One for each mass trace.<BR>(Hotkey: 6)");
415
dm_hulls_2d_->setShortcut(Qt::Key_6);
416
connect(dm_hulls_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
419
dm_label_2d_ = new QToolButton(tool_bar_2d_feat_);
420
dm_label_2d_->setPopupMode(QToolButton::MenuButtonPopup);
421
QAction* action2 = new QAction(QIcon(":/labels.png"), "Show feature label", dm_label_2d_);
422
action2->setCheckable(true);
423
action2->setWhatsThis("2D feature draw mode: Labels<BR><BR>Display different kinds of annotation next to features.<BR>(Hotkey: 7)");
424
action2->setShortcut(Qt::Key_7);
425
dm_label_2d_->setDefaultAction(action2);
426
tool_bar_2d_feat_->addWidget(dm_label_2d_);
427
connect(dm_label_2d_, SIGNAL(triggered(QAction*)), this, SLOT(changeLabel(QAction*)));
429
group_label_2d_ = new QActionGroup(dm_label_2d_);
430
QMenu* menu = new QMenu(dm_label_2d_);
431
for (Size i = 0; i < LayerData::SIZE_OF_LABEL_TYPE; ++i)
433
QAction* temp = group_label_2d_->addAction(
434
QString(LayerData::NamesOfLabelType[i].c_str()));
435
temp->setCheckable(true);
436
if (i == 0) temp->setChecked(true);
437
menu->addAction(temp);
439
dm_label_2d_->setMenu(menu);
441
// unassigned peptide identifications:
442
dm_unassigned_2d_ = new QToolButton(tool_bar_2d_feat_);
443
dm_unassigned_2d_->setPopupMode(QToolButton::MenuButtonPopup);
444
QAction* action_unassigned = new QAction(QIcon(":/unassigned.png"), "Show unassigned peptide identifications", dm_unassigned_2d_);
445
action_unassigned->setCheckable(true);
446
action_unassigned->setWhatsThis("2D feature draw mode: Unassigned peptide identifications<BR><BR>Show unassigned peptide identifications by precursor m/z or by peptide mass.<BR>(Hotkey: 8)");
447
action_unassigned->setShortcut(Qt::Key_8);
448
dm_unassigned_2d_->setDefaultAction(action_unassigned);
449
tool_bar_2d_feat_->addWidget(dm_unassigned_2d_);
450
connect(dm_unassigned_2d_, SIGNAL(triggered(QAction*)), this, SLOT(changeUnassigned(QAction*)));
452
group_unassigned_2d_ = new QActionGroup(dm_unassigned_2d_);
453
menu = new QMenu(dm_unassigned_2d_);
454
StringList options = StringList::create(
455
"Don't show,Show by precursor m/z,Show by peptide mass");
456
for (StringList::iterator opt_it = options.begin(); opt_it != options.end();
459
QAction* temp = group_unassigned_2d_->addAction(opt_it->toQString());
460
temp->setCheckable(true);
461
if (opt_it == options.begin()) temp->setChecked(true);
462
menu->addAction(temp);
464
dm_unassigned_2d_->setMenu(menu);
466
//--2D consensus toolbar--
467
tool_bar_2d_cons_ = addToolBar("2D peak tool bar");
469
dm_elements_2d_ = tool_bar_2d_cons_->addAction(QIcon(":/elements.png"),"Show consensus feature element positions");
470
dm_elements_2d_->setCheckable(true);
471
dm_elements_2d_->setWhatsThis("2D consensus feature draw mode: Elements<BR><BR>The individual elements that make up the consensus feature are drawn.<BR>(Hotkey: 9)");
472
dm_elements_2d_->setShortcut(Qt::Key_9);
473
connect(dm_elements_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
475
//--2D identifications toolbar--
476
tool_bar_2d_ident_ = addToolBar("2D identifications tool bar");
478
dm_ident_2d_ = tool_bar_2d_ident_->addAction(QIcon(":/peptidemz.png"), "Use theoretical peptide mass for m/z positions (default: precursor mass)");
479
dm_ident_2d_->setCheckable(true);
480
dm_ident_2d_->setWhatsThis("2D peptide identification draw mode: m/z source<BR><BR>Toggle between precursor mass (default) and theoretical peptide mass as source for the m/z positions of peptide identifications.<BR>(Hotkey: 5)");
481
dm_ident_2d_->setShortcut(Qt::Key_5);
482
connect(dm_ident_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
484
//################## Dock widgets #################
486
layer_dock_widget_ = new QDockWidget("Layers", this);
487
addDockWidget(Qt::RightDockWidgetArea, layer_dock_widget_);
488
layer_manager_ = new QListWidget(layer_dock_widget_);
489
layer_manager_->setWhatsThis("Layer bar<BR><BR>Here the available layers are shown. Left-click on a layer to select it.<BR>Layers can be shown and hidden using the checkboxes in front of the name.<BR> Renaming and removing a layer is possible through the context menu.<BR>Dragging a layer to the tab bar copies the layer.<BR>Double-clicking a layer open its preferences.<BR>You can use the 'PageUp' and 'PageDown' buttons to change the selected layer.");
491
layer_dock_widget_->setWidget(layer_manager_);
492
layer_manager_->setContextMenuPolicy(Qt::CustomContextMenu);
493
layer_manager_->setDragEnabled(true);
494
connect(layer_manager_,SIGNAL(currentRowChanged(int)),this,SLOT(layerSelectionChange(int)));
495
connect(layer_manager_,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(layerContextMenu(const QPoint&)));
496
connect(layer_manager_,SIGNAL(itemChanged(QListWidgetItem*)),this,SLOT(layerVisibilityChange(QListWidgetItem*)));
497
connect(layer_manager_,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(layerEdit(QListWidgetItem*)));
499
windows->addAction(layer_dock_widget_->toggleViewAction());
502
views_dockwidget_ = new QDockWidget("Views", this);
503
addDockWidget(Qt::RightDockWidgetArea, views_dockwidget_);
504
views_tabwidget_ = new QTabWidget(views_dockwidget_);
505
views_dockwidget_->setWidget(views_tabwidget_);
507
spectra_view_widget_ = new SpectraViewWidget();
508
connect(spectra_view_widget_, SIGNAL(showSpectrumMetaData(int)), this, SLOT(showSpectrumMetaData(int)));
509
connect(spectra_view_widget_, SIGNAL(showSpectrumAs1D(int)), this, SLOT(showSpectrumAs1D(int)));
510
connect(spectra_view_widget_, SIGNAL(spectrumSelected(int)), this, SLOT(activate1DSpectrum(int)));
511
connect(spectra_view_widget_, SIGNAL(spectrumDoubleClicked(int)), this, SLOT(showSpectrumAs1D(int)));
512
spectraview_behavior_ = new TOPPViewSpectraViewBehavior(this);
513
view_behavior_ = spectraview_behavior_;
515
spectra_identification_view_widget_ = new SpectraIdentificationViewWidget(Param());
516
connect(spectra_identification_view_widget_, SIGNAL(spectrumDeselected(int)), this, SLOT(deactivate1DSpectrum(int)));
517
connect(spectra_identification_view_widget_, SIGNAL(showSpectrumAs1D(int)), this, SLOT(showSpectrumAs1D(int)));
518
connect(spectra_identification_view_widget_, SIGNAL(spectrumSelected(int)), this, SLOT(activate1DSpectrum(int)));
519
identificationview_behavior_ = new TOPPViewIdentificationViewBehavior(this);
520
connect(spectra_identification_view_widget_, SIGNAL(requestVisibleArea1D(DoubleReal, DoubleReal)), identificationview_behavior_, SLOT(setVisibleArea1D(DoubleReal, DoubleReal)));
522
// topp tool dock widget
523
TOPPASTreeView* tools_tree_view = TOPPASBase::createTOPPToolsTreeWidget();
524
connect (tools_tree_view, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(insertNewVertexInCenter_(QTreeWidgetItem*)));
526
views_tabwidget_->addTab(spectra_view_widget_, "Scan view");
527
views_tabwidget_->addTab(spectra_identification_view_widget_, "Identification view");
528
views_tabwidget_->setTabEnabled(1, false);
529
views_tabwidget_->addTab(tools_tree_view, "TOPPAS view");
530
views_tabwidget_->setTabEnabled(2, false);
532
// switch between different view tabs
533
connect(views_tabwidget_, SIGNAL(currentChanged(int)), this, SLOT(viewChanged(int)));
535
// add hide/show option to dock widget
536
windows->addAction(views_dockwidget_->toggleViewAction());
538
// filter dock widget
539
filter_dock_widget_ = new QDockWidget("Data filters", this);
540
addDockWidget(Qt::RightDockWidgetArea, filter_dock_widget_);
541
QWidget* tmp_widget = new QWidget(); //dummy widget as QDockWidget takes only one widget
542
filter_dock_widget_->setWidget(tmp_widget);
544
QVBoxLayout* vbl = new QVBoxLayout(tmp_widget);
546
filters_ = new QListWidget(tmp_widget);
547
filters_->setSelectionMode(QAbstractItemView::NoSelection);
548
filters_->setWhatsThis("Data filter bar<BR><BR>Here filtering options for the current layer can be set.<BR>Through the context menu you can add, remove and edit filters.<BR>For convenience, editing filters is also possible by double-clicking them.");
549
filters_->setContextMenuPolicy(Qt::CustomContextMenu);
550
connect(filters_,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(filterContextMenu(const QPoint&)));
551
connect(filters_,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(filterEdit(QListWidgetItem*)));
552
vbl->addWidget(filters_);
554
filters_check_box_ = new QCheckBox("Enable/disable all filters", tmp_widget);
555
connect(filters_check_box_,SIGNAL(toggled(bool)),this,SLOT(layerFilterVisibilityChange(bool)));
556
vbl->addWidget(filters_check_box_);
558
windows->addAction(filter_dock_widget_->toggleViewAction());
561
QDockWidget* log_bar = new QDockWidget("Log", this);
562
addDockWidget(Qt::BottomDockWidgetArea, log_bar);
563
log_ = new QTextEdit(log_bar);
564
log_->setReadOnly(true);
565
log_->setContextMenuPolicy(Qt::CustomContextMenu);
566
connect(log_,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(logContextMenu(const QPoint&)));
567
log_bar->setWidget(log_);
569
windows->addAction(log_bar->toggleViewAction());
571
//################## DEFAULTS #################
572
initializeDefaultParameters_();
574
// store defaults in param_
581
current_path_ = param_.getValue("preferences:default_path");
588
//######################### File System Watcher ###########################################
589
watcher_ = new FileWatcher(this);
590
connect(watcher_,SIGNAL(fileChanged(const String&)),this, SLOT(fileChanged_(const String&)));
125
using namespace Math;
127
const String TOPPViewBase::CAPTION_3D_SUFFIX_ = " (3D)";
129
TOPPViewBase::TOPPViewBase(QWidget* parent) :
131
DefaultParamHandler("TOPPViewBase"),
133
watcher_msgbox_(false)
135
#if defined(__APPLE__)
136
// we do not want to load plugins as this leads to serious problems
137
// when shipping on mac os x
138
QApplication::setLibraryPaths(QStringList());
141
setWindowTitle("TOPPView");
142
setWindowIcon(QIcon(":/TOPPView.png"));
144
// ensure correct encoding of paths
145
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
147
//prevents errors caused by too small width, height values
148
setMinimumSize(400, 400);
150
//enable drag-and-drop
151
setAcceptDrops(true);
153
//by default, linked zooming is turned off
154
zoom_together_ = false;
156
// get geometry of first screen
157
QRect screen_geometry = QApplication::desktop()->screenGeometry();
158
// center main window
160
(int)(0.1 * screen_geometry.width()),
161
(int)(0.1 * screen_geometry.height()),
162
(int)(0.8 * screen_geometry.width()),
163
(int)(0.8 * screen_geometry.height())
166
// create dummy widget (to be able to have a layout), Tab bar and workspace
167
QWidget* dummy = new QWidget(this);
168
setCentralWidget(dummy);
169
QVBoxLayout* box_layout = new QVBoxLayout(dummy);
171
// create empty tab bar and workspace which will hold the main visualization widgets (e.g. spectrawidgets...)
172
tab_bar_ = new EnhancedTabBar(dummy);
173
tab_bar_->setWhatsThis("Tab bar<BR><BR>Close tabs through the context menu or by double-clicking them.<BR>The tab bar accepts drag-and-drop from the layer bar.");
174
tab_bar_->addTab("dummy", 4710);
175
tab_bar_->setMinimumSize(tab_bar_->sizeHint());
176
tab_bar_->removeId(4710);
178
connect(tab_bar_, SIGNAL(currentIdChanged(int)), this, SLOT(enhancedWorkspaceWindowChanged(int)));
179
connect(tab_bar_, SIGNAL(aboutToCloseId(int)), this, SLOT(closeByTab(int)));
181
//connect signals ans slots for drag-and-drop
182
connect(tab_bar_, SIGNAL(dropOnWidget(const QMimeData*, QWidget*)), this, SLOT(copyLayer(const QMimeData*, QWidget*)));
183
connect(tab_bar_, SIGNAL(dropOnTab(const QMimeData*, QWidget*, int)), this, SLOT(copyLayer(const QMimeData*, QWidget*, int)));
184
box_layout->addWidget(tab_bar_);
186
ws_ = new EnhancedWorkspace(dummy);
187
connect(ws_, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateToolBar()));
188
connect(ws_, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateTabBar(QWidget*)));
189
connect(ws_, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateLayerBar()));
190
connect(ws_, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateViewBar()));
191
connect(ws_, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateFilterBar()));
192
connect(ws_, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateMenu()));
193
connect(ws_, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateCurrentPath()));
194
connect(ws_, SIGNAL(dropReceived(const QMimeData*, QWidget*, int)), this, SLOT(copyLayer(const QMimeData*, QWidget*, int)));
196
box_layout->addWidget(ws_);
198
//################## MENUS #################
200
QMenu* file = new QMenu("&File", this);
201
menuBar()->addMenu(file);
202
file->addAction("&Open file", this, SLOT(openFileDialog()), Qt::CTRL + Qt::Key_O);
203
file->addAction("Open from &database", this, SLOT(openDatabaseDialog()), Qt::CTRL + Qt::Key_D);
204
file->addAction("Open &example file", this, SLOT(openExampleDialog()));
205
file->addAction("&Close", this, SLOT(closeFile()), Qt::CTRL + Qt::Key_W);
206
file->addSeparator();
209
file->addAction("&Show meta data (file)", this, SLOT(metadataFileDialog()));
210
file->addAction("&Show meta data (database)", this, SLOT(metadataDatabaseDialog()));
211
file->addSeparator();
214
QMenu* recent_menu = new QMenu("&Recent files", this);
215
recent_actions_.resize(20);
216
for (Size i = 0; i < 20; ++i)
218
recent_actions_[i] = recent_menu->addAction("", this, SLOT(openRecentFile()));
219
recent_actions_[i]->setVisible(false);
221
file->addMenu(recent_menu);
223
file->addSeparator();
224
file->addAction("&Preferences", this, SLOT(preferencesDialog()));
225
file->addAction("&Quit", qApp, SLOT(quit()));
228
QMenu* tools = new QMenu("&Tools", this);
229
menuBar()->addMenu(tools);
230
tools->addAction("&Go to", this, SLOT(showGoToDialog()), Qt::CTRL + Qt::Key_G);
231
tools->addAction("&Edit meta data", this, SLOT(editMetadata()), Qt::CTRL + Qt::Key_M);
232
tools->addAction("&Statistics", this, SLOT(layerStatistics()));
233
tools->addSeparator();
235
tools->addAction("Apply TOPP tool (whole layer)", this, SLOT(showTOPPDialog()), Qt::CTRL + Qt::Key_T)->setData(false);
236
tools->addAction("Apply TOPP tool (visible layer data)", this, SLOT(showTOPPDialog()), Qt::CTRL + Qt::SHIFT + Qt::Key_T)->setData(true);
237
tools->addAction("Rerun TOPP tool", this, SLOT(rerunTOPPTool()), Qt::Key_F4);
238
tools->addSeparator();
239
tools->addAction("&Annotate with identification", this, SLOT(annotateWithID()), Qt::CTRL + Qt::Key_I);
240
tools->addAction("Align spectra", this, SLOT(showSpectrumAlignmentDialog()));
241
tools->addAction("Generate theoretical spectrum", this, SLOT(showSpectrumGenerationDialog()));
244
QMenu* layer = new QMenu("&Layer", this);
245
menuBar()->addMenu(layer);
246
layer->addAction("Save all data", this, SLOT(saveLayerAll()), Qt::CTRL + Qt::Key_S);
247
layer->addAction("Save visible data", this, SLOT(saveLayerVisible()), Qt::CTRL + Qt::SHIFT + Qt::Key_S);
248
layer->addSeparator();
249
layer->addAction("Show/hide grid lines", this, SLOT(toggleGridLines()), Qt::CTRL + Qt::Key_R);
250
layer->addAction("Show/hide axis legends", this, SLOT(toggleAxisLegends()), Qt::CTRL + Qt::Key_L);
251
layer->addSeparator();
252
layer->addAction("Preferences", this, SLOT(showPreferences()));
255
QMenu* windows = new QMenu("&Windows", this);
256
menuBar()->addMenu(windows);
257
windows->addAction("&Cascade", this->ws_, SLOT(cascade()));
258
windows->addAction("&Tile automatic", this->ws_, SLOT(tile()));
259
windows->addAction(QIcon(":/tile_horizontal.png"), "Tile &vertical", this, SLOT(tileHorizontal()));
260
windows->addAction(QIcon(":/tile_vertical.png"), "Tile &horizontal", this, SLOT(tileVertical()));
261
linkZoom_action_ = windows->addAction("Link &Zoom", this, SLOT(linkZoom()));
262
windows->addSeparator();
265
QMenu* help = new QMenu("&Help", this);
266
menuBar()->addMenu(help);
267
help->addAction(QWhatsThis::createAction(help));
268
help->addSeparator();
269
QAction* action = help->addAction("OpenMS website", this, SLOT(showURL()));
270
action->setData("http://www.OpenMS.de");
271
action = help->addAction("Tutorials and documentation", this, SLOT(showURL()), Qt::Key_F1);
272
action->setData(String("html/index.html").toQString());
274
help->addSeparator();
275
help->addAction("&About", this, SLOT(showAboutDialog()));
278
message_label_ = new QLabel(statusBar());
279
statusBar()->addWidget(message_label_, 1);
281
rt_label_ = new QLabel("RT: 12345678", statusBar());
282
rt_label_->setMinimumSize(rt_label_->sizeHint());
283
rt_label_->setText("");
284
statusBar()->addPermanentWidget(rt_label_, 0);
285
mz_label_ = new QLabel("m/z: 123456780912", statusBar());
286
mz_label_->setMinimumSize(mz_label_->sizeHint());
287
mz_label_->setText("");
288
statusBar()->addPermanentWidget(mz_label_, 0);
290
//################## TOOLBARS #################
291
//create toolbars and connect signals
294
//--Basic tool bar for all views--
295
tool_bar_ = addToolBar("Basic tool bar");
298
intensity_button_group_ = new QButtonGroup(tool_bar_);
299
intensity_button_group_->setExclusive(true);
301
b = new QToolButton(tool_bar_);
302
b->setIcon(QIcon(":/lin.png"));
303
b->setToolTip("Intensity: Normal");
304
b->setShortcut(Qt::Key_N);
305
b->setCheckable(true);
306
b->setWhatsThis("Intensity: Normal<BR><BR>Intensity is displayed unmodified.<BR>(Hotkey: N)");
307
intensity_button_group_->addButton(b, SpectrumCanvas::IM_NONE);
308
tool_bar_->addWidget(b);
310
b = new QToolButton(tool_bar_);
311
b->setIcon(QIcon(":/percentage.png"));
312
b->setToolTip("Intensity: Percentage");
313
b->setShortcut(Qt::Key_P);
314
b->setCheckable(true);
315
b->setWhatsThis("Intensity: Percentage<BR><BR>Intensity is displayed as a percentage of the layer"
316
" maximum intensity. If only one layer is displayed this mode behaves like the"
317
" normal mode. If more than one layer is displayed intensities are aligned."
319
intensity_button_group_->addButton(b, SpectrumCanvas::IM_PERCENTAGE);
320
tool_bar_->addWidget(b);
322
b = new QToolButton(tool_bar_);
323
b->setIcon(QIcon(":/snap.png"));
324
b->setToolTip("Intensity: Snap to maximum displayed intensity");
325
b->setShortcut(Qt::Key_S);
326
b->setCheckable(true);
327
b->setWhatsThis("Intensity: Snap to maximum displayed intensity<BR><BR> In this mode the"
328
" color gradient is adapted to the maximum currently displayed intensity."
330
intensity_button_group_->addButton(b, SpectrumCanvas::IM_SNAP);
331
tool_bar_->addWidget(b);
333
b = new QToolButton(tool_bar_);
334
b->setIcon(QIcon(":/log.png"));
335
b->setToolTip("Intensity: Use log scaling for colors");
336
b->setCheckable(true);
337
b->setWhatsThis("Intensity: Logarithmic scaling of intensities for color calculation");
338
intensity_button_group_->addButton(b, SpectrumCanvas::IM_LOG);
339
tool_bar_->addWidget(b);
341
connect(intensity_button_group_, SIGNAL(buttonClicked(int)), this, SLOT(setIntensityMode(int)));
342
tool_bar_->addSeparator();
345
QAction* reset_zoom_button = tool_bar_->addAction(QIcon(":/reset_zoom.png"), "Reset Zoom", this, SLOT(resetZoom()));
346
reset_zoom_button->setWhatsThis("Reset zoom: Zooms out as far as possible and resets the zoom history.<BR>(Hotkey: Backspace)");
351
tool_bar_1d_ = addToolBar("1D tool bar");
354
draw_group_1d_ = new QButtonGroup(tool_bar_1d_);
355
draw_group_1d_->setExclusive(true);
357
b = new QToolButton(tool_bar_1d_);
358
b->setIcon(QIcon(":/peaks.png"));
359
b->setToolTip("Peak mode");
360
b->setShortcut(Qt::Key_I);
361
b->setCheckable(true);
362
b->setWhatsThis("1D Draw mode: Peaks<BR><BR>Peaks are diplayed as sticks.");
363
draw_group_1d_->addButton(b, Spectrum1DCanvas::DM_PEAKS);
364
tool_bar_1d_->addWidget(b);
366
b = new QToolButton(tool_bar_1d_);
367
b->setIcon(QIcon(":/lines.png"));
368
b->setToolTip("Raw data mode");
369
b->setShortcut(Qt::Key_R);
370
b->setCheckable(true);
371
b->setWhatsThis("1D Draw mode: Raw data<BR><BR>Peaks are diplayed as a continuous line.");
372
draw_group_1d_->addButton(b, Spectrum1DCanvas::DM_CONNECTEDLINES);
373
tool_bar_1d_->addWidget(b);
375
connect(draw_group_1d_, SIGNAL(buttonClicked(int)), this, SLOT(setDrawMode1D(int)));
376
tool_bar_->addSeparator();
378
//--2D peak toolbar--
379
tool_bar_2d_peak_ = addToolBar("2D peak tool bar");
381
dm_precursors_2d_ = tool_bar_2d_peak_->addAction(QIcon(":/precursors.png"), "Show fragment scan precursors");
382
dm_precursors_2d_->setCheckable(true);
383
dm_precursors_2d_->setWhatsThis("2D peak draw mode: Precursors<BR><BR>fragment scan precursor peaks are marked.<BR>(Hotkey: 1)");
384
dm_precursors_2d_->setShortcut(Qt::Key_1);
386
connect(dm_precursors_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
388
projections_2d_ = tool_bar_2d_peak_->addAction(QIcon(":/projections.png"), "Show Projections", this, SLOT(toggleProjections()));
389
projections_2d_->setWhatsThis("Projections: Shows projections of peak data along RT and MZ axis.<BR>(Hotkey: 2)");
390
projections_2d_->setShortcut(Qt::Key_2);
392
//--2D feature toolbar--
393
tool_bar_2d_feat_ = addToolBar("2D feature tool bar");
395
dm_hull_2d_ = tool_bar_2d_feat_->addAction(QIcon(":/convexhull.png"), "Show feature convex hull");
396
dm_hull_2d_->setCheckable(true);
397
dm_hull_2d_->setWhatsThis("2D feature draw mode: Convex hull<BR><BR>The convex hull of the feature is displayed.<BR>(Hotkey: 5)");
398
dm_hull_2d_->setShortcut(Qt::Key_5);
399
connect(dm_hull_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
401
dm_hulls_2d_ = tool_bar_2d_feat_->addAction(QIcon(":/convexhulls.png"), "Show feature convex hulls");
402
dm_hulls_2d_->setCheckable(true);
403
dm_hulls_2d_->setWhatsThis("2D feature draw mode: Convex hulls<BR><BR>The convex hulls of the feature are displayed: One for each mass trace.<BR>(Hotkey: 6)");
404
dm_hulls_2d_->setShortcut(Qt::Key_6);
405
connect(dm_hulls_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
408
dm_label_2d_ = new QToolButton(tool_bar_2d_feat_);
409
dm_label_2d_->setPopupMode(QToolButton::MenuButtonPopup);
410
QAction* action2 = new QAction(QIcon(":/labels.png"), "Show feature annotation", dm_label_2d_);
411
action2->setCheckable(true);
412
action2->setWhatsThis("2D feature draw mode: Labels<BR><BR>Display different kinds of annotation next to features.<BR>(Hotkey: 7)");
413
action2->setShortcut(Qt::Key_7);
414
dm_label_2d_->setDefaultAction(action2);
415
tool_bar_2d_feat_->addWidget(dm_label_2d_);
416
connect(dm_label_2d_, SIGNAL(triggered(QAction*)), this, SLOT(changeLabel(QAction*)));
418
group_label_2d_ = new QActionGroup(dm_label_2d_);
419
QMenu* menu = new QMenu(dm_label_2d_);
420
for (Size i = 0; i < LayerData::SIZE_OF_LABEL_TYPE; ++i)
422
QAction* temp = group_label_2d_->addAction(
423
QString(LayerData::NamesOfLabelType[i].c_str()));
424
temp->setCheckable(true);
425
if (i == 0) temp->setChecked(true);
426
menu->addAction(temp);
428
dm_label_2d_->setMenu(menu);
430
// unassigned peptide identifications:
431
dm_unassigned_2d_ = new QToolButton(tool_bar_2d_feat_);
432
dm_unassigned_2d_->setPopupMode(QToolButton::MenuButtonPopup);
433
QAction* action_unassigned = new QAction(QIcon(":/unassigned.png"), "Show unassigned peptide identifications", dm_unassigned_2d_);
434
action_unassigned->setCheckable(true);
435
action_unassigned->setWhatsThis("2D feature draw mode: Unassigned peptide identifications<BR><BR>Show unassigned peptide identifications by precursor m/z or by peptide mass.<BR>(Hotkey: 8)");
436
action_unassigned->setShortcut(Qt::Key_8);
437
dm_unassigned_2d_->setDefaultAction(action_unassigned);
438
tool_bar_2d_feat_->addWidget(dm_unassigned_2d_);
439
connect(dm_unassigned_2d_, SIGNAL(triggered(QAction*)), this, SLOT(changeUnassigned(QAction*)));
441
group_unassigned_2d_ = new QActionGroup(dm_unassigned_2d_);
442
menu = new QMenu(dm_unassigned_2d_);
443
StringList options = StringList::create(
444
"Don't show,Show by precursor m/z,Show by peptide mass");
445
for (StringList::iterator opt_it = options.begin(); opt_it != options.end();
448
QAction* temp = group_unassigned_2d_->addAction(opt_it->toQString());
449
temp->setCheckable(true);
450
if (opt_it == options.begin())
451
temp->setChecked(true);
452
menu->addAction(temp);
454
dm_unassigned_2d_->setMenu(menu);
456
//--2D consensus toolbar--
457
tool_bar_2d_cons_ = addToolBar("2D peak tool bar");
459
dm_elements_2d_ = tool_bar_2d_cons_->addAction(QIcon(":/elements.png"), "Show consensus feature element positions");
460
dm_elements_2d_->setCheckable(true);
461
dm_elements_2d_->setWhatsThis("2D consensus feature draw mode: Elements<BR><BR>The individual elements that make up the consensus feature are drawn.<BR>(Hotkey: 9)");
462
dm_elements_2d_->setShortcut(Qt::Key_9);
463
connect(dm_elements_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
465
//--2D identifications toolbar--
466
tool_bar_2d_ident_ = addToolBar("2D identifications tool bar");
468
dm_ident_2d_ = tool_bar_2d_ident_->addAction(QIcon(":/peptidemz.png"), "Use theoretical peptide mass for m/z positions (default: precursor mass)");
469
dm_ident_2d_->setCheckable(true);
470
dm_ident_2d_->setWhatsThis("2D peptide identification draw mode: m/z source<BR><BR>Toggle between precursor mass (default) and theoretical peptide mass as source for the m/z positions of peptide identifications.<BR>(Hotkey: 5)");
471
dm_ident_2d_->setShortcut(Qt::Key_5);
472
connect(dm_ident_2d_, SIGNAL(toggled(bool)), this, SLOT(changeLayerFlag(bool)));
474
//################## Dock widgets #################
476
layer_dock_widget_ = new QDockWidget("Layers", this);
477
addDockWidget(Qt::RightDockWidgetArea, layer_dock_widget_);
478
layer_manager_ = new QListWidget(layer_dock_widget_);
479
layer_manager_->setWhatsThis("Layer bar<BR><BR>Here the available layers are shown. Left-click on a layer to select it.<BR>Layers can be shown and hidden using the checkboxes in front of the name.<BR> Renaming and removing a layer is possible through the context menu.<BR>Dragging a layer to the tab bar copies the layer.<BR>Double-clicking a layer open its preferences.<BR>You can use the 'PageUp' and 'PageDown' buttons to change the selected layer.");
481
layer_dock_widget_->setWidget(layer_manager_);
482
layer_manager_->setContextMenuPolicy(Qt::CustomContextMenu);
483
layer_manager_->setDragEnabled(true);
484
connect(layer_manager_, SIGNAL(currentRowChanged(int)), this, SLOT(layerSelectionChange(int)));
485
connect(layer_manager_, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(layerContextMenu(const QPoint &)));
486
connect(layer_manager_, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(layerVisibilityChange(QListWidgetItem*)));
487
connect(layer_manager_, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(layerEdit(QListWidgetItem*)));
489
windows->addAction(layer_dock_widget_->toggleViewAction());
492
views_dockwidget_ = new QDockWidget("Views", this);
493
addDockWidget(Qt::RightDockWidgetArea, views_dockwidget_);
494
views_tabwidget_ = new QTabWidget(views_dockwidget_);
495
views_dockwidget_->setWidget(views_tabwidget_);
497
spectra_view_widget_ = new SpectraViewWidget();
498
connect(spectra_view_widget_, SIGNAL(showSpectrumMetaData(int)), this, SLOT(showSpectrumMetaData(int)));
499
connect(spectra_view_widget_, SIGNAL(showSpectrumAs1D(int)), this, SLOT(showSpectrumAs1D(int)));
500
connect(spectra_view_widget_, SIGNAL(showSpectrumAs1D(std::vector<int, std::allocator<int> >)), this, SLOT(showSpectrumAs1D(std::vector<int, std::allocator<int> >)));
501
connect(spectra_view_widget_, SIGNAL(spectrumSelected(int)), this, SLOT(activate1DSpectrum(int)));
502
connect(spectra_view_widget_, SIGNAL(spectrumSelected(std::vector<int, std::allocator<int> >)), this, SLOT(activate1DSpectrum(std::vector<int, std::allocator<int> >)));
503
connect(spectra_view_widget_, SIGNAL(spectrumDoubleClicked(int)), this, SLOT(showSpectrumAs1D(int)));
504
connect(spectra_view_widget_, SIGNAL(spectrumDoubleClicked(std::vector<int, std::allocator<int> >)), this, SLOT(showSpectrumAs1D(std::vector<int, std::allocator<int> >)));
506
spectraview_behavior_ = new TOPPViewSpectraViewBehavior(this);
507
view_behavior_ = spectraview_behavior_;
509
spectra_identification_view_widget_ = new SpectraIdentificationViewWidget(Param());
510
connect(spectra_identification_view_widget_, SIGNAL(spectrumDeselected(int)), this, SLOT(deactivate1DSpectrum(int)));
511
connect(spectra_identification_view_widget_, SIGNAL(showSpectrumAs1D(int)), this, SLOT(showSpectrumAs1D(int)));
512
// connect(spectra_identification_view_widget_, SIGNAL(showSpectrumAs1D(std::vector<int, std::allocator<int> >)), this, SLOT(showSpectrumAs1D(std::vector<int, std::allocator<int> >)));
513
connect(spectra_identification_view_widget_, SIGNAL(spectrumSelected(int)), this, SLOT(activate1DSpectrum(int)));
514
//connect(spectra_identification_view_widget_, SIGNAL(spectrumSelected(std::vector<int, std::allocator<int> >)), this, SLOT(activate1DSpectrum(std::vector<int, std::allocator<int> >)));
515
identificationview_behavior_ = new TOPPViewIdentificationViewBehavior(this);
516
connect(spectra_identification_view_widget_, SIGNAL(requestVisibleArea1D(DoubleReal, DoubleReal)), identificationview_behavior_, SLOT(setVisibleArea1D(DoubleReal, DoubleReal)));
518
views_tabwidget_->addTab(spectra_view_widget_, "Scan view");
519
views_tabwidget_->addTab(spectra_identification_view_widget_, "Identification view");
520
views_tabwidget_->setTabEnabled(0, false);
521
views_tabwidget_->setTabEnabled(1, false);
523
// switch between different view tabs
524
connect(views_tabwidget_, SIGNAL(currentChanged(int)), this, SLOT(viewChanged(int)));
526
// add hide/show option to dock widget
527
windows->addAction(views_dockwidget_->toggleViewAction());
529
// filter dock widget
530
filter_dock_widget_ = new QDockWidget("Data filters", this);
531
addDockWidget(Qt::RightDockWidgetArea, filter_dock_widget_);
532
QWidget* tmp_widget = new QWidget(); //dummy widget as QDockWidget takes only one widget
533
filter_dock_widget_->setWidget(tmp_widget);
535
QVBoxLayout* vbl = new QVBoxLayout(tmp_widget);
537
filters_ = new QListWidget(tmp_widget);
538
filters_->setSelectionMode(QAbstractItemView::NoSelection);
539
filters_->setWhatsThis("Data filter bar<BR><BR>Here filtering options for the current layer can be set.<BR>Through the context menu you can add, remove and edit filters.<BR>For convenience, editing filters is also possible by double-clicking them.");
540
filters_->setContextMenuPolicy(Qt::CustomContextMenu);
541
connect(filters_, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(filterContextMenu(const QPoint &)));
542
connect(filters_, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(filterEdit(QListWidgetItem*)));
543
vbl->addWidget(filters_);
545
filters_check_box_ = new QCheckBox("Enable all filters", tmp_widget);
546
connect(filters_check_box_, SIGNAL(toggled(bool)), this, SLOT(layerFilterVisibilityChange(bool)));
547
vbl->addWidget(filters_check_box_);
549
windows->addAction(filter_dock_widget_->toggleViewAction());
552
QDockWidget* log_bar = new QDockWidget("Log", this);
553
addDockWidget(Qt::BottomDockWidgetArea, log_bar);
554
log_ = new QTextEdit(log_bar);
555
log_->setReadOnly(true);
556
log_->setContextMenuPolicy(Qt::CustomContextMenu);
557
connect(log_, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(logContextMenu(const QPoint &)));
558
log_bar->setWidget(log_);
560
windows->addAction(log_bar->toggleViewAction());
562
//################## DEFAULTS #################
563
initializeDefaultParameters_();
565
// store defaults in param_
572
current_path_ = param_.getValue("preferences:default_path");
579
//######################### File System Watcher ###########################################
580
watcher_ = new FileWatcher(this);
581
connect(watcher_, SIGNAL(fileChanged(const String &)), this, SLOT(fileChanged_(const String &)));
593
584
void TOPPViewBase::initializeDefaultParameters_()
596
587
defaults_.setValue("preferences:default_map_view", "2d", "Default visualization mode for maps.");
597
defaults_.setValidStrings("preferences:default_map_view",StringList::create("2d,3d"));
588
defaults_.setValidStrings("preferences:default_map_view", StringList::create("2d,3d"));
598
589
defaults_.setValue("preferences:default_path", ".", "Default path for loading and storing files.");
599
590
defaults_.setValue("preferences:default_path_current", "true", "If the current path is preferred over the default path.");
600
defaults_.setValidStrings("preferences:default_path_current",StringList::create("true,false"));
591
defaults_.setValidStrings("preferences:default_path_current", StringList::create("true,false"));
601
592
defaults_.setValue("preferences:tmp_file_path", QDir::tempPath(), "Path where temporary files can be created.");
602
593
defaults_.setValue("preferences:number_of_recent_files", 15, "Number of recent files in the main menu.");
603
defaults_.setMinInt("preferences:number_of_recent_files",5);
604
defaults_.setMaxInt("preferences:number_of_recent_files",20);
594
defaults_.setMinInt("preferences:number_of_recent_files", 5);
595
defaults_.setMaxInt("preferences:number_of_recent_files", 20);
605
596
defaults_.setValue("preferences:legend", "show", "Legend visibility");
606
defaults_.setValidStrings("preferences:legend",StringList::create("show,hide"));
607
defaults_.setValue("preferences:intensity_cutoff", "off","Low intensity cutoff for maps.");
608
defaults_.setValidStrings("preferences:intensity_cutoff",StringList::create("on,off"));
609
defaults_.setValue("preferences:on_file_change","ask","What action to take, when a data file changes. Do nothing, update automatically or ask the user.");
610
defaults_.setValidStrings("preferences:on_file_change",StringList::create("none,ask,update automatically"));
597
defaults_.setValidStrings("preferences:legend", StringList::create("show,hide"));
598
defaults_.setValue("preferences:intensity_cutoff", "off", "Low intensity cutoff for maps.");
599
defaults_.setValidStrings("preferences:intensity_cutoff", StringList::create("on,off"));
600
defaults_.setValue("preferences:on_file_change", "ask", "What action to take, when a data file changes. Do nothing, update automatically or ask the user.");
601
defaults_.setValidStrings("preferences:on_file_change", StringList::create("none,ask,update automatically"));
611
602
defaults_.setValue("preferences:topp_cleanup", "true", "If the temporary files for calling of TOPP tools should be removed after the call.");
612
defaults_.setValidStrings("preferences:topp_cleanup",StringList::create("true,false"));
603
defaults_.setValidStrings("preferences:topp_cleanup", StringList::create("true,false"));
614
605
defaults_.setValue("preferences:db:host", "localhost", "Database server host name.");
615
606
defaults_.setValue("preferences:db:login", "NoName", "Database login.");
616
607
defaults_.setValue("preferences:db:name", "OpenMS", "Database name.");
617
608
defaults_.setValue("preferences:db:port", 3306, "Database server port.");
618
defaults_.setSectionDescription("preferences:db","Database settings.");
609
defaults_.setSectionDescription("preferences:db", "Database settings.");
620
Spectrum1DCanvas* def1 = new Spectrum1DCanvas(Param(),0);
621
defaults_.insert("preferences:1d:",def1->getDefaults());
611
Spectrum1DCanvas* def1 = new Spectrum1DCanvas(Param(), 0);
612
defaults_.insert("preferences:1d:", def1->getDefaults());
623
defaults_.setSectionDescription("preferences:1d","Settings for single spectrum view.");
614
defaults_.setSectionDescription("preferences:1d", "Settings for single spectrum view.");
625
Spectrum2DCanvas* def2 = new Spectrum2DCanvas(Param(),0);
626
defaults_.insert("preferences:2d:",def2->getDefaults());
627
defaults_.setSectionDescription("preferences:2d","Settings for 2D map view.");
616
Spectrum2DCanvas* def2 = new Spectrum2DCanvas(Param(), 0);
617
defaults_.insert("preferences:2d:", def2->getDefaults());
618
defaults_.setSectionDescription("preferences:2d", "Settings for 2D map view.");
630
Spectrum3DCanvas* def3 = new Spectrum3DCanvas(Param(),0);
631
defaults_.insert("preferences:3d:",def3->getDefaults());
621
Spectrum3DCanvas* def3 = new Spectrum3DCanvas(Param(), 0);
622
defaults_.insert("preferences:3d:", def3->getDefaults());
633
defaults_.setSectionDescription("preferences:3d","Settings for 3D map view.");
624
defaults_.setSectionDescription("preferences:3d", "Settings for 3D map view.");
634
625
// identification view
635
SpectraIdentificationViewWidget* def4 = new SpectraIdentificationViewWidget(Param(),0);
636
defaults_.insert("preferences:idview:",def4->getDefaults());
626
SpectraIdentificationViewWidget* def4 = new SpectraIdentificationViewWidget(Param(), 0);
627
defaults_.insert("preferences:idview:", def4->getDefaults());
638
defaults_.setSectionDescription("preferences:idview","Settings for identification view.");
639
defaults_.setValue("preferences:version","none","OpenMS version, used to check if the TOPPView.ini is up-to-date");
629
defaults_.setSectionDescription("preferences:idview", "Settings for identification view.");
630
defaults_.setValue("preferences:version", "none", "OpenMS version, used to check if the TOPPView.ini is up-to-date");
640
631
subsections_.push_back("preferences:RecentFiles");
1999
2061
layer_manager_->blockSignals(false);
2002
void TOPPViewBase::layerSelectionChange(int i)
2006
getActiveCanvas()->activateLayer(i);
2064
void TOPPViewBase::layerSelectionChange(int i)
2066
// after adding a layer i is -1. TODO: check if this is the correct behaviour
2069
getActiveCanvas()->activateLayer(i); // also triggers update of viewBar
2012
void TOPPViewBase::layerContextMenu(const QPoint & pos)
2014
QListWidgetItem* item = layer_manager_->itemAt(pos);
2017
QAction* new_action = 0;
2018
int layer = layer_manager_->row(item);
2019
QMenu* context_menu = new QMenu(layer_manager_);
2020
context_menu->addAction("Rename");
2021
context_menu->addAction("Delete");
2074
void TOPPViewBase::layerContextMenu(const QPoint& pos)
2076
QListWidgetItem* item = layer_manager_->itemAt(pos);
2079
QAction* new_action = 0;
2080
int layer = layer_manager_->row(item);
2081
QMenu* context_menu = new QMenu(layer_manager_);
2082
context_menu->addAction("Rename");
2083
context_menu->addAction("Delete");
2023
2085
if (getActiveCanvas()->getLayer(layer).flipped)
2025
new_action = context_menu->addAction("Flip upwards (1D)");
2029
new_action = context_menu->addAction("Flip downwards (1D)");
2087
new_action = context_menu->addAction("Flip upwards (1D)");
2091
new_action = context_menu->addAction("Flip downwards (1D)");
2031
2093
if (!getActive1DWidget())
2033
new_action->setEnabled(false);
2036
context_menu->addSeparator();
2037
context_menu->addAction("Preferences");
2039
QAction* selected = context_menu->exec(layer_manager_->mapToGlobal(pos));
2041
if (selected!=0 && selected->text()=="Delete")
2095
new_action->setEnabled(false);
2098
context_menu->addSeparator();
2099
context_menu->addAction("Preferences");
2101
QAction* selected = context_menu->exec(layer_manager_->mapToGlobal(pos));
2103
if (selected != 0 && selected->text() == "Delete")
2043
2105
getActiveCanvas()->removeLayer(layer);
2046
else if (selected!=0 && selected->text()=="Rename")
2048
QString name = QInputDialog::getText(this,"Rename layer","Name:");
2108
else if (selected != 0 && selected->text() == "Rename")
2110
QString name = QInputDialog::getText(this, "Rename layer", "Name:");
2051
2113
getActiveCanvas()->setLayerName(layer, name);
2054
// flip layer up/downwards
2055
else if (selected != 0 && selected->text() == "Flip downwards (1D)")
2116
// flip layer up/downwards
2117
else if (selected != 0 && selected->text() == "Flip downwards (1D)")
2057
2119
getActive1DWidget()->canvas()->flipLayer(layer);
2058
2120
getActive1DWidget()->canvas()->setMirrorModeActive(true);
2060
else if (selected != 0 && selected->text() == "Flip upwards (1D)")
2122
else if (selected != 0 && selected->text() == "Flip upwards (1D)")
2062
2124
getActive1DWidget()->canvas()->flipLayer(layer);
2063
2125
bool b = getActive1DWidget()->canvas()->flippedLayersExist();
2064
2126
getActive1DWidget()->canvas()->setMirrorModeActive(b);
2066
else if (selected != 0 && selected->text() == "Preferences")
2128
else if (selected != 0 && selected->text() == "Preferences")
2068
2130
getActiveCanvas()->showCurrentLayerPreferences();
2071
//Update tab bar and window title
2072
if (getActiveCanvas()->getLayerCount()!=0)
2133
//Update tab bar and window title
2134
if (getActiveCanvas()->getLayerCount() != 0)
2074
2136
tab_bar_->setTabText(tab_bar_->currentIndex(), getActiveCanvas()->getLayer(0).name.toQString());
2075
2137
getActiveSpectrumWidget()->setWindowTitle(getActiveCanvas()->getLayer(0).name.toQString());
2079
tab_bar_->setTabText(tab_bar_->currentIndex(),"empty");
2141
tab_bar_->setTabText(tab_bar_->currentIndex(), "empty");
2080
2142
getActiveSpectrumWidget()->setWindowTitle("empty");
2083
//Update filter bar, spectrum bar and layer bar
2145
//Update filter bar, spectrum bar and layer bar
2085
2147
updateViewBar();
2089
delete (context_menu);
2093
void TOPPViewBase::logContextMenu(const QPoint & pos)
2095
QMenu* context_menu = new QMenu(log_);
2096
context_menu->addAction("Clear");
2098
QAction* selected = context_menu->exec(log_->mapToGlobal(pos));
2101
if (selected != 0 && selected->text()== "Clear")
2105
delete (context_menu);
2108
void TOPPViewBase::filterContextMenu(const QPoint & pos)
2110
//do nothing if no window is open
2111
if (getActiveCanvas()==0) return;
2151
delete (context_menu);
2155
void TOPPViewBase::logContextMenu(const QPoint& pos)
2157
QMenu* context_menu = new QMenu(log_);
2158
context_menu->addAction("Clear");
2160
QAction* selected = context_menu->exec(log_->mapToGlobal(pos));
2163
if (selected != 0 && selected->text() == "Clear")
2167
delete (context_menu);
2170
void TOPPViewBase::filterContextMenu(const QPoint& pos)
2172
//do nothing if no window is open
2173
if (getActiveCanvas() == 0)
2113
2176
//do nothing if no layer is loaded into the canvas
2114
if (getActiveCanvas()->getLayerCount() == 0) return;
2116
QMenu* context_menu = new QMenu(filters_);
2118
//warn if the current layer is not visible
2177
if (getActiveCanvas()->getLayerCount() == 0)
2180
QMenu* context_menu = new QMenu(filters_);
2182
//warn if the current layer is not visible
2119
2183
String layer_name = String("Layer: ") + getActiveCanvas()->getCurrentLayer().name;
2120
2184
if (!getActiveCanvas()->getCurrentLayer().visible)
2122
layer_name += " (invisible)";
2124
context_menu->addAction(layer_name.toQString())->setEnabled(false);
2125
context_menu->addSeparator();
2186
layer_name += " (invisible)";
2188
context_menu->addAction(layer_name.toQString())->setEnabled(false);
2189
context_menu->addSeparator();
2128
QListWidgetItem* item = filters_->itemAt(pos);
2131
context_menu->addAction("Edit");
2132
context_menu->addAction("Delete");
2136
context_menu->addAction("Add filter");
2139
QAction* selected = context_menu->exec(filters_->mapToGlobal(pos));
2142
if(selected->text()=="Delete")
2192
QListWidgetItem* item = filters_->itemAt(pos);
2195
context_menu->addAction("Edit");
2196
context_menu->addAction("Delete");
2200
context_menu->addAction("Add filter");
2203
QAction* selected = context_menu->exec(filters_->mapToGlobal(pos));
2206
if (selected->text() == "Delete")
2144
2208
DataFilters filters = getActiveCanvas()->getCurrentLayer().filters;
2145
filters.remove(filters_->row(item));
2209
filters.remove(filters_->row(item));
2146
2210
getActiveCanvas()->setFilters(filters);
2149
else if (selected->text()=="Edit")
2153
else if (selected->text()=="Add filter")
2213
else if (selected->text() == "Edit")
2217
else if (selected->text() == "Add filter")
2155
2219
DataFilters filters = getActiveCanvas()->getCurrentLayer().filters;
2156
DataFilters::DataFilter filter;
2157
DataFilterDialog dlg(filter, this);
2160
filters.add(filter);
2220
DataFilters::DataFilter filter;
2221
DataFilterDialog dlg(filter, this);
2224
filters.add(filter);
2161
2225
getActiveCanvas()->setFilters(filters);
2166
delete (context_menu);
2230
delete (context_menu);
2169
void TOPPViewBase::filterEdit(QListWidgetItem* item)
2233
void TOPPViewBase::filterEdit(QListWidgetItem* item)
2171
2235
DataFilters filters = getActiveCanvas()->getCurrentLayer().filters;
2172
DataFilters::DataFilter filter = filters[filters_->row(item)];
2173
DataFilterDialog dlg(filter, this);
2176
filters.replace(filters_->row(item),filter);
2236
DataFilters::DataFilter filter = filters[filters_->row(item)];
2237
DataFilterDialog dlg(filter, this);
2240
filters.replace(filters_->row(item), filter);
2177
2241
getActiveCanvas()->setFilters(filters);
2182
void TOPPViewBase::layerEdit(QListWidgetItem* /*item*/)
2246
void TOPPViewBase::layerEdit(QListWidgetItem* /*item*/)
2184
2248
getActiveCanvas()->showCurrentLayerPreferences();
2187
2251
void TOPPViewBase::updateFilterBar()
2192
2256
SpectrumCanvas* canvas = getActiveCanvas();
2193
if (canvas==0) return;
2194
if (canvas->getLayerCount()==0) return;
2260
if (canvas->getLayerCount() == 0)
2196
2263
const DataFilters& filters = getActiveCanvas()->getCurrentLayer().filters;
2197
for (Size i=0; i<filters.size(); ++i)
2199
QListWidgetItem* item = new QListWidgetItem(filters_);
2200
item->setText(filters[i].toString().toQString());
2264
for (Size i = 0; i < filters.size(); ++i)
2266
QListWidgetItem* item = new QListWidgetItem(filters_);
2267
item->setText(filters[i].toString().toQString());
2204
2271
filters_check_box_->setChecked(getActiveCanvas()->getCurrentLayer().filters.isActive());
2207
void TOPPViewBase::layerFilterVisibilityChange(bool on)
2274
void TOPPViewBase::layerFilterVisibilityChange(bool on)
2209
2276
if (getActiveCanvas())
2211
getActiveCanvas()->changeLayerFilterState(getActiveCanvas()->activeLayerIndex(),on);
2278
getActiveCanvas()->changeLayerFilterState(getActiveCanvas()->activeLayerIndex(), on);
2215
void TOPPViewBase::layerVisibilityChange(QListWidgetItem* item)
2219
layer = layer_manager_->row(item);
2282
void TOPPViewBase::layerVisibilityChange(QListWidgetItem* item)
2286
layer = layer_manager_->row(item);
2220
2287
visible = getActiveCanvas()->getLayer(layer).visible;
2222
if (item->checkState()==Qt::Unchecked && visible)
2289
if (item->checkState() == Qt::Unchecked && visible)
2224
2291
getActiveCanvas()->changeVisibility(layer, false);
2226
else if (item->checkState()==Qt::Checked && !visible)
2293
else if (item->checkState() == Qt::Checked && !visible)
2228
2295
getActiveCanvas()->changeVisibility(layer, true);
2232
2299
void TOPPViewBase::updateTabBar(QWidget* w)
2236
2303
EnhancedTabBarWidgetInterface* tbw = dynamic_cast<EnhancedTabBarWidgetInterface*>(w);
2237
2304
Int window_id = tbw->getWindowId();
2238
tab_bar_->setCurrentId(window_id);
2305
tab_bar_->setCurrentId(window_id);
2242
2309
void TOPPViewBase::tileVertical()
2244
2311
// primitive horizontal tiling
2245
2312
QWidgetList windows = ws_->windowList();
2246
if ( !windows.count() ) return;
2313
if (!windows.count())
2248
if (getActive1DWidget()) getActive1DWidget()->showNormal();
2249
if (getActive2DWidget()) getActive2DWidget()->showNormal();
2316
if (getActive1DWidget())
2317
getActive1DWidget()->showNormal();
2318
if (getActive2DWidget())
2319
getActive2DWidget()->showNormal();
2251
2321
int heightForEach = ws_->height() / windows.count();
2253
for ( int i = 0; i < int(windows.count()); ++i )
2323
for (int i = 0; i < int(windows.count()); ++i)
2255
QWidget *window = windows.at(i);
2256
if ( window->isMaximized() || window->isFullScreen() )
2325
QWidget* window = windows.at(i);
2326
if (window->isMaximized() || window->isFullScreen())
2258
2328
// prevent flicker
2259
2329
window->hide();
2260
2330
window->setWindowState(Qt::WindowNoState);
2261
2331
window->show();
2263
int preferredHeight = window->minimumHeight()+window->parentWidget()->baseSize().height();
2333
int preferredHeight = window->minimumHeight() + window->parentWidget()->baseSize().height();
2264
2334
int actHeight = std::max(heightForEach, preferredHeight);
2266
window->parentWidget()->setGeometry( 0, y, ws_->width(), actHeight );
2336
window->parentWidget()->setGeometry(0, y, ws_->width(), actHeight);
2267
2337
y += actHeight;
2562
2779
void TOPPViewBase::openRecentFile()
2564
QAction* action = qobject_cast<QAction *>(sender());
2781
QAction* action = qobject_cast<QAction*>(sender());
2567
2784
QString filename = action->text();
2568
if (filename.endsWith(".toppas", Qt::CaseInsensitive))
2570
addTOPPASFile(filename, true);
2574
addDataFile(filename, true, true);
2785
addDataFile(filename, true, true);
2579
2789
QStringList TOPPViewBase::getFileList_(const String& path_overwrite)
2581
String filter_all = "readable files (*.mzML *.mzXML *.mzData *.featureXML *.consensusXML *.idXML *.dta *.dta2d fid *.bz2 *.gz *.toppas);;";
2582
String filter_single = "mzML files (*.mzML);;mzXML files (*.mzXML);;mzData files (*.mzData);;feature map (*.featureXML);;consensus feature map (*.consensusXML);;peptide identifications (*.idXML);;XML files (*.xml);;XMass Analysis (fid);;dta files (*.dta);;dta2d files (*.dta2d);;bzipped files (*.bz2);;gzipped files (*.gz);;TOPPAS files (*.toppas);;all files (*)";
2791
String filter_all = "readable files (*.mzML *.mzXML *.mzData *.featureXML *.consensusXML *.idXML *.dta *.dta2d fid *.bz2 *.gz);;";
2792
String filter_single = "mzML files (*.mzML);;mzXML files (*.mzXML);;mzData files (*.mzData);;feature map (*.featureXML);;consensus feature map (*.consensusXML);;peptide identifications (*.idXML);;XML files (*.xml);;XMass Analysis (fid);;dta files (*.dta);;dta2d files (*.dta2d);;bzipped files (*.bz2);;gzipped files (*.gz);;all files (*)";
2584
QString open_path = current_path_.toQString();
2585
if (path_overwrite!="")
2794
QString open_path = current_path_.toQString();
2795
if (path_overwrite != "")
2587
2797
open_path = path_overwrite.toQString();
2589
2799
// we use the QT file dialog instead of using QFileDialog::Names(...)
2590
// On Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog,
2591
// which prevents us from doing GUI testing on it.
2800
// On Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog,
2801
// which prevents us from doing GUI testing on it.
2592
2802
QFileDialog dialog(this, "Open file(s)", open_path, (filter_all + filter_single).toQString());
2593
dialog.setFileMode(QFileDialog::ExistingFiles);
2594
QStringList file_names;
2803
dialog.setFileMode(QFileDialog::ExistingFiles);
2804
QStringList file_names;
2596
2806
if (dialog.exec())
2598
2808
file_names = dialog.selectedFiles();
2604
2814
void TOPPViewBase::openFileDialog()
2606
QStringList files = getFileList_();
2607
for(QStringList::iterator it = files.begin(); it!=files.end(); ++it)
2816
QStringList files = getFileList_();
2817
for (QStringList::iterator it = files.begin(); it != files.end(); ++it)
2609
2819
QString filename = *it;
2610
if (filename.endsWith(".toppas", Qt::CaseInsensitive))
2612
addTOPPASFile(filename, true);
2616
addDataFile(filename, true, true);
2621
void TOPPViewBase::addTOPPASFile(const String& file_name, bool in_new_window)
2623
TOPPASScene* scene = 0;
2624
if (in_new_window) // open in new window
2626
// create TOPPASWidget, load data and open in new window
2627
TOPPASWidget* tw = new TOPPASWidget(Param(), ws_, toppas_tmp_path_);
2628
showTOPPipelineInWindow_(tw, File::basename(file_name));
2629
scene = tw->getScene();
2630
scene->load(file_name);
2631
addRecentFile_(file_name);
2633
else // merge into existing scene
2635
TOPPASWidget* tw = getActiveTOPPASWidget();
2640
// create TOPPASWidget, load data into temporary scene and include into existing one
2641
TOPPASScene* tmp_scene = new TOPPASScene(0, File::getTempDirectory().toQString()+QDir::separator(), false);
2642
tmp_scene->load(file_name);
2643
scene = tw->getScene();
2644
scene->include(tmp_scene);
2650
// connect scene signals only if we created a new window (otherwise they already exist)
2651
connect(scene, SIGNAL(saveMe()), this, SLOT(savePipeline()));
2652
connect(scene, SIGNAL(selectionCopied(TOPPASScene*)), this, SLOT(saveToClipboard(TOPPASScene*)));
2653
connect(scene, SIGNAL(requestClipboardContent()), this, SLOT(sendClipboardContent()));
2654
connect(scene, SIGNAL(mainWindowNeedsUpdate()), this, SLOT(updateMenu()));
2655
connect(scene, SIGNAL(openInTOPPView(QStringList)), this, SLOT(openFilesInTOPPView(QStringList)));
2658
//connect vertex signals/slots for log messages
2659
for (TOPPASScene::VertexIterator it = scene->verticesBegin(); it != scene->verticesEnd(); ++it)
2661
TOPPASToolVertex* tv = qobject_cast<TOPPASToolVertex*>(*it);
2664
connect(tv, SIGNAL(toolStarted()), this, SLOT(toolStarted()));
2665
connect(tv, SIGNAL(toolFinished()), this, SLOT(toolFinished()));
2666
connect(tv, SIGNAL(toolCrashed()), this, SLOT(toolCrashed()));
2667
connect(tv, SIGNAL(toolFailed()), this, SLOT(toolFailed()));
2668
connect(tv, SIGNAL(toppOutputReady(const QString&)), this, SLOT(updateTOPPOutputLog(const QString&)));
2671
TOPPASOutputFileListVertex* oflv = qobject_cast<TOPPASOutputFileListVertex*>(*it);
2674
connect (oflv, SIGNAL(outputFileWritten(const String&)), this, SLOT(outputVertexFinished(const String&)));
2680
void TOPPViewBase::showTOPPipelineInWindow_(TOPPASWidget* tw, const String& caption)
2684
connect(tw,SIGNAL(sendStatusMessage(std::string,OpenMS::UInt)),this,SLOT(showStatusMessage(std::string,OpenMS::UInt)));
2685
connect(tw,SIGNAL(sendCursorStatus(double,double)),this,SLOT(showCursorStatus(double,double)));
2686
connect(tw,SIGNAL(toolDroppedOnWidget(double,double)),this,SLOT(insertNewVertex_(double,double)));
2687
connect(tw,SIGNAL(pipelineDroppedOnWidget(const String&, bool)),this,SLOT(addTOPPASFile(const String&, bool)));
2689
tw->setWindowTitle(caption.toQString());
2692
static int window_counter = 1337;
2693
tw->setWindowId(window_counter);
2696
//connect slots and signals for removing the widget from the bar, when it is closed
2697
//- through the menu entry
2698
//- through the tab bar
2699
//- through the MDI close button
2700
connect(tw, SIGNAL(aboutToBeDestroyed(int)),tab_bar_,SLOT(removeId(int)));
2702
//show first window maximized (only visible windows are in the list)
2703
if (ws_->windowList().count()==0)
2705
tw->showMaximized();
2711
TOPPASScene* ts = tw->getScene();
2713
connect (ts, SIGNAL(entirePipelineFinished()), this, SLOT(showPipelineFinishedLogMessage()));
2714
connect (ts, SIGNAL(entirePipelineFinished()), this, SLOT(updateMenu()));
2715
connect (ts, SIGNAL(pipelineExecutionFailed()), this, SLOT(updateMenu()));
2717
ts->setSceneRect((tw->mapToScene(tw->rect())).boundingRect());
2719
tab_bar_->addTab(caption.toQString(), tw->getWindowId());
2720
tab_bar_->setCurrentId(tw->getWindowId());
2721
enhancedWorkspaceWindowChanged(tw->getWindowId());
2724
void TOPPViewBase::insertNewVertex_(double x, double y, QTreeWidgetItem* item)
2726
// get toppas tree view from tab widget 2
2727
TOPPASTreeView* toppas_tree_view = qobject_cast<TOPPASTreeView*>(views_tabwidget_->widget(2));
2729
if (!getActiveTOPPASWidget() || !getActiveTOPPASWidget()->getScene() || !toppas_tree_view)
2734
TOPPASScene* scene = getActiveTOPPASWidget()->getScene();
2735
QTreeWidgetItem* current_tool = item ? item : toppas_tree_view->currentItem();
2736
String tool_name = String(current_tool->text(0));
2737
TOPPASVertex* tv = 0;
2739
if (tool_name == "<Input files>")
2741
tv = new TOPPASInputFileListVertex();
2743
else if (tool_name == "<Output files>")
2745
tv = new TOPPASOutputFileListVertex();
2746
TOPPASOutputFileListVertex* oflv = qobject_cast<TOPPASOutputFileListVertex*>(tv);
2747
connect (oflv, SIGNAL(outputFileWritten(const String&)), this, SLOT(outputVertexFinished(const String&)));
2748
scene->connectOutputVertexSignals(oflv);
2750
else if (tool_name == "<Merger>")
2752
tv = new TOPPASMergerVertex(true);
2754
else if (tool_name == "<Collector>")
2756
tv = new TOPPASMergerVertex(false);
2758
else // node is a TOPP tool
2760
if (current_tool->childCount() > 0)
2762
// category or tool name with types is selected (instead of a concrete type)
2766
if (current_tool->parent() != 0 && current_tool->parent()->parent() != 0)
2768
// selected item is a type
2769
tool_type = String(current_tool->text(0));
2770
tool_name = String(current_tool->parent()->text(0));
2774
// normal tool which does not have type selected
2775
tool_name = String(current_tool->text(0));
2779
tv = new TOPPASToolVertex(tool_name, tool_type);
2780
TOPPASToolVertex* ttv = qobject_cast<TOPPASToolVertex*>(tv);
2781
connect (ttv, SIGNAL(toolStarted()), this, SLOT(toolStarted()));
2782
connect (ttv, SIGNAL(toolFinished()), this, SLOT(toolFinished()));
2783
connect (ttv, SIGNAL(toolCrashed()), this, SLOT(toolCrashed()));
2784
connect (ttv, SIGNAL(toolFailed()), this, SLOT(toolFailed()));
2785
connect (ttv, SIGNAL(toppOutputReady(const QString&)), this, SLOT(updateTOPPOutputLog(const QString&)));
2787
scene->connectToolVertexSignals(ttv);
2790
scene->connectVertexSignals(tv);
2791
scene->addVertex(tv);
2793
tv->setZValue(toppas_z_value_);
2794
toppas_z_value_ += 0.000001;
2796
scene->setChanged(true);
2799
void TOPPViewBase::insertNewVertexInCenter_(QTreeWidgetItem* item)
2801
TOPPASTreeView* toppas_tree_view = qobject_cast<TOPPASTreeView*>(views_tabwidget_->widget(2));
2803
if (!getActiveTOPPASWidget() || !getActiveTOPPASWidget()->getScene() || !toppas_tree_view || !toppas_tree_view->currentItem())
2808
QPointF insert_pos = getActiveTOPPASWidget()->mapToScene(QPoint((getActiveTOPPASWidget()->width()/2.0)+(qreal)(5*toppas_node_offset_),(getActiveTOPPASWidget()->height()/2.0)+(qreal)(5*toppas_node_offset_)));
2809
insertNewVertex_(insert_pos.x(), insert_pos.y(), item);
2810
toppas_node_offset_ = (toppas_node_offset_+1) % 10;
2820
addDataFile(filename, true, true);
2813
2824
void TOPPViewBase::openExampleDialog()
2815
QStringList files = getFileList_(File::getOpenMSDataPath() + "/examples/");
2826
QStringList files = getFileList_(File::getOpenMSDataPath() + "/examples/");
2817
for(QStringList::iterator it = files.begin(); it != files.end(); ++it)
2828
for (QStringList::iterator it = files.begin(); it != files.end(); ++it)
2819
2830
QString filename = *it;
2820
if (filename.endsWith(".toppas", Qt::CaseInsensitive))
2822
addTOPPASFile(filename, true);
2826
addDataFile(filename, true, true);
2831
void TOPPViewBase::connectToDB_(DBConnection& db)
2833
//get the password if unset
2834
if (!param_.exists("DBPassword"))
2837
ss << "Enter password for user '" << (String)param_.getValue("preferences:db:login") << "' at '"<< (String)param_.getValue("preferences:db:host")<<":"<<(String)param_.getValue("preferences:db:port")<<"' : ";
2839
QString text = QInputDialog::getText(this, "TOPPView database password", ss.str().c_str(), QLineEdit::Password,QString::null, &ok);
2842
param_.setValue("DBPassword",text);
2846
if (param_.exists("DBPassword"))
2850
db.connect((String)param_.getValue("preferences:db:name"), (String)param_.getValue("preferences:db:login"),(String)param_.getValue("DBPassword"),(String)param_.getValue("preferences:db:host"),(UInt)param_.getValue("preferences:db:port"));
2852
catch (DBConnection::InvalidQuery& er)
2854
param_.remove("DBPassword");
2855
showLogMessage_(LS_ERROR,"Unable to log in to the database server",String("Check the login data in the preferences!\nDatabase error message: ") + er.what());
2831
addDataFile(filename, true, true);
2835
void TOPPViewBase::connectToDB_(DBConnection& db)
2837
//get the password if unset
2838
if (!param_.exists("DBPassword"))
2841
ss << "Enter password for user '" << (String)param_.getValue("preferences:db:login") << "' at '" << (String)param_.getValue("preferences:db:host") << ":" << (String)param_.getValue("preferences:db:port") << "' : ";
2843
QString text = QInputDialog::getText(this, "TOPPView database password", ss.str().c_str(), QLineEdit::Password, QString::null, &ok);
2846
param_.setValue("DBPassword", text);
2850
if (param_.exists("DBPassword"))
2854
db.connect((String)param_.getValue("preferences:db:name"), (String)param_.getValue("preferences:db:login"), (String)param_.getValue("DBPassword"), (String)param_.getValue("preferences:db:host"), (UInt)param_.getValue("preferences:db:port"));
2856
catch (DBConnection::InvalidQuery& er)
2858
param_.remove("DBPassword");
2859
showLogMessage_(LS_ERROR, "Unable to log in to the database server", String("Check the login data in the preferences!\nDatabase error message: ") + er.what());
2860
2864
void TOPPViewBase::openDatabaseDialog()
2864
if (db.isConnected())
2866
vector<UInt> result;
2867
DBOpenDialog db_dialog(db,result,this);
2868
if (db_dialog.exec())
2871
for (vector<UInt>::iterator it = result.begin();it!=result.end();++it)
2868
if (db.isConnected())
2870
vector<UInt> result;
2871
DBOpenDialog db_dialog(db, result, this);
2872
if (db_dialog.exec())
2875
for (vector<UInt>::iterator it = result.begin(); it != result.end(); ++it)
2873
2877
addDataDB(*it, true);
2879
void TOPPViewBase::rerunTOPPTool()
2881
//warn if hidden layer => wrong layer selected...
2882
const LayerData& layer = getActiveCanvas()->getCurrentLayer();
2885
showLogMessage_(LS_NOTICE,"The current layer is not visible","Have you selected the right layer for this action?");
2888
//delete old input and output file
2889
File::remove(topp_.file_name + "_in");
2890
File::remove(topp_.file_name + "_out");
2896
void TOPPViewBase::showTOPPDialog()
2898
QAction* action = qobject_cast<QAction*>(sender());
2899
showTOPPDialog_(action->data().toBool());
2902
void TOPPViewBase::showTOPPDialog_(bool visible)
2904
//warn if hidden layer => wrong layer selected...
2905
const LayerData& layer = getActiveCanvas()->getCurrentLayer();
2908
showLogMessage_(LS_NOTICE,"The current layer is not visible","Have you selected the right layer for this action?");
2911
//create and store unique file name prefix for files
2912
topp_.file_name = param_.getValue("preferences:tmp_file_path").toString() + "/TOPPView_" + File::getUniqueName();
2913
if (!File::writable(topp_.file_name+"_ini"))
2915
showLogMessage_(LS_ERROR,"Cannot create temporary file",String("Cannot write to '")+topp_.file_name+"'_ini!");
2918
ToolsDialog tools_dialog(this,topp_.file_name+"_ini",current_path_,getCurrentLayer()->type);
2920
if(tools_dialog.exec()==QDialog::Accepted)
2922
//Store tool name, input parameter and output parameter
2923
topp_.tool = tools_dialog.getTool();
2924
topp_.in = tools_dialog.getInput();
2925
topp_.out = tools_dialog.getOutput();
2926
topp_.visible = visible;
2932
void TOPPViewBase::runTOPPTool_()
2934
const LayerData& layer = getActiveCanvas()->getCurrentLayer();
2936
//test if files are writable
2937
if (!File::writable(topp_.file_name+"_in"))
2939
showLogMessage_(LS_ERROR,"Cannot create temporary file",String("Cannot write to '")+topp_.file_name+"_in'!");
2942
if (!File::writable(topp_.file_name+"_out"))
2944
showLogMessage_(LS_ERROR,"Cannot create temporary file",String("Cannot write to '")+topp_.file_name+"'_out!");
2949
topp_.layer_name = layer.name;
2883
void TOPPViewBase::rerunTOPPTool()
2885
//warn if hidden layer => wrong layer selected...
2886
const LayerData& layer = getActiveCanvas()->getCurrentLayer();
2889
showLogMessage_(LS_NOTICE, "The current layer is not visible", "Have you selected the right layer for this action?");
2892
//delete old input and output file
2893
File::remove(topp_.file_name + "_in");
2894
File::remove(topp_.file_name + "_out");
2900
void TOPPViewBase::showTOPPDialog()
2902
QAction* action = qobject_cast<QAction*>(sender());
2903
showTOPPDialog_(action->data().toBool());
2906
void TOPPViewBase::showTOPPDialog_(bool visible)
2908
//warn if hidden layer => wrong layer selected...
2909
const LayerData& layer = getActiveCanvas()->getCurrentLayer();
2912
showLogMessage_(LS_NOTICE, "The current layer is not visible", "Have you selected the right layer for this action?");
2915
//create and store unique file name prefix for files
2916
topp_.file_name = param_.getValue("preferences:tmp_file_path").toString() + "/TOPPView_" + File::getUniqueName();
2917
if (!File::writable(topp_.file_name + "_ini"))
2919
showLogMessage_(LS_ERROR, "Cannot create temporary file", String("Cannot write to '") + topp_.file_name + "'_ini!");
2922
ToolsDialog tools_dialog(this, topp_.file_name + "_ini", current_path_, getCurrentLayer()->type);
2924
if (tools_dialog.exec() == QDialog::Accepted)
2926
//Store tool name, input parameter and output parameter
2927
topp_.tool = tools_dialog.getTool();
2928
topp_.in = tools_dialog.getInput();
2929
topp_.out = tools_dialog.getOutput();
2930
topp_.visible = visible;
2936
void TOPPViewBase::runTOPPTool_()
2938
const LayerData& layer = getActiveCanvas()->getCurrentLayer();
2940
//test if files are writable
2941
if (!File::writable(topp_.file_name + "_in"))
2943
showLogMessage_(LS_ERROR, "Cannot create temporary file", String("Cannot write to '") + topp_.file_name + "_in'!");
2946
if (!File::writable(topp_.file_name + "_out"))
2948
showLogMessage_(LS_ERROR, "Cannot create temporary file", String("Cannot write to '") + topp_.file_name + "'_out!");
2953
topp_.layer_name = layer.name;
2950
2954
topp_.window_id = getActiveSpectrumWidget()->getWindowId();
2951
2955
topp_.spectrum_id = layer.getCurrentSpectrumIndex();
2952
if (layer.type==LayerData::DT_PEAK)
2955
f.setLogType(ProgressLogger::GUI);
2959
getActiveCanvas()->getVisiblePeakData(exp);
2960
f.store(topp_.file_name+"_in",exp);
2964
f.store(topp_.file_name+"_in",*layer.getPeakData());
2967
else if (layer.type==LayerData::DT_FEATURE)
2956
if (layer.type == LayerData::DT_PEAK && !(layer.chromatogram_flag_set()))
2959
f.setLogType(ProgressLogger::GUI);
2963
getActiveCanvas()->getVisiblePeakData(exp);
2964
f.store(topp_.file_name + "_in", exp);
2969
f.store(topp_.file_name + "_in", *layer.getPeakData());
2972
else if (layer.type == LayerData::DT_CHROMATOGRAM || layer.chromatogram_flag_set())
2975
// This means we have chromatogram data, either as DT_CHROMATOGRAM or as
2976
// DT_PEAK with the chromatogram flag set. To run the TOPPTool we need to
2977
// remove the flag and add the newly generated layer as spectrum data
2978
// (otherwise we run into problems with SpectraViewWidget::updateEntries
2979
// which assumes that all chromatogram data has chromatograms).
2980
getActiveCanvas()->getCurrentLayer().remove_chromatogram_flag(); // removing the flag is not constant
2981
//getActiveCanvas()->getCurrentLayer().getPeakData()->setMetaValue("chromatogram_passed_through_TOPP", "true");
2983
f.setLogType(ProgressLogger::GUI);
2987
getActiveCanvas()->getVisiblePeakData(exp);
2988
f.store(topp_.file_name + "_in", exp);
2992
f.store(topp_.file_name + "_in", *layer.getPeakData());
2995
else if (layer.type == LayerData::DT_FEATURE)
2972
3000
getActiveCanvas()->getVisibleFeatureData(map);
2973
FeatureXMLFile().store(topp_.file_name+"_in",map);
2977
FeatureXMLFile().store(topp_.file_name+"_in",*layer.getFeatureMap());
2984
ConsensusMapType map;
3001
FeatureXMLFile().store(topp_.file_name + "_in", map);
3005
FeatureXMLFile().store(topp_.file_name + "_in", *layer.getFeatureMap());
3012
ConsensusMapType map;
2985
3013
getActiveCanvas()->getVisibleConsensusData(map);
2986
ConsensusXMLFile().store(topp_.file_name+"_in",map);
2990
ConsensusXMLFile().store(topp_.file_name+"_in",*layer.getConsensusMap());
2994
//compose argument list
2997
<< (topp_.file_name + "_ini").toQString()
2998
<< QString("-%1").arg(topp_.in.toQString())
2999
<< (topp_.file_name + "_in").toQString()
3003
args << QString("-%1").arg(topp_.out.toQString())
3004
<< (topp_.file_name+"_out").toQString();
3007
//start log and show it
3008
showLogMessage_(LS_NOTICE,"Starting TOPP tool","");// tool + args.join(" "));
3011
topp_.process = new QProcess();
3012
topp_.process->setProcessChannelMode(QProcess::MergedChannels);
3013
connect(topp_.process,SIGNAL(readyReadStandardOutput()),this,SLOT(updateProcessLog()));
3014
topp_.process->start(topp_.tool.toQString(),args);
3016
//connect the finished slot
3017
connect(topp_.process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(finishTOPPToolExecution(int,QProcess::ExitStatus)));
3020
topp_.process->waitForStarted();
3014
ConsensusXMLFile().store(topp_.file_name + "_in", map);
3018
ConsensusXMLFile().store(topp_.file_name + "_in", *layer.getConsensusMap());
3022
// compose argument list
3025
<< (topp_.file_name + "_ini").toQString()
3026
<< QString("-%1").arg(topp_.in.toQString())
3027
<< (topp_.file_name + "_in").toQString()
3029
if (topp_.out != "")
3031
args << QString("-%1").arg(topp_.out.toQString())
3032
<< (topp_.file_name + "_out").toQString();
3035
// start log and show it
3036
showLogMessage_(LS_NOTICE, QString("Starting '%1'").arg(topp_.tool.toQString()), ""); // tool + args.join(" "));
3038
// initialize process
3039
topp_.process = new QProcess();
3040
topp_.process->setProcessChannelMode(QProcess::MergedChannels);
3043
connect(topp_.process, SIGNAL(readyReadStandardOutput()), this, SLOT(updateProcessLog()));
3044
connect(topp_.process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finishTOPPToolExecution(int, QProcess::ExitStatus)));
3046
QString tool_executable;
3049
// find correct location of TOPP tool
3050
tool_executable = File::findExecutable(topp_.tool).toQString();
3052
catch (Exception::FileNotFound& /*ex*/)
3054
showLogMessage_(LS_ERROR, "Could not locate executable!", QString("Finding executable of TOPP tool '%1' failed. Please check your TOPP/OpenMS installation. Workaround: Add the bin/ directory to your PATH").arg(topp_.tool.toQString()));
3058
// update menu entries according to new state
3061
// start the actual process
3062
topp_.timer.restart();
3063
topp_.process->start(tool_executable, args);
3064
topp_.process->waitForStarted();
3066
if (topp_.process->error() == QProcess::FailedToStart)
3068
showLogMessage_(LS_ERROR, QString("Failed to execute '%1'").arg(topp_.tool.toQString()), QString("Execution of TOPP tool '%1' failed with error: %2").arg(topp_.tool.toQString(), topp_.process->errorString()));
3070
// ensure that all tool output is emitted into log screen
3073
// re-enable Apply TOPP tool menues
3074
delete topp_.process;
3024
3082
void TOPPViewBase::finishTOPPToolExecution(int, QProcess::ExitStatus)
3026
//finish with new line
3029
String tmp_dir = param_.getValue("preferences:tmp_file_path").toString();
3031
if (topp_.process->exitStatus()==QProcess::CrashExit)
3033
showLogMessage_(LS_ERROR,"Execution of TOPP tool not successful!",String("The tool crashed during execution. If you want to debug this crash, check the input files in '") + tmp_dir + "' or enable 'debug' mode in the TOPP ini file.");
3035
else if(topp_.out!="")
3037
if (!File::readable(topp_.file_name+"_out"))
3039
showLogMessage_(LS_ERROR,"Cannot read TOPP output",String("Cannot read '")+topp_.file_name+"_out'!");
3043
addDataFile(topp_.file_name+"_out",true,false, topp_.layer_name + " (" + topp_.tool + ")", topp_.window_id, topp_.spectrum_id);
3048
delete topp_.process;
3052
//clean up temporary files
3053
if (param_.getValue("preferences:topp_cleanup")=="true")
3055
File::remove(topp_.file_name+"_ini");
3056
File::remove(topp_.file_name+"_in");
3057
File::remove(topp_.file_name+"_out");
3084
//finish with new line
3087
String tmp_dir = param_.getValue("preferences:tmp_file_path").toString();
3089
if (topp_.process->exitStatus() == QProcess::CrashExit)
3091
showLogMessage_(LS_ERROR, QString("Execution of '%1' not successful!").arg(topp_.tool.toQString()),
3092
QString("The tool crashed during execution. If you want to debug this crash, check the input files in '%1'"
3093
" or enable 'debug' mode in the TOPP ini file.").arg(tmp_dir.toQString()));
3095
else if (topp_.out != "")
3097
showLogMessage_(LS_NOTICE, QString("'%1' finished successfully").arg(topp_.tool.toQString()),
3098
QString("Execution time: %1 ms").arg(topp_.timer.elapsed()));
3099
if (!File::readable(topp_.file_name + "_out"))
3101
showLogMessage_(LS_ERROR, "Cannot read TOPP output", String("Cannot read '") + topp_.file_name + "_out'!");
3105
addDataFile(topp_.file_name + "_out", true, false, topp_.layer_name + " (" + topp_.tool + ")", topp_.window_id, topp_.spectrum_id);
3110
delete topp_.process;
3114
//clean up temporary files
3115
if (param_.getValue("preferences:topp_cleanup") == "true")
3117
File::remove(topp_.file_name + "_ini");
3118
File::remove(topp_.file_name + "_in");
3119
File::remove(topp_.file_name + "_out");
3061
const LayerData* TOPPViewBase::getCurrentLayer() const
3123
const LayerData* TOPPViewBase::getCurrentLayer() const
3063
3125
SpectrumCanvas* canvas = getActiveCanvas();
3068
return &(canvas->getCurrentLayer());
3130
return &(canvas->getCurrentLayer());
3071
3133
void TOPPViewBase::toggleProjections()
3073
3135
Spectrum2DWidget* w = getActive2DWidget();
3076
//update minimum size before
3077
if (!w->projectionsVisible())
3079
setMinimumSize(700,700);
3083
setMinimumSize(400,400);
3085
w->toggleProjections();
3138
//update minimum size before
3139
if (!w->projectionsVisible())
3141
setMinimumSize(700, 700);
3145
setMinimumSize(400, 400);
3147
w->toggleProjections();
3089
void TOPPViewBase::annotateWithID()
3151
void TOPPViewBase::loadFile(QString filename)
3153
addDataFile(String(filename), true, false);
3156
void TOPPViewBase::annotateWithID()
3091
3158
const LayerData& layer = getActiveCanvas()->getCurrentLayer();
3092
//warn if hidden layer => wrong layer selected...
3095
showLogMessage_(LS_NOTICE,"The current layer is not visible","Have you selected the right layer for this action?");
3159
//warn if hidden layer => wrong layer selected...
3162
showLogMessage_(LS_NOTICE, "The current layer is not visible", "Have you selected the right layer for this action? Aborting.");
3099
3167
QString name = QFileDialog::getOpenFileName(this,
3100
3168
"Select protein identification data",
3101
3169
current_path_.toQString(),
3102
3170
"idXML files (*.idXML);; all files (*.*)");
3106
vector<PeptideIdentification> identifications;
3107
vector<ProteinIdentification> protein_identifications;
3174
vector<PeptideIdentification> identifications;
3175
vector<ProteinIdentification> protein_identifications;
3112
IdXMLFile().load(name, protein_identifications, identifications, document_id);
3180
IdXMLFile().load(name, protein_identifications, identifications, document_id);
3114
3182
catch (Exception::BaseException& e)
3116
3184
QMessageBox::warning(this, "Error", QString("Loading of idXML file failed! (") + e.what() + ")");
3120
3188
IDMapper mapper;
3121
if (layer.type==LayerData::DT_PEAK)
3189
if (layer.type == LayerData::DT_PEAK)
3191
// clear identifications
3192
MSExperiment<>& exp = *layer.getPeakData();
3193
for (MSExperiment<>::iterator it = exp.begin(); it != exp.end(); ++it)
3195
vector<PeptideIdentification> empty_ids;
3196
it->setPeptideIdentifications(empty_ids);
3123
3199
Param p = mapper.getDefaults();
3124
3200
p.setValue("rt_tolerance", 0.1, "RT tolerance (in seconds) for the matching");
3125
3201
p.setValue("mz_tolerance", 1.0, "m/z tolerance (in ppm or Da) for the matching");
3126
3202
p.setValue("mz_measure", "Da", "unit of 'mz_tolerance' (ppm or Da)");
3127
3203
mapper.setParameters(p);
3128
3204
mapper.annotate(*layer.getPeakData(), identifications, protein_identifications);
3129
views_tabwidget_->setTabEnabled(1, true); // enable identification view
3131
else if (layer.type==LayerData::DT_FEATURE)
3205
views_tabwidget_->setTabEnabled(1, true); // enable identification view
3207
else if (layer.type == LayerData::DT_FEATURE)
3133
3209
mapper.annotate(*layer.getFeatureMap(), identifications, protein_identifications);
3137
3213
mapper.annotate(*layer.getConsensusMap(), identifications, protein_identifications);
3216
showLogMessage_(LS_NOTICE, "Done", "Annotation of spectra finished. Open identification view to see results!");
3140
3217
updateViewBar();
3143
3220
void TOPPViewBase::showSpectrumGenerationDialog()
3145
TheoreticalSpectrumGenerationDialog spec_gen_dialog;
3146
if (spec_gen_dialog.exec())
3148
String seq_string(spec_gen_dialog.line_edit->text());
3149
if (seq_string == "")
3151
QMessageBox::warning(this, "Error", "You must enter a peptide sequence!");
3222
TheoreticalSpectrumGenerationDialog spec_gen_dialog;
3223
if (spec_gen_dialog.exec())
3225
String seq_string(spec_gen_dialog.line_edit->text());
3226
if (seq_string == "")
3228
QMessageBox::warning(this, "Error", "You must enter a peptide sequence!");
3154
3231
AASequence aa_sequence;
3400
showLogMessage_(LS_NOTICE,"Wrong layer type","You cannot open feature data in 3D mode.");
3546
showLogMessage_(LS_NOTICE, "Wrong layer type", "Something went wrong during layer selection. Please report this problem with a description of your current layers!");
3404
void TOPPViewBase::showAboutDialog()
3406
//dialog and grid layout
3407
QDialog* dlg = new QDialog(this);
3408
QGridLayout* grid = new QGridLayout(dlg);
3409
dlg->setWindowTitle("About TOPPView");
3412
QLabel* label = new QLabel(dlg);
3413
label->setPixmap(QPixmap(":/TOPP_about.png"));
3414
grid->addWidget(label,0,0);
3417
QString text = QString("<BR>"
3418
"<FONT size=+3>TOPPView</font><BR>"
3422
"OpenMS and TOPP is free software available under the<BR>"
3423
"Lesser GNU Public License (LGPL)<BR>"
3429
"Any published work based on TOPP and OpenMS shall cite these papers:<BR>"
3430
"Sturm et al., BMC Bioinformatics (2008), 9, 163<BR>"
3431
"Kohlbacher et al., Bioinformatics (2007), 23:e191-e197<BR>"
3432
).arg(VersionInfo::getVersion().toQString());
3433
label = new QLabel(text,dlg);
3434
grid->addWidget(label,0,1,Qt::AlignTop | Qt::AlignLeft);
3437
QPushButton* button = new QPushButton("Close",dlg);
3438
grid->addWidget(button,1,1,Qt::AlignBottom | Qt::AlignRight);
3439
connect(button,SIGNAL(clicked()),dlg,SLOT(close()));
3445
void TOPPViewBase::updateProcessLog()
3447
//show log if there is output
3448
qobject_cast<QWidget *>(log_->parent())->show();
3451
log_->append(topp_.process->readAllStandardOutput());
3550
void TOPPViewBase::showAboutDialog()
3552
//dialog and grid layout
3553
QDialog* dlg = new QDialog(this);
3554
QGridLayout* grid = new QGridLayout(dlg);
3555
dlg->setWindowTitle("About TOPPView");
3558
QLabel* label = new QLabel(dlg);
3559
label->setPixmap(QPixmap(":/TOPP_about.png"));
3560
grid->addWidget(label, 0, 0);
3563
QString text = QString("<BR>"
3564
"<FONT size=+3>TOPPView</font><BR>"
3568
"OpenMS and TOPP is free software available under the<BR>"
3569
"BSD 3-Clause Licence (BSD-new)<BR>"
3575
"Any published work based on TOPP and OpenMS shall cite these papers:<BR>"
3576
"Sturm et al., BMC Bioinformatics (2008), 9, 163<BR>"
3577
"Kohlbacher et al., Bioinformatics (2007), 23:e191-e197<BR>"
3578
).arg(VersionInfo::getVersion().toQString());
3579
label = new QLabel(text, dlg);
3580
grid->addWidget(label, 0, 1, Qt::AlignTop | Qt::AlignLeft);
3583
QPushButton* button = new QPushButton("Close", dlg);
3584
grid->addWidget(button, 1, 1, Qt::AlignBottom | Qt::AlignRight);
3585
connect(button, SIGNAL(clicked()), dlg, SLOT(close()));
3591
void TOPPViewBase::updateProcessLog()
3593
//show log if there is output
3594
qobject_cast<QWidget*>(log_->parent())->show();
3597
log_->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); // move cursor to end, since text is inserted at cursor
3598
log_->insertPlainText(topp_.process->readAllStandardOutput());
3454
3602
Param TOPPViewBase::getSpectrumParameters(UInt dim)
3456
Param out = param_.copy(String("preferences:") + dim + "d:",true);
3457
out.setValue("default_path",param_.getValue("preferences:default_path").toString());
3604
Param out = param_.copy(String("preferences:") + dim + "d:", true);
3605
out.setValue("default_path", param_.getValue("preferences:default_path").toString());
3461
3609
void TOPPViewBase::abortTOPPTool()
3465
//block signals to avoid error message from finished() signal
3466
topp_.process->blockSignals(true);
3467
//kill and delete the process
3468
topp_.process->terminate();
3469
delete topp_.process;
3472
//finish log with new line
3613
//block signals to avoid error message from finished() signal
3614
topp_.process->blockSignals(true);
3615
//kill and delete the process
3616
topp_.process->terminate();
3617
delete topp_.process;
3620
//finish log with new line
3479
3627
void TOPPViewBase::updateMenu()
3481
//is there a canvas?
3482
bool canvas_exists = false;
3483
if (getActiveCanvas()!=0)
3485
canvas_exists = true;
3488
bool layer_exists = false;
3489
if (canvas_exists && getActiveCanvas()->getLayerCount()!=0)
3491
layer_exists = true;
3493
//is there a TOPP tool running
3494
bool topp_running = false;
3495
if (topp_.process!=0)
3497
topp_running = true;
3500
TOPPASWidget* tw = getActiveTOPPASWidget();
3501
TOPPASScene* ts = 0;
3504
ts = tw->getScene();
3505
} else // active widget is no TOPPAS widget
3629
//is there a canvas?
3630
bool canvas_exists = false;
3631
if (getActiveCanvas() != 0)
3633
canvas_exists = true;
3636
bool layer_exists = false;
3637
if (canvas_exists && getActiveCanvas()->getLayerCount() != 0)
3639
layer_exists = true;
3641
//is there a TOPP tool running
3642
bool topp_running = false;
3643
if (topp_.process != 0)
3645
topp_running = true;
3510
3648
bool mirror_mode = getActive1DWidget() && getActive1DWidget()->canvas()->mirrorModeActive();
3511
QList<QAction*> actions = this->findChildren<QAction*>("");
3512
for (int i=0; i<actions.count(); ++i)
3514
QString text = actions[i]->text();
3515
if (text=="&Close" || text=="Show/hide grid lines" || text=="Show/hide axis legends")
3517
actions[i]->setEnabled(false);
3520
actions[i]->setEnabled(true);
3523
else if (text.left(15)=="Apply TOPP tool")
3525
actions[i]->setEnabled(false);
3526
if (canvas_exists && layer_exists && !topp_running)
3528
actions[i]->setEnabled(true);
3531
else if (text=="Abort running TOPP tool")
3533
actions[i]->setEnabled(false);
3536
actions[i]->setEnabled(true);
3539
else if (text=="Rerun TOPP tool")
3541
actions[i]->setEnabled(false);
3542
if (canvas_exists && layer_exists && !topp_running && topp_.tool!="")
3544
actions[i]->setEnabled(true);
3547
else if (text=="&Go to" || text=="&Edit meta data" || text=="&Statistics" || text=="&Annotate with identification" || text=="Save all data" || text=="Save visible data" || text=="Preferences")
3549
actions[i]->setEnabled(false);
3550
if (canvas_exists && layer_exists)
3552
actions[i]->setEnabled(true);
3555
else if (text=="Align spectra")
3557
actions[i]->setEnabled(false);
3560
actions[i]->setEnabled(true);
3563
else if (text=="&Run (F5)") // pipeline menu
3566
if (ts && !(ts->isPipelineRunning()))
3570
actions[i]->setEnabled(show);
3572
else if (text=="&Abort") // pipeline menu
3575
if (ts && ts->isPipelineRunning())
3579
actions[i]->setEnabled(show);
3581
else if (text=="&Include TOPPAS pipeline") // pipeline menu
3584
actions[i]->setEnabled(show);
3586
else if (text=="&Load TOPPAS resource file") // pipeline menu
3589
actions[i]->setEnabled(show);
3591
else if (text=="Save TOPPAS &resource file") // pipeline menu
3594
actions[i]->setEnabled(show);
3596
else if (text=="&Save TOPPAS pipeline")
3598
bool show = ts && ts->wasChanged();
3599
actions[i]->setEnabled(show);
3601
else if (text=="Save TOPPAS pipeline &As")
3603
bool show = ts && ts->wasChanged();
3604
actions[i]->setEnabled(show);
3606
else if (text=="Refresh TOPPAS ¶meters") // pipeline menu
3608
bool show = ts && !(ts->isPipelineRunning());
3609
actions[i]->setEnabled(show);
3613
actions[i]->setEnabled(false);
3614
if (canvas_exists && layer_exists)
3616
actions[i]->setEnabled(true);
3649
QList<QAction*> actions = this->findChildren<QAction*>("");
3650
for (int i = 0; i < actions.count(); ++i)
3652
QString text = actions[i]->text();
3653
if (text == "&Close" || text == "Show/hide grid lines" || text == "Show/hide axis legends")
3655
actions[i]->setEnabled(false);
3658
actions[i]->setEnabled(true);
3661
else if (text.left(15) == "Apply TOPP tool")
3663
actions[i]->setEnabled(false);
3664
if (canvas_exists && layer_exists && !topp_running)
3666
actions[i]->setEnabled(true);
3669
else if (text == "Abort running TOPP tool")
3671
actions[i]->setEnabled(false);
3674
actions[i]->setEnabled(true);
3677
else if (text == "Rerun TOPP tool")
3679
actions[i]->setEnabled(false);
3680
if (canvas_exists && layer_exists && !topp_running && topp_.tool != "")
3682
actions[i]->setEnabled(true);
3685
else if (text == "&Go to" || text == "&Edit meta data" || text == "&Statistics" || text == "&Annotate with identification" || text == "Save all data" || text == "Save visible data" || text == "Preferences")
3687
actions[i]->setEnabled(false);
3688
if (canvas_exists && layer_exists)
3690
actions[i]->setEnabled(true);
3693
else if (text == "Align spectra")
3695
actions[i]->setEnabled(false);
3698
actions[i]->setEnabled(true);
3701
else if (text == "")
3703
actions[i]->setEnabled(false);
3704
if (canvas_exists && layer_exists)
3706
actions[i]->setEnabled(true);
3622
3712
void TOPPViewBase::loadFiles(const StringList& list, QSplashScreen* splash_screen)
3624
bool last_was_plus = false;
3625
for (StringList::const_iterator it=list.begin(); it!=list.end(); ++it)
3714
bool last_was_plus = false;
3715
for (StringList::const_iterator it = list.begin(); it != list.end(); ++it)
3629
last_was_plus = true;
3632
else if (*it=="@bw")
3634
if ( (getActive2DWidget()!=0 || getActive3DWidget()!=0) && getActiveCanvas()!=0 )
3636
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3637
tmp.setValue("dot:gradient", "Linear|0,#ffffff;100,#000000");
3638
getActiveCanvas()->setCurrentLayerParameters(tmp);
3641
else if (*it=="@bg")
3643
if ( (getActive2DWidget()!=0 || getActive3DWidget()!=0) && getActiveCanvas()!=0 )
3645
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3646
tmp.setValue("dot:gradient", "Linear|0,#dddddd;100,#000000");
3647
getActiveCanvas()->setCurrentLayerParameters(tmp);
3652
if ( (getActive2DWidget()!=0 || getActive3DWidget()!=0) && getActiveCanvas()!=0 )
3654
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3655
tmp.setValue("dot:gradient", "Linear|0,#000000;100,#000000");
3656
getActiveCanvas()->setCurrentLayerParameters(tmp);
3661
if ( (getActive2DWidget()!=0 || getActive3DWidget()!=0) && getActiveCanvas()!=0 )
3663
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3664
tmp.setValue("dot:gradient", "Linear|0,#ff0000;100,#ff0000");
3665
getActiveCanvas()->setCurrentLayerParameters(tmp);
3670
if ( (getActive2DWidget()!=0 || getActive3DWidget()!=0) && getActiveCanvas()!=0 )
3672
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3673
tmp.setValue("dot:gradient", "Linear|0,#00ff00;100,#00ff00");
3674
getActiveCanvas()->setCurrentLayerParameters(tmp);
3679
if ( (getActive2DWidget()!=0 || getActive3DWidget()!=0) && getActiveCanvas()!=0 )
3681
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3682
tmp.setValue("dot:gradient", "Linear|0,#ff00ff;100,#ff00ff");
3683
getActiveCanvas()->setCurrentLayerParameters(tmp);
3719
last_was_plus = true;
3722
else if (*it == "@bw")
3724
if ((getActive2DWidget() != 0 || getActive3DWidget() != 0) && getActiveCanvas() != 0)
3726
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3727
tmp.setValue("dot:gradient", "Linear|0,#ffffff;100,#000000");
3728
getActiveCanvas()->setCurrentLayerParameters(tmp);
3731
else if (*it == "@bg")
3733
if ((getActive2DWidget() != 0 || getActive3DWidget() != 0) && getActiveCanvas() != 0)
3735
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3736
tmp.setValue("dot:gradient", "Linear|0,#dddddd;100,#000000");
3737
getActiveCanvas()->setCurrentLayerParameters(tmp);
3740
else if (*it == "@b")
3742
if ((getActive2DWidget() != 0 || getActive3DWidget() != 0) && getActiveCanvas() != 0)
3744
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3745
tmp.setValue("dot:gradient", "Linear|0,#000000;100,#000000");
3746
getActiveCanvas()->setCurrentLayerParameters(tmp);
3749
else if (*it == "@r")
3751
if ((getActive2DWidget() != 0 || getActive3DWidget() != 0) && getActiveCanvas() != 0)
3753
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3754
tmp.setValue("dot:gradient", "Linear|0,#ff0000;100,#ff0000");
3755
getActiveCanvas()->setCurrentLayerParameters(tmp);
3758
else if (*it == "@g")
3760
if ((getActive2DWidget() != 0 || getActive3DWidget() != 0) && getActiveCanvas() != 0)
3762
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3763
tmp.setValue("dot:gradient", "Linear|0,#00ff00;100,#00ff00");
3764
getActiveCanvas()->setCurrentLayerParameters(tmp);
3767
else if (*it == "@m")
3769
if ((getActive2DWidget() != 0 || getActive3DWidget() != 0) && getActiveCanvas() != 0)
3771
Param tmp = getActiveCanvas()->getCurrentLayer().param;
3772
tmp.setValue("dot:gradient", "Linear|0,#ff00ff;100,#ff00ff");
3773
getActiveCanvas()->setCurrentLayerParameters(tmp);
3686
3776
else if (!last_was_plus || !getActiveSpectrumWidget())
3688
splash_screen->showMessage((String("Loading file: ") + *it).toQString());
3689
splash_screen->repaint();
3690
QApplication::processEvents();
3691
addDataFile(*it, false, true); // add data file but don't show options
3695
splash_screen->showMessage((String("Loading file: ") + *it).toQString());
3696
splash_screen->repaint();
3697
QApplication::processEvents();
3698
last_was_plus = false;
3699
addDataFile(*it, false, true,"",getActiveSpectrumWidget()->getWindowId());
3778
splash_screen->showMessage((String("Loading file: ") + *it).toQString());
3779
splash_screen->repaint();
3780
QApplication::processEvents();
3781
addDataFile(*it, false, true); // add data file but don't show options
3785
splash_screen->showMessage((String("Loading file: ") + *it).toQString());
3786
splash_screen->repaint();
3787
QApplication::processEvents();
3788
last_was_plus = false;
3789
addDataFile(*it, false, true, "", getActiveSpectrumWidget()->getWindowId());
3704
3794
void TOPPViewBase::showLogMessage_(TOPPViewBase::LogState state, const String& heading, const String& body)
3706
//Compose current time string
3707
DateTime d = DateTime::now();
3709
String state_string;
3712
case LS_NOTICE: state_string = "NOTICE"; break;
3713
case LS_WARNING: state_string = "WARNING"; break;
3714
case LS_ERROR: state_string = "ERROR"; break;
3718
log_->append("==============================================================================");
3719
log_->append((d.getTime() + " " + state_string + ": " + heading).toQString());
3720
log_->append(body.toQString());
3722
//show log tool window
3723
qobject_cast<QWidget *>(log_->parent())->show();
3796
//Compose current time string
3797
DateTime d = DateTime::now();
3799
String state_string;
3802
case LS_NOTICE: state_string = "NOTICE"; break;
3804
case LS_WARNING: state_string = "WARNING"; break;
3806
case LS_ERROR: state_string = "ERROR"; break;
3810
log_->append("==============================================================================");
3811
log_->append((d.getTime() + " " + state_string + ": " + heading).toQString());
3812
log_->append(body.toQString());
3814
//show log tool window
3815
qobject_cast<QWidget*>(log_->parent())->show();
3726
void TOPPViewBase::saveLayerAll()
3818
void TOPPViewBase::saveLayerAll()
3728
3820
getActiveCanvas()->saveCurrentLayer(false);
3731
void TOPPViewBase::saveLayerVisible()
3823
void TOPPViewBase::saveLayerVisible()
3733
3825
getActiveCanvas()->saveCurrentLayer(true);
3736
void TOPPViewBase::toggleGridLines()
3828
void TOPPViewBase::toggleGridLines()
3738
3830
getActiveCanvas()->showGridLines(!getActiveCanvas()->gridLinesShown());
3741
void TOPPViewBase::toggleAxisLegends()
3833
void TOPPViewBase::toggleAxisLegends()
3743
3835
getActiveSpectrumWidget()->showLegend(!getActiveSpectrumWidget()->isLegendShown());
3746
void TOPPViewBase::showPreferences()
3838
void TOPPViewBase::showPreferences()
3748
3840
getActiveCanvas()->showCurrentLayerPreferences();
3751
void TOPPViewBase::metadataFileDialog()
3753
QStringList files = getFileList_();
3755
fh.getOptions().setMetadataOnly(true);
3756
for (QStringList::iterator it = files.begin(); it!=files.end(); ++it)
3761
fh.loadExperiment(*it,exp);
3763
catch (Exception::BaseException& e)
3765
QMessageBox::critical(this,"Error",(String("Error while reading data: ")+e.what()).c_str());
3768
MetaDataBrowser dlg(false, this);
3774
void TOPPViewBase::metadataDatabaseDialog()
3778
if (con.isConnected())
3781
DBOpenDialog db_dialog(con,ids,ws_);
3782
if (db_dialog.exec())
3785
db.getOptions().setMetadataOnly(true);
3786
for (vector<UInt>::iterator it = ids.begin();it!=ids.end();++it)
3791
db.loadExperiment(*it, exp);
3793
catch (Exception::BaseException& e)
3795
QMessageBox::critical(this,"Error",(String("Error while reading data: ")+e.what()).c_str());
3798
MetaDataBrowser dlg(false, this);
3843
void TOPPViewBase::metadataFileDialog()
3845
QStringList files = getFileList_();
3847
fh.getOptions().setMetadataOnly(true);
3848
for (QStringList::iterator it = files.begin(); it != files.end(); ++it)
3853
fh.loadExperiment(*it, exp);
3855
catch (Exception::BaseException& e)
3857
QMessageBox::critical(this, "Error", (String("Error while reading data: ") + e.what()).c_str());
3860
MetaDataBrowser dlg(false, this);
3866
void TOPPViewBase::metadataDatabaseDialog()
3870
if (con.isConnected())
3873
DBOpenDialog db_dialog(con, ids, ws_);
3874
if (db_dialog.exec())
3877
db.getOptions().setMetadataOnly(true);
3878
for (vector<UInt>::iterator it = ids.begin(); it != ids.end(); ++it)
3883
db.loadExperiment(*it, exp);
3885
catch (Exception::BaseException& e)
3887
QMessageBox::critical(this, "Error", (String("Error while reading data: ") + e.what()).c_str());
3890
MetaDataBrowser dlg(false, this);
3806
3898
SpectraIdentificationViewWidget* TOPPViewBase::getSpectraIdentificationViewWidget()