[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfblockprocess.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfblockprocess.h
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2011 by Philippe Faist
5  * philippe.faist@bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id: klfblockprocess.h 969 2016-12-29 07:44:24Z phfaist $ */
23 
24 #ifndef KLFBLOCKPROCESS_H
25 #define KLFBLOCKPROCESS_H
26 
28 
32 #include <klfdefs.h>
33 
34 #include <QProcess>
35 #include <QString>
36 #include <QByteArray>
37 
38 
40 
57 {
58  Q_OBJECT
59 public:
61  KLFBlockProcess(QObject *parent = 0);
63  ~KLFBlockProcess();
64 
68  inline void setProcessAppEvents(bool processAppEvents) { mProcessAppEvents = processAppEvents; }
69 
73  return readAllStandardError();
74  }
75 
79  return readAllStandardOutput();
80  }
81 
83  bool processNormalExit() const {
84  return QProcess::exitStatus() == NormalExit;
85  }
86 
88  int processExitStatus() const {
89  return exitCode();
90  }
91 
92  // detect python, shell, etc. interpreters using some standard paths
93  static QString detectInterpreterPath(const QString& interp,
94  const QStringList & addpaths = QStringList());
95 
96 
108  virtual QString getInterpreterPath(const QString& ext);
109 
110 public slots:
120  bool startProcess(QStringList cmd, QByteArray stdindata, QStringList env = QStringList());
121 
125  bool startProcess(QStringList cmd, QStringList env = QStringList());
126 
129  return QString::fromLocal8Bit(getAllStderr());
130  }
133  return QString::fromLocal8Bit(getAllStdout());
134  }
135 
136 
137 private slots:
138  void ourProcExited();
139  void ourProcGotOurStdinData();
140 
141 private:
142  int _runstatus;
143  bool mProcessAppEvents;
144 };
145 
146 
147 
148 #endif
QString readStdoutString()
void setProcessAppEvents(bool processAppEvents)
A QProcess subclass for code-blocking process execution.
bool processNormalExit() const
QString fromLocal8Bit(const char *str, int size)
#define KLF_EXPORT
QString readStderrString()
QByteArray getAllStderr()
int processExitStatus() const
QByteArray readAllStandardOutput()
QProcess::ExitStatus exitStatus() const
int exitCode() const
QByteArray readAllStandardError()
QByteArray getAllStdout()

Generated by doxygen 1.8.13