UI: Disable properties button in source toolbar
If a scene or group is selected, disable the properties button in the source toolbar. This also does a refactor of the function to enable/disable the toolbar buttons.
This commit is contained in:
parent
148122f5aa
commit
26725fa2d5
2 changed files with 22 additions and 7 deletions
|
|
@ -3089,10 +3089,26 @@ void OBSBasic::UpdateContextBarDeferred(bool force)
|
|||
Qt::QueuedConnection, Q_ARG(bool, force));
|
||||
}
|
||||
|
||||
void OBSBasic::SourceToolBarActionsSetEnabled(bool enable)
|
||||
void OBSBasic::SourceToolBarActionsSetEnabled()
|
||||
{
|
||||
bool enable = false;
|
||||
bool disableProps = false;
|
||||
|
||||
OBSSceneItem item = GetCurrentSceneItem();
|
||||
|
||||
if (item) {
|
||||
OBSSource source = obs_sceneitem_get_source(item);
|
||||
disableProps = !obs_source_configurable(source);
|
||||
|
||||
enable = true;
|
||||
}
|
||||
|
||||
if (disableProps)
|
||||
ui->actionSourceProperties->setEnabled(false);
|
||||
else
|
||||
ui->actionSourceProperties->setEnabled(enable);
|
||||
|
||||
ui->actionRemoveSource->setEnabled(enable);
|
||||
ui->actionSourceProperties->setEnabled(enable);
|
||||
ui->actionSourceUp->setEnabled(enable);
|
||||
ui->actionSourceDown->setEnabled(enable);
|
||||
|
||||
|
|
@ -3101,14 +3117,13 @@ void OBSBasic::SourceToolBarActionsSetEnabled(bool enable)
|
|||
|
||||
void OBSBasic::UpdateContextBar(bool force)
|
||||
{
|
||||
OBSSceneItem item = GetCurrentSceneItem();
|
||||
bool enable = item != nullptr;
|
||||
|
||||
SourceToolBarActionsSetEnabled(enable);
|
||||
SourceToolBarActionsSetEnabled();
|
||||
|
||||
if (!ui->contextContainer->isVisible() && !force)
|
||||
return;
|
||||
|
||||
OBSSceneItem item = GetCurrentSceneItem();
|
||||
|
||||
if (item) {
|
||||
obs_source_t *source = obs_sceneitem_get_source(item);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue