OpenMS
TOPPASBase.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, 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 QWidget;
33 class QTreeWidget;
34 class QTreeWidgetItem;
35 class QWebView;
36 class QNetworkAccessManager;
37 
38 
39 namespace OpenMS
40 {
41  class EnhancedWorkSpace;
42  class EnhancedTabBar;
43  class TOPPASWidget;
44  class TOPPASScene;
45  class LogWindow;
46  class TOPPASResources;
47 
53  class OPENMS_GUI_DLLAPI TOPPASBase :
54  public QMainWindow,
55  public DefaultParamHandler
56  {
57  Q_OBJECT
58 
59 public:
60 
62  TOPPASBase(QWidget* parent = nullptr);
64  ~TOPPASBase() override;
65 
71  void loadPreferences(String filename = "");
73  void savePreferences();
75  void loadFiles(const std::vector<String>& list, QSplashScreen* splash_screen);
76 
77 public slots:
79  void addTOPPASFile(const String& file_name, bool in_new_window = true);
81  void openFilesByDialog();
83  void openExampleDialog();
85  void newPipeline();
87  void includePipeline();
89  void saveCurrentPipelineAs();
91  void savePipeline();
93  void exportAsImage();
95  void loadPipelineResourceFile();
97  void savePipelineResourceFile();
99  void openOnlinePipelineRepository();
101  void preferencesDialog();
103  void updateCurrentPath();
105  void updateTabBar(QMdiSubWindow* w);
107  void showAboutDialog();
109  void showURL();
116  void showStatusMessage(const std::string& msg, OpenMS::UInt time);
118  void showCursorStatus(double x, double y);
120  void closeFile();
122  void updateToolBar();
124  void runPipeline();
126  void abortPipeline();
128  void toolStarted();
130  void toolFinished();
132  void toolCrashed();
134  void toolFailed();
136  void outputVertexFinished(const String& file);
138  void updateTOPPOutputLog(const QString& out);
140  void showPipelineFinishedLogMessage();
142  void saveToClipboard(TOPPASScene* scene);
144  void sendClipboardContent();
146  void refreshParameters();
148  void openFilesInTOPPView(QStringList all_files);
150  void openToppasFile(const QString& filename);
151 protected slots:
152 
157  void closeByTab(int id);
159  void focusByTab(int id);
161 
163  void updateMenu();
165  void showAsWindow_(TOPPASWidget* sw, const String& caption);
167  void insertNewVertex_(double x, double y, QTreeWidgetItem* item = nullptr);
169  void insertNewVertexInCenter_(QTreeWidgetItem* item);
170 
172  void downloadTOPPASfromHomepage_(const QUrl& url);
174  void toppasFileDownloaded_(QNetworkReply* r);
176  void TOPPASreadyRead();
177 
179  void descriptionUpdated_();
180 
181 protected:
182 
187 
191  QToolBar* tool_bar_;
193 
195  RecentFilesMenu recent_files_menu_; // needs to be declared before 'menu_', because its needed there
196 
199 
201  QWebView* webview_;
203  QNetworkAccessManager* network_manager_;
205  QNetworkReply* network_reply_;
206 
209 
214 
219  QLabel* message_label_;
221 
223  TOPPASWidget* window_(int id) const;
224 
225 
229 
232 
234  static int node_offset_;
235 
237  static qreal z_value_;
238 
240  TOPPASWidget* activeSubWindow_() const;
241 
243 
244  void closeEvent(QCloseEvent* event) override;
245  void keyPressEvent(QKeyEvent* e) override;
247 
250 
251 
252 public:
254 
255  static TOPPASTreeView* createTOPPToolsTreeWidget(QWidget* parent_widget = nullptr);
257 
260  static QString savePipelineAs(TOPPASWidget* w, const QString& current_path);
261 
263  static QString loadPipelineResourceFile(TOPPASWidget* w, const QString& current_path);
264 
266  static QString savePipelineResourceFile(TOPPASWidget* w, const QString& current_path);
267 
269  static QString refreshPipelineParameters(TOPPASWidget* tw, QString current_path);
271  }; //class
272 
273 } //namespace
274 
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:56
QTreeWidget * tools_tree_view_
Tree view of all available TOPP tools.
Definition: TOPPASBase.h:211
QTextEdit * desc_
Workflow Description window.
Definition: TOPPASBase.h:186
EnhancedTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData()
Definition: TOPPASBase.h:208
static int node_offset_
Offset counter for new inserted nodes (to avoid invisible stacking)
Definition: TOPPASBase.h:234
QNetworkAccessManager * network_manager_
download .toppas files from homepage
Definition: TOPPASBase.h:203
QListWidget * blocks_list_
List of ready analysis pipelines.
Definition: TOPPASBase.h:213
QWebView * webview_
OpenMS homepage workflow browser.
Definition: TOPPASBase.h:201
QNetworkReply * network_reply_
the content of the network request
Definition: TOPPASBase.h:205
EnhancedWorkspace * ws_
Main workspace.
Definition: TOPPASBase.h:198
static qreal z_value_
z-value counter for new inserted nodes (new nodes should be on top)
Definition: TOPPASBase.h:237
String tmp_path_
The path for temporary files.
Definition: TOPPASBase.h:231
QLabel * message_label_
Label for messages in the status bar.
Definition: TOPPASBase.h:219
QToolBar * tool_bar_
Definition: TOPPASBase.h:191
RecentFilesMenu recent_files_menu_
manages recent list of filenames and the menu that goes with it
Definition: TOPPASBase.h:195
String current_path_
Definition: TOPPASBase.h:228
TOPPASScene * clipboard_scene_
The clipboard.
Definition: TOPPASBase.h:249
LogWindow * log_
Log output window.
Definition: TOPPASBase.h:184
A container for all visual items of a TOPPAS workflow.
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:68
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22