Explorar o código

UI: Ensure only one advanced audio settings window

Add a check to prevent that the advanced audio settings dialog is only
once. When the dialog is already present raise it to the top instead.
fryshorts %!s(int64=10) %!d(string=hai) anos
pai
achega
90ccae6f4c
Modificáronse 2 ficheiros con 14 adicións e 0 borrados
  1. 13 0
      obs/window-basic-main.cpp
  2. 1 0
      obs/window-basic-main.hpp

+ 13 - 0
obs/window-basic-main.cpp

@@ -1651,9 +1651,17 @@ void OBSBasic::on_action_Settings_triggered()
 
 void OBSBasic::on_actionAdvAudioProperties_triggered()
 {
+	if (advAudioWindow != nullptr) {
+		advAudioWindow->raise();
+		return;
+	}
+
 	advAudioWindow = new OBSBasicAdvAudio(this);
 	advAudioWindow->show();
 	advAudioWindow->setAttribute(Qt::WA_DeleteOnClose, true);
+
+	connect(advAudioWindow, SIGNAL(destroyed()),
+		this, SLOT(on_advAudioProps_destroyed()));
 }
 
 void OBSBasic::on_advAudioProps_clicked()
@@ -1661,6 +1669,11 @@ void OBSBasic::on_advAudioProps_clicked()
 	on_actionAdvAudioProperties_triggered();
 }
 
+void OBSBasic::on_advAudioProps_destroyed()
+{
+	advAudioWindow = nullptr;
+}
+
 void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
 		QListWidgetItem *prev)
 {

+ 1 - 0
obs/window-basic-main.hpp

@@ -234,6 +234,7 @@ private slots:
 	void on_action_Settings_triggered();
 	void on_actionAdvAudioProperties_triggered();
 	void on_advAudioProps_clicked();
+	void on_advAudioProps_destroyed();
 	void on_actionShowLogs_triggered();
 	void on_actionUploadCurrentLog_triggered();
 	void on_actionUploadLastLog_triggered();