[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
src/klfbackend/klfblockprocess.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfblockprocess.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2011 by Philippe Faist
00005  *   philippe.faist@bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id$ */
00023 
00024 #ifndef KLFBLOCKPROCESS_H
00025 #define KLFBLOCKPROCESS_H
00026 
00028 
00032 #include <klfdefs.h>
00033 
00034 #include <QProcess>
00035 #include <QString>
00036 #include <QByteArray>
00037 
00038 
00040 
00056 class KLF_EXPORT KLFBlockProcess : public QProcess
00057 {
00058   Q_OBJECT
00059 public:
00061   KLFBlockProcess(QObject *parent = 0);
00063   ~KLFBlockProcess();
00064 
00068   inline void setProcessAppEvents(bool processAppEvents) { mProcessAppEvents = processAppEvents; }
00069 
00072   QByteArray getAllStderr() {
00073     return readAllStandardError();
00074   }
00075 
00078   QByteArray getAllStdout() {
00079     return readAllStandardOutput();
00080   }
00081 
00083   bool processNormalExit() const {
00084     return QProcess::exitStatus() == NormalExit;
00085   }
00086 
00088   int processExitStatus() const {
00089     return exitCode();
00090   }
00091 
00092   // detect python, shell, etc. interpreters using some standard paths
00093   static QString detectInterpreterPath(const QString& interp,
00094                                        const QStringList & addpaths = QStringList());
00095 
00096 
00108   virtual QString getInterpreterPath(const QString& ext);
00109 
00110 public slots:
00120   bool startProcess(QStringList cmd, QByteArray stdindata, QStringList env = QStringList());
00121 
00125   bool startProcess(QStringList cmd, QStringList env = QStringList());
00126 
00128   QString readStderrString() {
00129     return QString::fromLocal8Bit(getAllStderr());
00130   }
00132   QString readStdoutString() {
00133     return QString::fromLocal8Bit(getAllStdout());
00134   }
00135 
00136 
00137 private slots:
00138   void ourProcExited();
00139   void ourProcGotOurStdinData();
00140 
00141 private:
00142   int _runstatus;
00143   bool mProcessAppEvents;
00144 };
00145 
00146 
00147 
00148 #endif

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net