MCPcopy Create free account
hub / github.com/IENT/YUView / updateRecentFileActions

Method updateRecentFileActions

YUViewLib/src/ui/Mainwindow.cpp:459–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459void 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
486void MainWindow::closeEvent(QCloseEvent *event)
487{

Callers 1

createMenusAndActionsMethod · 0.95

Calls 2

setTextMethod · 0.80
setDataMethod · 0.80

Tested by

no test coverage detected