File indexing completed on 2024-05-12 05:44:25
0001 /*************************************************************************** 0002 * Copyright (C) 2008 by Rajko Albrecht * 0003 * ral@alwins-world.de * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0019 ***************************************************************************/ 0020 #include <kprocess.h> 0021 0022 #ifndef WATCHEDPROCESS_H 0023 #define WATCHEDPROCESS_H 0024 0025 class ProcessData; 0026 0027 class WatchedProcess : public KProcess 0028 { 0029 Q_OBJECT 0030 public: 0031 explicit WatchedProcess(QObject *parent = nullptr); 0032 ~WatchedProcess() override; 0033 0034 void appendTempFile(const QString &); 0035 void appendTempDir(const QString &); 0036 void setAutoDelete(bool); 0037 bool autoDelete() const; 0038 0039 private: 0040 ProcessData *m_Data; 0041 0042 protected Q_SLOTS: 0043 void slotError(QProcess::ProcessError); 0044 void slotFinished(int, QProcess::ExitStatus); 0045 void slotReadyReadStandardError(); 0046 void slotReadyReadStandardOutput(); 0047 void slotStarted(); 0048 void slotStateChanged(QProcess::ProcessState); 0049 0050 Q_SIGNALS: 0051 void dataStderrRead(const QByteArray &, WatchedProcess *); 0052 void dataStdoutRead(const QByteArray &, WatchedProcess *); 0053 0054 void error(QProcess::ProcessError, WatchedProcess *); 0055 void finished(int, QProcess::ExitStatus, WatchedProcess *); 0056 void started(WatchedProcess *); 0057 void stateChanged(QProcess::ProcessState newState, WatchedProcess *); 0058 }; 0059 0060 #endif