UI: Show name of scene item in Transform window title

This commit is contained in:
Warchamp7 2021-08-17 07:56:57 -04:00 committed by Jim
parent 4d1862d3c6
commit 6f90380ec2
2 changed files with 13 additions and 1 deletions

View file

@ -615,6 +615,9 @@ Basic.TransformWindow.BoundsType.ScaleToWidth="Scale to width of bounds"
Basic.TransformWindow.BoundsType.ScaleToHeight="Scale to height of bounds"
Basic.TransformWindow.BoundsType.Stretch="Stretch to bounds"
Basic.TransformWindow.Title="Edit Transform for '%1'"
Basic.TransformWindow.NoSelectedSource="No source selected"
# no scene warning
Basic.Main.AddSourceHelp.Title="Cannot Add Source"
Basic.Main.AddSourceHelp.Text="You need to have at least 1 scene to add a source."

View file

@ -73,6 +73,9 @@ OBSBasicTransform::OBSBasicTransform(OBSBasic *parent)
SetScene(scene);
SetItem(item);
std::string name = obs_source_get_name(obs_sceneitem_get_source(item));
setWindowTitle(QTStr("Basic.TransformWindow.Title").arg(name.c_str()));
obs_data_t *wrapper =
obs_scene_save_transform_states(main->GetCurrentScene(), false);
undo_data = std::string(obs_data_get_json(wrapper));
@ -204,8 +207,11 @@ void OBSBasicTransform::OBSSceneItemDeselect(void *param, calldata_t *data)
OBSScene scene = (obs_scene_t *)calldata_ptr(data, "scene");
OBSSceneItem item = (obs_sceneitem_t *)calldata_ptr(data, "item");
if (item == window->item)
if (item == window->item) {
window->setWindowTitle(
QTStr("Basic.TransformWindow.NoSelectedSource"));
window->SetItem(FindASelectedItem(scene));
}
}
static const uint32_t listToAlign[] = {OBS_ALIGN_TOP | OBS_ALIGN_LEFT,
@ -266,6 +272,9 @@ void OBSBasicTransform::RefreshControls()
ui->cropTop->setValue(int(crop.top));
ui->cropBottom->setValue(int(crop.bottom));
ignoreItemChange = false;
std::string name = obs_source_get_name(source);
setWindowTitle(QTStr("Basic.TransformWindow.Title").arg(name.c_str()));
}
void OBSBasicTransform::OnBoundsType(int index)