$OpenBSD: patch-src_mumble_AudioWizard_cpp,v 1.3 2019/08/05 17:42:40 sthen Exp $

chunk 1 - unbreak with protobuf 3.7+

others -

Disable submitting anonymous statistics

Disable Text-To-Speech; use sound notifications by default

There's a convoluted threading issue: in PAAudio.cpp, around line 338,
it will get caught in an infinite loop. It relies on the PortAudioInput
object being destroyed in another thread, thereby setting bRunning to
false and telling it to exit the loop, which will never happen. Luckily,
this bug is only exposed by the AudioWizard configuration stuff. So,
skip calling restartAudio() from on_qsOutputDelay_valueChanged() while
the AudioWizard is starting up

Index: src/mumble/AudioWizard.cpp
--- src/mumble/AudioWizard.cpp.orig
+++ src/mumble/AudioWizard.cpp
@@ -34,10 +34,12 @@
 
 #include "AudioInput.h"
 #include "AudioOutputSample.h"
-#include "Global.h"
 #include "Log.h"
 #include "MainWindow.h"
 
+// We define a global macro called 'g'. This can lead to issues when included code uses 'g' as a type or parameter name (like protobuf 3.7 does). As such, for now, we have to make this our last include.
+#include "Global.h"
+
 CompletablePage::CompletablePage(QWizard *p) : QWizardPage(p) {
 	bComplete = true;
 }
@@ -62,7 +64,8 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
 	setupUi(this);
 
 	// Done
-	qcbUsage->setChecked(g.s.bUsage);
+	qcbUsage->setEnabled(false);
+	qcbUsage->setChecked(false);
 
 	// Device
 	if (AudioInputRegistrar::qmNew) {
@@ -114,18 +117,10 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
 	else
 		qrbQualityCustom->setChecked(true);
 
-	quint32 iMessage = Settings::LogNone;
-	for (int i = Log::firstMsgType;i <= Log::lastMsgType; ++i) {
-		iMessage |= (g.s.qmMessages[i] & (Settings::LogSoundfile | Settings::LogTTS));
-	}
+	qrbNotificationTTS->setEnabled(false);
+	qrbNotificationTTS->setChecked(false);
+	qrbNotificationSounds->setChecked(true);
 
-	if (iMessage == Settings::LogTTS && g.s.bTTS)
-		qrbNotificationTTS->setChecked(true);
-	else if (iMessage == Settings::LogSoundfile)
-		qrbNotificationSounds->setChecked(true);
-	else // If we find mixed message types or only tts with main tts disable assume custom
-		qrbNotificationCustom->setChecked(true);
-
 	qrbNotificationCustom->setVisible(qrbNotificationCustom->isChecked());
 
 	qrbQualityCustom->setVisible(qrbQualityCustom->isChecked());
@@ -308,7 +303,8 @@ void AudioWizard::on_qcbOutputDevice_activated(int) {
 void AudioWizard::on_qsOutputDelay_valueChanged(int v) {
 	qlOutputDelay->setText(tr("%1 ms").arg(v*10));
 	g.s.iOutputDelay = v;
-	restartAudio();
+	if (! bInit)
+		restartAudio();
 }
 
 void AudioWizard::on_qsMaxAmp_valueChanged(int v) {
