Browse Source

UI: Disable Copy Filters in scene list for scene with no filters

When you right-click on a source in the Sources list that does not have
any filters, the "Copy Filters" item is disabled. When you right-click
on a scene in the Scenes list that does not have any filters, the "Copy
Filters" item is enabled. This fixes the Scenes context menu to behave
like the Sources context menu.
Ryan Foster 4 years ago
parent
commit
5517db5122
1 changed files with 7 additions and 2 deletions
  1. 7 2
      UI/window-basic-main.cpp

+ 7 - 2
UI/window-basic-main.cpp

@@ -4729,6 +4729,10 @@ void OBSBasic::on_scenes_customContextMenuRequested(const QPoint &pos)
 			SLOT(on_actionAddScene_triggered()));
 			SLOT(on_actionAddScene_triggered()));
 
 
 	if (item) {
 	if (item) {
+		QAction *copyFilters = new QAction(QTStr("Copy.Filters"), this);
+		copyFilters->setEnabled(false);
+		connect(copyFilters, SIGNAL(triggered()), this,
+			SLOT(SceneCopyFilters()));
 		QAction *pasteFilters =
 		QAction *pasteFilters =
 			new QAction(QTStr("Paste.Filters"), this);
 			new QAction(QTStr("Paste.Filters"), this);
 		pasteFilters->setEnabled(copyFiltersString);
 		pasteFilters->setEnabled(copyFiltersString);
@@ -4738,8 +4742,7 @@ void OBSBasic::on_scenes_customContextMenuRequested(const QPoint &pos)
 		popup.addSeparator();
 		popup.addSeparator();
 		popup.addAction(QTStr("Duplicate"), this,
 		popup.addAction(QTStr("Duplicate"), this,
 				SLOT(DuplicateSelectedScene()));
 				SLOT(DuplicateSelectedScene()));
-		popup.addAction(QTStr("Copy.Filters"), this,
-				SLOT(SceneCopyFilters()));
+		popup.addAction(copyFilters);
 		popup.addAction(pasteFilters);
 		popup.addAction(pasteFilters);
 		popup.addSeparator();
 		popup.addSeparator();
 		popup.addAction(QTStr("Rename"), this, SLOT(EditSceneName()));
 		popup.addAction(QTStr("Rename"), this, SLOT(EditSceneName()));
@@ -4806,6 +4809,8 @@ void OBSBasic::on_scenes_customContextMenuRequested(const QPoint &pos)
 
 
 		connect(multiviewAction, &QAction::triggered,
 		connect(multiviewAction, &QAction::triggered,
 			std::bind(showInMultiview, data));
 			std::bind(showInMultiview, data));
+
+		copyFilters->setEnabled(obs_source_filter_count(source) > 0);
 	}
 	}
 
 
 	popup.addSeparator();
 	popup.addSeparator();