From 0af803551a0d81259ae8f0ed95d082eafe6fd391 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 22 Jul 2019 18:49:24 +0200 Subject: [PATCH] Main window: handle window closing correctly --- sdrgui/mainwindow.cpp | 24 ++++++++++++------------ sdrgui/mainwindow.h | 1 - 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 4d523e866..18f3363c4 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -812,8 +812,19 @@ void MainWindow::createStatusBar() statusBar()->addPermanentWidget(m_dateTimeWidget); } -void MainWindow::closeEvent(QCloseEvent*) +void MainWindow::closeEvent(QCloseEvent *closeEvent) { + qDebug("MainWindow::closeEvent"); + + savePresetSettings(m_settings.getWorkingPreset(), 0); + m_settings.save(); + + while (m_deviceUIs.size() > 0) + { + removeLastDevice(); + } + + closeEvent->accept(); } void MainWindow::updatePresetControls() @@ -1942,17 +1953,6 @@ void MainWindow::on_action_removeLastDevice_triggered() } } -void MainWindow::on_action_Exit_triggered() -{ - savePresetSettings(m_settings.getWorkingPreset(), 0); - m_settings.save(); - - while (m_deviceUIs.size() > 0) - { - removeLastDevice(); - } -} - void MainWindow::tabInputViewIndexChanged() { int inputViewIndex = ui->tabInputsView->currentIndex(); diff --git a/sdrgui/mainwindow.h b/sdrgui/mainwindow.h index a091e754c..b91943bf1 100644 --- a/sdrgui/mainwindow.h +++ b/sdrgui/mainwindow.h @@ -392,7 +392,6 @@ private slots: void on_action_addSinkDevice_triggered(); void on_action_addMIMODevice_triggered(); void on_action_removeLastDevice_triggered(); - void on_action_Exit_triggered(); void tabInputViewIndexChanged(); void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release); };