mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-08 00:29:44 -04:00
UI: Add copying/pasting of sources/filters
Closes jp9000/obs-studio#860
This commit is contained in:
@@ -3347,6 +3347,19 @@ void OBSBasic::CreateSourcePopupMenu(QListWidgetItem *item, bool preview)
|
||||
if (addSourceMenu)
|
||||
popup.addMenu(addSourceMenu);
|
||||
|
||||
ui->actionCopyFilters->setEnabled(false);
|
||||
|
||||
popup.addSeparator();
|
||||
popup.addAction(ui->actionCopySource);
|
||||
popup.addAction(ui->actionPasteRef);
|
||||
popup.addAction(ui->actionPasteDup);
|
||||
popup.addSeparator();
|
||||
|
||||
popup.addSeparator();
|
||||
popup.addAction(ui->actionCopyFilters);
|
||||
popup.addAction(ui->actionPasteFilters);
|
||||
popup.addSeparator();
|
||||
|
||||
if (item) {
|
||||
if (addSourceMenu)
|
||||
popup.addSeparator();
|
||||
@@ -3393,6 +3406,8 @@ void OBSBasic::CreateSourcePopupMenu(QListWidgetItem *item, bool preview)
|
||||
SLOT(OpenFilters()));
|
||||
popup.addAction(QTStr("Properties"), this,
|
||||
SLOT(on_actionSourceProperties_triggered()));
|
||||
|
||||
ui->actionCopyFilters->setEnabled(true);
|
||||
}
|
||||
|
||||
popup.exec(QCursor::pos());
|
||||
@@ -5270,3 +5285,60 @@ bool OBSBasic::sysTrayMinimizeToTray()
|
||||
return config_get_bool(GetGlobalConfig(),
|
||||
"BasicWindow", "SysTrayMinimizeToTray");
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionCopySource_triggered()
|
||||
{
|
||||
on_actionCopyTransform_triggered();
|
||||
|
||||
OBSSceneItem item = GetCurrentSceneItem();
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
OBSSource source = obs_sceneitem_get_source(item);
|
||||
|
||||
copyString = obs_source_get_name(source);
|
||||
copyVisible = obs_sceneitem_visible(item);
|
||||
|
||||
ui->actionPasteRef->setEnabled(true);
|
||||
ui->actionPasteDup->setEnabled(true);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionPasteRef_triggered()
|
||||
{
|
||||
OBSBasicSourceSelect::SourcePaste(copyString, copyVisible, false);
|
||||
on_actionPasteTransform_triggered();
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionPasteDup_triggered()
|
||||
{
|
||||
OBSBasicSourceSelect::SourcePaste(copyString, copyVisible, true);
|
||||
on_actionPasteTransform_triggered();
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionCopyFilters_triggered()
|
||||
{
|
||||
OBSSceneItem item = GetCurrentSceneItem();
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
OBSSource source = obs_sceneitem_get_source(item);
|
||||
|
||||
copyFiltersString = obs_source_get_name(source);
|
||||
|
||||
ui->actionPasteFilters->setEnabled(true);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionPasteFilters_triggered()
|
||||
{
|
||||
OBSSource source = obs_get_source_by_name(copyFiltersString);
|
||||
OBSSceneItem sceneItem = GetCurrentSceneItem();
|
||||
|
||||
OBSSource dstSource = obs_sceneitem_get_source(sceneItem);
|
||||
|
||||
if (source == dstSource)
|
||||
return;
|
||||
|
||||
obs_source_copy_filters(dstSource, source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user