Mercurial > hg > easyhg
comparison hgrunner.cpp @ 76:d575a8f76a53
* Win32 build fixes
author | Chris Cannam |
---|---|
date | Sat, 20 Nov 2010 10:11:00 +0000 |
parents | 295e3ee4a257 |
children | b522aaa2c053 |
comparison
equal
deleted
inserted
replaced
75:295e3ee4a257 | 76:d575a8f76a53 |
---|---|
27 #include <QSettings> | 27 #include <QSettings> |
28 #include <QInputDialog> | 28 #include <QInputDialog> |
29 | 29 |
30 #include <iostream> | 30 #include <iostream> |
31 #include <unistd.h> | 31 #include <unistd.h> |
32 #include <pty.h> | |
33 #include <errno.h> | 32 #include <errno.h> |
34 #include <stdio.h> | 33 #include <stdio.h> |
34 | |
35 #ifndef Q_OS_WIN32 | |
36 #include <pty.h> | |
37 #endif | |
35 | 38 |
36 HgRunner::HgRunner(QWidget * parent): QProgressBar(parent) | 39 HgRunner::HgRunner(QWidget * parent): QProgressBar(parent) |
37 { | 40 { |
38 proc = new QProcess(this); | 41 proc = new QProcess(this); |
39 | 42 |
48 | 51 |
49 stdOut.clear(); | 52 stdOut.clear(); |
50 stdErr.clear(); | 53 stdErr.clear(); |
51 | 54 |
52 procInput = 0; | 55 procInput = 0; |
56 #ifndef Q_OS_WIN32 | |
53 char name[1024]; | 57 char name[1024]; |
54 if (openpty(&ptyMasterFd, &ptySlaveFd, name, NULL, NULL)) { | 58 if (openpty(&ptyMasterFd, &ptySlaveFd, name, NULL, NULL)) { |
55 perror("openpty failed"); | 59 perror("openpty failed"); |
56 } else { | 60 } else { |
57 DEBUG << "openpty succeeded: master " << ptyMasterFd | 61 DEBUG << "openpty succeeded: master " << ptyMasterFd |
60 procInput->open(ptyMasterFd, QFile::WriteOnly); | 64 procInput->open(ptyMasterFd, QFile::WriteOnly); |
61 ptySlaveFilename = name; | 65 ptySlaveFilename = name; |
62 proc->setStandardInputFile(ptySlaveFilename); | 66 proc->setStandardInputFile(ptySlaveFilename); |
63 ::close(ptySlaveFd); | 67 ::close(ptySlaveFd); |
64 } | 68 } |
65 | 69 #endif |
66 connect(proc, SIGNAL(started()), this, SLOT(started())); | 70 connect(proc, SIGNAL(started()), this, SLOT(started())); |
67 connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), | 71 connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), |
68 this, SLOT(finished(int, QProcess::ExitStatus))); | 72 this, SLOT(finished(int, QProcess::ExitStatus))); |
69 connect(proc, SIGNAL(readyReadStandardOutput()), | 73 connect(proc, SIGNAL(readyReadStandardOutput()), |
70 this, SLOT(stdOutReady())); | 74 this, SLOT(stdOutReady())); |