annotate hgrunner.h @ 89:622da79c0f4f

* A bit more work on new Work (file status) widget
author Chris Cannam
date Tue, 23 Nov 2010 14:49:13 +0000
parents 8a4e26dc3182
children fdca34c989c0
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@57 6 Based on HgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@57 8 Copyright (c) 2010 Chris Cannam
Chris@57 9 Copyright (c) 2010 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
Chris@57 17
jtkorhonen@0 18 #ifndef HGRUNNER_H
jtkorhonen@0 19 #define HGRUNNER_H
jtkorhonen@0 20
jtkorhonen@0 21 #include <QProgressBar>
jtkorhonen@0 22 #include <QProcess>
jtkorhonen@0 23 #include <QByteArray>
jtkorhonen@0 24 #include <QRect>
Chris@75 25 #include <QFile>
jtkorhonen@0 26
jtkorhonen@0 27 class HgRunner : public QProgressBar
jtkorhonen@0 28 {
jtkorhonen@0 29 Q_OBJECT
jtkorhonen@0 30
Chris@62 31 public:
Chris@62 32 HgRunner(QWidget * parent = 0);
Chris@62 33 ~HgRunner();
jtkorhonen@0 34
Chris@62 35 void startHgCommand(QString workingDir, QStringList params);
Chris@62 36 void startCommand(QString command, QString workingDir, QStringList params);
jtkorhonen@0 37
Chris@62 38 bool isCommandRunning();
Chris@62 39 void killCurrentCommand();
jtkorhonen@0 40
Chris@62 41 int getExitCode();
Chris@62 42 QProcess::ExitStatus getExitStatus();
jtkorhonen@0 43
Chris@62 44 void hideProgBar();
jtkorhonen@0 45
Chris@84 46 QString getOutput();
Chris@62 47
Chris@62 48 signals:
Chris@62 49 void commandCompleted();
Chris@62 50 void commandFailed();
Chris@62 51
Chris@62 52 private:
Chris@62 53 void setProcExitInfo(int procExitCode, QProcess::ExitStatus procExitStatus);
Chris@62 54 QString getLastCommandLine();
Chris@62 55 void presentErrorToUser();
Chris@62 56 QString getHgBinaryName();
Chris@84 57 void closeProcInput();
Chris@75 58
Chris@84 59 void noteUsername(QString);
Chris@84 60 void noteRealm(QString);
Chris@84 61 void getUsername();
Chris@84 62 void getPassword();
Chris@84 63 void checkPrompts(QString);
Chris@84 64
Chris@84 65 int m_ptyMasterFd;
Chris@84 66 int m_ptySlaveFd;
Chris@84 67 QString m_ptySlaveFilename;
Chris@84 68 QFile *m_procInput;
Chris@62 69
Chris@84 70 bool m_isRunning;
Chris@84 71 QProcess *m_proc;
Chris@84 72 QString m_output;
Chris@84 73 int m_exitCode;
Chris@84 74 QProcess::ExitStatus m_exitStatus;
Chris@84 75 QString m_lastHgCommand;
Chris@84 76 QString m_lastParams;
Chris@84 77
Chris@84 78 QString m_userName;
Chris@84 79 QString m_realm;
Chris@62 80
Chris@62 81 private slots:
Chris@62 82 void started();
Chris@62 83 void finished(int procExitCode, QProcess::ExitStatus procExitStatus);
Chris@84 84 void dataReady();
jtkorhonen@0 85 };
jtkorhonen@0 86
jtkorhonen@0 87 #endif // HGRUNNER_H