Reworked according to designers request. Do not fall back to default audion output

This commit is contained in:
vladest 2017-08-22 23:26:27 +02:00
parent e403f7266a
commit 6f0229f450
5 changed files with 47 additions and 42 deletions

View file

@ -23,11 +23,12 @@ CheckBox {
property string color: hifi.colors.lightGrayText
readonly property bool isLightColorScheme: colorScheme === hifi.colorSchemes.light
property bool isRedCheck: false
property bool isRound: false
property int boxSize: 14
property int boxRadius: 3
property int boxRadius: isRound ? boxSize : 3
property bool wrap: true;
readonly property int checkSize: Math.max(boxSize - 8, 10)
readonly property int checkRadius: 2
readonly property int checkRadius: isRound ? checkSize / 2 : 2
focusPolicy: Qt.ClickFocus
indicator: Rectangle {

View file

@ -37,6 +37,7 @@ Rectangle {
}
property bool isVR: Audio.context === "VR"
property real rightMostInputLevelPos: 0
//placeholder for control sizes and paddings
//recalculates dynamically in case of UI size is changed
QtObject {
@ -54,7 +55,7 @@ Rectangle {
id: bar
spacing: 0
width: parent.width
height: 36
height: 42
AudioControls.AudioTabButton {
height: parent.height
@ -68,21 +69,20 @@ Rectangle {
Column {
spacing: 12;
anchors.topMargin: 8
anchors.top: bar.bottom
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
width: parent.width;
Separator { }
RalewayRegular {
x: margins.paddings;
x: margins.paddings + margins.sizeCheckBox;
size: 16;
color: "white";
text: qsTr("Mic Settings")
text: qsTr("Input Device Settings")
}
Separator { }
ColumnLayout {
x: margins.paddings; // padding does not work
spacing: 16;
@ -118,28 +118,27 @@ Rectangle {
AvatarInputs.showAudioTools = checked;
checked = Qt.binding(function() { return AvatarInputs.showAudioTools; }); // restore binding
}
onXChanged: rightMostInputLevelPos = x + width
}
}
}
Separator {}
RowLayout {
Row {
x: margins.paddings;
width: parent.width - margins.paddings*2
height: 28
spacing: 0
HiFiGlyphs {
Layout.minimumWidth: margins.sizeCheckBox
Layout.maximumWidth: margins.sizeCheckBox
width: margins.sizeCheckBox
text: hifi.glyphs.mic;
color: hifi.colors.primaryHighlight;
anchors.verticalCenter: parent.verticalCenter;
size: 36;
size: 30;
}
RalewayRegular {
Layout.minimumWidth: margins.sizeText + margins.sizeLevel
Layout.maximumWidth: margins.sizeText + margins.sizeLevel
width: margins.sizeText + margins.sizeLevel
anchors.verticalCenter: parent.verticalCenter;
size: 16;
color: hifi.colors.lightGrayText;
@ -151,19 +150,22 @@ Rectangle {
id: inputView
width: parent.width - margins.paddings*2
x: margins.paddings
height: 145;
height: 150
spacing: 4;
snapMode: ListView.SnapToItem;
clip: true;
model: Audio.devices.input;
delegate: RowLayout {
width: inputView.width;
spacing: 5
delegate: Item {
width: rightMostInputLevelPos
height: margins.sizeCheckBox
AudioControls.CheckBox {
Layout.fillWidth: true
anchors.left: parent.left
width: parent.width - inputLevel.width
clip: true
checked: bar.currentIndex === 0 ? selectedDesktop : selectedHMD;
boxRadius: boxSize/2
boxSize: margins.sizeCheckBox / 2
isRound: true
text: devicename
onClicked: {
if (checked) {
@ -172,6 +174,9 @@ Rectangle {
}
}
InputLevel {
id: inputLevel
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
visible: (bar.currentIndex === 1 && selectedHMD && isVR) ||
(bar.currentIndex === 0 && selectedDesktop && !isVR);
}
@ -180,22 +185,20 @@ Rectangle {
Separator {}
RowLayout {
Row {
x: margins.paddings;
width: parent.width - margins.paddings*2
height: 28
height: 36
spacing: 0
HiFiGlyphs {
Layout.minimumWidth: margins.sizeCheckBox
Layout.maximumWidth: margins.sizeCheckBox
width: margins.sizeCheckBox
text: hifi.glyphs.unmuted;
color: hifi.colors.primaryHighlight;
anchors.verticalCenter: parent.verticalCenter;
size: 28;
size: 36;
}
RalewayRegular {
Layout.minimumWidth: margins.sizeText + margins.sizeLevel
Layout.maximumWidth: margins.sizeText + margins.sizeLevel
width: margins.sizeText + margins.sizeLevel
anchors.verticalCenter: parent.verticalCenter;
size: 16;
color: hifi.colors.lightGrayText;
@ -207,18 +210,19 @@ Rectangle {
id: outputView
width: parent.width - margins.paddings*2
x: margins.paddings
height: Math.min(220, contentHeight);
height: Math.min(210, contentHeight);
spacing: 4;
snapMode: ListView.SnapToItem;
clip: true;
model: Audio.devices.output;
delegate: RowLayout {
width: outputView.width;
spacing: 0
delegate: Item {
width: rightMostInputLevelPos
height: margins.sizeCheckBox
AudioControls.CheckBox {
Layout.fillWidth: true
boxRadius: boxSize/2
width: parent.width
boxSize: margins.sizeCheckBox / 2
isRound: true
checked: bar.currentIndex === 0 ? selectedDesktop : selectedHMD;
text: devicename
onClicked: {
@ -229,6 +233,12 @@ Rectangle {
}
}
}
PlaySampleSound { anchors { left: parent.left; leftMargin: margins.paddings }}
PlaySampleSound {
x: margins.paddings
visible: (bar.currentIndex === 1 && isVR) ||
(bar.currentIndex === 0 && !isVR);
anchors { left: parent.left; leftMargin: margins.paddings }
}
}
}

View file

@ -16,6 +16,7 @@ import "../../styles-uit"
TabButton {
id: control
font.pixelSize: height / 2
HifiConstants { id: hifi; }

View file

@ -14,5 +14,6 @@ import QtQuick 2.7
import "../../controls-uit" as HifiControls
HifiControls.CheckBox2 {
spacing: 8
color: "white"
}

View file

@ -1717,14 +1717,6 @@ int AudioClient::setOutputBufferSize(int numFrames, bool persist) {
if (persist) {
_outputBufferSizeFrames.set(numFrames);
}
if (_audioOutput) {
// The buffer size can't be adjusted after QAudioOutput::start() has been called, so
// recreate the device by switching to the default.
QAudioDeviceInfo outputDeviceInfo = defaultAudioDeviceForMode(QAudio::AudioOutput);
qCDebug(audioclient) << __FUNCTION__ << "about to send changeDevice signal outputDeviceInfo: [" << outputDeviceInfo.deviceName() << "]";
emit changeDevice(outputDeviceInfo); // On correct thread, please, as setOutputBufferSize can be called from main thread.
}
}
return numFrames;
}