mirror of
https://github.com/overte-org/overte.git
synced 2025-04-17 14:46:40 +02:00
moving gain slider to audio settings
This commit is contained in:
parent
a00d6ec9f6
commit
f1cf11de85
2 changed files with 77 additions and 26 deletions
|
@ -376,7 +376,7 @@ Item {
|
|||
}
|
||||
FiraSansRegular {
|
||||
id: nameCardConnectionInfoText
|
||||
visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard
|
||||
visible: selected && !isMyCard && pal.activeTab == "connectionsTab"
|
||||
width: parent.width
|
||||
height: displayNameTextPixelSize
|
||||
size: displayNameTextPixelSize - 4
|
||||
|
@ -412,7 +412,7 @@ Item {
|
|||
}
|
||||
FiraSansRegular {
|
||||
id: nameCardRemoveConnectionText
|
||||
visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard
|
||||
visible: selected && !isMyCard && pal.activeTab == "connectionsTab"
|
||||
width: parent.width
|
||||
height: displayNameTextPixelSize
|
||||
size: displayNameTextPixelSize - 4
|
||||
|
@ -425,7 +425,7 @@ Item {
|
|||
}
|
||||
HifiControls.Button {
|
||||
id: visitConnectionButton
|
||||
visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard
|
||||
visible: selected && !isMyCard && pal.activeTab == "connectionsTab"
|
||||
text: "Visit"
|
||||
enabled: thisNameCard.placeName !== ""
|
||||
anchors.verticalCenter: nameCardRemoveConnectionImage.verticalCenter
|
||||
|
@ -450,7 +450,7 @@ Item {
|
|||
// Style
|
||||
radius: 4
|
||||
color: "#c5c5c5"
|
||||
visible: (isMyCard || (selected && pal.activeTab == "nearbyTab")) && isPresent
|
||||
visible: (!isMyCard && (selected && pal.activeTab == "nearbyTab")) && isPresent
|
||||
// Rectangle for the zero-gain point on the VU meter
|
||||
Rectangle {
|
||||
id: vuMeterZeroGain
|
||||
|
@ -481,7 +481,7 @@ Item {
|
|||
id: vuMeterBase
|
||||
// Anchors
|
||||
anchors.fill: parent
|
||||
visible: isMyCard || selected
|
||||
visible: !isMyCard && selected
|
||||
// Style
|
||||
color: parent.color
|
||||
radius: parent.radius
|
||||
|
@ -489,7 +489,7 @@ Item {
|
|||
// Rectangle for the VU meter audio level
|
||||
Rectangle {
|
||||
id: vuMeterLevel
|
||||
visible: isMyCard || selected
|
||||
visible: !isMyCard && selected
|
||||
// Size
|
||||
width: (thisNameCard.audioLevel) * parent.width
|
||||
// Style
|
||||
|
@ -525,7 +525,7 @@ Item {
|
|||
anchors.verticalCenter: nameCardVUMeter.verticalCenter;
|
||||
anchors.left: nameCardVUMeter.left;
|
||||
// Properties
|
||||
visible: (isMyCard || (selected && pal.activeTab == "nearbyTab")) && isPresent;
|
||||
visible: (!isMyCard && (selected && pal.activeTab == "nearbyTab")) && isPresent;
|
||||
minimumValue: -60.0
|
||||
maximumValue: 20.0
|
||||
stepSize: 5
|
||||
|
@ -572,19 +572,7 @@ Item {
|
|||
implicitHeight: 16
|
||||
}
|
||||
}
|
||||
RalewayRegular {
|
||||
// The slider for my card is special, it controls the master gain
|
||||
id: gainSliderText;
|
||||
visible: isMyCard;
|
||||
text: "master volume";
|
||||
size: hifi.fontSizes.tabularData;
|
||||
anchors.left: parent.right;
|
||||
anchors.leftMargin: 8;
|
||||
color: hifi.colors.baseGrayHighlight;
|
||||
horizontalAlignment: Text.AlignLeft;
|
||||
verticalAlignment: Text.AlignTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateGainFromQML(avatarUuid, sliderValue, isReleased) {
|
||||
if (Users.getAvatarGain(avatarUuid) != sliderValue) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
|
@ -26,6 +26,8 @@ Rectangle {
|
|||
HifiConstants { id: hifi; }
|
||||
|
||||
property var eventBridge;
|
||||
// leave as blank, this is user's volume for the avatar mixer
|
||||
property var myAvatarUuid: ""
|
||||
property string title: "Audio Settings"
|
||||
property int switchHeight: 16
|
||||
property int switchWidth: 40
|
||||
|
@ -82,16 +84,16 @@ Rectangle {
|
|||
});
|
||||
}
|
||||
|
||||
function disablePeakValues() {
|
||||
root.showPeaks = false;
|
||||
AudioScriptingInterface.devices.input.peakValuesEnabled = false;
|
||||
function updateMyAvatarGainFromQML(sliderValue, isReleased) {
|
||||
if (Users.getAvatarGain(myAvatarUuid) != sliderValue) {
|
||||
Users.setAvatarGain(myAvatarUuid, sliderValue);
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: enablePeakValues();
|
||||
Component.onDestruction: disablePeakValues();
|
||||
onVisibleChanged: visible ? enablePeakValues() : disablePeakValues();
|
||||
|
||||
Column {
|
||||
id: column
|
||||
spacing: 12;
|
||||
anchors.top: bar.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
|
@ -305,6 +307,67 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: gainContainer
|
||||
x: margins.paddings;
|
||||
width: parent.width - margins.paddings*2
|
||||
height: gainSliderTextMetrics.height
|
||||
|
||||
HifiControlsUit.Slider {
|
||||
id: gainSlider
|
||||
anchors.right: parent.right
|
||||
height: parent.height
|
||||
width: 200
|
||||
minimumValue: -60.0
|
||||
maximumValue: 20.0
|
||||
stepSize: 5
|
||||
value: Users.getAvatarGain(myAvatarUuid)
|
||||
onValueChanged: {
|
||||
updateMyAvatarGainFromQML(value, false);
|
||||
}
|
||||
onPressedChanged: {
|
||||
if (!pressed) {
|
||||
updateMyAvatarGainFromQML(value, false);
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onWheel: {
|
||||
// Do nothing.
|
||||
}
|
||||
onDoubleClicked: {
|
||||
gainSlider.value = 0.0
|
||||
}
|
||||
onPressed: {
|
||||
// Pass through to Slider
|
||||
mouse.accepted = false
|
||||
}
|
||||
onReleased: {
|
||||
// the above mouse.accepted seems to make this
|
||||
// never get called, nonetheless...
|
||||
mouse.accepted = false
|
||||
}
|
||||
}
|
||||
}
|
||||
TextMetrics {
|
||||
id: gainSliderTextMetrics
|
||||
text: gainSliderText.text
|
||||
font: gainSliderText.font
|
||||
}
|
||||
RalewayRegular {
|
||||
// The slider for my card is special, it controls the master gain
|
||||
id: gainSliderText;
|
||||
text: "Avatar volume";
|
||||
size: 16;
|
||||
anchors.left: parent.left;
|
||||
color: hifi.colors.white;
|
||||
horizontalAlignment: Text.AlignLeft;
|
||||
verticalAlignment: Text.AlignTop;
|
||||
}
|
||||
}
|
||||
|
||||
AudioControls.PlaySampleSound {
|
||||
x: margins.paddings
|
||||
|
||||
|
|
Loading…
Reference in a new issue