OpenMS
TOPPASBase.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Johannes Veit $
6 // $Authors: Johannes Junker, Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
14 //OpenMS
19 
20 //QT
21 #include <QtWidgets/QButtonGroup>
22 #include <QtWidgets/QMainWindow>
23 #include <QtWidgets/QMdiArea>
24 #include <QtNetwork/QNetworkReply>
25 #include <QtWidgets/QSplashScreen>
26 
27 class QToolBar;
28 class QListWidget;
29 class QTextEdit;
30 class QMdiArea;
31 class QLabel;
32 class QPushButton;
33 class QWidget;
34 class QTreeWidget;
35 class QTreeWidgetItem;
36 class QWebView;
37 class QNetworkAccessManager;
38 
39 
40 namespace OpenMS
41 {
42  class EnhancedWorkSpace;
43  class EnhancedTabBar;
44  class TOPPASWidget;
45  class TOPPASScene;
46  class LogWindow;
47  class TOPPASResources;
48 
54  class OPENMS_GUI_DLLAPI TOPPASBase :
55  public QMainWindow,
56  public DefaultParamHandler
57  {
58  Q_OBJECT
59 
60 public:
61 
63  TOPPASBase(QWidget* parent = nullptr);
65  ~TOPPASBase() override;
66 
72  void loadPreferences(String filename = "");
74  void savePreferences();
76  void loadFiles(const std::vector<String>& list, QSplashScreen* splash_screen);
77 
78 public slots:
80  void addTOPPASFile(const String& file_name, bool in_new_window = true);
82  void openFilesByDialog();
84  void openExampleDialog();
86  void newPipeline();
88  void includePipeline();
90  void saveCurrentPipelineAs();
92  void savePipeline();
94  void exportAsImage();
96  void loadPipelineResourceFile();
98  void savePipelineResourceFile();
100  void openOnlinePipelineRepository();
102  void preferencesDialog();
104  void updateCurrentPath();
106  void updateTabBar(QMdiSubWindow* w);
108  void showAboutDialog();
110  void showURL();
117  void showStatusMessage(const std::string& msg, OpenMS::UInt time);
119  void showCursorStatus(double x, double y);
121  void closeFile();
123  void updateToolBar();
125  void runPipeline();
127  void abortPipeline();
129  void toolStarted();
131  void toolFinished();
133  void toolCrashed();
135  void toolFailed();
137  void outputVertexFinished(const String& file);
139  void updateTOPPOutputLog(const QString& out);
141  void showPipelineFinishedLogMessage();
143  void saveToClipboard(TOPPASScene* scene);
145  void sendClipboardContent();
147  void refreshParameters();
149  void openFilesInTOPPView(QStringList all_files);
151  void openToppasFile(const QString& filename);
152 protected slots:
153 
158  void closeByTab(int id);
160  void focusByTab(int id);
162 
164  void updateMenu();
166  void showAsWindow_(TOPPASWidget* sw, const String& caption);
168  void insertNewVertex_(double x, double y, QTreeWidgetItem* item = nullptr);
170  void insertNewVertexInCenter_(QTreeWidgetItem* item);
171 
173  void downloadTOPPASfromHomepage_(const QUrl& url);
175  void toppasFileDownloaded_(QNetworkReply* r);
177  void TOPPASreadyRead();
178 
180  void descriptionUpdated_();
181 
182 protected:
183 
188 
192  QToolBar* tool_bar_;
194 
196  RecentFilesMenu recent_files_menu_; // needs to be declared before 'menu_', because its needed there
197 
200 
202  QWebView* webview_;
204  QNetworkAccessManager* network_manager_;
206  QNetworkReply* network_reply_;
207 
210 
216  QPushButton* tools_expand_all_;
218  QPushButton* tools_collapse_all_;
221 
226  QLabel* message_label_;
228 
230  TOPPASWidget* window_(int id) const;
231 
232  void filterToolTree_();
233 
237 
240 
242  static int node_offset_;
243 
245  static qreal z_value_;
246 
248  TOPPASWidget* activeSubWindow_() const;
249 
251 
252  void closeEvent(QCloseEvent* event) override;
253  void keyPressEvent(QKeyEvent* e) override;
255 
258 
259 
260 public:
262 
263  static TOPPASTreeView* createTOPPToolsTreeWidget(QWidget* parent_widget = nullptr);
265 
268  static QString savePipelineAs(TOPPASWidget* w, const QString& current_path);
269 
271  static QString loadPipelineResourceFile(TOPPASWidget* w, const QString& current_path);
272 
274  static QString savePipelineResourceFile(TOPPASWidget* w, const QString& current_path);
275 
277  static QString refreshPipelineParameters(TOPPASWidget* tw, QString current_path);
279  }; //class
280 
281 } //namespace
282 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
Convenience tab bar implementation.
Definition: EnhancedTabBar.h:36
Definition: EnhancedWorkspace.h:27
A log window (QTextEdit) with convenience functions.
Definition: LogWindow.h:29
Manages recent files opened by the user and provides a QMenu to go with it.
Definition: RecentFilesMenu.h:35
A more convenient string class.
Definition: String.h:34
Main window of the TOPPAS tool.
Definition: TOPPASBase.h:57
QLineEdit * tools_filter_
Filter for the Tree view.
Definition: TOPPASBase.h:214
QTextEdit * desc_
Workflow Description window.
Definition: TOPPASBase.h:187
QPushButton * tools_collapse_all_
Collapse button for the Tree view.
Definition: TOPPASBase.h:218
EnhancedTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData()
Definition: TOPPASBase.h:209
static int node_offset_
Offset counter for new inserted nodes (to avoid invisible stacking)
Definition: TOPPASBase.h:242
QNetworkAccessManager * network_manager_
download .toppas files from homepage
Definition: TOPPASBase.h:204
QListWidget * blocks_list_
List of ready analysis pipelines.
Definition: TOPPASBase.h:220
QWebView * webview_
OpenMS homepage workflow browser.
Definition: TOPPASBase.h:202
TOPPASTreeView * tools_tree_view_
Tree view of all available TOPP tools.
Definition: TOPPASBase.h:212
QNetworkReply * network_reply_
the content of the network request
Definition: TOPPASBase.h:206
EnhancedWorkspace * ws_
Main workspace.
Definition: TOPPASBase.h:199
static qreal z_value_
z-value counter for new inserted nodes (new nodes should be on top)
Definition: TOPPASBase.h:245
String tmp_path_
The path for temporary files.
Definition: TOPPASBase.h:239
QLabel * message_label_
Label for messages in the status bar.
Definition: TOPPASBase.h:226
QToolBar * tool_bar_
Definition: TOPPASBase.h:192
RecentFilesMenu recent_files_menu_
manages recent list of filenames and the menu that goes with it
Definition: TOPPASBase.h:196
String current_path_
Definition: TOPPASBase.h:236
TOPPASScene * clipboard_scene_
The clipboard.
Definition: TOPPASBase.h:257
QPushButton * tools_expand_all_
Expand button for the Tree view.
Definition: TOPPASBase.h:216
LogWindow * log_
Log output window.
Definition: TOPPASBase.h:185
Definition: TOPPASScene.h:61
Tree view implementation for the list of TOPP tools.
Definition: TOPPASTreeView.h:30
Widget visualizing and allowing to edit TOPP pipelines.
Definition: TOPPASWidget.h:37
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19