MorphoGraphX
ProcessThread.hpp
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef PROCESSTHREAD_HPP
12 #define PROCESSTHREAD_HPP
13 
14 #include <Process.hpp>
15 
16 #include <QEvent>
17 #include <QMutex>
18 #include <QThread>
19 
20 namespace mgx {
21  struct mgx_EXPORT ProcessUpdateViewEvent : public QEvent
22  {
23  ProcessUpdateViewEvent() : QEvent(QEvent::User) {}
24  };
25 
26  struct mgx_EXPORT ProcessSystemCommand : public QEvent {
27  ProcessSystemCommand(process::Process* p, process::SystemCommand cmd, const QStringList& prms)
28  : QEvent(QEvent::User), process(p), command(cmd), parms(prms) {}
29 
31  process::SystemCommand command;
32  const QStringList& parms;
33  };
34 
35  class mgx_EXPORT ProcessThread : public QThread {
36  Q_OBJECT
37  public:
38  ProcessThread(process::Process* proc, const QStringList& prms, QObject* parent)
39  : QThread(parent), process(proc), parms(prms) {}
40 
41  virtual ~ProcessThread() {}
42 
43  void run();
44 
45  bool exitStatus() const
46  {
47  return _status;
48  }
49  QString errorMessage() const
50  {
51  return _error;
52  }
53  QString warningMessage() const
54  {
55  return _warning;
56  }
57 
58  protected:
60  QStringList parms;
61  bool _status;
62  QString _error, _warning;
63  };
64 }
65 #endif
Definition: ProcessThread.hpp:21
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
Definition: ProcessThread.hpp:35
File containing the definition of a Process.
This is the main process class, the one all process inherit from.
Definition: Process.hpp:258
This namespace contains all the classes needed to define processes.
Definition: ProcessThread.hpp:26