Rework SourceSelectionWidget to support widget caching

This commit is contained in:
WarmUpTill
2025-05-20 21:37:18 +02:00
committed by WarmUpTill
parent 3dd3f576c3
commit ba3e87a761
15 changed files with 125 additions and 78 deletions

View File

@@ -193,12 +193,19 @@ static void populateTargetTypeSelection(QComboBox *list)
list->addItem(obs_module_text("AdvSceneSwitcher.OBSVideoOutput"));
}
static QStringList getVideoSourcesList()
{
auto sources = GetVideoSourceNames();
sources.sort();
return sources;
}
MacroActionScreenshotEdit::MacroActionScreenshotEdit(
QWidget *parent, std::shared_ptr<MacroActionScreenshot> entryData)
: QWidget(parent),
_scenes(new SceneSelectionWidget(this, true, false, true, true,
true)),
_sources(new SourceSelectionWidget(this, QStringList(), true)),
_sources(new SourceSelectionWidget(this, getVideoSourcesList, true)),
_saveType(new QComboBox()),
_targetType(new QComboBox()),
_savePath(new FileSelection(FileSelection::Type::WRITE, this)),
@@ -206,9 +213,6 @@ MacroActionScreenshotEdit::MacroActionScreenshotEdit(
{
setToolTip(obs_module_text(
"AdvSceneSwitcher.action.screenshot.blackscreenNote"));
auto sources = GetVideoSourceNames();
sources.sort();
_sources->SetSourceNameList(sources);
populateSaveTypeSelection(_saveType);
populateTargetTypeSelection(_targetType);