mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
feat: add close event handling to MainWindow for active processes
This commit is contained in:
+26
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -56,5 +56,8 @@ private:
|
||||
QWidget *m_titleBar;
|
||||
QWidget *m_contentArea;
|
||||
QHBoxLayout *m_titleBarLayout;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
Reference in New Issue
Block a user