Merge pull request #2094 from torresam/copy_sources
UI: Add copy/paste of multiple selected sourcesmaster
commit
c290e81a1a
|
@ -1053,7 +1053,7 @@ retryScene:
|
||||||
opt_start_replaybuffer = false;
|
opt_start_replaybuffer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
copyString = nullptr;
|
copyStrings.clear();
|
||||||
copyFiltersString = nullptr;
|
copyFiltersString = nullptr;
|
||||||
|
|
||||||
LogScenes();
|
LogScenes();
|
||||||
|
@ -5855,6 +5855,11 @@ int OBSBasic::GetTopSelectedSourceItem()
|
||||||
return selectedItems.count() ? selectedItems[0].row() : -1;
|
return selectedItems.count() ? selectedItems[0].row() : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QModelIndexList OBSBasic::GetAllSelectedSourceItems()
|
||||||
|
{
|
||||||
|
return ui->sources->selectionModel()->selectedIndexes();
|
||||||
|
}
|
||||||
|
|
||||||
void OBSBasic::on_preview_customContextMenuRequested(const QPoint &pos)
|
void OBSBasic::on_preview_customContextMenuRequested(const QPoint &pos)
|
||||||
{
|
{
|
||||||
CreateSourcePopupMenu(GetTopSelectedSourceItem(), true);
|
CreateSourcePopupMenu(GetTopSelectedSourceItem(), true);
|
||||||
|
@ -7036,41 +7041,52 @@ bool OBSBasic::sysTrayMinimizeToTray()
|
||||||
|
|
||||||
void OBSBasic::on_actionCopySource_triggered()
|
void OBSBasic::on_actionCopySource_triggered()
|
||||||
{
|
{
|
||||||
OBSSceneItem item = GetCurrentSceneItem();
|
copyStrings.clear();
|
||||||
|
bool allowPastingDuplicate = true;
|
||||||
|
|
||||||
|
for (auto &selectedSource : GetAllSelectedSourceItems()) {
|
||||||
|
OBSSceneItem item = ui->sources->Get(selectedSource.row());
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
on_actionCopyTransform_triggered();
|
on_actionCopyTransform_triggered();
|
||||||
|
|
||||||
OBSSource source = obs_sceneitem_get_source(item);
|
OBSSource source = obs_sceneitem_get_source(item);
|
||||||
|
|
||||||
copyString = obs_source_get_name(source);
|
copyStrings.push_front(obs_source_get_name(source));
|
||||||
|
|
||||||
copyVisible = obs_sceneitem_visible(item);
|
copyVisible = obs_sceneitem_visible(item);
|
||||||
|
|
||||||
ui->actionPasteRef->setEnabled(true);
|
|
||||||
|
|
||||||
uint32_t output_flags = obs_source_get_output_flags(source);
|
uint32_t output_flags = obs_source_get_output_flags(source);
|
||||||
if ((output_flags & OBS_SOURCE_DO_NOT_DUPLICATE) == 0)
|
if (!(output_flags & OBS_SOURCE_DO_NOT_DUPLICATE) == 0)
|
||||||
ui->actionPasteDup->setEnabled(true);
|
allowPastingDuplicate = false;
|
||||||
else
|
}
|
||||||
ui->actionPasteDup->setEnabled(false);
|
|
||||||
|
ui->actionPasteRef->setEnabled(true);
|
||||||
|
ui->actionPasteDup->setEnabled(allowPastingDuplicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::on_actionPasteRef_triggered()
|
void OBSBasic::on_actionPasteRef_triggered()
|
||||||
{
|
{
|
||||||
|
for (auto ©String : copyStrings) {
|
||||||
/* do not allow duplicate refs of the same group in the same scene */
|
/* do not allow duplicate refs of the same group in the same scene */
|
||||||
OBSScene scene = GetCurrentScene();
|
OBSScene scene = GetCurrentScene();
|
||||||
if (!!obs_scene_get_group(scene, copyString))
|
if (!!obs_scene_get_group(scene, copyString))
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
OBSBasicSourceSelect::SourcePaste(copyString, copyVisible, false);
|
OBSBasicSourceSelect::SourcePaste(copyString, copyVisible,
|
||||||
|
false);
|
||||||
on_actionPasteTransform_triggered();
|
on_actionPasteTransform_triggered();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::on_actionPasteDup_triggered()
|
void OBSBasic::on_actionPasteDup_triggered()
|
||||||
{
|
{
|
||||||
OBSBasicSourceSelect::SourcePaste(copyString, copyVisible, true);
|
for (auto ©String : copyStrings) {
|
||||||
|
OBSBasicSourceSelect::SourcePaste(copyString, copyVisible,
|
||||||
|
true);
|
||||||
on_actionPasteTransform_triggered();
|
on_actionPasteTransform_triggered();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::AudioMixerCopyFilters()
|
void OBSBasic::AudioMixerCopyFilters()
|
||||||
|
|
|
@ -157,7 +157,7 @@ private:
|
||||||
bool projectChanged = false;
|
bool projectChanged = false;
|
||||||
bool previewEnabled = true;
|
bool previewEnabled = true;
|
||||||
|
|
||||||
const char *copyString;
|
std::list<const char *> copyStrings;
|
||||||
const char *copyFiltersString = nullptr;
|
const char *copyFiltersString = nullptr;
|
||||||
bool copyVisible = true;
|
bool copyVisible = true;
|
||||||
|
|
||||||
|
@ -332,6 +332,8 @@ private:
|
||||||
|
|
||||||
int GetTopSelectedSourceItem();
|
int GetTopSelectedSourceItem();
|
||||||
|
|
||||||
|
QModelIndexList GetAllSelectedSourceItems();
|
||||||
|
|
||||||
obs_hotkey_pair_id streamingHotkeys, recordingHotkeys, pauseHotkeys,
|
obs_hotkey_pair_id streamingHotkeys, recordingHotkeys, pauseHotkeys,
|
||||||
replayBufHotkeys, togglePreviewHotkeys;
|
replayBufHotkeys, togglePreviewHotkeys;
|
||||||
obs_hotkey_id forceStreamingStopHotkey;
|
obs_hotkey_id forceStreamingStopHotkey;
|
||||||
|
|
Loading…
Reference in New Issue