OpenMS
ExternalProcessMBox.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
15 
16 namespace OpenMS
17 {
18 
28  class OPENMS_GUI_DLLAPI ExternalProcessMBox
29  {
30  public:
33 
35  ExternalProcessMBox(std::function<void(const String&)> callbackStdOut, std::function<void(const String&)> callbackStdErr);
36 
39 
41  void setCallbacks(std::function<void(const String&)> callbackStdOut, std::function<void(const String&)> callbackStdErr);
42 
54  ExternalProcess::RETURNSTATE run(QWidget* parent, const QString& exe, const QStringList& args, const QString& working_dir, const bool verbose, String& error_msg);
55 
59  ExternalProcess::RETURNSTATE run(QWidget* parent, const QString& exe, const QStringList& args, const QString& working_dir, const bool verbose);
60 
61 
62  private:
64  };
65 } // ns OpenMS
A wrapper around ExternalProcess to conveniently show a MessageBox when an error occurs.
Definition: ExternalProcessMBox.h:29
ExternalProcess::RETURNSTATE run(QWidget *parent, const QString &exe, const QStringList &args, const QString &working_dir, const bool verbose, String &error_msg)
Runs a program by calling ExternalProcess::run and shows any error reported in error_msg as a Message...
void setCallbacks(std::function< void(const String &)> callbackStdOut, std::function< void(const String &)> callbackStdErr)
re-wire the callbacks used using run()
ExternalProcess ep_
Definition: ExternalProcessMBox.h:63
ExternalProcessMBox(std::function< void(const String &)> callbackStdOut, std::function< void(const String &)> callbackStdErr)
set the callback functions to process stdout and stderr output when the external process generates it
ExternalProcess::RETURNSTATE run(QWidget *parent, const QString &exe, const QStringList &args, const QString &working_dir, const bool verbose)
Same as other overload, just without a returned error message.
ExternalProcessMBox()
default Ctor; callbacks for stdout/stderr are empty
A wrapper around QProcess to conveniently start an external program and forward its outputs.
Definition: ExternalProcess.h:38
RETURNSTATE
result of calling an external executable
Definition: ExternalProcess.h:44
A more convenient string class.
Definition: String.h:34
int verbose
Verbosity level ( "-v" is 1 and "-V" is 2 )
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19