@@ -27,6 +27,8 @@ const static std::map<MacroActionSource::Action, std::string> actionTypes = {
27
27
" AdvSceneSwitcher.action.source.type.deinterlaceMode" },
28
28
{MacroActionSource::Action::DEINTERLACE_FIELD_ORDER,
29
29
" AdvSceneSwitcher.action.source.type.deinterlaceOrder" },
30
+ {MacroActionSource::Action::INTERACT,
31
+ " AdvSceneSwitcher.action.source.type.interact" },
30
32
};
31
33
32
34
const static std::map<obs_deinterlace_mode, std::string> deinterlaceModes = {
@@ -128,6 +130,8 @@ bool MacroActionSource::PerformAction()
128
130
break ;
129
131
case Action::SETTINGS_BUTTON:
130
132
pressSourceButton (_button, s);
133
+ case Action::INTERACT:
134
+ _interaction.SendToSource (s);
131
135
break ;
132
136
case Action::DEINTERLACE_MODE:
133
137
obs_source_set_deinterlace_mode (s, _deinterlaceMode);
@@ -165,6 +169,7 @@ bool MacroActionSource::Save(obs_data_t *obj) const
165
169
static_cast <int >(_deinterlaceMode));
166
170
obs_data_set_int (obj, " deinterlaceOrder" ,
167
171
static_cast <int >(_deinterlaceOrder));
172
+ _interaction.Save (obj);
168
173
return true ;
169
174
}
170
175
@@ -179,6 +184,7 @@ bool MacroActionSource::Load(obs_data_t *obj)
179
184
obs_data_get_int (obj, " deinterlaceMode" ));
180
185
_deinterlaceOrder = static_cast <obs_deinterlace_field_order>(
181
186
obs_data_get_int (obj, " deinterlaceOrder" ));
187
+ _interaction.Load (obj);
182
188
return true ;
183
189
}
184
190
@@ -249,7 +255,8 @@ MacroActionSourceEdit::MacroActionSourceEdit(
249
255
_deinterlaceMode(new QComboBox()),
250
256
_deinterlaceOrder(new QComboBox()),
251
257
_warning(new QLabel(
252
- obs_module_text (" AdvSceneSwitcher.action.source.warning" )))
258
+ obs_module_text (" AdvSceneSwitcher.action.source.warning" ))),
259
+ _interaction(new SourceInteractionWidget())
253
260
{
254
261
populateActionSelection (_actions);
255
262
auto sources = GetSourceNames ();
@@ -273,6 +280,13 @@ MacroActionSourceEdit::MacroActionSourceEdit(
273
280
this , SLOT (DeinterlaceModeChanged (int )));
274
281
QWidget::connect (_deinterlaceOrder, SIGNAL (currentIndexChanged (int )),
275
282
this , SLOT (DeinterlaceOrderChanged (int )));
283
+ QWidget::connect (
284
+ _interaction,
285
+ SIGNAL (SettingsChanged (SourceInteractionInstance *)), this ,
286
+ SLOT (InteractionSettingsChanged (SourceInteractionInstance *)));
287
+ QWidget::connect (_interaction,
288
+ SIGNAL (TypeChanged (SourceInteraction::Type)), this ,
289
+ SLOT (InteractionTypeChanged (SourceInteraction::Type)));
276
290
277
291
QVBoxLayout *mainLayout = new QVBoxLayout;
278
292
QHBoxLayout *entryLayout = new QHBoxLayout;
@@ -294,6 +308,7 @@ MacroActionSourceEdit::MacroActionSourceEdit(
294
308
buttonLayout->addWidget (_getSettings);
295
309
buttonLayout->addStretch ();
296
310
mainLayout->addLayout (buttonLayout);
311
+ mainLayout->addWidget (_interaction);
297
312
setLayout (mainLayout);
298
313
299
314
_entryData = entryData;
@@ -318,6 +333,7 @@ void MacroActionSourceEdit::UpdateEntryData()
318
333
static_cast <int >(_entryData->_deinterlaceMode )));
319
334
_deinterlaceOrder->setCurrentIndex (_deinterlaceOrder->findData (
320
335
static_cast <int >(_entryData->_deinterlaceOrder )));
336
+ _interaction->SetSourceInteractionSelection (_entryData->_interaction );
321
337
SetWidgetVisibility ();
322
338
}
323
339
@@ -377,6 +393,16 @@ void MacroActionSourceEdit::SettingsChanged()
377
393
378
394
auto lock = LockContext ();
379
395
_entryData->_settings = _settings->toPlainText ().toStdString ();
396
+ }
397
+
398
+ void MacroActionSourceEdit::InteractionTypeChanged (SourceInteraction::Type value)
399
+ {
400
+ if (_loading || !_entryData) {
401
+ return ;
402
+ }
403
+
404
+ auto lock = LockContext ();
405
+ _entryData->_interaction .SetType (value);
380
406
381
407
adjustSize ();
382
408
updateGeometry ();
@@ -405,6 +431,16 @@ void MacroActionSourceEdit::DeinterlaceOrderChanged(int idx)
405
431
_deinterlaceOrder->itemData (idx).toInt ());
406
432
}
407
433
434
+ void MacroActionSourceEdit::InteractionSettingsChanged (
435
+ SourceInteractionInstance *value)
436
+ {
437
+ if (_loading || !_entryData) {
438
+ return ;
439
+ }
440
+ auto lock = LockContext ();
441
+ _entryData->_interaction .SetSettings (value);
442
+ }
443
+
408
444
void MacroActionSourceEdit::SetWidgetVisibility ()
409
445
{
410
446
const bool showSettings = _entryData->_action ==
@@ -424,6 +460,8 @@ void MacroActionSourceEdit::SetWidgetVisibility()
424
460
_deinterlaceOrder->setVisible (
425
461
_entryData->_action ==
426
462
MacroActionSource::Action::DEINTERLACE_FIELD_ORDER);
463
+ _interaction->setVisible (_entryData->_action ==
464
+ MacroActionSource::Action::INTERACT);
427
465
adjustSize ();
428
466
updateGeometry ();
429
467
}
0 commit comments