Просмотр исходного кода

UI: Add workaround to fix deleting final scene bug

cg2121 8 лет назад
Родитель
Сommit
66dbf8f258
2 измененных файлов с 14 добавлено и 0 удалено
  1. 4 0
      UI/data/locale/en-US.ini
  2. 10 0
      UI/window-basic-main.cpp

+ 4 - 0
UI/data/locale/en-US.ini

@@ -688,3 +688,7 @@ SceneItemHide="Hide '%1'"
 OutputWarnings.NoTracksSelected="You must select at least one track"
 OutputWarnings.MultiTrackRecording="Warning: Certain formats (such as FLV) do not support multiple tracks per recording"
 OutputWarnings.MP4Recording="Warning: Recordings saved to MP4 will be unrecoverable if the file cannot be finalized (e.g. as a result of BSODs, power losses, etc.). If you want to record multiple audio tracks consider using MKV and remux the recording to mp4 after it is finished (File->Remux Recordings)"
+
+# deleting final scene
+FinalScene.Title="Delete Scene"
+FinalScene.Text="There needs to be at least one scene."

+ 10 - 0
UI/window-basic-main.cpp

@@ -1928,6 +1928,7 @@ void OBSBasic::RemoveScene(OBSSource source)
 
 	QListWidgetItem *sel = nullptr;
 	int count = ui->scenes->count();
+
 	for (int i = 0; i < count; i++) {
 		auto item = ui->scenes->item(i);
 		auto cur_scene = GetOBSRef<OBSScene>(item);
@@ -2139,6 +2140,15 @@ void OBSBasic::DeactivateAudioSource(OBSSource source)
 
 bool OBSBasic::QueryRemoveSource(obs_source_t *source)
 {
+	int count = ui->scenes->count();
+
+	if (count == 1) {
+		QMessageBox::information(this,
+					QTStr("FinalScene.Title"),
+					QTStr("FinalScene.Text"));
+		return false;
+	}
+
 	const char *name  = obs_source_get_name(source);
 
 	QString text = QTStr("ConfirmRemove.Text");