| 696 | } |
| 697 | |
| 698 | void QmitkSegmentationTaskListWidget::UpdateFormWidget() |
| 699 | { |
| 700 | if (!m_CurrentTaskIndex.has_value()) |
| 701 | { |
| 702 | m_Ui->formWidget->hide(); |
| 703 | return; |
| 704 | } |
| 705 | |
| 706 | const auto current = m_CurrentTaskIndex.value(); |
| 707 | |
| 708 | if (!ActiveTaskIsShown() || !m_TaskList->HasForm(current)) |
| 709 | { |
| 710 | m_Ui->formWidget->hide(); |
| 711 | return; |
| 712 | } |
| 713 | |
| 714 | auto form = m_TaskList->GetForm(current); |
| 715 | |
| 716 | try |
| 717 | { |
| 718 | const auto formPath = m_TaskList->GetAbsolutePath(form.Path); |
| 719 | m_Form = nlohmann::json::parse(ReadFileAsString(QString::fromStdString(formPath.string())).toStdString()); |
| 720 | } |
| 721 | catch (const mitk::Exception& e) |
| 722 | { |
| 723 | MITK_ERROR << e.GetDescription(); |
| 724 | return; |
| 725 | } |
| 726 | |
| 727 | m_Form.AddSupplement("Task"); |
| 728 | m_Ui->formWidget->SetForm(&m_Form); |
| 729 | |
| 730 | const auto responsesPath = m_TaskList->GetAbsolutePath(form.Result); |
| 731 | m_Ui->formWidget->SetResponsesPath(responsesPath); |
| 732 | |
| 733 | m_Ui->formWidget->show(); |
| 734 | } |
| 735 | |
| 736 | void QmitkSegmentationTaskListWidget::OnFormSubmission() |
| 737 | { |
no test coverage detected