mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
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
|
@ -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);
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ private:
|
|||
bool drawSpacingHelpers = true;
|
||||
|
||||
float GetDevicePixelRatio();
|
||||
void SourceToolBarActionsSetEnabled(bool enable);
|
||||
void SourceToolBarActionsSetEnabled();
|
||||
|
||||
std::string lastScreenshot;
|
||||
std::string lastReplay;
|
||||
|
|
Loading…
Reference in a new issue