| 457 | } |
| 458 | |
| 459 | void MainWindow::updateRecentFileActions() |
| 460 | { |
| 461 | QSettings settings; |
| 462 | auto files = settings.value("recentFileList").toStringList(); |
| 463 | |
| 464 | int fileIdx = 0; |
| 465 | auto it = files.begin(); |
| 466 | while (it != files.end()) |
| 467 | { |
| 468 | if ((QFile(*it).exists())) |
| 469 | { |
| 470 | QString text = tr("&%1 %2").arg(fileIdx + 1).arg(*it); |
| 471 | recentFileActions[fileIdx]->setText(text); |
| 472 | recentFileActions[fileIdx]->setData(*it); |
| 473 | recentFileActions[fileIdx]->setVisible(true); |
| 474 | fileIdx++; |
| 475 | it++; |
| 476 | } |
| 477 | else |
| 478 | it = files.erase(it); |
| 479 | } |
| 480 | for (int j = fileIdx; j < MAX_RECENT_FILES; ++j) |
| 481 | recentFileActions[j]->setVisible(false); |
| 482 | |
| 483 | settings.setValue("recentFileList", files); |
| 484 | } |
| 485 | |
| 486 | void MainWindow::closeEvent(QCloseEvent *event) |
| 487 | { |
no test coverage detected