Add and use m_updateSteps.
This commit is contained in:
		@@ -16,6 +16,15 @@
 | 
				
			|||||||
#include <QColor>
 | 
					#include <QColor>
 | 
				
			||||||
#include <QColorDialog>
 | 
					#include <QColorDialog>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define CHECK_BACKEND_CONNECTION    0
 | 
				
			||||||
 | 
					#define CHECK_UPDATE_REQUEST        1
 | 
				
			||||||
 | 
					#define UPDATE_CUSTOMER_REPOSITORY  2
 | 
				
			||||||
 | 
					#define INSTALL_SW_PACKETS_DRY_RUN  3
 | 
				
			||||||
 | 
					#define INSTALL_SW_PACKETS          4
 | 
				
			||||||
 | 
					#define INSTALL_DC_CONFIGURATION    5
 | 
				
			||||||
 | 
					#define SYNCHRONIZE_REPOSITORY      6
 | 
				
			||||||
 | 
					#define UPDATE_DC                   7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MainWindow::MainWindow(Worker *worker, QWidget *parent)
 | 
					MainWindow::MainWindow(Worker *worker, QWidget *parent)
 | 
				
			||||||
    : QMainWindow(parent)
 | 
					    : QMainWindow(parent)
 | 
				
			||||||
@@ -27,6 +36,25 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ui->setupUi(this);
 | 
					    ui->setupUi(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_updateSteps.resize(8);
 | 
				
			||||||
 | 
					    m_updateSteps[CHECK_BACKEND_CONNECTION] = "Check backend connection (ISMAS) ";
 | 
				
			||||||
 | 
					    m_updateSteps[CHECK_UPDATE_REQUEST] = "Check update request ";
 | 
				
			||||||
 | 
					    m_updateSteps[UPDATE_CUSTOMER_REPOSITORY] = "Update customer repository ";
 | 
				
			||||||
 | 
					    m_updateSteps[INSTALL_SW_PACKETS_DRY_RUN] = "Install SW packets (dry run) ";
 | 
				
			||||||
 | 
					    m_updateSteps[INSTALL_SW_PACKETS] = "Install SW packets ";
 | 
				
			||||||
 | 
					    m_updateSteps[INSTALL_DC_CONFIGURATION] = "Install DC configuration ";
 | 
				
			||||||
 | 
					    m_updateSteps[SYNCHRONIZE_REPOSITORY] = "Synchronize repository/filesystem ";
 | 
				
			||||||
 | 
					    m_updateSteps[UPDATE_DC] = "Update DC";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        QString &tmp = m_updateSteps[i];
 | 
				
			||||||
 | 
					        int len = m_showLineLength - tmp.length();
 | 
				
			||||||
 | 
					        while (--len > 0) {
 | 
				
			||||||
 | 
					           tmp += " ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        ui->stepLabel->setText(tmp + "\n");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this->setStatusBar(new QStatusBar(this));
 | 
					    this->setStatusBar(new QStatusBar(this));
 | 
				
			||||||
    QFont f;
 | 
					    QFont f;
 | 
				
			||||||
    f.setStyleHint(QFont::Monospace);
 | 
					    f.setStyleHint(QFont::Monospace);
 | 
				
			||||||
@@ -149,81 +177,68 @@ void MainWindow::onShowTariffUpdate(QString) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowISMASConnectivity(QString status) {
 | 
					void MainWindow::onShowISMASConnectivity(QString status) {
 | 
				
			||||||
    // ausgabe: connected, not connected, connecting
 | 
					    // qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_stepLabelChopCount = 0;
 | 
					    QString s = m_updateSteps[CHECK_BACKEND_CONNECTION].trimmed();
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString tmp("Check backend connection (ISMAS) ");
 | 
					 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					 | 
				
			||||||
    while (--len > 0) {
 | 
					 | 
				
			||||||
       tmp += " ";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool const custRepoExists = internal::customerRepoExists();
 | 
					    bool const custRepoExists = internal::customerRepoExists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (status.contains(UpdateCommand::ISMAS_CONNECTED, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::ISMAS_CONNECTED, Qt::CaseInsensitive)) {
 | 
				
			||||||
        if (custRepoExists) {
 | 
					        if (custRepoExists) {
 | 
				
			||||||
            s += QString("%1 <font color='Green'>connected</font><br />").arg(tmp);
 | 
					            s += " <font color='Green'>connected</font>";
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            s += QString("%1 <font color='Green'>connected (initial configuration)</font><br />").arg(tmp);
 | 
					            s += " <font color='Green'>connected (initial configuration)</font>";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(UpdateCommand::NO_CUSTOMER_REPOSITORY, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::NO_CUSTOMER_REPOSITORY, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Blue'>NOT CONNECTED</font><br />").arg(tmp);
 | 
					        s += " <font color='Blue'>NOT CONNECTED</font>";
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(UpdateCommand::ISMAS_CONNECTION_IN_PROGRESS, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::ISMAS_CONNECTION_IN_PROGRESS, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>connecting</font><br />").arg(tmp);
 | 
					        s += " <font color='Green'>connecting</font>";
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(UpdateCommand::ISMAS_NOT_CONNECTED, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::ISMAS_NOT_CONNECTED, Qt::CaseInsensitive)) {
 | 
				
			||||||
        if (custRepoExists) {
 | 
					        if (custRepoExists) {
 | 
				
			||||||
            s += QString(  "%1 <font color='Red'>NOT CONNECTED. STOP</font><br />").arg(tmp);
 | 
					            s += " <font color='Red'>NOT CONNECTED. STOP</font>";
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            s += QString(  "%1 <font color='Red'>not connected. (initial configuration)</font><br />").arg(tmp);
 | 
					            s += " <font color='Red'>not connected. (initial configuration)</font>";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        s += QString(  "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
 | 
					        s += " <font color='Red'>UNKNOWN STATUS</font>";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_stepLabelChopCount = -s.length();
 | 
					    m_updateSteps[CHECK_BACKEND_CONNECTION] = s;
 | 
				
			||||||
    s += "Check update request";
 | 
					    s.clear();
 | 
				
			||||||
    m_stepLabelChopCount += s.length();
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        s += m_updateSteps[i] + "<br />";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ui->stepLabel->setText(s);
 | 
					    ui->stepLabel->setText(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowCustRepoStatus(QString status) {
 | 
					void MainWindow::onShowCustRepoStatus(QString status) {
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
					    // qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					    QString s = m_updateSteps[UPDATE_CUSTOMER_REPOSITORY].trimmed();
 | 
				
			||||||
    s.chop(m_stepLabelChopCount);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString tmp("Update customer repository ");
 | 
					 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					 | 
				
			||||||
    while (--len > 0) {
 | 
					 | 
				
			||||||
       tmp += " ";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (status.contains(internal::GIT_CUSTOMER_REPO_UP_TO_DATE, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(internal::GIT_CUSTOMER_REPO_UP_TO_DATE, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>%2</font><br />").arg(tmp).arg(internal::GIT_CUSTOMER_REPO_UP_TO_DATE);
 | 
					        s += QString(" <font color='Green'>%1</font>").arg(internal::GIT_CUSTOMER_REPO_UP_TO_DATE);
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>%2</font><br />").arg(tmp).arg(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY);
 | 
					        s += QString(" <font color='Green'>%1</font>").arg(internal::GIT_CUSTOMER_REPO_NOT_NECESSARY);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        s += QString(  "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
 | 
					        s += " <font color='Red'>UNKNOWN STATUS</font>";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_stepLabelChopCount = -s.length();
 | 
					    m_updateSteps[UPDATE_CUSTOMER_REPOSITORY] = s;
 | 
				
			||||||
    s += "Install SW packets (dry run)";
 | 
					    s.clear();
 | 
				
			||||||
    m_stepLabelChopCount += s.length();
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        s += m_updateSteps[i] + "<br />";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ui->stepLabel->setText(s);
 | 
					    ui->stepLabel->setText(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowExecOpkgStatus(QString status) {
 | 
					void MainWindow::onShowExecOpkgStatus(QString status) {
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
					    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					    QString s = ui->stepLabel->text();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -245,6 +260,7 @@ void MainWindow::onShowExecOpkgStatus(QString status) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowExecOpkgCommand(QString cmd) {
 | 
					void MainWindow::onShowExecOpkgCommand(QString cmd) {
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "cmd" << cmd;
 | 
					    qCritical() << __func__ << ":" << __LINE__ << "cmd" << cmd;
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (cmd.back() != QChar('\n')) {
 | 
					    if (cmd.back() != QChar('\n')) {
 | 
				
			||||||
        cmd += "\n";
 | 
					        cmd += "\n";
 | 
				
			||||||
@@ -253,158 +269,132 @@ void MainWindow::onShowExecOpkgCommand(QString cmd) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowExecOpkgOverallResult(QString status, bool noaction) {
 | 
					void MainWindow::onShowExecOpkgOverallResult(QString status, bool noaction) {
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
					    //qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					    QString s = noaction ?
 | 
				
			||||||
    s.chop(m_stepLabelChopCount);
 | 
					        m_updateSteps[INSTALL_SW_PACKETS_DRY_RUN].trimmed() :
 | 
				
			||||||
 | 
					        m_updateSteps[INSTALL_SW_PACKETS].trimmed();
 | 
				
			||||||
    QString tmp = noaction ? "Install SW packets (dry run) " : "Install SW packets ";
 | 
					 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while (--len > 0) {
 | 
					 | 
				
			||||||
       tmp += " ";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (status.contains(internal::EXEC_OPKG_COMMANDS_SUCCESS, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(internal::EXEC_OPKG_COMMANDS_SUCCESS, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
 | 
					        s += " <font color='Green'>success</font>";
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(internal::EXEC_OPKG_COMMANDS_FAIL, Qt::CaseInsensitive)) {
 | 
					    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);
 | 
					        s += QString(" <font color='Red'>%1</font>").arg(internal::EXEC_OPKG_COMMANDS_FAIL);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        s += QString(  "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
 | 
					        s += " <font color='Red'>UNKNOWN STATUS</font>";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (noaction) {
 | 
					    if (noaction) {
 | 
				
			||||||
        m_stepLabelChopCount = -s.length();
 | 
					        m_updateSteps[INSTALL_SW_PACKETS_DRY_RUN] = s;
 | 
				
			||||||
        s += "Install SW packets";
 | 
					 | 
				
			||||||
        m_stepLabelChopCount += s.length();
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        m_stepLabelChopCount = -s.length();
 | 
					        m_updateSteps[INSTALL_SW_PACKETS] = s;
 | 
				
			||||||
        s += "Install DC configuration";
 | 
					    }
 | 
				
			||||||
        m_stepLabelChopCount += s.length();
 | 
					
 | 
				
			||||||
 | 
					    s.clear();
 | 
				
			||||||
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        s += m_updateSteps[i] + "<br />";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ui->stepLabel->setText(s);
 | 
					    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 = m_updateSteps[INSTALL_DC_CONFIGURATION].trimmed();
 | 
				
			||||||
    s.chop(m_stepLabelChopCount);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString tmp = "Install DC configuration ";
 | 
					 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while (--len > 0) {
 | 
					 | 
				
			||||||
       tmp += " ";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (status.contains(UpdateCommand::UPDATE_DC_JSON_FILES_SUCCESS, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::UPDATE_DC_JSON_FILES_SUCCESS, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
 | 
					        s += " <font color='Green'>success</font>";
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        s += QString(  "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
 | 
					        s += " <font color='Red'>UNKNOWN STATUS</font>";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_stepLabelChopCount = -s.length();
 | 
					    m_updateSteps[INSTALL_DC_CONFIGURATION] = s;
 | 
				
			||||||
    s += "Synchronize repository/filesystem";
 | 
					    s.clear();
 | 
				
			||||||
    m_stepLabelChopCount += s.length();
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        s += m_updateSteps[i] + "<br />";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ui->stepLabel->setText(s);
 | 
					    ui->stepLabel->setText(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowSyncCustRepoStatus(QString status) {
 | 
					void MainWindow::onShowSyncCustRepoStatus(QString status) {
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
					    //qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					    QString s = m_updateSteps[SYNCHRONIZE_REPOSITORY].trimmed();
 | 
				
			||||||
    s.chop(m_stepLabelChopCount);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString tmp = "Synchronize repository/filesystem ";
 | 
					 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while (--len > 0) {
 | 
					 | 
				
			||||||
       tmp += " ";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (status.contains(UpdateCommand::SYNC_CUSTOMER_REPO_FILES_SUCCESS, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::SYNC_CUSTOMER_REPO_FILES_SUCCESS, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
 | 
					        s += " <font color='Green'>success</font>";
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        s += QString(  "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
 | 
					        s += " <font color='Red'>UNKNOWN STATUS</font>";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_stepLabelChopCount = -s.length();
 | 
					    m_updateSteps[SYNCHRONIZE_REPOSITORY] = s;
 | 
				
			||||||
    s += "Update DC";
 | 
					    s.clear();
 | 
				
			||||||
    m_stepLabelChopCount += s.length();
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        s += m_updateSteps[i] + "<br />";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ui->stepLabel->setText(s);
 | 
					    ui->stepLabel->setText(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowUpdateDCFirmware(QString status) {
 | 
					void MainWindow::onShowUpdateDCFirmware(QString status) {
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
					    // qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					    QString s = m_updateSteps[UPDATE_DC].trimmed();
 | 
				
			||||||
    s.chop(m_stepLabelChopCount);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString tmp = "Update DC ";
 | 
					 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while (--len > 0) {
 | 
					 | 
				
			||||||
       tmp += " ";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (status.contains(UpdateCommand::UPDATE_DC_FIRMARE_SUCCESS, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::UPDATE_DC_FIRMARE_SUCCESS, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>success</font><br />").arg(tmp);
 | 
					        s += " <font color='Green'>success</font>";
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        s += QString(  "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
 | 
					        s += " <font color='Red'>UNKNOWN STATUS</font>";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_updateSteps[UPDATE_DC] = s;
 | 
				
			||||||
 | 
					    s.clear();
 | 
				
			||||||
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        if (i != UPDATE_DC) {
 | 
				
			||||||
 | 
					            s += m_updateSteps[i] + "<br />";
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            s += m_updateSteps[i];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ui->stepLabel->setText(s);
 | 
					    ui->stepLabel->setText(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onShowUpdateRequest(QString status) {
 | 
					void MainWindow::onShowUpdateRequest(QString status) {
 | 
				
			||||||
 | 
					    // qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << "status" << status;
 | 
					    QString s = m_updateSteps[CHECK_UPDATE_REQUEST].trimmed();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					 | 
				
			||||||
    s.chop(m_stepLabelChopCount);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QString tmp = "Check update request ";
 | 
					 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while (--len > 0) {
 | 
					 | 
				
			||||||
       tmp += " ";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool const custRepoExists = internal::customerRepoExists();
 | 
					    bool const custRepoExists = internal::customerRepoExists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (status.contains(UpdateCommand::UPDATE_NOT_REQUESTED, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::UPDATE_NOT_REQUESTED, Qt::CaseInsensitive)) {
 | 
				
			||||||
        if (custRepoExists) {
 | 
					        if (custRepoExists) {
 | 
				
			||||||
            s += QString(  "%1 <font color='Red'>NOT REQUESTED. STOP.</font><br />").arg(tmp);
 | 
					            s += " <font color='Red'>NOT REQUESTED. STOP.</font>";
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            s += QString("%1 <font color='Blue'>not requested (initial configuration)</font><br />").arg(tmp);
 | 
					            s += " <font color='Blue'>not requested (initial configuration)</font>";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(UpdateCommand::UPDATE_REQUESTED, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::UPDATE_REQUESTED, Qt::CaseInsensitive)) {
 | 
				
			||||||
        if (custRepoExists) {
 | 
					        if (custRepoExists) {
 | 
				
			||||||
            s += QString("%1 <font color='Green'>requested</font><br />").arg(tmp);
 | 
					            s += " <font color='Green'>requested</font>";
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            s += QString("%1 <font color='Blue'>requested (initial configuration)</font><br />").arg(tmp);
 | 
					            s += " <font color='Blue'>requested (initial configuration)</font>";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(UpdateCommand::UPDATE_NOT_NECESSARY, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::UPDATE_NOT_NECESSARY, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Green'>not necessary</font><br />").arg(tmp);
 | 
					        s += " <font color='Green'>not necessary</font>";
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (status.contains(UpdateCommand::NO_CUSTOMER_REPOSITORY, Qt::CaseInsensitive)) {
 | 
					    if (status.contains(UpdateCommand::NO_CUSTOMER_REPOSITORY, Qt::CaseInsensitive)) {
 | 
				
			||||||
        s += QString("%1 <font color='Blue'>UNKNOWN (ISMAS not connected)</font><br />").arg(tmp);
 | 
					        s += " <font color='Blue'>UNKNOWN (ISMAS not connected)</font>";
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        s += QString(  "%1 <font color='Red'>UNKNOWN</font><br />").arg(tmp);
 | 
					        s += " <font color='Red'>UNKNOWN</font>";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_stepLabelChopCount = -s.length();
 | 
					    m_updateSteps[CHECK_UPDATE_REQUEST] = s;
 | 
				
			||||||
    s += "Update customer repository";
 | 
					    s.clear();
 | 
				
			||||||
    m_stepLabelChopCount += s.length();
 | 
					    for (int i = 0; i < m_updateSteps.size(); ++i) {
 | 
				
			||||||
 | 
					        s += m_updateSteps[i] + "<br />";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ui->stepLabel->setText(s);
 | 
					    ui->stepLabel->setText(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -412,6 +402,7 @@ void MainWindow::onShowISMASChecks(QString) {
 | 
				
			|||||||
    // deprecated
 | 
					    // deprecated
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString s = ui->stepLabel->text();
 | 
					    QString s = ui->stepLabel->text();
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString tmp("Check ISMAS connectivity ");
 | 
					    QString tmp("Check ISMAS connectivity ");
 | 
				
			||||||
    int len = m_showLineLength - tmp.length();
 | 
					    int len = m_showLineLength - tmp.length();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,8 @@
 | 
				
			|||||||
#include <QMainWindow>
 | 
					#include <QMainWindow>
 | 
				
			||||||
#include <QTimer>
 | 
					#include <QTimer>
 | 
				
			||||||
#include <QStatusBar>
 | 
					#include <QStatusBar>
 | 
				
			||||||
 | 
					#include <QVector>
 | 
				
			||||||
 | 
					#include <QString>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QT_BEGIN_NAMESPACE
 | 
					QT_BEGIN_NAMESPACE
 | 
				
			||||||
namespace Ui { class MainWindow; }
 | 
					namespace Ui { class MainWindow; }
 | 
				
			||||||
@@ -97,5 +99,8 @@ private:
 | 
				
			|||||||
    QTimer *m_statusTimer;
 | 
					    QTimer *m_statusTimer;
 | 
				
			||||||
    QString m_targetDcVersion;
 | 
					    QString m_targetDcVersion;
 | 
				
			||||||
    int m_stepLabelChopCount{};
 | 
					    int m_stepLabelChopCount{};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QVector<QString> m_updateSteps{};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
#endif // MAINWINDOW_H
 | 
					#endif // MAINWINDOW_H
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user