disbale exit-button as long as update process is running

This commit is contained in:
Gerhard Hoffmann 2023-08-02 17:51:35 +02:00
parent a995cae000
commit 0ee92f0181
4 changed files with 16 additions and 0 deletions

View File

@ -31,6 +31,8 @@ MainWindow::MainWindow(Worker *worker, QWidget *parent)
connect(m_exitTimer, SIGNAL(timeout()), ui->exit, SLOT(click())); connect(m_exitTimer, SIGNAL(timeout()), ui->exit, SLOT(click()));
connect(ui->start, SIGNAL(clicked()), m_worker, SLOT(update())); connect(ui->start, SIGNAL(clicked()), m_worker, SLOT(update()));
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(enableExit()), this, SLOT(onEnableExit()));
connect(m_worker, SIGNAL(stopStartTimer()), this, SLOT(onStopStartTimer())); connect(m_worker, SIGNAL(stopStartTimer()), this, SLOT(onStopStartTimer()));
connect(m_worker, SIGNAL(restartExitTimer()), this, SLOT(onRestartExitTimer())); connect(m_worker, SIGNAL(restartExitTimer()), this, SLOT(onRestartExitTimer()));
connect(m_worker, SIGNAL(appendText(QString, QString)), this, SLOT(onAppendText(QString, QString))); connect(m_worker, SIGNAL(appendText(QString, QString)), this, SLOT(onAppendText(QString, QString)));
@ -60,6 +62,14 @@ void MainWindow::onStopStartTimer() {
m_startTimer->stop(); m_startTimer->stop();
} }
void MainWindow::onDisableExit() {
ui->exit->setEnabled(false);
}
void MainWindow::onEnableExit() {
ui->exit->setEnabled(true);
}
void MainWindow::onRestartExitTimer() { void MainWindow::onRestartExitTimer() {
m_exitTimer->stop(); m_exitTimer->stop();
m_exitTimer->start(10 * 1000); m_exitTimer->start(10 * 1000);

View File

@ -23,6 +23,8 @@ public slots:
void onSetProgress(quint8); void onSetProgress(quint8);
void onStopStartTimer(); void onStopStartTimer();
void onRestartExitTimer(); void onRestartExitTimer();
void onEnableExit();
void onDisableExit();
private slots: private slots:
void onQuit(); void onQuit();

View File

@ -122,6 +122,7 @@ void Worker::privateUpdate() {
start->setEnabled(false); start->setEnabled(false);
emit stopStartTimer(); emit stopStartTimer();
emit disableExit();
m_updateProcessRunning = true; m_updateProcessRunning = true;
bool sentIsmasLastVersionNotification = false; bool sentIsmasLastVersionNotification = false;
@ -217,6 +218,7 @@ void Worker::privateUpdate() {
} }
m_updateProcessRunning = false; m_updateProcessRunning = false;
emit enableExit();
emit restartExitTimer(); emit restartExitTimer();
} }

View File

@ -176,6 +176,8 @@ signals:
void setProgress(quint8); void setProgress(quint8);
void stopStartTimer(); void stopStartTimer();
void restartExitTimer(); void restartExitTimer();
void enableExit();
void disableExit();
public slots: public slots:
void update(); void update();