summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-13 00:45:49 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-13 00:45:49 -0500
commita837ea28e986c8e2f49c470d647cd63f89cf8254 (patch)
tree95dbf6db4dbcb37523c3e6e99a05615ee6be8546 /ui
parentf2c20d3ad7103758eddfb080b54e10691ea61132 (diff)
downloadhorizon-a837ea28e986c8e2f49c470d647cd63f89cf8254.tar.gz
horizon-a837ea28e986c8e2f49c470d647cd63f89cf8254.tar.bz2
horizon-a837ea28e986c8e2f49c470d647cd63f89cf8254.tar.xz
horizon-a837ea28e986c8e2f49c470d647cd63f89cf8254.zip
Qt UI: Execute: Use message buffer; flush log file
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/runner/executepage.cc17
-rw-r--r--ui/qt5/runner/executepage.hh3
2 files changed, 19 insertions, 1 deletions
diff --git a/ui/qt5/runner/executepage.cc b/ui/qt5/runner/executepage.cc
index d5788df..7567597 100644
--- a/ui/qt5/runner/executepage.cc
+++ b/ui/qt5/runner/executepage.cc
@@ -94,7 +94,21 @@ void ExecutePage::executorReady() {
QByteArray msgs = executor->readAllStandardError();
log.write(msgs);
- QStringList msgList = QString::fromUtf8(msgs).split("\n");
+ msgBuffer.append(msgs);
+ processMessages();
+}
+
+void ExecutePage::processMessages() {
+ QByteArray ready;
+
+ /* No message is ready yet. */
+ if(!msgBuffer.contains('\n')) return;
+
+ int len = msgBuffer.lastIndexOf('\n');
+ ready = msgBuffer.left(len);
+ msgBuffer.remove(0, len + 1);
+
+ QStringList msgList = QString::fromUtf8(ready).split("\n");
for(auto &msg : msgList) {
QString msgType = msg.section('\t', 1, 1);
if(msgType == "step-start") {
@@ -125,6 +139,7 @@ void ExecutePage::executorFinished(int code, QProcess::ExitStatus status) {
markFailed(this->current);
}
+ log.flush();
wizard()->button(QWizard::CancelButton)->setEnabled(false);
finishTimer->start();
}
diff --git a/ui/qt5/runner/executepage.hh b/ui/qt5/runner/executepage.hh
index 32987e7..77b3219 100644
--- a/ui/qt5/runner/executepage.hh
+++ b/ui/qt5/runner/executepage.hh
@@ -42,6 +42,7 @@ private:
QProcess *executor;
QTimer *finishTimer;
QFile log;
+ QByteArray msgBuffer;
Phase current;
bool failed;
@@ -51,6 +52,8 @@ private:
void markFinished(Phase phase);
void markFailed(Phase phase);
+ void processMessages();
+
void executorReady();
void executorOutReady();
void executorErrored(QProcess::ProcessError what);