| 251 | } |
| 252 | |
| 253 | void FilterSelectionWidget::SetFilter(const SourceSelection &source, |
| 254 | const FilterSelection &filter) |
| 255 | { |
| 256 | _source = source; |
| 257 | PopulateSelection(); |
| 258 | |
| 259 | int idx = -1; |
| 260 | |
| 261 | switch (filter.GetType()) { |
| 262 | case FilterSelection::Type::ALL: |
| 263 | idx = findText(obs_module_text( |
| 264 | "AdvSceneSwitcher.filterSelection.all")); |
| 265 | break; |
| 266 | case FilterSelection::Type::SOURCE: { |
| 267 | if (_filterEndIdx == -1) { |
| 268 | idx = -1; |
| 269 | break; |
| 270 | } |
| 271 | idx = FindIdxInRagne(this, _variablesEndIdx, _filterEndIdx, |
| 272 | filter.ToString()); |
| 273 | break; |
| 274 | } |
| 275 | case FilterSelection::Type::VARIABLE: { |
| 276 | if (_variablesEndIdx == -1) { |
| 277 | idx = -1; |
| 278 | break; |
| 279 | } |
| 280 | idx = FindIdxInRagne(this, _selectIdx, _variablesEndIdx, |
| 281 | filter.ToString()); |
| 282 | break; |
| 283 | default: |
| 284 | idx = -1; |
| 285 | break; |
| 286 | } |
| 287 | } |
| 288 | setCurrentIndex(idx); |
| 289 | _currentSelection = filter; |
| 290 | } |
| 291 | |
| 292 | void FilterSelectionWidget::showEvent(QShowEvent *event) |
| 293 | { |
no test coverage detected