UI: Disable toolbar buttons when no source is selected

When no source is selected, disable the toolbar buttons so the user
knows the buttons can't be clicked. They would just do nothing
before.
This commit is contained in:
cg2121
2022-09-14 21:15:58 -05:00
committed by Ryan Foster
parent 24d7bea41f
commit 0df774cd01
10 changed files with 35 additions and 8 deletions

View File

@@ -3077,13 +3077,26 @@ void OBSBasic::UpdateContextBarDeferred(bool force)
Qt::QueuedConnection, Q_ARG(bool, force));
}
void OBSBasic::SourceToolBarActionsSetEnabled(bool enable)
{
ui->actionRemoveSource->setEnabled(enable);
ui->actionSourceProperties->setEnabled(enable);
ui->actionSourceUp->setEnabled(enable);
ui->actionSourceDown->setEnabled(enable);
RefreshToolBarStyling(ui->sourcesToolbar);
}
void OBSBasic::UpdateContextBar(bool force)
{
OBSSceneItem item = GetCurrentSceneItem();
bool enable = item != nullptr;
SourceToolBarActionsSetEnabled(enable);
if (!ui->contextContainer->isVisible() && !force)
return;
OBSSceneItem item = GetCurrentSceneItem();
if (item) {
obs_source_t *source = obs_sceneitem_get_source(item);