| 1581 | } |
| 1582 | |
| 1583 | void MainWindow::closeEvent(QCloseEvent *event) |
| 1584 | { |
| 1585 | // Check that we aren't checking files |
| 1586 | if (!mThread->isChecking()) { |
| 1587 | saveSettings(); |
| 1588 | event->accept(); |
| 1589 | } else { |
| 1590 | const QString text(tr("Analyzer is running.\n\n" \ |
| 1591 | "Do you want to stop the analysis and exit Cppcheck?")); |
| 1592 | |
| 1593 | QMessageBox msg(QMessageBox::Warning, |
| 1594 | tr("Cppcheck"), |
| 1595 | text, |
| 1596 | QMessageBox::Yes | QMessageBox::No, |
| 1597 | this); |
| 1598 | |
| 1599 | msg.setDefaultButton(QMessageBox::No); |
| 1600 | const int rv = msg.exec(); |
| 1601 | if (rv == QMessageBox::Yes) { |
| 1602 | // This isn't really very clean way to close threads but since the app is |
| 1603 | // exiting it doesn't matter. |
| 1604 | mThread->stop(); |
| 1605 | saveSettings(); |
| 1606 | mExiting = true; |
| 1607 | } |
| 1608 | event->ignore(); |
| 1609 | } |
| 1610 | } |
| 1611 | |
| 1612 | void MainWindow::toggleAllChecked(bool checked) |
| 1613 | { |
nothing calls this directly
no test coverage detected