comparison src/hgrunner.h @ 370:b9c153e00e84

Move source files to src/
author Chris Cannam
date Thu, 24 Mar 2011 10:27:51 +0000
parents hgrunner.h@8fd71f570884
children c567fed39559
comparison
equal deleted inserted replaced
369:19cce6d2c470 370:b9c153e00e84
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 EasyMercurial
5
6 Based on HgExplorer by Jari Korhonen
7 Copyright (c) 2010 Jari Korhonen
8 Copyright (c) 2011 Chris Cannam
9 Copyright (c) 2011 Queen Mary, University of London
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 */
17
18 #ifndef HGRUNNER_H
19 #define HGRUNNER_H
20
21 #include "hgaction.h"
22
23 #include <QProgressBar>
24 #include <QProcess>
25 #include <QByteArray>
26 #include <QRect>
27 #include <QFile>
28
29 #include <deque>
30
31 class HgRunner : public QProgressBar
32 {
33 Q_OBJECT
34
35 public:
36 HgRunner(QString myDirPath, QWidget * parent = 0);
37 ~HgRunner();
38
39 void requestAction(HgAction action);
40 void killCurrentActions(); // kill anything running; clear the queue
41
42 signals:
43 void commandStarting(HgAction action);
44 void commandCompleted(HgAction action, QString stdOut);
45 void commandFailed(HgAction action, QString stdErr);
46
47 private slots:
48 void started();
49 void error(QProcess::ProcessError);
50 void finished(int procExitCode, QProcess::ExitStatus procExitStatus);
51 void dataReadyStdout();
52 void dataReadyStderr();
53 void dataReadyPty();
54
55 private:
56 void checkQueue();
57 void startCommand(HgAction action);
58 void closeProcInput();
59 void killCurrentCommand();
60
61 void noteUsername(QString);
62 void noteRealm(QString);
63 void getUsername();
64 void getPassword();
65 bool checkPrompts(QString);
66
67 void openTerminal();
68 void closeTerminal();
69
70 QString getHgBinaryName();
71 QString getExtensionLocation();
72
73 QString getUnbundledFileName();
74 QString unbundleExtension();
75
76 int m_ptyMasterFd;
77 int m_ptySlaveFd;
78 QString m_ptySlaveFilename;
79 QFile *m_ptyFile;
80
81 bool m_isRunning;
82 QProcess *m_proc;
83 QString m_stdout;
84 QString m_stderr;
85
86 QString m_userName;
87 QString m_realm;
88
89 QString m_myDirPath;
90 QString m_extensionPath;
91
92 typedef std::deque<HgAction> ActionQueue;
93 ActionQueue m_queue;
94 HgAction m_currentAction;
95 };
96
97 #endif // HGRUNNER_H