From 64dce44fe12ce42e44061d1ec718631d053ece97 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Sat, 9 Sep 2023 14:40:43 +0200 Subject: [PATCH] Move update-object into main window. Activate using ISMAS WAIT button. --- worker.cpp | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/worker.cpp b/worker.cpp index 6a5c050..3f8582f 100644 --- a/worker.cpp +++ b/worker.cpp @@ -55,7 +55,6 @@ Worker::Worker(int customerNr, , m_parent(parent) , m_serialInterface(serialInterface) , m_baudrate(baudrate) - , m_update(nullptr) , m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this) , m_osVersion(getOsVersion()) , m_atbqtVersion(getATBQTVersion()) @@ -73,8 +72,10 @@ Worker::Worker(int customerNr, , m_updateProcessRunning(true) , m_returnCode(0) , m_progressValue(0) - , m_withoutIsmasDirectPort(true) /* useful for testing */ { + //, m_withoutIsmasDirectPort(true) /* useful for testing */ { + , m_withoutIsmasDirectPort(false) /* useful for testing */ { + this->setObjectName("worker-object"); QDir::setCurrent(m_workingDirectory); // restart apism to make sure it is running ? @@ -126,9 +127,6 @@ Worker::~Worker() { } } } - if (m_update) { - delete m_update; - } } void Worker::setProgress(int progress) { @@ -798,7 +796,6 @@ bool Worker::filesToUpdate() { bool Worker::updateFiles(quint8 percent) { QStringList filesToDownload; m_displayIndex = 0; - startProgressLoop(); for (int i = 0; i < m_filesToUpdate.size(); ++i) { QString const fName = m_filesToUpdate.at(i); @@ -862,30 +859,19 @@ bool Worker::updateFiles(quint8 percent) { stopProgressLoop(); setProgress(100); - bool ret = true; if (filesToDownload.size() > 0) { Utils::printInfoMsg(QString("FILES_TO_DOWNLOAD_TO_PSA_HW ") + filesToDownload.join(',')); - m_update = new Update(m_mainWindow->getPlugin(), - this, - m_customerRepository, - m_customerNrStr, - m_branchName, - m_pluginName, - m_workingDirectory, - m_dryRun, - m_parent, - m_serialInterface.toStdString().c_str(), - m_baudrate.toStdString().c_str()); - - ret = m_update->doUpdate(m_displayIndex, filesToDownload); - + Update *update = m_mainWindow->getUpdate(); + if (update) { + return update->doUpdate(m_displayIndex, filesToDownload); + } } else { Utils::printCriticalErrorMsg("NO FILES_TO_DOWNLOAD_TO_PSA_HW"); } - return ret; + return true; } bool Worker::syncCustomerRepositoryAndFS() {