# # # patch "guitone/res/i18n/guitone_de.ts" # from [b6365b945cde49d6f477e28405783a57b8a15a31] # to [10ac88a1778d3080da3364fb948d06be4a4b4906] # # patch "guitone/src/monotone/Monotone.cpp" # from [a7cdd9c87a67de047fabe2a507a87f42c3f2c37a] # to [6aa87a271c6973377edec63d7b7a05a1f816707e] # # patch "guitone/src/util/DiffParser.cpp" # from [ed56182851ef14f4fbde1066ab48691fb5459b33] # to [dc159c08bc6acc00ce10529aeb1152a92fd09913] # # patch "guitone/src/util/SignalWaiter.cpp" # from [be5421eb7c7ffb705b73ed2fbe4743e2faa41eca] # to [4fe4a08a5d27f559e572c691812520ff11425e71] # # patch "guitone/src/util/SignalWaiter.h" # from [dddf95284e9e1e44a6f4b0732ecabfa49edb06ff] # to [d56a5f9d80726c5cae3a791fc59ce8d5186be75b] # ============================================================ --- guitone/res/i18n/guitone_de.ts b6365b945cde49d6f477e28405783a57b8a15a31 +++ guitone/res/i18n/guitone_de.ts 10ac88a1778d3080da3364fb948d06be4a4b4906 @@ -907,7 +907,7 @@ Sie können zum Arbeitsbereich-Modus jed Monotone - + The monotone process exited unexpectedly (process error %1). Please reconfigure the path to the monotone binary in the Preferences dialog or check if the version of the database you try to load matches the monotone version you are using. monotone returned: @@ -918,7 +918,7 @@ monotone gab zurück: %2 - + The monotone process exited unexpectedly (return code %1). Please reconfigure the path to the monotone binary in the Preferences dialog or check if the version of the database you try to load matches the monotone version you are using. monotone returned: ============================================================ --- guitone/src/monotone/Monotone.cpp a7cdd9c87a67de047fabe2a507a87f42c3f2c37a +++ guitone/src/monotone/Monotone.cpp 6aa87a271c6973377edec63d7b7a05a1f816707e @@ -337,26 +337,25 @@ bool Monotone::executeCommand(const QStr { return false; } - - SignalWaiter waiter(process, SIGNAL(readyReadStandardOutput())); writeStdin(command, options); - while (waiter.wait(1000)) + bool parsed; + SignalWaiter waiter(process, SIGNAL(readyRead())); + + do { + waiter.wait(500); + // check if we already could parse the complete stdio output - if (!readAndParseStdout(retCode)) - { + parsed = readAndParseStdout(retCode); + qDebug("parsed: %d", parsed); + if (!parsed) qWarning("Monotone::executeCommand: Contents incomplete/invalid."); - continue; - } - - // parsing successful - return true; } + while (!parsed); - qWarning("Monotone::executeCommand: Timed out waiting for output."); - return false; + return true; } bool Monotone::triggerCommand(const QStringList & command) @@ -437,7 +436,7 @@ void Monotone::readAndProcessCommand() emit commandFinished(retCode); disconnect( - process, SIGNAL(readyReadStandardOutput()), + process, SIGNAL(readyRead()), this, SLOT(readAndProcessCommand()) ); } ============================================================ --- guitone/src/util/DiffParser.cpp ed56182851ef14f4fbde1066ab48691fb5459b33 +++ guitone/src/util/DiffParser.cpp dc159c08bc6acc00ce10529aeb1152a92fd09913 @@ -73,7 +73,7 @@ void DiffParser::parse(const QString & i else { // then this should be a normal file diff - rx = QRegExp("^---\\s(.+)\\s+\\w{40}"); + rx = QRegExp("^---\\s([^\\t]+)\\t\\w{40}"); Q_ASSERT(rx.indexIn(nextGroup) > -1); curFile = rx.cap(1); curDiff->is_binary = false; ============================================================ --- guitone/src/util/SignalWaiter.cpp be5421eb7c7ffb705b73ed2fbe4743e2faa41eca +++ guitone/src/util/SignalWaiter.cpp 4fe4a08a5d27f559e572c691812520ff11425e71 @@ -20,34 +20,51 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "SignalWaiter.h" +#include "signalwaiter.h" #include -#include -#include +#include -SignalWaiter::SignalWaiter(const QObject* sender, const char* signal) : QObject(0) { - obj = sender; - sig = signal; +SignalWaiter::SignalWaiter(const QObject* sender, const char* signal) + : QObject(0) +{ + Q_ASSERT(sender && signal); + connect(sender, signal, this, SLOT(signalCaught())); } // Returns true if the signal was caught, returns false if the wait timed out -bool SignalWaiter::wait(int msec, const QObject* sender, const char* signal) { - if(sender!=0 && signal!=0) connect(sender, signal, this, SLOT(signalCaught())); - else if(obj!=0 && sig!=0) connect(obj, sig, this, SLOT(signalCaught())); - else if(msec == -1) return false; - // There would be an else clause here, except you can use this to idle for a specified amount of time - - if(msec!=-1) QTimer::singleShot(msec, this, SLOT(timedOut())); - ready = timeout = false; - while(!ready && !timeout) QCoreApplication::processEvents(); - return ready || !timeout; +static bool SignalWaiter::wait(const QObject* sender, const char* signal, int msec) +{ + SignalWaiter w(sender, signal); + return w.wait(msec); } -void SignalWaiter::signalCaught() { +void SignalWaiter::signalCaught() +{ ready = true; } -void SignalWaiter::timedOut() { +void SignalWaiter::timerEvent(QTimerEvent* event) +{ + killTimer(); timeout = true; } +// Returns true if the signal was caught, returns false if the wait timed out +bool SignalWaiter::wait(int msec) +{ + // Check input parameters + if (msec < -1) return false; + + // activate the timeout + if (msec != -1) startTimer(msec); + + // Begin waiting + ready = timeout = false; + while (!ready && !timeout) + QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); + + // Clean up and return status + killTimer(); + return ready || !timeout; +} + ============================================================ --- guitone/src/util/SignalWaiter.h dddf95284e9e1e44a6f4b0732ecabfa49edb06ff +++ guitone/src/util/SignalWaiter.h d56a5f9d80726c5cae3a791fc59ce8d5186be75b @@ -20,23 +20,26 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef QSIGNALWAITER_H -#define QSIGNALWAITER_H +#ifndef SIGNALWAITER_H +#define SIGNALWAITER_H #include +class QTimerEvent; -class SignalWaiter : public QObject { +class SignalWaiter : public QObject +{ Q_OBJECT public: - SignalWaiter(const QObject* sender = 0, const char* signal = 0); - bool wait(int msec = -1, const QObject* sender = 0, const char* signal = 0); + QxtSignalWaiter(const QObject* sender, const char* signal); + static bool wait(const QObject* sender, const char* signal, int msec = -1); + bool wait(int msec = -1); +protected: + void timerEvent(QTimerEvent* event); private slots: void signalCaught(); - void timedOut(); private: - const QObject* obj; - const char* sig; bool ready, timeout; }; #endif +