Merge pull request #16073 from zfox23/micIconFix

Fix some engine bugs that fix muted state in all UIs including simplifiedUI
This commit is contained in:
Zach Fox 2019-08-19 13:09:43 -07:00 committed by GitHub
commit 36dffb7dc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,16 +90,21 @@ void Audio::setMuted(bool isMuted) {
void Audio::setMutedDesktop(bool isMuted) {
bool changed = false;
bool isHMD = qApp->isHMDMode();
withWriteLock([&] {
if (_mutedDesktop != isMuted) {
changed = true;
_mutedDesktop = isMuted;
auto client = DependencyManager::get<AudioClient>().data();
QMetaObject::invokeMethod(client, "setMuted", Q_ARG(bool, isMuted), Q_ARG(bool, false));
if (!isHMD) {
auto client = DependencyManager::get<AudioClient>().data();
QMetaObject::invokeMethod(client, "setMuted", Q_ARG(bool, isMuted), Q_ARG(bool, false));
}
}
});
if (changed) {
emit mutedChanged(isMuted);
if (!isHMD) {
emit mutedChanged(isMuted);
}
emit mutedDesktopChanged(isMuted);
}
}
@ -112,16 +117,21 @@ bool Audio::getMutedDesktop() const {
void Audio::setMutedHMD(bool isMuted) {
bool changed = false;
bool isHMD = qApp->isHMDMode();
withWriteLock([&] {
if (_mutedHMD != isMuted) {
changed = true;
_mutedHMD = isMuted;
auto client = DependencyManager::get<AudioClient>().data();
QMetaObject::invokeMethod(client, "setMuted", Q_ARG(bool, isMuted), Q_ARG(bool, false));
if (isHMD) {
auto client = DependencyManager::get<AudioClient>().data();
QMetaObject::invokeMethod(client, "setMuted", Q_ARG(bool, isMuted), Q_ARG(bool, false));
}
}
});
if (changed) {
emit mutedChanged(isMuted);
if (isHMD) {
emit mutedChanged(isMuted);
}
emit mutedHMDChanged(isMuted);
}
}
@ -386,6 +396,7 @@ void Audio::onContextChanged() {
changed = true;
}
});
if (_settingsLoaded) {
bool isMuted = isHMD ? getMutedHMD() : getMutedDesktop();
setMuted(isMuted);
@ -395,6 +406,12 @@ void Audio::onContextChanged() {
}
if (changed) {
emit contextChanged(isHMD ? Audio::HMD : Audio::DESKTOP);
bool mutedHMD = getMutedHMD();
bool mutedDesktop = getMutedDesktop();
if (mutedHMD != mutedDesktop) {
emit mutedChanged(isHMD ? mutedHMD : mutedDesktop);
}
}
}