OpenMS
2.6.0
|
A wrapper around ExternalProcess to conveniently show a MessageBox when an error occurs. More...
#include <OpenMS/VISUAL/MISC/ExternalProcessMBox.h>
Public Member Functions | |
ExternalProcessMBox () | |
default Ctor; callbacks for stdout/stderr are empty More... | |
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 More... | |
~ExternalProcessMBox () | |
D'tor. More... | |
void | setCallbacks (std::function< void(const String &)> callbackStdOut, std::function< void(const String &)> callbackStdErr) |
re-wire the callbacks used using run() More... | |
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 MessageBox before this function returns. More... | |
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. More... | |
Private Attributes | |
ExternalProcess | ep_ |
A wrapper around ExternalProcess to conveniently show a MessageBox when an error occurs.
Use the custom Ctor to provide callback functions for stdout/stderr output or set them via setCallbacks().
Running an external program blocks the caller, so do not use this in a main GUI thread (unless you have some other means to tell the user that no interaction is possible at the moment).
default Ctor; callbacks for stdout/stderr are empty
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
~ExternalProcessMBox | ( | ) |
D'tor.
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.
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 MessageBox before this function returns.
parent | Optional parent widget, used to position QMesssageBoxes above the parent | |
exe | The program to call (can contain spaces in path, no problem) | |
args | A list of extra arguments (can be empty) | |
working_dir | Execute the external process in the given directory (relevant when relative input/output paths are given). Leave empty to use the current working directory. | |
verbose | Report the call command and errors via the callbacks (default: false) | |
[out] | error_string | Message to display to the user or log somewhere if something went wrong (if return != SUCCESS) |
void setCallbacks | ( | std::function< void(const String &)> | callbackStdOut, |
std::function< void(const String &)> | callbackStdErr | ||
) |
re-wire the callbacks used using run()
|
private |