OpenMS
TOPPASBase.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2023.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Johannes Veit $
32 // $Authors: Johannes Junker, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
40 //OpenMS
45 
46 //QT
47 #include <QtWidgets/QButtonGroup>
48 #include <QtWidgets/QMainWindow>
49 #include <QtWidgets/QMdiArea>
50 #include <QtNetwork/QNetworkReply>
51 #include <QtWidgets/QSplashScreen>
52 
53 class QToolBar;
54 class QListWidget;
55 class QTextEdit;
56 class QMdiArea;
57 class QLabel;
58 class QWidget;
59 class QTreeWidget;
60 class QTreeWidgetItem;
61 class QWebView;
62 class QNetworkAccessManager;
63 
64 
65 namespace OpenMS
66 {
67  class EnhancedWorkSpace;
68  class EnhancedTabBar;
69  class TOPPASWidget;
70  class TOPPASScene;
71  class LogWindow;
72  class TOPPASResources;
73 
79  class OPENMS_GUI_DLLAPI TOPPASBase :
80  public QMainWindow,
81  public DefaultParamHandler
82  {
83  Q_OBJECT
84 
85 public:
86 
88  TOPPASBase(QWidget* parent = nullptr);
90  ~TOPPASBase() override;
91 
97  void loadPreferences(String filename = "");
99  void savePreferences();
101  void loadFiles(const std::vector<String>& list, QSplashScreen* splash_screen);
102 
103 public slots:
105  void addTOPPASFile(const String& file_name, bool in_new_window = true);
107  void openFilesByDialog();
109  void openExampleDialog();
111  void newPipeline();
113  void includePipeline();
115  void saveCurrentPipelineAs();
117  void savePipeline();
119  void exportAsImage();
121  void loadPipelineResourceFile();
123  void savePipelineResourceFile();
125  void openOnlinePipelineRepository();
127  void preferencesDialog();
129  void updateCurrentPath();
131  void updateTabBar(QMdiSubWindow* w);
133  void showAboutDialog();
135  void showURL();
142  void showStatusMessage(const std::string& msg, OpenMS::UInt time);
144  void showCursorStatus(double x, double y);
146  void closeFile();
148  void updateToolBar();
150  void runPipeline();
152  void abortPipeline();
154  void toolStarted();
156  void toolFinished();
158  void toolCrashed();
160  void toolFailed();
162  void outputVertexFinished(const String& file);
164  void updateTOPPOutputLog(const QString& out);
166  void showPipelineFinishedLogMessage();
168  void saveToClipboard(TOPPASScene* scene);
170  void sendClipboardContent();
172  void refreshParameters();
174  void openFilesInTOPPView(QStringList all_files);
176  void openToppasFile(const QString& filename);
177 protected slots:
178 
183  void closeByTab(int id);
185  void focusByTab(int id);
187 
189  void updateMenu();
191  void showAsWindow_(TOPPASWidget* sw, const String& caption);
193  void insertNewVertex_(double x, double y, QTreeWidgetItem* item = nullptr);
195  void insertNewVertexInCenter_(QTreeWidgetItem* item);
196 
198  void downloadTOPPASfromHomepage_(const QUrl& url);
200  void toppasFileDownloaded_(QNetworkReply* r);
202  void TOPPASreadyRead();
203 
205  void descriptionUpdated_();
206 
207 protected:
208 
213 
217  QToolBar* tool_bar_;
219 
221  RecentFilesMenu recent_files_menu_; // needs to be declared before 'menu_', because its needed there
222 
225 
227  QWebView* webview_;
229  QNetworkAccessManager* network_manager_;
231  QNetworkReply* network_reply_;
232 
235 
240 
245  QLabel* message_label_;
247 
249  TOPPASWidget* window_(int id) const;
250 
251 
255 
258 
260  static int node_offset_;
261 
263  static qreal z_value_;
264 
266  TOPPASWidget* activeSubWindow_() const;
267 
269 
270  void closeEvent(QCloseEvent* event) override;
271  void keyPressEvent(QKeyEvent* e) override;
273 
276 
277 
278 public:
280 
281  static TOPPASTreeView* createTOPPToolsTreeWidget(QWidget* parent_widget = nullptr);
283 
286  static QString savePipelineAs(TOPPASWidget* w, const QString& current_path);
287 
289  static QString loadPipelineResourceFile(TOPPASWidget* w, const QString& current_path);
290 
292  static QString savePipelineResourceFile(TOPPASWidget* w, const QString& current_path);
293 
295  static QString refreshPipelineParameters(TOPPASWidget* tw, QString current_path);
297  }; //class
298 
299 } //namespace
300 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Convenience tab bar implementation.
Definition: EnhancedTabBar.h:62
Definition: EnhancedWorkspace.h:53
A log window (QTextEdit) with convenience functions.
Definition: LogWindow.h:55
Manages recent files opened by the user and provides a QMenu to go with it.
Definition: RecentFilesMenu.h:61
A more convenient string class.
Definition: String.h:60
Main window of the TOPPAS tool.
Definition: TOPPASBase.h:82
QTreeWidget * tools_tree_view_
Tree view of all available TOPP tools.
Definition: TOPPASBase.h:237
QTextEdit * desc_
Workflow Description window.
Definition: TOPPASBase.h:212
EnhancedTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData()
Definition: TOPPASBase.h:234
static int node_offset_
Offset counter for new inserted nodes (to avoid invisible stacking)
Definition: TOPPASBase.h:260
QNetworkAccessManager * network_manager_
download .toppas files from homepage
Definition: TOPPASBase.h:229
QListWidget * blocks_list_
List of ready analysis pipelines.
Definition: TOPPASBase.h:239
QWebView * webview_
OpenMS homepage workflow browser.
Definition: TOPPASBase.h:227
QNetworkReply * network_reply_
the content of the network request
Definition: TOPPASBase.h:231
EnhancedWorkspace * ws_
Main workspace.
Definition: TOPPASBase.h:224
static qreal z_value_
z-value counter for new inserted nodes (new nodes should be on top)
Definition: TOPPASBase.h:263
String tmp_path_
The path for temporary files.
Definition: TOPPASBase.h:257
QLabel * message_label_
Label for messages in the status bar.
Definition: TOPPASBase.h:245
QToolBar * tool_bar_
Definition: TOPPASBase.h:217
RecentFilesMenu recent_files_menu_
manages recent list of filenames and the menu that goes with it
Definition: TOPPASBase.h:221
String current_path_
Definition: TOPPASBase.h:254
TOPPASScene * clipboard_scene_
The clipboard.
Definition: TOPPASBase.h:275
LogWindow * log_
Log output window.
Definition: TOPPASBase.h:210
A container for all visual items of a TOPPAS workflow.
Definition: TOPPASScene.h:87
Tree view implementation for the list of TOPP tools.
Definition: TOPPASTreeView.h:56
Widget visualizing and allowing to edit TOPP pipelines.
Definition: TOPPASWidget.h:63
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48