feat: add close event handling to MainWindow for active processes

This commit is contained in:
uncor3
2026-03-20 03:10:35 +00:00
parent acbe957250
commit 61b049d8dc
2 changed files with 29 additions and 8 deletions
+26 -8
View File
@@ -497,16 +497,34 @@ void MainWindow::updateNoDevicesConnected()
m_mainStackedWidget->setCurrentIndex(1); // Show device list page
}
void MainWindow::closeEvent(QCloseEvent *event)
{
if (StatusBalloon::sharedInstance()->hasActiveProcesses()) {
auto reply = QMessageBox::question(
this, tr("Transfers in Progress"),
tr("There are import/export operations in progress.\n"
"Do you really want to quit? This will cancel them."),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (reply == QMessageBox::No) {
event->ignore();
return;
}
ExportManager::sharedInstance()->cancelAllJobs();
}
QMainWindow::closeEvent(event);
}
MainWindow::~MainWindow()
{
// idevice_event_unsubscribe();
// #ifdef ENABLE_RECOVERY_DEVICE_SUPPORT
// irecv_device_event_unsubscribe(context);
// #endif
#ifdef ENABLE_RECOVERY_DEVICE_SUPPORT
irecv_device_event_unsubscribe(context);
#endif
m_deviceMonitor->requestInterruption();
// FIXME:QThread: Destroyed while thread '' is still running
// m_deviceMonitor->wait();
m_deviceMonitor->wait();
delete m_deviceMonitor;
// delete m_updater;
delete m_updater;
// sleep(2);
}
}
+3
View File
@@ -56,5 +56,8 @@ private:
QWidget *m_titleBar;
QWidget *m_contentArea;
QHBoxLayout *m_titleBarLayout;
protected:
void closeEvent(QCloseEvent *event) override;
};
#endif // MAINWINDOW_H