fixing error in master + getting ptt to show up

This commit is contained in:
Wayne Chen 2019-03-10 19:00:41 -07:00
parent 15eb90f634
commit cf3694e8e3

View file

@ -104,7 +104,6 @@ Rectangle {
RowLayout { RowLayout {
x: 2 * margins.paddings; x: 2 * margins.paddings;
spacing: columnOne.width;
width: parent.width; width: parent.width;
// mute is in its own row // mute is in its own row
@ -170,66 +169,66 @@ Rectangle {
} }
} }
} }
}
Separator {} Separator {}
Item {
width: rightMostInputLevelPos ColumnLayout {
height: pttTextContainer.height + pttCheckBox.height + margins.paddings + 10 id: pttColumn
AudioControls.CheckBox { spacing: 24;
id: pttCheckBox x: 2 * margins.paddings;
spacing: muteMic.spacing; HifiControlsUit.Switch {
width: rightMostInputLevelPos id: pttSwitch
anchors.top: parent.top height: root.switchHeight;
text: qsTr("Push To Talk (T)"); switchWidth: root.switchWidth;
checked: isVR ? AudioScriptingInterface.pushToTalkHMD : AudioScriptingInterface.pushToTalkDesktop; labelTextOn: qsTr("Push To Talk (T)");
onClicked: { backgroundOnColor: "#E3E3E3";
if (isVR) { checked: (bar.currentIndex === 1 && isVR) ||
AudioScriptingInterface.pushToTalkHMD = checked; (bar.currentIndex === 0 && !isVR) ? AudioScriptingInterface.pushToTalkDesktop : AudioScriptingInterface.pushToTalkHMD;
onCheckedChanged: {
if ((bar.currentIndex === 1 && isVR) ||
(bar.currentIndex === 0 && !isVR)) {
AudioScriptingInterface.pushToTalkDesktop = checked;
} else {
AudioScriptingInterface.pushToTalkHMD = checked;
}
checked = Qt.binding(function() {
if ((bar.currentIndex === 1 && isVR) ||
(bar.currentIndex === 0 && !isVR)) {
return AudioScriptingInterface.pushToTalkDesktop;
} else { } else {
AudioScriptingInterface.pushToTalkDesktop = checked; return AudioScriptingInterface.pushToTalkHMD;
} }
checked = Qt.binding(function() { }); // restore binding
if (isVR) {
return AudioScriptingInterface.pushToTalkHMD;
} else {
return AudioScriptingInterface.pushToTalkDesktop;
}
}); // restore binding
}
} }
Item { }
id: pttTextContainer Item {
anchors.top: pttCheckBox.bottom id: pttTextContainer
anchors.topMargin: 10 width: rightMostInputLevelPos
width: parent.width height: pttTextMetrics.height
height: pttTextMetrics.height anchors.left: parent.left
visible: true anchors.leftMargin: -margins.padding
TextMetrics { TextMetrics {
id: pttTextMetrics id: pttTextMetrics
text: pttText.text text: pttText.text
font: pttText.font font: pttText.font
} }
RalewayRegular { RalewayRegular {
id: pttText id: pttText
wrapMode: Text.WordWrap color: hifi.colors.white;
color: hifi.colors.white; width: parent.width;
width: parent.width; wrapMode: (bar.currentIndex === 1 && isVR) ||
font.italic: true (bar.currentIndex === 0 && !isVR) ? Text.NoWrap : Text.WordWrap;
size: 16; font.italic: true
text: isVR ? qsTr("Press and hold grip triggers on both of your controllers to unmute.") : size: 16;
qsTr("Press and hold the button \"T\" to unmute.");
onTextChanged: { text: (bar.currentIndex === 1 && isVR) ||
if (pttTextMetrics.width > rightMostInputLevelPos) { (bar.currentIndex === 0 && !isVR) ? qsTr("Press and hold the button \"T\" to unmute.") :
pttTextContainer.height = Math.ceil(pttTextMetrics.width / rightMostInputLevelPos) * pttTextMetrics.height; qsTr("Press and hold grip triggers on both of your controllers to unmute.");
} else { onTextChanged: {
pttTextContainer.height = pttTextMetrics.height; if (pttTextMetrics.width > pttTextContainer.width) {
} pttTextContainer.height = Math.ceil(pttTextMetrics.width / pttTextContainer.width) * pttTextMetrics.height;
}
}
Component.onCompleted: {
if (pttTextMetrics.width > rightMostInputLevelPos) {
pttTextContainer.height = Math.ceil(pttTextMetrics.width / rightMostInputLevelPos) * pttTextMetrics.height;
} else { } else {
pttTextContainer.height = pttTextMetrics.height; pttTextContainer.height = pttTextMetrics.height;
} }
@ -240,6 +239,7 @@ Rectangle {
Separator {} Separator {}
Item { Item {
x: margins.paddings; x: margins.paddings;
width: parent.width - margins.paddings*2 width: parent.width - margins.paddings*2
@ -293,7 +293,7 @@ Rectangle {
text: devicename text: devicename
onPressed: { onPressed: {
if (!checked) { if (!checked) {
stereoMic.checked = false; stereoInput.checked = false;
AudioScriptingInterface.setStereoInput(false); // the next selected audio device might not support stereo AudioScriptingInterface.setStereoInput(false); // the next selected audio device might not support stereo
AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1); AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1);
} }