fuel-scm/Utils.h
kostas 6b470516fa 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
2012-05-12 07:56:42 +00:00

33 lines
795 B
C++

#ifndef UTILS_H
#define UTILS_H
#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);
#ifdef Q_WS_WIN
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