| 406 | } |
| 407 | |
| 408 | void 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 | |
| 437 | void SessionItemWidget::resizeEvent(QResizeEvent *e) |
| 438 | { |
no test coverage detected