Adding three friend operator<< functions to output status information of
the update process: the first on outputs to CONSOLE(), the second one outputs to ISMAS() and the last one to GUI(), i.e. the text edit of the main window.
This commit is contained in:
parent
16a9556863
commit
c2ce44c79b
427
worker.h
427
worker.h
@ -389,6 +389,7 @@ private:
|
||||
}
|
||||
|
||||
Worker::instance->m_currentStep = step;
|
||||
QStringList lst = QStringList(smap[step]);
|
||||
|
||||
switch (step) {
|
||||
case UPDATE_STEP::STARTED: {
|
||||
@ -465,14 +466,34 @@ private:
|
||||
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||
Utils::printUpdateStatusMsg(
|
||||
debug,
|
||||
QStringList(smap[step])
|
||||
<< QString("CHECK ISMAS-TRIGGER-STATUS..."));
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE: {
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
} break;
|
||||
case UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER:
|
||||
break;
|
||||
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH:
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS:
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH_FAILURE:
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_REPOSITORY:
|
||||
break;
|
||||
@ -486,7 +507,42 @@ private:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES:
|
||||
case UPDATE_STEP::FILES_TO_UPDATE:
|
||||
break;
|
||||
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES: {
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
} break;
|
||||
case UPDATE_STEP::FILES_TO_DOWNLOAD:
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMANDS:
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1:
|
||||
__attribute__((fallthrough));
|
||||
// [[fallthrough]] -> c++17 -> unknown for clang
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_6:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_7:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_8:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_9:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_LAST:
|
||||
lst << instance->m_debugMsg;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS:
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||
break;
|
||||
@ -517,32 +573,42 @@ private:
|
||||
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::SEND_LAST_VERSION:
|
||||
// SEND_LAST_VERSION_CORRECTION
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_ACTIVATED:
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_FAILED:
|
||||
break;
|
||||
case UPDATE_STEP::FINISHED:
|
||||
break;
|
||||
case UPDATE_STEP::DEBUG:
|
||||
Utils::printUpdateStatusMsg(
|
||||
debug, QStringList(smap[step]) << instance->m_debugMsg);
|
||||
break;
|
||||
case UPDATE_STEP::DEBUG: {
|
||||
lst << instance->m_debugMsg;
|
||||
qCritical() << __LINE__ << lst;
|
||||
Utils::printUpdateStatusMsg(debug, lst);
|
||||
} break;
|
||||
case UPDATE_STEP::ERROR:
|
||||
//Utils::printUpdateStatusMsg(
|
||||
// debug, QStringList(smap[step]) << instance->m_errorMsg);
|
||||
break;
|
||||
}
|
||||
|
||||
instance->m_debugMsg.clear();
|
||||
|
||||
return step;
|
||||
}
|
||||
|
||||
// ISMAS()
|
||||
friend UPDATE_STEP operator<<(IsmasClient &ismasClient, UPDATE_STEP step) {
|
||||
|
||||
if (!Worker::instance) {
|
||||
return step;
|
||||
}
|
||||
|
||||
Worker::instance->m_currentStep = step;
|
||||
QStringList lst = QStringList(smap[step]);
|
||||
|
||||
switch (step) {
|
||||
case UPDATE_STEP::STARTED: {
|
||||
ismasClient.setProgressInPercent(_STARTED);
|
||||
@ -599,8 +665,8 @@ private:
|
||||
.arg(instance->m_customerRepository)
|
||||
.arg(instance->m_gc.branchName()).toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
ismasUpdateNews);
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::CHECKOUT_REPOSITORY:
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY);
|
||||
@ -617,7 +683,6 @@ private:
|
||||
case UPDATE_STEP::CHECKOUT_REPOSITORY_FAILURE:
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_REPOSITORY_FAILURE);
|
||||
break;
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER:
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER);
|
||||
break;
|
||||
@ -627,12 +692,60 @@ private:
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateTriggerSet("ISMAS TRIGGER SET", ""));
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.errorUpdateTrigger(instance->m_ismasMsg.join(' '), ""));
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_WRONG_VALUE);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE: {
|
||||
ismasClient.setProgressInPercent(_CHECK_ISMAS_TRIGGER_FAILURE);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0003",
|
||||
_CHECK_ISMAS_TRIGGER_FAILURE,
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER:
|
||||
ismasClient.setProgressInPercent(_INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER);
|
||||
break;
|
||||
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
||||
ismasClient.setProgressInPercent(_INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER);
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH:
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH);
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS: {
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH_SUCCESS);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0010",
|
||||
_CHECKOUT_BRANCH_SUCCESS,
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH_FAILURE: {
|
||||
ismasClient.setProgressInPercent(_CHECKOUT_BRANCH_FAILURE);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0003",
|
||||
_CHECKOUT_BRANCH_FAILURE,
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::UPDATE_REPOSITORY:
|
||||
ismasClient.setProgressInPercent(_UPDATE_REPOSITORY);
|
||||
break;
|
||||
@ -651,9 +764,139 @@ private:
|
||||
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
||||
ismasClient.setProgressInPercent(_CHECK_FOR_REPOSITORY_CHANGES_FAILURE);
|
||||
break;
|
||||
case UPDATE_STEP::FILES_TO_UPDATE:
|
||||
ismasClient.setProgressInPercent(_FILES_TO_UPDATE);
|
||||
break;
|
||||
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES:
|
||||
ismasClient.setProgressInPercent(_APPLY_REPOSITORY_CHANGES);
|
||||
break;
|
||||
case UPDATE_STEP::FILES_TO_DOWNLOAD:
|
||||
ismasClient.setProgressInPercent(_FILES_TO_DOWNLOAD);
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMANDS:
|
||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMANDS);
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1:
|
||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_1);
|
||||
__attribute__((fallthrough)); // [[fallthrough]]; -> c++17, unknown to clang
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_2);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_3);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_4);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_5);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_6);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_7);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_8: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_8);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_9: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_8: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_9);
|
||||
} __attribute__((fallthrough));
|
||||
}
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_LAST: {
|
||||
switch(step) {
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_6: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_7: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_8: break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_9: break;
|
||||
default: ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_LAST);
|
||||
}
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
_ISMAS_CONTINUE,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_SUCCESS);
|
||||
} break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
||||
ismasClient.setProgressInPercent(_EXEC_OPKG_COMMAND_FAILURE);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
_ISMAS_FAILURE,
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||
ismasClient.setProgressInPercent(_DOWNLOAD_CONFIG_FILE);
|
||||
break;
|
||||
@ -696,15 +939,54 @@ private:
|
||||
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
||||
ismasClient.setProgressInPercent(_SAVE_LOGS_FAILURE);
|
||||
break;
|
||||
case UPDATE_STEP::SEND_LAST_VERSION:
|
||||
ismasClient.setProgressInPercent(_SEND_LAST_VERSION);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
||||
ismasClient.setProgressInPercent(_UPDATE_SUCCEEDED);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_FAILED:
|
||||
case UPDATE_STEP::SEND_LAST_VERSION: {
|
||||
ismasClient.setProgressInPercent(_SEND_LAST_VERSION + _SEND_LAST_VERSION_CORRECTION);
|
||||
ismasClient.sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||
QString("#M=APISM#C=CMD_SENDVERSION#J=") +
|
||||
ismasClient.updateOfPSASendVersion(instance->getPSAInstalled()));
|
||||
} break;
|
||||
case UPDATE_STEP::UPDATE_SUCCEEDED: {
|
||||
ismasClient.setProgressInPercent(_UPDATE_SUCCEEDED + _UPDATE_SUCCEEDED_CORRECTION);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0001", // WAIT-button set to 100%
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::UPDATE_ACTIVATED: {
|
||||
ismasClient.setProgressInPercent(_UPDATE_ACTIVATED + _UPDATE_ACTIVATED_CORRECTION);
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0002", // reset WAIT-button to "" (empty string)
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::SUCCESS,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::UPDATE_FAILED: {
|
||||
ismasClient.setProgressInPercent(_UPDATE_FAILED);
|
||||
break;
|
||||
QString const &ismasUpdateNews =
|
||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||
ismasClient.updateNewsToIsmas(
|
||||
"U0003",
|
||||
ismasClient.getProgressInPercent(),
|
||||
IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||
smap[step],
|
||||
instance->m_ismasMsg.join(' ').toStdString().c_str(),
|
||||
"");
|
||||
ismasClient.sendRequestReceiveResponse(
|
||||
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
|
||||
} break;
|
||||
case UPDATE_STEP::FINISHED:
|
||||
ismasClient.setProgressInPercent(_FINISHED);
|
||||
break;
|
||||
@ -714,10 +996,19 @@ private:
|
||||
break;
|
||||
}
|
||||
|
||||
instance->m_ismasMsg.clear();
|
||||
|
||||
return step;
|
||||
}
|
||||
|
||||
// GUI()
|
||||
friend UPDATE_STEP operator<<(Worker *worker, UPDATE_STEP step) {
|
||||
if (!Worker::instance) {
|
||||
return step;
|
||||
}
|
||||
|
||||
Worker::instance->m_currentStep = step;
|
||||
|
||||
switch (step) {
|
||||
case UPDATE_STEP::STARTED:
|
||||
break;
|
||||
@ -760,15 +1051,36 @@ private:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_SUCCESS:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_WRONG_VALUE:
|
||||
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_WRONG);
|
||||
emit worker->showErrorMessage(worker->m_guiMsg);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_ISMAS_TRIGGER_FAILURE:
|
||||
emit worker->replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||
emit worker->showErrorMessage(worker->m_guiMsg);
|
||||
break;
|
||||
case UPDATE_STEP::INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER:
|
||||
break;
|
||||
case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER:
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH:
|
||||
emit worker->appendText("\nPrepare customer environment ...");
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS:
|
||||
emit worker->replaceLast("Prepare customer environment ...", UPDATE_STEP_DONE);
|
||||
break;
|
||||
case UPDATE_STEP::CHECKOUT_BRANCH_FAILURE:
|
||||
emit worker->replaceLast("Prepare customer environment ...", UPDATE_STEP_FAIL);
|
||||
emit worker->showErrorMessage(worker->m_guiMsg);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_REPOSITORY:
|
||||
emit worker->appendText("\nUpdate repository...");
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS:
|
||||
emit worker->replaceLast(QString("Update repository ..."), UPDATE_STEP_DONE);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_REPOSITORY_FAILURE:
|
||||
emit worker->replaceLast(QString("Update repository ..."), UPDATE_STEP_FAIL);
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES:
|
||||
break;
|
||||
@ -776,8 +1088,59 @@ private:
|
||||
break;
|
||||
case UPDATE_STEP::CHECK_FOR_REPOSITORY_CHANGES_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::FILES_TO_UPDATE: {
|
||||
|
||||
qCritical() << "FILES_TO_UPDATE" << worker->m_filesToUpdate;
|
||||
|
||||
int const size = worker->m_filesToUpdate.size();
|
||||
if (size > 1) {
|
||||
emit worker->appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(i));
|
||||
}
|
||||
} else {
|
||||
emit worker->appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
||||
emit worker->appendText(QString("\n ") + worker->m_filesToUpdate.at(0));
|
||||
}
|
||||
} break;
|
||||
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES:
|
||||
break;
|
||||
case UPDATE_STEP::FILES_TO_DOWNLOAD:
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMANDS:
|
||||
emit worker->appendText("\n( ) Update opkg pakets ...");
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_1:
|
||||
__attribute__((fallthrough));
|
||||
// [[fallthrough]] -> c++17 -> unknown for clang
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_2:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_3:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_4:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_5:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_6:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_7:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_8:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_9:
|
||||
__attribute__((fallthrough));
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_LAST:
|
||||
break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_SUCCESS: {
|
||||
QString prepend = QString("(") + QString("%1").arg(worker->m_displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update opkg pakets ... ");
|
||||
worker->m_opkgCommands.prepend(prepend);
|
||||
emit worker->replaceLast(worker->m_opkgCommands, UPDATE_STEP_DONE);
|
||||
} break;
|
||||
case UPDATE_STEP::EXEC_OPKG_COMMAND_FAILURE: {
|
||||
emit worker->replaceLast(QString("(") + QString("%1").arg(worker->m_displayIndex).rightJustified(3, ' ') + QString(")")
|
||||
+ QString(" Update opkg pakets ... "), UPDATE_STEP_FAIL);
|
||||
} break;
|
||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE:
|
||||
break;
|
||||
case UPDATE_STEP::DOWNLOAD_CONFIG_FILE_SUCCESS:
|
||||
@ -795,10 +1158,13 @@ private:
|
||||
case UPDATE_STEP::APPLY_REPOSITORY_CHANGES_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY:
|
||||
emit worker->appendText("\nSync customer environment with filesystem ...");
|
||||
break;
|
||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS:
|
||||
emit worker->replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_DONE);
|
||||
break;
|
||||
case UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_FAILURE:
|
||||
emit worker->replaceLast(QString("Sync customer environment with filesystem ..."), UPDATE_STEP_FAIL);
|
||||
break;
|
||||
case UPDATE_STEP::SAVE_LOGS:
|
||||
break;
|
||||
@ -807,10 +1173,15 @@ private:
|
||||
case UPDATE_STEP::SAVE_LOGS_FAILURE:
|
||||
break;
|
||||
case UPDATE_STEP::SEND_LAST_VERSION:
|
||||
emit worker->appendText(QString("Send last version info "), UPDATE_STEP_DONE);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_SUCCEEDED:
|
||||
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_ACTIVATED:
|
||||
break;
|
||||
case UPDATE_STEP::UPDATE_FAILED:
|
||||
emit worker->appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
||||
break;
|
||||
case UPDATE_STEP::FINISHED:
|
||||
break;
|
||||
@ -822,6 +1193,8 @@ private:
|
||||
break;
|
||||
}
|
||||
|
||||
worker->m_guiMsg.clear();
|
||||
|
||||
return step;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user