UI: Add ability to lock preview
Adds the ability to lock the preview so sources can't be edited. This feature is typically used in the case where the user wants to prevent accidentally clicking and dragging on sources.
This commit is contained in:
parent
f3d0272f57
commit
2c5aa87468
6 changed files with 53 additions and 2 deletions
|
|
@ -374,6 +374,8 @@ void OBSBasic::Save(const char *file)
|
|||
ui->transitionDuration->value(), transitions,
|
||||
scene, curProgramScene);
|
||||
|
||||
obs_data_set_bool(saveData, "preview_locked", ui->preview->Locked());
|
||||
|
||||
if (!obs_data_save_json_safe(saveData, file, "tmp", "bak"))
|
||||
blog(LOG_ERROR, "Could not save scene data to %s", file);
|
||||
|
||||
|
|
@ -607,6 +609,10 @@ retryScene:
|
|||
|
||||
RefreshQuickTransitions();
|
||||
|
||||
bool previewLocked = obs_data_get_bool(data, "preview_locked");
|
||||
ui->preview->SetLocked(previewLocked);
|
||||
ui->actionLockPreview->setChecked(previewLocked);
|
||||
|
||||
obs_data_release(data);
|
||||
|
||||
if (!opt_starting_scene.empty())
|
||||
|
|
@ -2958,6 +2964,12 @@ void OBSBasic::CreateSourcePopupMenu(QListWidgetItem *item, bool preview)
|
|||
if (IsPreviewProgramMode())
|
||||
action->setEnabled(false);
|
||||
|
||||
action = popup.addAction(
|
||||
QTStr("Basic.MainMenu.Edit.LockPreview"),
|
||||
this, SLOT(on_actionLockPreview_triggered()));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(ui->preview->Locked());
|
||||
|
||||
previewProjector = new QMenu(QTStr("PreviewProjector"));
|
||||
AddProjectorMenuMonitors(previewProjector, this,
|
||||
SLOT(OpenPreviewProjector()));
|
||||
|
|
@ -4306,3 +4318,9 @@ void OBSBasic::on_toggleStatusBar_toggled(bool visible)
|
|||
config_set_bool(App()->GlobalConfig(), "BasicWindow",
|
||||
"ShowStatusBar", visible);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionLockPreview_triggered()
|
||||
{
|
||||
ui->preview->ToggleLocked();
|
||||
ui->actionLockPreview->setChecked(ui->preview->Locked());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue