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,41 +169,46 @@ 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;
} else { onCheckedChanged: {
if ((bar.currentIndex === 1 && isVR) ||
(bar.currentIndex === 0 && !isVR)) {
AudioScriptingInterface.pushToTalkDesktop = checked; AudioScriptingInterface.pushToTalkDesktop = checked;
} else {
AudioScriptingInterface.pushToTalkHMD = checked;
} }
checked = Qt.binding(function() { checked = Qt.binding(function() {
if (isVR) { if ((bar.currentIndex === 1 && isVR) ||
return AudioScriptingInterface.pushToTalkHMD; (bar.currentIndex === 0 && !isVR)) {
} else {
return AudioScriptingInterface.pushToTalkDesktop; return AudioScriptingInterface.pushToTalkDesktop;
} else {
return AudioScriptingInterface.pushToTalkHMD;
} }
}); // restore binding }); // restore binding
} }
} }
Item { Item {
id: pttTextContainer id: pttTextContainer
anchors.top: pttCheckBox.bottom width: rightMostInputLevelPos
anchors.topMargin: 10
width: parent.width
height: pttTextMetrics.height height: pttTextMetrics.height
visible: true anchors.left: parent.left
anchors.leftMargin: -margins.padding
TextMetrics { TextMetrics {
id: pttTextMetrics id: pttTextMetrics
text: pttText.text text: pttText.text
@ -212,24 +216,19 @@ Rectangle {
} }
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) ||
(bar.currentIndex === 0 && !isVR) ? Text.NoWrap : Text.WordWrap;
font.italic: true font.italic: true
size: 16; size: 16;
text: isVR ? qsTr("Press and hold grip triggers on both of your controllers to unmute.") :
qsTr("Press and hold the button \"T\" to unmute."); text: (bar.currentIndex === 1 && isVR) ||
(bar.currentIndex === 0 && !isVR) ? qsTr("Press and hold the button \"T\" to unmute.") :
qsTr("Press and hold grip triggers on both of your controllers to unmute.");
onTextChanged: { onTextChanged: {
if (pttTextMetrics.width > rightMostInputLevelPos) { if (pttTextMetrics.width > pttTextContainer.width) {
pttTextContainer.height = Math.ceil(pttTextMetrics.width / rightMostInputLevelPos) * pttTextMetrics.height; pttTextContainer.height = Math.ceil(pttTextMetrics.width / pttTextContainer.width) * pttTextMetrics.height;
} else {
pttTextContainer.height = 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);
} }