diff --git a/UpdatePTUDevCtrl/process/update_dc_command.cpp b/UpdatePTUDevCtrl/process/update_dc_command.cpp index dba1c3e..241812f 100644 --- a/UpdatePTUDevCtrl/process/update_dc_command.cpp +++ b/UpdatePTUDevCtrl/process/update_dc_command.cpp @@ -21,13 +21,45 @@ void UpdateDCCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) { void UpdateDCCommand::readyReadStandardOutput() { QProcess *p = (QProcess *)sender(); if (p) { - QString s = p->readAllStandardOutput(); - - // TODO Worker *w = worker(); if (w) { - // static constexpr const char *UPDATE_DC_FIRMARE_SUCCESS"success"}; - emit w->showUpdateDCFirmware(UpdateCommand::UPDATE_DC_FIRMARE_SUCCESS); + QString s = p->readAllStandardOutput(); + int i = -1; + if ((i = s.indexOf("")) != -1) { + s = s.mid(i+12).trimmed(); + if ((i = s.indexOf("\"")) != -1) { + s = s.mid(i+1); + if ((i = s.indexOf("\"")) != -1) { + s = s.mid(0, i).trimmed(); + } + } + // emit w->showDcDownload(s); + } else + if ((i = s.indexOf("")) != -1) { + bool ok; + int v = s.mid(i+13).trimmed().toInt(&ok); + if (ok) { + emit w->setDcDownloadProgress(v); + emit w->insertText(s.mid(0,i) + "\n"); + } + } else + if ((i = s.indexOf("")) != -1) { + emit w->showUpdateDCFirmware(internal::UPDATE_DC_FIRMARE_SUCCESS); + // QThread::sleep(3); + // emit w->summary(); + // qApp->exit(0); + } else + if ((i = s.indexOf("")) != -1) { + // TODO + emit w->summary(); + } else + if ((i = s.indexOf("")) != -1) { + emit w->summary(); + //qApp->exit(-1); + } else { + emit w->insertText(s); + } + m_commandResult += s; } } }