| 272 | } |
| 273 | |
| 274 | void SequenceScenesPage::AddStep(int defaultSceneIndex) |
| 275 | { |
| 276 | auto *row = new QWidget(_stepsContainer); |
| 277 | auto *rowLayout = new QHBoxLayout(row); |
| 278 | rowLayout->setContentsMargins(0, 0, 0, 0); |
| 279 | |
| 280 | auto *sceneCombo = new QComboBox(row); |
| 281 | sceneCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
| 282 | const QStringList scenes = GetSceneNames(); |
| 283 | for (const QString &name : scenes) { |
| 284 | sceneCombo->addItem(name); |
| 285 | } |
| 286 | if (defaultSceneIndex >= 0 && defaultSceneIndex < scenes.size()) { |
| 287 | sceneCombo->setCurrentIndex(defaultSceneIndex); |
| 288 | } |
| 289 | PlaceWidgets(obs_module_text("FirstRunWizard.seqScenes.switchTo"), |
| 290 | rowLayout, {{"{{scene}}", sceneCombo}}, false); |
| 291 | |
| 292 | auto *delayWidget = new QWidget(row); |
| 293 | auto *delayLayout = new QHBoxLayout(delayWidget); |
| 294 | delayLayout->setContentsMargins(0, 0, 0, 0); |
| 295 | auto *durationSel = new DurationSelection(delayWidget, true, 0.1); |
| 296 | durationSel->SetDuration(Duration(5.0)); |
| 297 | PlaceWidgets(obs_module_text("FirstRunWizard.seqScenes.thenWait"), |
| 298 | delayLayout, {{"{{duration}}", durationSel}}, false); |
| 299 | rowLayout->addWidget(delayWidget); |
| 300 | |
| 301 | auto *removeBtn = new QPushButton(row); |
| 302 | removeBtn->setProperty("themeID", |
| 303 | QVariant(QString::fromUtf8("removeIconSmall"))); |
| 304 | removeBtn->setProperty("class", |
| 305 | QVariant(QString::fromUtf8("icon-trash"))); |
| 306 | removeBtn->setToolTip( |
| 307 | obs_module_text("FirstRunWizard.seqScenes.removeTooltip")); |
| 308 | removeBtn->setMaximumSize(22, 22); |
| 309 | rowLayout->addWidget(removeBtn); |
| 310 | |
| 311 | _rows.append({row, sceneCombo, delayWidget, durationSel, removeBtn}); |
| 312 | _stepsLayout->addWidget(row); |
| 313 | |
| 314 | UpdateDelayVisibility(); |
| 315 | UpdateRemoveButtons(); |
| 316 | |
| 317 | connect(removeBtn, &QPushButton::clicked, this, |
| 318 | [this, row]() { RemoveStep(row); }); |
| 319 | } |
| 320 | |
| 321 | void SequenceScenesPage::RemoveStep(QWidget *rowWidget) |
| 322 | { |
nothing calls this directly
no test coverage detected