Update main-window

This commit is contained in:
Gerhard Hoffmann 2025-02-06 16:26:44 +01:00
parent 238f2498b7
commit b270a9f30e
4 changed files with 193 additions and 2 deletions

View File

@ -310,7 +310,7 @@ HEADERS += \
process/check_ismas_connectivity_command.h \
process/check_update_activation_command.h \
process/check_and_fetch_customer_repository_command.h \
process/exec_opkg_command.cpp \
process/exec_opkg_command.h \
process/show_software_status_command.h \
message_handler.h \
worker.h \

View File

@ -4,6 +4,7 @@
#include "utils.h"
#include "progress_event.h"
#include "update_dc_event.h"
#include "process/update_command.h"
#include <DeviceController/interfaces.h>
#include <QDateTime>
@ -85,7 +86,17 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
connect(m_worker, SIGNAL(showDcDownload(QString)),this,SLOT(onShowDcDownload(QString)));
connect(m_worker, SIGNAL(showJsonDownload(QString)),this,SLOT(onShowJsonDownload(QString)));
connect(m_worker, SIGNAL(showTariffUpdate(QString)),this,SLOT(onShowTariffUpdate(QString)));
// deprecated
connect(m_worker, SIGNAL(showISMASChecks(QString)),this,SLOT(onShowISMASChecks(QString)));
connect(m_worker, SIGNAL(showISMASConnectivity(QString)),this,SLOT(onShowISMASConnectivity(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(showExecOpkgStatus(QString)),this,SLOT(onShowExecOpkgStatus(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(showUpdateDCFirmware(QString)),this,SLOT(onShowUpdateDCFirmware(QString)));
connect(m_worker, SIGNAL(setDcDownloadProgress(int)),this,SLOT(onSetDcDownloadProgress(int)));
connect(m_worker, SIGNAL(enableExit()),this,SLOT(onEnableExit()));
connect(m_worker, SIGNAL(stopStartTimer()),this,SLOT(onStopStartTimer()));
@ -134,7 +145,170 @@ void MainWindow::onShowTariffUpdate(QString) {
ui->stepLabel->setText(s);
}
void MainWindow::onShowISMASConnectivity(QString status) {
// ausgabe: connected, not connected, connecting
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
QString tmp("backend connection (ISMAS) ");
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(UpdateCommand::ISMAS_CONNECTED, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>connected</font><br />").arg(tmp);
} else
if (status.contains(UpdateCommand::ISMAS_CONNECTION_IN_PROGRESS, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>connecting</font><br />").arg(tmp);
} else
if (status.contains(UpdateCommand::ISMAS_NOT_CONNECTED, Qt::CaseInsensitive)) {
s += QString( "%1 <font color='Red'>NOT CONNECTED</font><br />").arg(tmp);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowCustRepoStatus(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
QString tmp("customer repository ");
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>up to date</font><br />").arg(tmp);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowExecOpkgStatus(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
QString tmp = "execute opkg commands ";
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(UpdateCommand::EXEC_OPKG_COMMANDS_SUCCESS, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowDownloadDCJsonFilesStatus(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
QString tmp = "configure device controller ";
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(UpdateCommand::UPDATE_DC_JSON_FILES_SUCCESS, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowSyncCustRepoStatus(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
QString tmp = "synchronize repository/filesystem ";
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(UpdateCommand::SYNC_CUSTOMER_REPO_FILES_SUCCESS, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowUpdateDCFirmware(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
QString tmp = "device controller update ";
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(UpdateCommand::UPDATE_DC_FIRMARE_SUCCESS, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowUpdateRequest(QString status) {
qCritical() << __func__ << ":" << __LINE__ << "status" << status;
QString s = ui->stepLabel->text();
QString tmp = "update request ";
int len = m_showLineLength - tmp.length();
while (--len > 0) {
tmp += "&nbsp;";
}
if (status.contains(UpdateCommand::UPDATE_NOT_REQUESTED, Qt::CaseInsensitive)) {
s += QString( "%1 <font color='Red'>NOT REQUESTED</font><br />").arg(tmp);
} else
if (status.contains(UpdateCommand::UPDATE_REQUESTED, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>requested</font><br />").arg(tmp);
} else
if (status.contains(UpdateCommand::UPDATE_NOT_NECESSARY, Qt::CaseInsensitive)) {
s += QString("%1 <font color='Green'>not necessary</font><br />").arg(tmp);
} else {
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
}
ui->stepLabel->setText(s);
}
void MainWindow::onShowISMASChecks(QString) {
// deprecated
QString s = ui->stepLabel->text();
QString tmp("Check ISMAS connectivity ");
@ -177,7 +351,10 @@ void MainWindow::onShowDcDownload(QString version) {
ui->exit->setEnabled(false);
// test
onShowISMASChecks("");
// onShowISMASChecks("");
onShowISMASConnectivity("connected");
onShowUpdateRequest("activated");
onShowTariffUpdate("");
onShowJsonDownload("");

View File

@ -55,6 +55,13 @@ public slots:
void onShowJsonDownload(QString);
void onShowTariffUpdate(QString);
void onShowISMASChecks(QString);
void onShowISMASConnectivity(QString);
void onShowUpdateRequest(QString);
void onShowCustRepoStatus(QString);
void onShowExecOpkgStatus(QString);
void onShowDownloadDCJsonFilesStatus(QString);
void onShowSyncCustRepoStatus(QString);
void onShowUpdateDCFirmware(QString);
void onSetDcDownloadProgress(int);
void onShowSummary(QString);
#if EMERGENCY_LEAVE_BL==1

View File

@ -493,6 +493,13 @@ signals:
void showJsonDownload(QString);
void showTariffUpdate(QString);
void showISMASChecks(QString);
void showISMASConnectivity(QString);
void showCustRepoStatus(QString);
void showUpdateRequest(QString);
void showExecOpkgStatus(QString);
void showDownloadDCJsonFilesStatus(QString);
void showSyncCustRepoStatus(QString);
void showUpdateDCFirmware(QString);
void showSummary(QString);
void setDcDownloadProgress(int);