diff options
author | Claudio Maradonna <penguyman@stronzi.org> | 2018-07-24 01:26:22 +0200 |
---|---|---|
committer | Claudio Maradonna <penguyman@stronzi.org> | 2018-07-24 01:26:22 +0200 |
commit | 094967fb68c0350d6234cd9374bf24748d7f4133 (patch) | |
tree | d6df6569754661cce1882e5aa73873383acadbac /src/executor.cpp | |
parent | 9ff9147be35f498ec33e42f44a7aa66f9274524e (diff) |
Now qDebug enable only if QT_DEBUG is defined. Trying to refactoring MainWindow - QtPass class should handle connecctions and business logic
Diffstat (limited to 'src/executor.cpp')
-rw-r--r-- | src/executor.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/executor.cpp b/src/executor.cpp index 64abb664..3af033dd 100644 --- a/src/executor.cpp +++ b/src/executor.cpp @@ -1,9 +1,12 @@ #include "executor.h" -#include "debughelper.h" #include <QCoreApplication> #include <QDir> #include <QTextCodec> +#ifdef QT_DEBUG +#include "debughelper.h" +#endif + /** * @brief Executor::Executor executes external applications * @param parent @@ -32,8 +35,11 @@ void Executor::executeNext() { if (!i.input.isEmpty()) { m_process.waitForStarted(-1); QByteArray data = i.input.toUtf8(); - if (m_process.write(data) != data.length()) - dbg() << "Not all data written to process:" << i.id << " " << i.app; + if (m_process.write(data) != data.length()) { +#ifdef QT_DEBUG + dbg() << "Not all data written to process:" << i.id << " " << i.app; +#endif + } } m_process.closeWriteChannel(); } @@ -100,7 +106,9 @@ void Executor::execute(int id, const QString &workDir, const QString &app, // This will result in bogus "QProcess::FailedToStart" messages, // also hiding legitimate errors from the gpg commands. if (app.isEmpty()) { - dbg() << "Trying to execute nothing..."; +#ifdef QT_DEBUG + dbg() << "Trying to execute nothing..."; +#endif return; } QString appPath = @@ -131,7 +139,9 @@ int Executor::executeBlocking(QString app, const QStringList &args, QByteArray data = input.toUtf8(); internal.waitForStarted(-1); if (internal.write(data) != data.length()) { - dbg() << "Not all input written:" << app; +#ifdef QT_DEBUG + dbg() << "Not all input written:" << app; +#endif } internal.closeWriteChannel(); } @@ -200,8 +210,11 @@ void Executor::finished(int exitCode, QProcess::ExitStatus exitStatus) { output = codec->toUnicode(m_process.readAllStandardOutput()); if (i.readStderr or exitCode != 0) { err = codec->toUnicode(m_process.readAllStandardError()); - if (exitCode != 0) - dbg() << exitCode << err; + if (exitCode != 0) { +#ifdef QT_DEBUG + dbg() << exitCode << err; +#endif + } } emit finished(i.id, exitCode, output, err); } |