Pārlūkot izejas kodu

UI: Fix enumeration of scene collections on first run

When running the program for the first time, no scene collections will
show up in the scene collection menu.  This changes it to forcibly save
the first scene collection on the first run of the program, and then
re-enumerates the list to ensure it's listed.
jp9000 8 gadi atpakaļ
vecāks
revīzija
12236d73f4
1 mainītis faili ar 13 papildinājumiem un 0 dzēšanām
  1. 13 0
      UI/window-basic-main-scene-collections.cpp

+ 13 - 0
UI/window-basic-main-scene-collections.cpp

@@ -221,9 +221,22 @@ void OBSBasic::RefreshSceneCollections()
 
 
 	EnumSceneCollections(addCollection);
 	EnumSceneCollections(addCollection);
 
 
+	/* force saving of first scene collection on first run, otherwise
+	 * no scene collections will show up */
+	if (!count) {
+		long prevDisableVal = disableSaving;
+
+		disableSaving = 0;
+		SaveProjectNow();
+		disableSaving = prevDisableVal;
+
+		EnumSceneCollections(addCollection);
+	}
+
 	ui->actionRemoveSceneCollection->setEnabled(count > 1);
 	ui->actionRemoveSceneCollection->setEnabled(count > 1);
 
 
 	OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
 	OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
+
 	main->OpenSavedProjectors();
 	main->OpenSavedProjectors();
 	main->ui->actionPasteFilters->setEnabled(false);
 	main->ui->actionPasteFilters->setEnabled(false);
 	main->ui->actionPasteRef->setEnabled(false);
 	main->ui->actionPasteRef->setEnabled(false);