📄 qappexec.h
字号:
/*************************************************************************** * Copyright (C) 2007 by Motorola Commnunity around the World * * lahu3672@googlemail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/#ifndef QAPPEXEC_H#define QAPPEXEC_H#include <sys/types.h>#include <unistd.h>#include <qobject.h>#include <qarray.h>#include <qqueue.h>#include <qthread.h>#include <qarray.h>#include <qstring.h>#include <pty.h>#include <signal.h>#include <sys/wait.h>#include <errno.h>#include <qcopchannel_qws.h>#include <sys/ioctl.h>#define BUFSIZE 4096class QFdListener;class QFdManager: public QObject{ Q_OBJECT friend class QFdListener; public: QFdManager(QObject *parent, const char *name); virtual ~QFdManager(); protected: virtual QArray<int> *fdsToRead() = 0; virtual void fdIsReady(int fd) = 0;};class QFdListener: public QThread{ public: QFdListener(QFdManager *m); ~QFdListener(); void stop(); protected: virtual void run(); private: bool started; QFdManager *m; };class QAppExec:public QFdManager{ Q_OBJECT public: QAppExec(const QString &appname, char *const *args, QObject *parent = 0, const char *name = 0); virtual ~QAppExec(); void start(); void stop(); uint size(); void readBlock(QByteArray &arr); void writeBlock(const QByteArray &arr); bool running(); void setSize(struct winsize *ws); protected: virtual QArray<int> *fdsToRead(); virtual void fdIsReady(int fd); private: pid_t child_pid; int pty; QString path; char *const *args; QArray<int> *rd; QFdListener *fdl; QByteArray *buf; QQueue<QByteArray> data; signals: void readyRead(); void stopped();};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -