mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 08:03:34 +02:00
Get rid of QML errors in HMD mode. Sync Audio menu in Tablet/HMD without recreating menu items
This commit is contained in:
parent
3fe8675b0c
commit
28447cde0b
4 changed files with 19 additions and 5 deletions
|
@ -79,7 +79,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: AvatarInputs
|
target: AvatarInputs !== undefined ? AvatarInputs : null
|
||||||
onShowAudioToolsChanged: {
|
onShowAudioToolsChanged: {
|
||||||
audioTools.checkbox.checked = showAudioTools
|
audioTools.checkbox.checked = showAudioTools
|
||||||
}
|
}
|
||||||
|
@ -100,12 +100,14 @@ Rectangle {
|
||||||
id: audioTools
|
id: audioTools
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors { left: parent.left; right: parent.right; leftMargin: 30 }
|
anchors { left: parent.left; right: parent.right; leftMargin: 30 }
|
||||||
checkbox.checked: AvatarInputs.showAudioTools
|
checkbox.checked: AvatarInputs !== undefined ? AvatarInputs.showAudioTools : false
|
||||||
text.text: qsTr("Show audio level meter")
|
text.text: qsTr("Show audio level meter")
|
||||||
onCheckBoxClicked: {
|
onCheckBoxClicked: {
|
||||||
|
if (AvatarInputs !== undefined) {
|
||||||
AvatarInputs.showAudioTools = checked
|
AvatarInputs.showAudioTools = checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
|
@ -18,7 +18,6 @@ Row {
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
onClicked: checkBoxClicked(cb.checked)
|
onClicked: checkBoxClicked(cb.checked)
|
||||||
onCheckedChanged: console.log("checked", checked, "device ",txt.text)
|
|
||||||
}
|
}
|
||||||
RalewayBold {
|
RalewayBold {
|
||||||
id: txt
|
id: txt
|
||||||
|
|
|
@ -2057,6 +2057,8 @@ void Application::initializeUi() {
|
||||||
|
|
||||||
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
||||||
|
|
||||||
|
rootContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
||||||
|
|
||||||
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
||||||
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,16 @@ function onMenuEvent(audioDeviceMenuString) {
|
||||||
|
|
||||||
function onCurrentDeviceChanged() {
|
function onCurrentDeviceChanged() {
|
||||||
debug("System audio device switched. ");
|
debug("System audio device switched. ");
|
||||||
setupAudioMenus()
|
var interfaceInputDevice = "Use " + AudioDevice.getInputDevice() + " for Input";
|
||||||
|
var interfaceOutputDevice = "Use " + AudioDevice.getOutputDevice() + " for Output";
|
||||||
|
for (var index = 0; index < audioDevicesList.length; index++) {
|
||||||
|
if (audioDevicesList[index] === interfaceInputDevice ||
|
||||||
|
audioDevicesList[index] === interfaceOutputDevice) {
|
||||||
|
Menu.setIsOptionChecked(audioDevicesList[index], true);
|
||||||
|
} else {
|
||||||
|
Menu.setIsOptionChecked(audioDevicesList[index], false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchAudioDevice(audioDeviceMenuString) {
|
function switchAudioDevice(audioDeviceMenuString) {
|
||||||
|
@ -279,6 +288,8 @@ Script.scriptEnding.connect(function () {
|
||||||
removeAudioMenus();
|
removeAudioMenus();
|
||||||
Menu.menuItemEvent.disconnect(onMenuEvent);
|
Menu.menuItemEvent.disconnect(onMenuEvent);
|
||||||
HMD.displayModeChanged.disconnect(checkHMDAudio);
|
HMD.displayModeChanged.disconnect(checkHMDAudio);
|
||||||
|
AudioDevice.currentInputDeviceChanged.disconnect(onCurrentDeviceChanged);
|
||||||
|
AudioDevice.currentOutputDeviceChanged.disconnect(onCurrentDeviceChanged);
|
||||||
AudioDevice.deviceChanged.disconnect(onDevicechanged);
|
AudioDevice.deviceChanged.disconnect(onDevicechanged);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue