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