OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
runner.hpp
Go to the documentation of this file.
1 #ifndef CSM_DOC_RUNNER_H
2 #define CSM_DOC_RUNNER_H
3 
4 #include <vector>
5 #include <string>
6 
7 #include <boost/filesystem/path.hpp>
8 
9 #include <QObject>
10 #include <QProcess>
11 #include <QTextDocument>
12 
14 
15 class QTemporaryFile;
16 
17 namespace CSMDoc
18 {
19  class OperationHolder;
20 
21  class Runner : public QObject
22  {
23  Q_OBJECT
24 
25  QProcess mProcess;
26  bool mRunning;
28  std::vector<std::string> mContentFiles;
29  std::string mStartupInstruction;
30  QTemporaryFile *mStartup;
31  QTextDocument mLog;
32  boost::filesystem::path mProjectPath;
33 
34  public:
35 
36  Runner (const boost::filesystem::path& projectPath);
37 
38  ~Runner();
39 
42  void start (bool delayed = false);
43 
44  void stop();
45 
48  bool isRunning() const;
49 
50  void configure (const ESM::DebugProfile& profile,
51  const std::vector<std::string>& contentFiles,
52  const std::string& startupInstruction);
53 
54  QTextDocument *getLog();
55 
56  signals:
57 
58  void runStateChanged();
59 
60  private slots:
61 
62  void finished (int exitCode, QProcess::ExitStatus exitStatus);
63 
65  };
66 
67  class Operation;
68 
70  class SaveWatcher : public QObject
71  {
72  Q_OBJECT
73 
75 
76  public:
77 
79  SaveWatcher (Runner *runner, OperationHolder *operation);
80 
81  private slots:
82 
83  void saveDone (int type, bool failed);
84  };
85 }
86 
87 #endif
void runStateChanged()
void saveDone(int type, bool failed)
Definition: runner.cpp:153
static const struct @2 signals[]
Definition: operation.hpp:22
Watch for end of save operation and restart or stop runner.
Definition: runner.hpp:70
void configure(const ESM::DebugProfile &profile, const std::vector< std::string > &contentFiles, const std::string &startupInstruction)
Definition: runner.cpp:121
boost::filesystem::path mProjectPath
Definition: runner.hpp:32
std::vector< std::string > mContentFiles
Definition: runner.hpp:28
void readyReadStandardOutput()
Definition: runner.cpp:140
QTextDocument * getLog()
Definition: runner.cpp:135
QTemporaryFile * mStartup
Definition: runner.hpp:30
ESM::DebugProfile mProfile
Definition: runner.hpp:27
void start(bool delayed=false)
Definition: runner.cpp:34
SaveWatcher(Runner *runner, OperationHolder *operation)
*this attaches itself to runner
Definition: runner.cpp:147
std::string mStartupInstruction
Definition: runner.hpp:29
~Runner()
Definition: runner.cpp:24
void stop()
Definition: runner.cpp:102
QTextDocument mLog
Definition: runner.hpp:31
Definition: debugprofile.hpp:11
QProcess mProcess
Definition: runner.hpp:25
Definition: runner.hpp:21
void finished(int exitCode, QProcess::ExitStatus exitStatus)
Definition: runner.cpp:129
Definition: operationholder.hpp:18
Runner(const boost::filesystem::path &projectPath)
Definition: runner.cpp:10
bool isRunning() const
Definition: runner.cpp:116
Runner * mRunner
Definition: runner.hpp:74
bool mRunning
Definition: runner.hpp:26