| OpenMS 2.5.0

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-2020.
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
41 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
42 #include <OpenMS/VISUAL/TOPPASTreeView.h>
43
44 //QT
45 #include <QtWidgets/QMainWindow>
46 #include <QtWidgets/QMdiArea>
47 #include <QtWidgets/QButtonGroup>
48 #include <QtCore/QProcess>
49 #include <QtWidgets/QSplashScreen>
50 #include <QtNetwork/QNetworkReply>
51
52 class QToolBar;
53 class QListWidget;
54 class QTextEdit;
55 class QMdiArea;
56 class QLabel;
57 class QWidget;
58 class QTreeWidget;
59 class QTreeWidgetItem;
60 class QWebView;
61 class QNetworkAccessManager;
62
63
64 namespace OpenMS
65 {
66 class TOPPASWidget;
67 class TOPPASScene;
68 class TOPPASTabBar;
69 class TOPPASLogWindow;
70 class TOPPASResources;
71
77 class OPENMS_GUI_DLLAPI TOPPASBase :
78 public QMainWindow,
79 public DefaultParamHandler
80 {
81 Q_OBJECT
82
83 public:
84
86 TOPPASBase(QWidget* parent = nullptr);
88 ~TOPPASBase() override;
89
95 void loadPreferences(String filename = "");
97 void savePreferences();
99 void loadFiles(const StringList& list, QSplashScreen* splash_screen);
100
101 public slots:
103 void addTOPPASFile(const String& file_name, bool in_new_window = true);
105 void openFileDialog();
107 void openExampleDialog();
109 void newPipeline(const int id = -1);
111 void includePipeline();
113 void saveCurrentPipelineAs();
115 void savePipeline();
117 void exportAsImage();
119 void loadPipelineResourceFile();
121 void savePipelineResourceFile();
123 void openOnlinePipelineRepository();
125 void preferencesDialog();
127 void updateCurrentPath();
129 void updateTabBar(QMdiSubWindow* w);
131 void showAboutDialog();
133 void showURL();
140 void showStatusMessage(std::string msg, OpenMS::UInt time);
142 void showCursorStatus(double x, double y);
144 void closeFile();
146 void updateToolBar();
148 void runPipeline();
150 void abortPipeline();
152 void toolStarted();
154 void toolFinished();
156 void toolCrashed();
158 void toolFailed();
160 void outputVertexFinished(const String& file);
162 void updateTOPPOutputLog(const QString& out);
164 void showPipelineFinishedLogMessage();
166 void saveToClipboard(TOPPASScene* scene);
168 void sendClipboardContent();
170 void refreshParameters();
172 void openFilesInTOPPView(QStringList all_files);
174 void openToppasFile(QString filename);
175 protected slots:
176
180 void closeByTab(int id);
183 void focusByTab(int id);
185
187 void updateMenu();
189 void showAsWindow_(TOPPASWidget* sw, const String& caption, const int special_id = -1);
191 void insertNewVertex_(double x, double y, QTreeWidgetItem* item = nullptr);
193 void insertNewVertexInCenter_(QTreeWidgetItem* item);
194
196 void downloadTOPPASfromHomepage_(const QUrl& url);
198 void toppasFileDownloaded_(QNetworkReply* r);
200 void TOPPASreadyRead();
201
203 void descriptionUpdated_();
204
205 protected:
206
208 TOPPASLogWindow* log_;
210 QTextEdit* desc_;
211
215 QToolBar* tool_bar_;
217
219 QMdiArea* ws_;
220
222 QWebView* webview_;
224 QNetworkAccessManager* network_manager_;
226 QNetworkReply* network_reply_;
227
229 TOPPASTabBar* tab_bar_;
230
232 QTreeWidget* tools_tree_view_;
234 QListWidget* blocks_list_;
235
239 QLabel* message_label_;
242
244 TOPPASWidget* window_(int id) const;
245
246
249 String current_path_;
250
252 String tmp_path_;
253
255 static int node_offset_;
256
258 static qreal z_value_;
259
261 TOPPASWidget* activeSubWindow_() const;
262
264
265 void closeEvent(QCloseEvent* event) override;
266 void keyPressEvent(QKeyEvent* e) override;
268
270 enum LogState
271 {
272 LS_NOTICE,
273 LS_WARNING,
274 LS_ERROR
275 };
277 void showLogMessage_(LogState state, const String& heading, const String& body);
278
280 TOPPASScene* clipboard_scene_;
281
282
283 public:
285 static int const IDINITIALUNTITLED = 1000;
286
288
289 static TOPPASTreeView* createTOPPToolsTreeWidget(QWidget* parent_widget = nullptr);
291
294 static QString savePipelineAs(TOPPASWidget* w, QString current_path);
295
297 static QString loadPipelineResourceFile(TOPPASWidget* w, QString current_path);
298
300 static QString savePipelineResourceFile(TOPPASWidget* w, QString current_path);
301
303 static QString refreshPipelineParameters(TOPPASWidget* tw, QString current_path);
305 }; //class
306
307 } //namespace
308
OpenMS::TOPPASBase::tools_tree_view_
QTreeWidget * tools_tree_view_
Tree view of all available TOPP tools.
Definition: TOPPASBase.h:232
QListWidget
OpenMS::String
A more convenient string class.
Definition: String.h:58
QWidget
OpenMS::TOPPASLogWindow
QTextEdit implementation with a "clear" button in the context menu.
Definition: TOPPASLogWindow.h:50
OpenMS::TOPPASBase::ws_
QMdiArea * ws_
Main workspace.
Definition: TOPPASBase.h:219
TOPPASTreeView.h
OpenMS::TOPPASBase::LS_WARNING
Warning.
Definition: TOPPASBase.h:273
QTreeWidget
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
OpenMS::TOPPASBase::tool_bar_
QToolBar * tool_bar_
Definition: TOPPASBase.h:215
OpenMS::TOPPASBase::current_path_
String current_path_
Definition: TOPPASBase.h:249
OpenMS::TOPPASBase
Main window of the TOPPAS tool.
Definition: TOPPASBase.h:77
OpenMS::TOPPASBase::webview_
QWebView * webview_
OpenMS homepage workflow browser.
Definition: TOPPASBase.h:222
OpenMS::TOPPASWidget
Widget visualizing and allowing to edit TOPP pipelines.
Definition: TOPPASWidget.h:60
OpenMS::TOPPASBase::LS_NOTICE
Notice.
Definition: TOPPASBase.h:272
OpenMS::TOPPASBase::z_value_
static qreal z_value_
z-value counter for new inserted nodes (new nodes should be on top)
Definition: TOPPASBase.h:258
OpenMS::TOPPASBase::tmp_path_
String tmp_path_
The path for temporary files.
Definition: TOPPASBase.h:252
OpenMS::TOPPASBase::network_reply_
QNetworkReply * network_reply_
the content of the network request
Definition: TOPPASBase.h:226
OpenMS::TOPPASTreeView
Tree view implementation for the list of TOPP tools.
Definition: TOPPASTreeView.h:54
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::TOPPASBase::blocks_list_
QListWidget * blocks_list_
List of ready analysis pipelines.
Definition: TOPPASBase.h:234
OpenMS::TOPPASTabBar
Convenience tab bar implementation.
Definition: TOPPASTabBar.h:59
OpenMS::TOPPASBase::log_
TOPPASLogWindow * log_
Log output window.
Definition: TOPPASBase.h:208
OpenMS::TOPPASScene
A container for all visual items of a TOPPAS workflow.
Definition: TOPPASScene.h:85
DefaultParamHandler.h
OpenMS::TOPPASBase::clipboard_scene_
TOPPASScene * clipboard_scene_
The clipboard.
Definition: TOPPASBase.h:280
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::TOPPASBase::desc_
QTextEdit * desc_
Workflow Description window.
Definition: TOPPASBase.h:210
QMainWindow
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
QTextEdit
OpenMS::TOPPASBase::tab_bar_
TOPPASTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData() ...
Definition: TOPPASBase.h:229
OpenMS::TOPPASBase::node_offset_
static int node_offset_
Offset counter for new inserted nodes (to avoid invisible stacking)
Definition: TOPPASBase.h:255
OpenMS::TOPPASBase::network_manager_
QNetworkAccessManager * network_manager_
download .toppas files from homepage
Definition: TOPPASBase.h:224
OpenMS::TOPPASBase::LogState
LogState
Log message states.
Definition: TOPPASBase.h:270
QMdiArea