MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / updateSession

Method updateSession

src/plugins/recent/mainframe/sessionitemwidget.cpp:408–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406}
407
408void SessionItemWidget::updateSession()
409{
410 bool isLastSession = d->sessionSrv->lastSession() == d->sessionName;
411 bool isCurrentSession = d->sessionSrv->currentSession() == d->sessionName;
412 bool isDefaultSession = d->sessionSrv->isDefaultSession(d->sessionName);
413 bool isDefaultVirgin = d->sessionSrv->isDefaultVirgin();
414
415 d->renameBtn->setEnabled(!isDefaultSession);
416 d->removeBtn->setEnabled(!isDefaultSession && !isCurrentSession);
417
418 auto title = d->sessionName;
419 if (isLastSession && isDefaultVirgin)
420 title = tr("%1 (last session)").arg(title);
421 if (isCurrentSession && !isDefaultVirgin)
422 title = tr("%1 (current session)").arg(title);
423 d->headerLine->setTitle(title);
424 d->headerLine->setTitleTip(d->sessionName);
425
426 const auto &sessionCfg = d->sessionSrv->sessionFile(d->sessionName);
427 if (!QFile::exists(sessionCfg))
428 return d->prjInfoLabel->setVisible(false);
429
430 Settings st("", sessionCfg);
431 const auto &prjList = st.value("Session", "ProjectList").toList();
432 const auto &info = d->createProjectInfo(prjList);
433 d->prjInfoLabel->setVisible(!info.isEmpty());
434 d->prjInfoLabel->setText(info);
435}
436
437void SessionItemWidget::resizeEvent(QResizeEvent *e)
438{

Callers 1

updateSessionsMethod · 0.80

Calls 14

lastSessionMethod · 0.80
isDefaultSessionMethod · 0.80
isDefaultVirginMethod · 0.80
setTitleTipMethod · 0.80
sessionFileMethod · 0.80
setVisibleMethod · 0.80
toListMethod · 0.80
currentSessionMethod · 0.45
setEnabledMethod · 0.45
setTitleMethod · 0.45
valueMethod · 0.45
createProjectInfoMethod · 0.45

Tested by

no test coverage detected