| 230 | } |
| 231 | |
| 232 | MacroSegmentScriptEdit::MacroSegmentScriptEdit( |
| 233 | QWidget *parent, std::shared_ptr<MacroSegmentScript> entryData) |
| 234 | : QWidget(parent), |
| 235 | _timeout(new DurationSelection(this)) |
| 236 | { |
| 237 | QWidget::connect(_timeout, &DurationSelection::DurationChanged, this, |
| 238 | &MacroSegmentScriptEdit::TimeoutChanged); |
| 239 | |
| 240 | auto timeoutLayout = new QHBoxLayout(); |
| 241 | PlaceWidgets(obs_module_text("AdvSceneSwitcher.script.timeout"), |
| 242 | timeoutLayout, {{"{{timeout}}", _timeout}}); |
| 243 | |
| 244 | auto layout = new QVBoxLayout(); |
| 245 | |
| 246 | auto properties = entryData->GetProperties(); |
| 247 | if (!!properties) { |
| 248 | obs_properties_destroy(properties); |
| 249 | |
| 250 | // We need a separate OBSData object here as we can't risk |
| 251 | // entryData->_settings being modified while it is currently used |
| 252 | OBSDataAutoRelease data = obs_data_create(); |
| 253 | obs_data_apply(data, entryData->GetSettings()); |
| 254 | |
| 255 | #if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(30, 0, 0) |
| 256 | auto propertiesView = |
| 257 | new OBSPropertiesView(data.Get(), this, GetProperties, |
| 258 | nullptr, UpdateSettings); |
| 259 | layout->addWidget(propertiesView); |
| 260 | connect(propertiesView, &OBSPropertiesView::PropertiesResized, |
| 261 | this, [this]() { |
| 262 | adjustSize(); |
| 263 | updateGeometry(); |
| 264 | }); |
| 265 | #else |
| 266 | layout->addWidget(new QLabel( |
| 267 | "Displaying script properties not supported when compiled for OBS 29!")); |
| 268 | #endif |
| 269 | } |
| 270 | |
| 271 | layout->addLayout(timeoutLayout); |
| 272 | setLayout(layout); |
| 273 | |
| 274 | _entryData = entryData; |
| 275 | UpdateEntryData(); |
| 276 | _loading = false; |
| 277 | |
| 278 | adjustSize(); |
| 279 | updateGeometry(); |
| 280 | } |
| 281 | |
| 282 | void MacroSegmentScriptEdit::UpdateEntryData() |
| 283 | { |
nothing calls this directly
no test coverage detected