Add class UpdateProcessRunning: use for sending SEND-LAST-VERSION as

part of its destruktor: RAII-pattern.
This commit is contained in:
Gerhard Hoffmann 2023-10-30 15:05:30 +01:00
parent 34e5189945
commit d4ddbbee21

View File

@ -193,17 +193,27 @@ class Worker : public QObject {
int sendUpdateSucceededAndActivated();
int sendFinalResult();
struct UpdateProcessRunning {
Worker *m_worker;
static constexpr const int UPDATE_SUCCESS_AND_ACTIVATED = 0;
static constexpr const int CLONE_AND_CHECKOUT_SUCCESS = 0;
static constexpr const int CLONE_AND_CHECKOUT_FAILURE = -3;
static constexpr const int ISMAS_TRIGGER_FAILURE = -5;
static constexpr const int ENVIRONMENT_CONFIG_FAILURE = -6;
static constexpr const int GIT_PULL_FAILURE = -7;
static constexpr const int UPDATE_FILES_FAILURE = -8;
static constexpr const int RSYNC_FAILURE = -9;
static constexpr const int SEND_LAST_VERSION_FAILURE = -10;
static constexpr const int SAVE_LOG_FILES_FAILURE = -11;
explicit UpdateProcessRunning(Worker *worker) : m_worker(worker) {
m_worker->m_updateProcessRunning = true;
emit m_worker->disableExit();
m_worker->startProgressLoop();
}
virtual ~UpdateProcessRunning() {
m_worker->ISMAS() << (m_worker->GUI() << (m_worker->CONSOLE()
<< UPDATE_STEP::SEND_LAST_VERSION));
m_worker->stopProgressLoop();
m_worker->m_updateProcessRunning = false;
emit m_worker->enableExit();
emit m_worker->restartExitTimer();
}
};
friend struct UpdateProcessRunning;
public:
enum class UPDATE_STEP {