Fixed onAppendText() and onReplaceLast():

Watch out for special suffixes.
This commit is contained in:
Gerhard Hoffmann 2023-08-07 13:59:44 +02:00
parent 6d43cf4c9f
commit cdb045b72b

View File

@ -97,7 +97,7 @@ void MainWindow::customEvent(QEvent *event) {
m_progressValue = progress;
ui->updateProgress->setValue(progress/10);
QApplication::postEvent(this, new ProgressEvent(this, progress+10));
QThread::msleep(100);
QThread::msleep(150);
}
}
}
@ -147,9 +147,12 @@ void MainWindow::onQuit() {
void MainWindow::onAppendText(QString text, QString suffix) {
QString editText = ui->updateStatus->toPlainText();
if (suffix.size() > 0) {
editText += QString("\n").leftJustified(m_width-3, '=');
editText += " ";
if (!suffix.isNull() && suffix.size() > 0) {
qInfo() << "TEXT" << text << "SUFFIX" << suffix;
if (suffix == Worker::UPDATE_STEP_SUCCESS || suffix == Worker::UPDATE_STEP_FAIL) {
editText += QString("\n").leftJustified(m_width-3, '=');
editText += " ";
}
editText += (QString("\n") + text).leftJustified(m_width - (2 + suffix.size()) ) + suffix;
} else {
editText += text.leftJustified(m_width-9);