Fixed issue on OSX where the QProcess was terminating without providing all the fossil output.

Corrected handling of new-lines in fossil output on OSX.
The update command now logs only the actual update output from fossil.
The log cursor is now repositioned to the end before any text is appended.
Fixed minor static analysis warnings.


FossilOrigin-Name: 4db466899df13050ac14c60097286f1df3adc46f
This commit is contained in:
kostas
2012-05-12 07:56:42 +00:00
parent cb9fa1a754
commit 6b470516fa
6 changed files with 80 additions and 38 deletions

19
Utils.h
View File

@@ -3,6 +3,8 @@
#include <QString>
#include <QMessageBox>
#include <QProcess>
#include <QMutex>
QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, const QString &query, QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No);
@@ -10,4 +12,21 @@ QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, c
bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint);
#endif
class QLoggedProcess : public QProcess
{
Q_OBJECT
public:
explicit QLoggedProcess(QObject *parent = 0);
void getLogAndClear(QByteArray &buffer);
bool isLogEmpty() const { return log.isEmpty(); }
qint64 logBytesAvailable() const { return log.size(); }
private slots:
void onReadyReadStandardOutput();
private:
QMutex mutex;
QByteArray log;
};
#endif // UTILS_H