Browse Source

Merge pull request #2312 from cg2121/fix-audio-message

UI: Fix audio restart message not hiding
Jim 5 years ago
parent
commit
c6053c3d96
2 changed files with 21 additions and 4 deletions
  1. 19 4
      UI/window-basic-settings.cpp
  2. 2 0
      UI/window-basic-settings.hpp

+ 19 - 4
UI/window-basic-settings.cpp

@@ -763,6 +763,9 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
 	on_baseResolution_editTextChanged(ui->baseResolution->currentText());
 
 	App()->DisableHotkeys();
+
+	channelIndex = ui->channelSetup->currentIndex();
+	sampleRateIndex = ui->sampleRate->currentIndex();
 }
 
 OBSBasicSettings::~OBSBasicSettings()
@@ -3867,10 +3870,22 @@ void OBSBasicSettings::AudioChanged()
 void OBSBasicSettings::AudioChangedRestart()
 {
 	if (!loading) {
-		audioChanged = true;
-		ui->audioMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
-		sender()->setProperty("changed", QVariant(true));
-		EnableApplyButton(true);
+		int currentChannelIndex = ui->channelSetup->currentIndex();
+		int currentSampleRateIndex = ui->sampleRate->currentIndex();
+
+		if (currentChannelIndex != channelIndex ||
+		    currentSampleRateIndex != sampleRateIndex) {
+			audioChanged = true;
+			ui->audioMsg->setText(
+				QTStr("Basic.Settings.ProgramRestart"));
+			sender()->setProperty("changed", QVariant(true));
+			EnableApplyButton(true);
+		} else {
+			audioChanged = false;
+			ui->audioMsg->setText("");
+			sender()->setProperty("changed", QVariant(false));
+			EnableApplyButton(false);
+		}
 	}
 }
 

+ 2 - 0
UI/window-basic-settings.hpp

@@ -117,6 +117,8 @@ private:
 	bool loading = true;
 	bool forceAuthReload = false;
 	std::string savedTheme;
+	int sampleRateIndex = 0;
+	int channelIndex = 0;
 
 	int lastSimpleRecQualityIdx = 0;
 	int lastChannelSetupIdx = 0;