annotate src/hgrunner.h @ 682:751b21af6b6f

Work around font mis-hinting when scaled on Windows
author Chris Cannam
date Fri, 07 Dec 2018 14:29:23 +0000
parents ae67ea0af696
children 5b3bcb2d0943
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@644 8 Copyright (c) 2013 Chris Cannam
Chris@644 9 Copyright (c) 2013 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
Chris@109 21 #include "hgaction.h"
Chris@109 22
Chris@561 23 #include <QWidget>
jtkorhonen@0 24 #include <QProcess>
Chris@561 25
Chris@561 26 class QProgressBar;
Chris@571 27 class QPushButton;
Chris@561 28 class QFile;
jtkorhonen@0 29
Chris@109 30 #include <deque>
Chris@109 31
Chris@561 32 class HgRunner : public QWidget
jtkorhonen@0 33 {
jtkorhonen@0 34 Q_OBJECT
jtkorhonen@0 35
Chris@62 36 public:
Chris@561 37 HgRunner(QString myDirPath, QWidget *parent = 0);
Chris@62 38 ~HgRunner();
jtkorhonen@0 39
Chris@561 40 public slots:
Chris@109 41 void requestAction(HgAction action);
Chris@182 42 void killCurrentActions(); // kill anything running; clear the queue
jtkorhonen@0 43
Chris@109 44 signals:
Chris@238 45 void commandStarting(HgAction action);
Chris@142 46 void commandCompleted(HgAction action, QString stdOut);
Chris@537 47 void commandFailed(HgAction action, QString stdErr, QString stdOut);
jtkorhonen@0 48
Chris@564 49 /**
Chris@564 50 * Emitted when the currently executing command is cancelled. Note
Chris@564 51 * that this clears the queue completely, so all subsequent
Chris@564 52 * commands are also discarded.
Chris@564 53 */
Chris@564 54 void commandCancelled(HgAction action);
Chris@564 55
Chris@109 56 private slots:
Chris@109 57 void started();
Chris@189 58 void error(QProcess::ProcessError);
Chris@109 59 void finished(int procExitCode, QProcess::ExitStatus procExitStatus);
Chris@110 60 void dataReadyStdout();
Chris@110 61 void dataReadyStderr();
Chris@113 62 void dataReadyPty();
Chris@62 63
Chris@62 64 private:
Chris@109 65 void checkQueue();
Chris@109 66 void startCommand(HgAction action);
Chris@84 67 void closeProcInput();
Chris@109 68 void killCurrentCommand();
Chris@75 69
Chris@84 70 void noteUsername(QString);
Chris@84 71 void noteRealm(QString);
Chris@84 72 void getUsername();
Chris@84 73 void getPassword();
Chris@113 74 bool checkPrompts(QString);
Chris@84 75
Chris@111 76 void openTerminal();
Chris@111 77 void closeTerminal();
chris@406 78
Chris@239 79 QString getHgBinaryName();
chris@406 80 QString getSshBinaryName();
Chris@239 81 QString getExtensionLocation();
Chris@239 82
Chris@455 83 QString getAuthFilePath();
Chris@455 84 QString getAuthKey();
Chris@455 85 void pruneOldAuthFiles();
Chris@455 86
Chris@188 87 QString getUnbundledFileName();
Chris@180 88 QString unbundleExtension();
Chris@161 89
Chris@561 90 QProgressBar *m_progress;
Chris@571 91 QPushButton *m_cancel;
Chris@561 92
Chris@605 93 HgAction expandEnvironment(HgAction);
Chris@444 94 QStringList addExtensionOptions(QStringList);
Chris@444 95
Chris@84 96 int m_ptyMasterFd;
Chris@84 97 int m_ptySlaveFd;
Chris@84 98 QString m_ptySlaveFilename;
Chris@113 99 QFile *m_ptyFile;
Chris@62 100
Chris@84 101 bool m_isRunning;
Chris@84 102 QProcess *m_proc;
Chris@110 103 QString m_stdout;
Chris@110 104 QString m_stderr;
Chris@84 105
Chris@84 106 QString m_userName;
Chris@84 107 QString m_realm;
Chris@172 108
Chris@172 109 QString m_myDirPath;
Chris@161 110 QString m_extensionPath;
Chris@62 111
Chris@444 112 QString m_authKey;
Chris@444 113 QString m_authFilePath;
Chris@444 114
Chris@109 115 typedef std::deque<HgAction> ActionQueue;
Chris@109 116 ActionQueue m_queue;
Chris@109 117 HgAction m_currentAction;
jtkorhonen@0 118 };
jtkorhonen@0 119
jtkorhonen@0 120 #endif // HGRUNNER_H