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 property string color: hifi.colors.lightGrayText
readonly property bool isLightColorScheme: colorScheme === hifi.colorSchemes.light readonly property bool isLightColorScheme: colorScheme === hifi.colorSchemes.light
property bool isRedCheck: false property bool isRedCheck: false
property bool isRound: false
property int boxSize: 14 property int boxSize: 14
property int boxRadius: 3 property int boxRadius: isRound ? boxSize : 3
property bool wrap: true; property bool wrap: true;
readonly property int checkSize: Math.max(boxSize - 8, 10) 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 focusPolicy: Qt.ClickFocus
indicator: Rectangle { indicator: Rectangle {

View file

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

View file

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

View file

@ -1717,14 +1717,6 @@ int AudioClient::setOutputBufferSize(int numFrames, bool persist) {
if (persist) { if (persist) {
_outputBufferSizeFrames.set(numFrames); _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; return numFrames;
} }