MainWindow::MainWindow():

Add status timer, to show proceeding update, so user does not exit
	application / restart machine.
This commit is contained in:
Gerhard Hoffmann 2024-11-22 12:55:27 +01:00
parent 1e271201c5
commit e82417dde7
2 changed files with 20 additions and 0 deletions

View File

@ -59,6 +59,24 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
m_exitTimer->setSingleShot(true); m_exitTimer->setSingleShot(true);
m_exitTimer->start(1800 * 1000); 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(ui->exit, SIGNAL(clicked()),this,SLOT(onQuit()));
connect(m_worker, SIGNAL(disableExit()),this,SLOT(onDisableExit())); connect(m_worker, SIGNAL(disableExit()),this,SLOT(onDisableExit()));
connect(m_worker, SIGNAL(enableExit()),this,SLOT(onEnableExit())); connect(m_worker, SIGNAL(enableExit()),this,SLOT(onEnableExit()));
@ -76,6 +94,7 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
MainWindow::~MainWindow() { MainWindow::~MainWindow() {
delete m_startTimer; delete m_startTimer;
delete m_exitTimer; delete m_exitTimer;
delete m_statusTimer;
delete ui; delete ui;
} }

View File

@ -73,5 +73,6 @@ private:
bool m_progressRunning; bool m_progressRunning;
//int m_progressValue; //int m_progressValue;
UpdateDcEvent::UpdateStep m_updateStep; UpdateDcEvent::UpdateStep m_updateStep;
QTimer *m_statusTimer;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H