Chris@57: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@57: Chris@57: /* Chris@57: EasyMercurial Chris@57: Chris@57: Based on HgExplorer by Jari Korhonen Chris@57: Copyright (c) 2010 Jari Korhonen Chris@57: Copyright (c) 2010 Chris Cannam Chris@57: Copyright (c) 2010 Queen Mary, University of London Chris@57: Chris@57: This program is free software; you can redistribute it and/or Chris@57: modify it under the terms of the GNU General Public License as Chris@57: published by the Free Software Foundation; either version 2 of the Chris@57: License, or (at your option) any later version. See the file Chris@57: COPYING included with this distribution for more information. Chris@57: */ Chris@57: jtkorhonen@0: #ifndef HGRUNNER_H jtkorhonen@0: #define HGRUNNER_H jtkorhonen@0: jtkorhonen@0: #include jtkorhonen@0: #include jtkorhonen@0: #include jtkorhonen@0: #include Chris@75: #include jtkorhonen@0: jtkorhonen@0: class HgRunner : public QProgressBar jtkorhonen@0: { jtkorhonen@0: Q_OBJECT jtkorhonen@0: Chris@62: public: Chris@62: HgRunner(QWidget * parent = 0); Chris@62: ~HgRunner(); jtkorhonen@0: Chris@62: void startHgCommand(QString workingDir, QStringList params); Chris@62: void startCommand(QString command, QString workingDir, QStringList params); jtkorhonen@0: Chris@62: bool isCommandRunning(); Chris@62: void killCurrentCommand(); jtkorhonen@0: Chris@62: int getExitCode(); Chris@62: QProcess::ExitStatus getExitStatus(); jtkorhonen@0: Chris@62: void hideProgBar(); jtkorhonen@0: Chris@84: QString getOutput(); Chris@62: Chris@62: signals: Chris@62: void commandCompleted(); Chris@62: void commandFailed(); Chris@62: Chris@62: private: Chris@62: void setProcExitInfo(int procExitCode, QProcess::ExitStatus procExitStatus); Chris@62: QString getLastCommandLine(); Chris@62: void presentErrorToUser(); Chris@62: QString getHgBinaryName(); Chris@84: void closeProcInput(); Chris@75: Chris@84: void noteUsername(QString); Chris@84: void noteRealm(QString); Chris@84: void getUsername(); Chris@84: void getPassword(); Chris@84: void checkPrompts(QString); Chris@84: Chris@84: int m_ptyMasterFd; Chris@84: int m_ptySlaveFd; Chris@84: QString m_ptySlaveFilename; Chris@84: QFile *m_procInput; Chris@62: Chris@84: bool m_isRunning; Chris@84: QProcess *m_proc; Chris@84: QString m_output; Chris@84: int m_exitCode; Chris@84: QProcess::ExitStatus m_exitStatus; Chris@84: QString m_lastHgCommand; Chris@84: QString m_lastParams; Chris@84: Chris@84: QString m_userName; Chris@84: QString m_realm; Chris@62: Chris@62: private slots: Chris@62: void started(); Chris@62: void finished(int procExitCode, QProcess::ExitStatus procExitStatus); Chris@84: void dataReady(); jtkorhonen@0: }; jtkorhonen@0: jtkorhonen@0: #endif // HGRUNNER_H