Prechádzať zdrojové kódy

UI: Fix property name bug in frontend API

This commit fixes a bug that would cause the frontend API function
obs_frontend_set_current_scene_collection to never be successful.  Due
to the bug, the following null pointer check would always fail, so the
action would never be triggered.

Modification by Jim: Instead of fixing the typo that caused this to
occur, make it so both scene collection menus and profile menus both use
"file_name" consistently.

Closes jp9000/obs-studio#712
vic 9 rokov pred
rodič
commit
7db00a18fa

+ 3 - 3
UI/window-basic-main-scene-collections.cpp

@@ -191,7 +191,7 @@ void OBSBasic::RefreshSceneCollections()
 	int count = 0;
 
 	for (int i = 0; i < menuActions.count(); i++) {
-		QVariant v = menuActions[i]->property("fileName");
+		QVariant v = menuActions[i]->property("file_name");
 		if (v.typeName() != nullptr)
 			delete menuActions[i];
 	}
@@ -205,7 +205,7 @@ void OBSBasic::RefreshSceneCollections()
 		file.erase(file.size() - 5, 5);
 
 		QAction *action = new QAction(QT_UTF8(name), this);
-		action->setProperty("fileName", QT_UTF8(path));
+		action->setProperty("file_name", QT_UTF8(path));
 		connect(action, &QAction::triggered,
 				this, &OBSBasic::ChangeSceneCollection);
 		action->setCheckable(true);
@@ -355,7 +355,7 @@ void OBSBasic::ChangeSceneCollection()
 	if (!action)
 		return;
 
-	fileName = QT_TO_UTF8(action->property("fileName").value<QString>());
+	fileName = QT_TO_UTF8(action->property("file_name").value<QString>());
 	if (fileName.empty())
 		return;