| 373 | |
| 374 | Q_DECL_DEPRECATED_X("-------------存在兼容代码需要删除") |
| 375 | void RecentDisplayWidget::initData() |
| 376 | { |
| 377 | const QString oldCfgFile = CustomPaths::user(CustomPaths::Configures) + QDir::separator() + "recent.support"; |
| 378 | const QString newCfgFile = CustomPaths::user(CustomPaths::Configures) + QDir::separator() + "recent.json"; |
| 379 | d->recentSettings.load("", newCfgFile); |
| 380 | |
| 381 | QFile file(oldCfgFile); |
| 382 | if (file.open(QIODevice::ReadOnly)) { |
| 383 | auto doc = QJsonDocument::fromJson(file.readAll()); |
| 384 | file.close(); |
| 385 | file.remove(); |
| 386 | |
| 387 | QVariantList prjList; |
| 388 | QJsonArray prjArray = doc.object().value(kProjects).toArray(); |
| 389 | for (const auto &prj : prjArray) { |
| 390 | auto prjObj = prj.toObject(); |
| 391 | const auto &info = parseProjectInfo(prjObj); |
| 392 | if (!info.isEmpty()) |
| 393 | prjList << info; |
| 394 | } |
| 395 | d->recentSettings.setValue(kRecentGroup, kProjects, prjList); |
| 396 | |
| 397 | QVariantList docList; |
| 398 | QJsonArray docArray = doc.object().value(kDocuments).toArray(); |
| 399 | for (const auto &doc : docArray) { |
| 400 | auto filePath = doc.toString(); |
| 401 | if (!filePath.isEmpty()) |
| 402 | docList << filePath; |
| 403 | } |
| 404 | d->recentSettings.setValue(kRecentGroup, kDocuments, docList); |
| 405 | } |
| 406 | |
| 407 | d->recentListView->setItemList(d->recentSettings.value(kRecentGroup, kProjects).toList()); |
| 408 | d->recentListView->setItemList(d->recentSettings.value(kRecentGroup, kDocuments).toList()); |
| 409 | d->sessionListWidget->addSessionList(d->sessionSrv->sessionList()); |
| 410 | } |
| 411 | |
| 412 | void RecentDisplayWidget::showEvent(QShowEvent *event) |
| 413 | { |
nothing calls this directly
no test coverage detected