Move update-object into main window.

Activate using ISMAS WAIT button.
This commit is contained in:
Gerhard Hoffmann 2023-09-09 14:40:43 +02:00
parent 7e96b65c1b
commit 64dce44fe1

View File

@ -55,7 +55,6 @@ Worker::Worker(int customerNr,
, m_parent(parent) , m_parent(parent)
, m_serialInterface(serialInterface) , m_serialInterface(serialInterface)
, m_baudrate(baudrate) , m_baudrate(baudrate)
, m_update(nullptr)
, m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this) , m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this)
, m_osVersion(getOsVersion()) , m_osVersion(getOsVersion())
, m_atbqtVersion(getATBQTVersion()) , m_atbqtVersion(getATBQTVersion())
@ -73,8 +72,10 @@ Worker::Worker(int customerNr,
, m_updateProcessRunning(true) , m_updateProcessRunning(true)
, m_returnCode(0) , m_returnCode(0)
, m_progressValue(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); QDir::setCurrent(m_workingDirectory);
// restart apism to make sure it is running ? // 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) { void Worker::setProgress(int progress) {
@ -798,7 +796,6 @@ bool Worker::filesToUpdate() {
bool Worker::updateFiles(quint8 percent) { bool Worker::updateFiles(quint8 percent) {
QStringList filesToDownload; QStringList filesToDownload;
m_displayIndex = 0; m_displayIndex = 0;
startProgressLoop(); startProgressLoop();
for (int i = 0; i < m_filesToUpdate.size(); ++i) { for (int i = 0; i < m_filesToUpdate.size(); ++i) {
QString const fName = m_filesToUpdate.at(i); QString const fName = m_filesToUpdate.at(i);
@ -862,30 +859,19 @@ bool Worker::updateFiles(quint8 percent) {
stopProgressLoop(); stopProgressLoop();
setProgress(100); setProgress(100);
bool ret = true;
if (filesToDownload.size() > 0) { if (filesToDownload.size() > 0) {
Utils::printInfoMsg(QString("FILES_TO_DOWNLOAD_TO_PSA_HW ") + filesToDownload.join(',')); Utils::printInfoMsg(QString("FILES_TO_DOWNLOAD_TO_PSA_HW ") + filesToDownload.join(','));
m_update = new Update(m_mainWindow->getPlugin(), Update *update = m_mainWindow->getUpdate();
this, if (update) {
m_customerRepository, return update->doUpdate(m_displayIndex, filesToDownload);
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);
} else { } else {
Utils::printCriticalErrorMsg("NO FILES_TO_DOWNLOAD_TO_PSA_HW"); Utils::printCriticalErrorMsg("NO FILES_TO_DOWNLOAD_TO_PSA_HW");
} }
return ret; return true;
} }
bool Worker::syncCustomerRepositoryAndFS() { bool Worker::syncCustomerRepositoryAndFS() {