| 866 | } |
| 867 | |
| 868 | void TempVarOutputMappingsWidget::Rebuild() |
| 869 | { |
| 870 | _loading = true; |
| 871 | |
| 872 | // Remove all existing row widgets from layout and delete them |
| 873 | for (auto &row : _rows) { |
| 874 | _rowsLayout->removeWidget(row.container); |
| 875 | delete row.container; |
| 876 | } |
| 877 | _rows.clear(); |
| 878 | |
| 879 | if (!_segment) { |
| 880 | _loading = false; |
| 881 | UpdateVisibility(); |
| 882 | return; |
| 883 | } |
| 884 | |
| 885 | const auto &mappings = _segment->GetVarMappings(); |
| 886 | for (int i = 0; i < (int)mappings.size(); i++) { |
| 887 | const auto &mapping = mappings[i]; |
| 888 | |
| 889 | auto container = new QWidget(this); |
| 890 | auto rowLayout = new QHBoxLayout(); |
| 891 | rowLayout->setContentsMargins(0, 0, 0, 0); |
| 892 | |
| 893 | auto tempVarCombo = new FilterComboBox( |
| 894 | container, |
| 895 | obs_module_text("AdvSceneSwitcher.tempVar.select")); |
| 896 | tempVarCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
| 897 | tempVarCombo->setMaximumWidth(350); |
| 898 | tempVarCombo->setDuplicatesEnabled(true); |
| 899 | PopulateTempVarCombo(tempVarCombo); |
| 900 | if (mapping.tempVar.HasValidID()) { |
| 901 | QVariant v; |
| 902 | v.setValue(mapping.tempVar); |
| 903 | tempVarCombo->setCurrentIndex( |
| 904 | tempVarCombo->findData(v)); |
| 905 | } |
| 906 | |
| 907 | auto arrowLabel = new QLabel(container); |
| 908 | { |
| 909 | QIcon icon; |
| 910 | const auto path = (GetThemeTypeName() == "Light") |
| 911 | ? "theme:Light/right.svg" |
| 912 | : "theme:Dark/right.svg"; |
| 913 | icon.addFile(QString::fromUtf8(path), QSize(), |
| 914 | QIcon::Normal, QIcon::Off); |
| 915 | arrowLabel->setPixmap(icon.pixmap(16, 16)); |
| 916 | } |
| 917 | |
| 918 | auto varSel = new VariableSelection(container); |
| 919 | varSel->SetVariable(mapping.variable); |
| 920 | |
| 921 | auto removeBtn = new QToolButton(container); |
| 922 | removeBtn->setProperty("themeID", QVariant(QString::fromUtf8( |
| 923 | "removeIconSmall"))); |
| 924 | removeBtn->setProperty( |
| 925 | "class", QVariant(QString::fromUtf8("icon-trash"))); |
nothing calls this directly
no test coverage detected