Changes for ATBUpdateOpkg

This commit is contained in:
Gerhard Hoffmann 2025-02-18 14:54:41 +01:00
parent 7cdefc9b49
commit af83c11f73

View File

@ -95,6 +95,8 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
connect(m_worker, SIGNAL(showUpdateRequest(QString)),this,SLOT(onShowUpdateRequest(QString))); connect(m_worker, SIGNAL(showUpdateRequest(QString)),this,SLOT(onShowUpdateRequest(QString)));
connect(m_worker, SIGNAL(showCustRepoStatus(QString)),this,SLOT(onShowCustRepoStatus(QString))); connect(m_worker, SIGNAL(showCustRepoStatus(QString)),this,SLOT(onShowCustRepoStatus(QString)));
connect(m_worker, SIGNAL(showExecOpkgStatus(QString)),this,SLOT(onShowExecOpkgStatus(QString))); connect(m_worker, SIGNAL(showExecOpkgStatus(QString)),this,SLOT(onShowExecOpkgStatus(QString)));
connect(m_worker, SIGNAL(showExecOpkgCommand(QString)),this,SLOT(onShowExecOpkgCommand(QString)));
connect(m_worker, SIGNAL(showExecOpkgOverallResult(QString, bool)),this,SLOT(onShowExecOpkgOverallResult(QString,bool)));
connect(m_worker, SIGNAL(showDownloadDCJsonFilesStatus(QString)),this,SLOT(onShowDownloadDCJsonFilesStatus(QString))); connect(m_worker, SIGNAL(showDownloadDCJsonFilesStatus(QString)),this,SLOT(onShowDownloadDCJsonFilesStatus(QString)));
connect(m_worker, SIGNAL(showSyncCustRepoStatus(QString)),this,SLOT(onShowSyncCustRepoStatus(QString))); connect(m_worker, SIGNAL(showSyncCustRepoStatus(QString)),this,SLOT(onShowSyncCustRepoStatus(QString)));
connect(m_worker, SIGNAL(showUpdateDCFirmware(QString)),this,SLOT(onShowUpdateDCFirmware(QString))); connect(m_worker, SIGNAL(showUpdateDCFirmware(QString)),this,SLOT(onShowUpdateDCFirmware(QString)));
@ -149,11 +151,12 @@ void MainWindow::onShowTariffUpdate(QString) {
void MainWindow::onShowISMASConnectivity(QString status) { void MainWindow::onShowISMASConnectivity(QString status) {
// ausgabe: connected, not connected, connecting // ausgabe: connected, not connected, connecting
m_stepLabelChopCount = 0;
qCritical() << __func__ << ":" << __LINE__ << "status" << status; qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text(); QString s = ui->stepLabel->text();
QString tmp("backend connection (ISMAS) "); QString tmp("Check backend connection (ISMAS) ");
int len = m_showLineLength - tmp.length(); int len = m_showLineLength - tmp.length();
while (--len > 0) { while (--len > 0) {
tmp += "&nbsp;"; tmp += "&nbsp;";
@ -184,6 +187,10 @@ void MainWindow::onShowISMASConnectivity(QString status) {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp); s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
} }
m_stepLabelChopCount = -s.length();
s += "Check update request";
m_stepLabelChopCount += s.length();
ui->stepLabel->setText(s); ui->stepLabel->setText(s);
} }
@ -191,8 +198,9 @@ void MainWindow::onShowCustRepoStatus(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status; qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text(); QString s = ui->stepLabel->text();
s.chop(m_stepLabelChopCount);
QString tmp("customer repository "); QString tmp("Check customer repository ");
int len = m_showLineLength - tmp.length(); int len = m_showLineLength - tmp.length();
while (--len > 0) { while (--len > 0) {
tmp += "&nbsp;"; tmp += "&nbsp;";
@ -204,6 +212,10 @@ void MainWindow::onShowCustRepoStatus(QString status) {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp); s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
} }
m_stepLabelChopCount = -s.length();
s += "Install SW packets (dry run)";
m_stepLabelChopCount += s.length();
ui->stepLabel->setText(s); ui->stepLabel->setText(s);
} }
@ -228,12 +240,57 @@ void MainWindow::onShowExecOpkgStatus(QString status) {
ui->stepLabel->setText(s); ui->stepLabel->setText(s);
} }
void MainWindow::onShowExecOpkgCommand(QString cmd) {
qCritical() << __func__ << ":" << __LINE__ << "cmd" << cmd;
if (cmd.back() != QChar('\n')) {
cmd += "\n";
}
onInsertText(cmd);
}
void MainWindow::onShowExecOpkgOverallResult(QString status, bool noaction) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
s.chop(m_stepLabelChopCount);
QString tmp = noaction ? "Install SW packets (dry run) " : "Install SW packets ";
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(internal::EXEC_OPKG_COMMANDS_SUCCESS, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
} else
if (status.contains(internal::EXEC_OPKG_COMMANDS_FAIL, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Red'>%2</font><br />").arg(tmp).arg(internal::EXEC_OPKG_COMMANDS_FAIL);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
if (noaction) {
m_stepLabelChopCount = -s.length();
s += "Install SW packets";
m_stepLabelChopCount += s.length();
} else {
m_stepLabelChopCount = -s.length();
s += "Install DC configuration";
m_stepLabelChopCount += s.length();
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowDownloadDCJsonFilesStatus(QString status) { void MainWindow::onShowDownloadDCJsonFilesStatus(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status; qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text(); QString s = ui->stepLabel->text();
s.chop(m_stepLabelChopCount);
QString tmp = "configure device controller "; QString tmp = "Install DC configuration ";
int len = m_showLineLength - tmp.length(); int len = m_showLineLength - tmp.length();
while (--len > 0) { while (--len > 0) {
@ -246,6 +303,10 @@ void MainWindow::onShowDownloadDCJsonFilesStatus(QString status) {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp); s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
} }
m_stepLabelChopCount = -s.length();
s += "Synchronize repository/filesystem";
m_stepLabelChopCount += s.length();
ui->stepLabel->setText(s); ui->stepLabel->setText(s);
} }
@ -253,8 +314,9 @@ void MainWindow::onShowSyncCustRepoStatus(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status; qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text(); QString s = ui->stepLabel->text();
s.chop(m_stepLabelChopCount);
QString tmp = "synchronize repository/filesystem "; QString tmp = "Synchronize repository/filesystem ";
int len = m_showLineLength - tmp.length(); int len = m_showLineLength - tmp.length();
while (--len > 0) { while (--len > 0) {
@ -267,6 +329,10 @@ void MainWindow::onShowSyncCustRepoStatus(QString status) {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp); s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
} }
m_stepLabelChopCount = -s.length();
s += "Update DC";
m_stepLabelChopCount += s.length();
ui->stepLabel->setText(s); ui->stepLabel->setText(s);
} }
@ -274,8 +340,9 @@ void MainWindow::onShowUpdateDCFirmware(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status; qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text(); QString s = ui->stepLabel->text();
s.chop(m_stepLabelChopCount);
QString tmp = "device controller update "; QString tmp = "Update DC ";
int len = m_showLineLength - tmp.length(); int len = m_showLineLength - tmp.length();
while (--len > 0) { while (--len > 0) {
@ -297,8 +364,9 @@ void MainWindow::onShowUpdateRequest(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status; qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text(); QString s = ui->stepLabel->text();
s.chop(m_stepLabelChopCount);
QString tmp = "update request "; QString tmp = "Check update request ";
int len = m_showLineLength - tmp.length(); int len = m_showLineLength - tmp.length();
while (--len > 0) { while (--len > 0) {
@ -330,6 +398,10 @@ void MainWindow::onShowUpdateRequest(QString status) {
s += QString( "%1 <font color='Red'>UNKNOWN</font><br />").arg(tmp); s += QString( "%1 <font color='Red'>UNKNOWN</font><br />").arg(tmp);
} }
m_stepLabelChopCount = -s.length();
s += "Check customer repository";
m_stepLabelChopCount += s.length();
ui->stepLabel->setText(s); ui->stepLabel->setText(s);
} }