MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / TOPPViewMenu

Method TOPPViewMenu

src/openms_gui/source/VISUAL/TOPPViewMenu.cpp:41–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 }
40
41 TOPPViewMenu::TOPPViewMenu(TOPPViewBase* const parent, EnhancedWorkspace* const ws, RecentFilesMenu* const recent_files)
42 : QObject()
43 //parent_(parent)
44 {
45 QAction* action; ///< for adding tool tips to actions
46
47 QMenu* m_file = new QMenu("&File", parent);
48 m_file->setToolTipsVisible(true);
49 parent->menuBar()->addMenu(m_file);
50
51 m_file->addAction( // we explicitly pass an empty Path here using a Lambda, since using the default `..., parent, &TOPPViewBase::openFilesByDialog, ...`)
52 // passes a "0" as argument (Qt bug?)
53 "&Open file", parent, [parent]() { parent->openFilesByDialog(""); }, Qt::CTRL + Qt::Key_O);
54 m_file->addAction("Open &example file", parent, [parent]() { parent->openFilesByDialog(File::getOpenMSDataPath() + "/examples/"); }, Qt::CTRL + Qt::Key_E);
55 addAction_(m_file->addAction("&Close tab", parent, &TOPPViewBase::closeTab, Qt::CTRL + Qt::Key_W),
56 TV_STATUS::HAS_CANVAS);
57 m_file->addSeparator();
58
59 // Meta data
60 action = m_file->addAction("&Show meta data (file)", parent, &TOPPViewBase::metadataFileDialog);
61 action->setToolTip("Load a file's meta information without actually loading the data.");
62
63 m_file->addSeparator();
64
65 // Recent files
66 m_file->addMenu(recent_files->getMenu()); // updates automatically via RecentFilesMenu class, since this is just a pointer
67
68 m_file->addSeparator();
69
70 // Specifically set the role of the Preferences item. Additionally we have to avoid adding other action items that are
71 // called preferences/config/options and have the default TextHeuristicRole because otherwise they will overwrite the macOS specific
72 // menu entry under Application -> Preferences...
73 // m_file->addAction("&Preferences", parent, &TOPPViewBase::preferencesDialog);
74 auto pref = new QAction("&Preferences", parent);
75 pref->setMenuRole(QAction::PreferencesRole);
76 pref->setEnabled(true);
77 m_file->addAction(pref);
78 connect(pref, &QAction::triggered, parent, &TOPPViewBase::preferencesDialog);
79
80 m_file->addAction("&Quit", qApp, SLOT(quit()));
81
82 // Tools menu
83 QMenu* m_tools = new QMenu("&Tools", parent);
84 m_tools->setToolTipsVisible(true);
85 parent->menuBar()->addMenu(m_tools);
86 addAction_(m_tools->addAction("&Select data range", parent, &TOPPViewBase::showGoToDialog, Qt::CTRL + Qt::Key_G),
87 TV_STATUS::HAS_LAYER);
88 addAction_(m_tools->addAction("&Edit meta data", parent, &TOPPViewBase::editMetadata, Qt::CTRL + Qt::Key_M),
89 TV_STATUS::HAS_LAYER);
90 addAction_(m_tools->addAction("&Statistics", parent, &TOPPViewBase::layerStatistics),
91 TV_STATUS::HAS_LAYER);
92 m_tools->addSeparator();
93 action = addAction_(m_tools->addAction("Apply TOPP tool (whole layer)", parent, &TOPPViewBase::showTOPPDialog, Qt::CTRL + Qt::Key_T),
94 TV_STATUS::HAS_LAYER + TV_STATUS::TOPP_IDLE);
95 action->setData(false);
96 action = addAction_(m_tools->addAction("Apply TOPP tool (visible layer data)", parent, &TOPPViewBase::showTOPPDialog, Qt::CTRL + Qt::SHIFT + Qt::Key_T),
97 TV_STATUS::HAS_LAYER + TV_STATUS::TOPP_IDLE);
98 action->setData(true);

Callers

nothing calls this directly

Calls 3

getMenuMethod · 0.80
openFilesByDialogMethod · 0.45
setDataMethod · 0.45

Tested by

no test coverage detected