| 462 | } |
| 463 | |
| 464 | TempVariableSelection::TempVariableSelection(QWidget *parent) |
| 465 | : QWidget(parent), |
| 466 | _selection(new FilterComboBox( |
| 467 | this, obs_module_text("AdvSceneSwitcher.tempVar.select"))), |
| 468 | _info(new AutoUpdateHelpIcon(this, |
| 469 | [this]() { return SetupInfoLabel(); })) |
| 470 | |
| 471 | { |
| 472 | MacroEdit *edit = findMacroEditParent(parent); |
| 473 | assert(edit); |
| 474 | _macroEdits.push_back(edit); |
| 475 | while ((edit = findMacroEditParent(edit->parentWidget()))) { |
| 476 | _macroEdits.push_back(edit); |
| 477 | } |
| 478 | |
| 479 | _info->hide(); |
| 480 | |
| 481 | _selection->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
| 482 | _selection->setMaximumWidth(350); |
| 483 | _selection->setDuplicatesEnabled(true); |
| 484 | PopulateSelection(); |
| 485 | |
| 486 | QWidget::connect(_selection, SIGNAL(currentIndexChanged(int)), this, |
| 487 | SLOT(SelectionIdxChanged(int))); |
| 488 | QWidget::connect(_selection, SIGNAL(highlighted(int)), this, |
| 489 | SLOT(HighlightChanged(int))); |
| 490 | for (const auto macroEdit : _macroEdits) { |
| 491 | QWidget::connect(macroEdit, SIGNAL(MacroSegmentOrderChanged()), |
| 492 | this, SLOT(MacroSegmentsChanged())); |
| 493 | } |
| 494 | QWidget::connect(TempVarSignalManager::Instance(), |
| 495 | SIGNAL(SegmentTempVarsChanged(MacroSegment *)), this, |
| 496 | SLOT(SegmentTempVarsChanged(MacroSegment *))); |
| 497 | |
| 498 | auto layout = new QHBoxLayout(); |
| 499 | layout->setContentsMargins(0, 0, 0, 0); |
| 500 | layout->addWidget(_selection); |
| 501 | layout->addWidget(_info); |
| 502 | setLayout(layout); |
| 503 | } |
| 504 | |
| 505 | void TempVariableSelection::SelectionIdxChanged(int idx) |
| 506 | { |
nothing calls this directly
no test coverage detected