| 664 | } |
| 665 | |
| 666 | QString TempVariableSelection::SetupInfoLabel() |
| 667 | { |
| 668 | auto currentSelection = _selection->itemData(_selection->currentIndex()) |
| 669 | .value<TempVariableRef>(); |
| 670 | const auto segment = currentSelection._segment.lock(); |
| 671 | if (!segment) { |
| 672 | _info->setToolTip(""); |
| 673 | _info->hide(); |
| 674 | return ""; |
| 675 | } |
| 676 | |
| 677 | auto macro = segment->GetMacro(); |
| 678 | if (!macro) { |
| 679 | _info->setToolTip(""); |
| 680 | _info->hide(); |
| 681 | return ""; |
| 682 | } |
| 683 | auto var = currentSelection.GetTempVariable(macro); |
| 684 | if (!var) { |
| 685 | _info->setToolTip(""); |
| 686 | _info->hide(); |
| 687 | return ""; |
| 688 | } |
| 689 | auto description = QString::fromStdString(var->_description); |
| 690 | std::lock_guard<std::mutex> lock(var->_lastValuesMutex); |
| 691 | if (!var->_lastValues.empty()) { |
| 692 | if (!description.isEmpty()) { |
| 693 | description += QString("\n\n"); |
| 694 | } |
| 695 | description += |
| 696 | QString(obs_module_text( |
| 697 | "AdvSceneSwitcher.tempVar.selectionInfo.lastValues")) + |
| 698 | "\n"; |
| 699 | for (const auto &value : var->_lastValues) { |
| 700 | description += "\n" + QString::fromStdString(value); |
| 701 | } |
| 702 | } |
| 703 | _info->setToolTip(description); |
| 704 | _info->setVisible(!description.isEmpty()); |
| 705 | return description; |
| 706 | } |
| 707 | |
| 708 | MacroSegment *TempVariableSelection::GetSegment() const |
| 709 | { |
nothing calls this directly
no test coverage detected