From e82417dde7350292915b416a4fa8646033894ca7 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 22 Nov 2024 12:55:27 +0100 Subject: [PATCH] MainWindow::MainWindow(): Add status timer, to show proceeding update, so user does not exit application / restart machine. --- UpdatePTUDevCtrl/mainwindow.cpp | 19 +++++++++++++++++++ UpdatePTUDevCtrl/mainwindow.h | 1 + 2 files changed, 20 insertions(+) diff --git a/UpdatePTUDevCtrl/mainwindow.cpp b/UpdatePTUDevCtrl/mainwindow.cpp index 5e84e88..6a7aa64 100644 --- a/UpdatePTUDevCtrl/mainwindow.cpp +++ b/UpdatePTUDevCtrl/mainwindow.cpp @@ -59,6 +59,24 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent) m_exitTimer->setSingleShot(true); m_exitTimer->start(1800 * 1000); + m_statusTimer = new QTimer(this); + if (m_statusTimer) { + connect(m_statusTimer, &QTimer::timeout, [this]() { + static QString p("."); + QTime const &t = QDateTime::currentDateTime().time(); + QString s = t.toString(Qt::ISODate); + s += ": Update might take several minutes " + p; + if (p.length() >= 5) { + p = "."; + } else { + p += "."; + } + this->statusBar()->showMessage(s); + }); + m_statusTimer->setSingleShot(false); + m_statusTimer->start(1000); + } + connect(ui->exit, SIGNAL(clicked()),this,SLOT(onQuit())); connect(m_worker, SIGNAL(disableExit()),this,SLOT(onDisableExit())); connect(m_worker, SIGNAL(enableExit()),this,SLOT(onEnableExit())); @@ -76,6 +94,7 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent) MainWindow::~MainWindow() { delete m_startTimer; delete m_exitTimer; + delete m_statusTimer; delete ui; } diff --git a/UpdatePTUDevCtrl/mainwindow.h b/UpdatePTUDevCtrl/mainwindow.h index c6eac86..4cf7b5f 100644 --- a/UpdatePTUDevCtrl/mainwindow.h +++ b/UpdatePTUDevCtrl/mainwindow.h @@ -73,5 +73,6 @@ private: bool m_progressRunning; //int m_progressValue; UpdateDcEvent::UpdateStep m_updateStep; + QTimer *m_statusTimer; }; #endif // MAINWINDOW_H