UI: Disable source copy if no sources are selected

This commit addresses Mantis Bug 993. If no source was selected, the
"Copy" context menu item was enabled, but selecting it would do nothing.
This commit disables that menu item when no sources are selected.
This commit is contained in:
Ryan Foster 2017-10-17 19:22:07 -04:00
parent 7bd06e7f26
commit c8353c90b6
2 changed files with 7 additions and 0 deletions

View File

@ -182,6 +182,9 @@
<addaction name="actionScaleOutput"/> <addaction name="actionScaleOutput"/>
</widget> </widget>
<action name="actionCopySource"> <action name="actionCopySource">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Copy</string> <string>Copy</string>
</property> </property>

View File

@ -2663,6 +2663,8 @@ void OBSBasic::SceneItemSelected(void *data, calldata_t *params)
QMetaObject::invokeMethod(window, "SelectSceneItem", QMetaObject::invokeMethod(window, "SelectSceneItem",
Q_ARG(OBSScene, scene), Q_ARG(OBSSceneItem, item), Q_ARG(OBSScene, scene), Q_ARG(OBSSceneItem, item),
Q_ARG(bool, true)); Q_ARG(bool, true));
window->ui->actionCopySource->setEnabled(true);
} }
void OBSBasic::SceneItemDeselected(void *data, calldata_t *params) void OBSBasic::SceneItemDeselected(void *data, calldata_t *params)
@ -2675,6 +2677,8 @@ void OBSBasic::SceneItemDeselected(void *data, calldata_t *params)
QMetaObject::invokeMethod(window, "SelectSceneItem", QMetaObject::invokeMethod(window, "SelectSceneItem",
Q_ARG(OBSScene, scene), Q_ARG(OBSSceneItem, item), Q_ARG(OBSScene, scene), Q_ARG(OBSSceneItem, item),
Q_ARG(bool, false)); Q_ARG(bool, false));
window->ui->actionCopySource->setEnabled(false);
} }
void OBSBasic::SourceLoaded(void *data, obs_source_t *source) void OBSBasic::SourceLoaded(void *data, obs_source_t *source)