mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into SUI/audioListFixes
This commit is contained in:
commit
4bbbaa8c19
10 changed files with 295 additions and 193 deletions
|
@ -58,7 +58,8 @@ Rectangle {
|
|||
if (isLoggedIn) {
|
||||
Commerce.getWalletStatus();
|
||||
} else {
|
||||
// Show some error to the user
|
||||
errorText.text = "There was a problem while retrieving your inventory. " +
|
||||
"Please try closing and re-opening the Avatar app.\n\nLogin status result: " + isLoggedIn;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,11 +67,19 @@ Rectangle {
|
|||
if (walletStatus === 5) {
|
||||
getInventory();
|
||||
} else {
|
||||
// Show some error to the user
|
||||
errorText.text = "There was a problem while retrieving your inventory. " +
|
||||
"Please try closing and re-opening the Avatar app.\n\nWallet status result: " + walletStatus;
|
||||
}
|
||||
}
|
||||
|
||||
onInventoryResult: {
|
||||
if (result.status !== "success") {
|
||||
errorText.text = "There was a problem while retrieving your inventory. " +
|
||||
"Please try closing and re-opening the Avatar app.\n\nInventory status: " + result.status + "\nMessage: " + result.message;
|
||||
} else if (result.data && result.data.assets && result.data.assets.length === 0) {
|
||||
errorText.text = "You have not created any avatars yet! Create an avatar with the Avatar Creator, then close and re-open the Avatar App."
|
||||
}
|
||||
|
||||
avatarAppInventoryModel.handlePage(result.status !== "success" && result.message, result);
|
||||
root.updatePreviewUrl();
|
||||
}
|
||||
|
@ -172,7 +181,7 @@ Rectangle {
|
|||
anchors.bottom: parent.bottom
|
||||
|
||||
AnimatedImage {
|
||||
visible: !inventoryContentsList.visible
|
||||
visible: !inventoryContentsList.visible && !errorText.visible
|
||||
anchors.centerIn: parent
|
||||
width: 72
|
||||
height: width
|
||||
|
@ -181,7 +190,7 @@ Rectangle {
|
|||
|
||||
ListView {
|
||||
id: inventoryContentsList
|
||||
visible: avatarAppInventoryModel.count !== 0
|
||||
visible: avatarAppInventoryModel.count !== 0 && !errorText.visible
|
||||
interactive: contentItem.height > height
|
||||
clip: true
|
||||
model: avatarAppInventoryModel
|
||||
|
@ -196,6 +205,18 @@ Rectangle {
|
|||
standaloneIncompatible: model.standalone_incompatible
|
||||
}
|
||||
}
|
||||
|
||||
HifiStylesUit.GraphikRegular {
|
||||
id: errorText
|
||||
text: ""
|
||||
visible: text !== ""
|
||||
anchors.fill: parent
|
||||
size: 22
|
||||
color: simplifiedUI.colors.text.white
|
||||
wrapMode: Text.Wrap
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -68,21 +68,20 @@ Flickable {
|
|||
|
||||
SimplifiedControls.Slider {
|
||||
id: peopleVolume
|
||||
property real lastValueSent
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin
|
||||
height: 30
|
||||
labelText: "People Volume"
|
||||
from: -60.0
|
||||
from: simplifiedUI.numericConstants.mutedValue
|
||||
to: 20.0
|
||||
defaultValue: 0.0
|
||||
stepSize: 5.0
|
||||
value: AudioScriptingInterface.getAvatarGain()
|
||||
value: AudioScriptingInterface.avatarGain
|
||||
live: true
|
||||
function updatePeopleGain(sliderValue) {
|
||||
if (AudioScriptingInterface.getAvatarGain() !== sliderValue) {
|
||||
AudioScriptingInterface.setAvatarGain(sliderValue);
|
||||
if (AudioScriptingInterface.avatarGain !== sliderValue) {
|
||||
AudioScriptingInterface.avatarGain = sliderValue;
|
||||
}
|
||||
}
|
||||
onValueChanged: {
|
||||
|
@ -97,22 +96,21 @@ Flickable {
|
|||
|
||||
SimplifiedControls.Slider {
|
||||
id: environmentVolume
|
||||
property real lastValueSent
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
Layout.topMargin: 2
|
||||
height: 30
|
||||
labelText: "Environment Volume"
|
||||
from: -60.0
|
||||
from: simplifiedUI.numericConstants.mutedValue
|
||||
to: 20.0
|
||||
defaultValue: 0.0
|
||||
stepSize: 5.0
|
||||
value: AudioScriptingInterface.getInjectorGain()
|
||||
value: AudioScriptingInterface.serverInjectorGain
|
||||
live: true
|
||||
function updateEnvironmentGain(sliderValue) {
|
||||
if (AudioScriptingInterface.getInjectorGain() !== sliderValue) {
|
||||
AudioScriptingInterface.setInjectorGain(sliderValue);
|
||||
AudioScriptingInterface.setLocalInjectorGain(sliderValue);
|
||||
if (AudioScriptingInterface.serverInjectorGain !== sliderValue) {
|
||||
AudioScriptingInterface.serverInjectorGain = sliderValue;
|
||||
AudioScriptingInterface.localInjectorGain = sliderValue;
|
||||
}
|
||||
}
|
||||
onValueChanged: {
|
||||
|
@ -127,21 +125,20 @@ Flickable {
|
|||
|
||||
SimplifiedControls.Slider {
|
||||
id: systemSoundVolume
|
||||
property real lastValueSent
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
Layout.topMargin: 2
|
||||
height: 30
|
||||
labelText: "System Sound Volume"
|
||||
from: -60.0
|
||||
from: simplifiedUI.numericConstants.mutedValue
|
||||
to: 20.0
|
||||
defaultValue: 0.0
|
||||
stepSize: 5.0
|
||||
value: AudioScriptingInterface.getSystemInjectorGain()
|
||||
value: AudioScriptingInterface.systemInjectorGain
|
||||
live: true
|
||||
function updateSystemGain(sliderValue) {
|
||||
if (AudioScriptingInterface.getSystemInjectorGain() !== sliderValue) {
|
||||
AudioScriptingInterface.setSystemInjectorGain(sliderValue);
|
||||
if (AudioScriptingInterface.systemInjectorGain !== sliderValue) {
|
||||
AudioScriptingInterface.systemInjectorGain = sliderValue;
|
||||
}
|
||||
}
|
||||
onValueChanged: {
|
||||
|
|
|
@ -221,4 +221,8 @@ QtObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property QtObject numericConstants: QtObject {
|
||||
readonly property real mutedValue: -60.0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,7 +203,10 @@ Rectangle {
|
|||
|
||||
Image {
|
||||
id: outputDeviceButton
|
||||
property bool outputMuted: false
|
||||
property bool outputMuted: AudioScriptingInterface.avatarGain === simplifiedUI.numericConstants.mutedValue &&
|
||||
AudioScriptingInterface.serverInjectorGain === simplifiedUI.numericConstants.mutedValue &&
|
||||
AudioScriptingInterface.localInjectorGain === simplifiedUI.numericConstants.mutedValue &&
|
||||
AudioScriptingInterface.systemInjectorGain === simplifiedUI.numericConstants.mutedValue
|
||||
source: outputDeviceButton.outputMuted ? "./images/outputDeviceMuted.svg" : "./images/outputDeviceLoud.svg"
|
||||
anchors.centerIn: parent
|
||||
width: 20
|
||||
|
@ -228,9 +231,8 @@ Rectangle {
|
|||
}
|
||||
onClicked: {
|
||||
Tablet.playSound(TabletEnums.ButtonClick);
|
||||
outputDeviceButton.outputMuted = !outputDeviceButton.outputMuted;
|
||||
|
||||
if (outputDeviceButton.outputMuted && !AudioScriptingInterface.muted) {
|
||||
if (!outputDeviceButton.outputMuted && !AudioScriptingInterface.muted) {
|
||||
AudioScriptingInterface.muted = true;
|
||||
}
|
||||
|
||||
|
@ -238,7 +240,7 @@ Rectangle {
|
|||
"source": "SimplifiedTopBar.qml",
|
||||
"method": "setOutputMuted",
|
||||
"data": {
|
||||
"outputMuted": outputDeviceButton.outputMuted
|
||||
"outputMuted": !outputDeviceButton.outputMuted
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -454,10 +456,6 @@ Rectangle {
|
|||
}
|
||||
break;
|
||||
|
||||
case "updateOutputMuted":
|
||||
outputDeviceButton.outputMuted = message.data.outputMuted;
|
||||
break;
|
||||
|
||||
case "updateStatusButton":
|
||||
statusButton.currentStatus = message.data.currentStatus;
|
||||
break;
|
||||
|
|
|
@ -400,10 +400,19 @@ void Audio::setReverbOptions(const AudioEffectOptions* options) {
|
|||
}
|
||||
|
||||
void Audio::setAvatarGain(float gain) {
|
||||
bool changed = false;
|
||||
if (getAvatarGain() != gain) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
// ask the NodeList to set the master avatar gain
|
||||
DependencyManager::get<NodeList>()->setAvatarGain(QUuid(), gain);
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit avatarGainChanged(gain);
|
||||
}
|
||||
}
|
||||
|
||||
float Audio::getAvatarGain() {
|
||||
|
@ -413,10 +422,19 @@ float Audio::getAvatarGain() {
|
|||
}
|
||||
|
||||
void Audio::setInjectorGain(float gain) {
|
||||
bool changed = false;
|
||||
if (getInjectorGain() != gain) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
// ask the NodeList to set the audio injector gain
|
||||
DependencyManager::get<NodeList>()->setInjectorGain(gain);
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit serverInjectorGainChanged(gain);
|
||||
}
|
||||
}
|
||||
|
||||
float Audio::getInjectorGain() {
|
||||
|
@ -426,6 +444,11 @@ float Audio::getInjectorGain() {
|
|||
}
|
||||
|
||||
void Audio::setLocalInjectorGain(float gain) {
|
||||
bool changed = false;
|
||||
if (getLocalInjectorGain() != gain) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
if (_localInjectorGain != gain) {
|
||||
_localInjectorGain = gain;
|
||||
|
@ -436,6 +459,11 @@ void Audio::setLocalInjectorGain(float gain) {
|
|||
DependencyManager::get<AudioClient>()->setLocalInjectorGain(gain);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (changed) {
|
||||
emit localInjectorGainChanged(gain);
|
||||
}
|
||||
}
|
||||
|
||||
float Audio::getLocalInjectorGain() {
|
||||
|
@ -445,6 +473,11 @@ float Audio::getLocalInjectorGain() {
|
|||
}
|
||||
|
||||
void Audio::setSystemInjectorGain(float gain) {
|
||||
bool changed = false;
|
||||
if (getSystemInjectorGain() != gain) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
if (_systemInjectorGain != gain) {
|
||||
_systemInjectorGain = gain;
|
||||
|
@ -455,6 +488,10 @@ void Audio::setSystemInjectorGain(float gain) {
|
|||
DependencyManager::get<AudioClient>()->setSystemInjectorGain(gain);
|
||||
}
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
emit systemInjectorGainChanged(gain);
|
||||
}
|
||||
}
|
||||
|
||||
float Audio::getSystemInjectorGain() {
|
||||
|
|
|
@ -66,6 +66,10 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable {
|
|||
* @property {boolean} pushToTalkHMD - <code>true</code> if HMD push-to-talk is enabled, otherwise <code>false</code>.
|
||||
* @property {boolean} pushingToTalk - <code>true</code> if the user is currently pushing-to-talk, otherwise
|
||||
* <code>false</code>.
|
||||
* @property {float} avatarGain - The gain (relative volume) that avatars' voices are played at. This gain is used at the server.
|
||||
* @property {float} localInjectorGain - The gain (relative volume) that local injectors (local environment sounds) are played at.
|
||||
* @property {float} serverInjectorGain - The gain (relative volume) that server injectors (server environment sounds) are played at. This gain is used at the server.
|
||||
* @property {float} systemInjectorGain - The gain (relative volume) that system sounds are played at.
|
||||
*
|
||||
* @comment The following properties are from AudioScriptingInterface.h.
|
||||
* @property {boolean} isStereoInput - <code>true</code> if the input audio is being used in stereo, otherwise
|
||||
|
@ -90,6 +94,10 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable {
|
|||
Q_PROPERTY(bool pushToTalkDesktop READ getPTTDesktop WRITE setPTTDesktop NOTIFY pushToTalkDesktopChanged)
|
||||
Q_PROPERTY(bool pushToTalkHMD READ getPTTHMD WRITE setPTTHMD NOTIFY pushToTalkHMDChanged)
|
||||
Q_PROPERTY(bool pushingToTalk READ getPushingToTalk WRITE setPushingToTalk NOTIFY pushingToTalkChanged)
|
||||
Q_PROPERTY(float avatarGain READ getAvatarGain WRITE setAvatarGain NOTIFY avatarGainChanged)
|
||||
Q_PROPERTY(float localInjectorGain READ getLocalInjectorGain WRITE setLocalInjectorGain NOTIFY localInjectorGainChanged)
|
||||
Q_PROPERTY(float serverInjectorGain READ getInjectorGain WRITE setInjectorGain NOTIFY serverInjectorGainChanged)
|
||||
Q_PROPERTY(float systemInjectorGain READ getSystemInjectorGain WRITE setSystemInjectorGain NOTIFY systemInjectorGainChanged)
|
||||
|
||||
public:
|
||||
static QString AUDIO;
|
||||
|
@ -412,6 +420,38 @@ signals:
|
|||
*/
|
||||
void pushingToTalkChanged(bool talking);
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the avatar gain changes.
|
||||
* @function Audio.avatarGainChanged
|
||||
* @param {float} gain - The new avatar gain value.
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void avatarGainChanged(float gain);
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the local injector gain changes.
|
||||
* @function Audio.localInjectorGainChanged
|
||||
* @param {float} gain - The new local injector gain value.
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void localInjectorGainChanged(float gain);
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the server injector gain changes.
|
||||
* @function Audio.serverInjectorGainChanged
|
||||
* @param {float} gain - The new server injector gain value.
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void serverInjectorGainChanged(float gain);
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the system injector gain changes.
|
||||
* @function Audio.systemInjectorGainChanged
|
||||
* @param {float} gain - The new system injector gain value.
|
||||
* @returns {Signal}
|
||||
*/
|
||||
void systemInjectorGainChanged(float gain);
|
||||
|
||||
public slots:
|
||||
|
||||
/**jsdoc
|
||||
|
|
|
@ -44,13 +44,14 @@ SelectionScriptingInterface::SelectionScriptingInterface() {
|
|||
}
|
||||
|
||||
/**jsdoc
|
||||
* The type of a specific item in a selection list.
|
||||
* <table>
|
||||
* <thead>
|
||||
* <tr><th>Value</th><th>Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr><td><code>"avatar"</code></td><td></td></tr>
|
||||
* <tr><td><code>"entity"</code></td><td></td></tr>
|
||||
* <tr><td><code>"avatar"</code></td><td>The item is an avatar.</td></tr>
|
||||
* <tr><td><code>"entity"</code></td><td>The item is an entity.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* @typedef {string} Selection.ItemType
|
||||
|
@ -245,9 +246,10 @@ void SelectionScriptingInterface::printList(const QString& listName) {
|
|||
}
|
||||
|
||||
/**jsdoc
|
||||
* A selection list.
|
||||
* @typedef {object} Selection.SelectedItemsList
|
||||
* @property {Uuid[]} avatars - The IDs of the avatars in the selection.
|
||||
* @property {Uuid[]} entities - The IDs of the entities in the selection.
|
||||
* @property {Uuid[]} avatars - The IDs of the avatars in the selection list.
|
||||
* @property {Uuid[]} entities - The IDs of the entities in the selection list.
|
||||
*/
|
||||
QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& listName) const {
|
||||
QReadLocker lock(&_selectionListsLock);
|
||||
|
@ -438,18 +440,19 @@ bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
|
|||
}
|
||||
|
||||
/**jsdoc
|
||||
* The highlighting style of a selection list.
|
||||
* @typedef {object} Selection.HighlightStyle
|
||||
* @property {Color} outlineUnoccludedColor - Color of the specified highlight region.
|
||||
* @property {Color} outlineOccludedColor - ""
|
||||
* @property {Color} fillUnoccludedColor- ""
|
||||
* @property {Color} fillOccludedColor- ""
|
||||
* @property {number} outlineUnoccludedAlpha - Alpha value ranging from <code>0.0</code> (not visible) to <code>1.0</code>
|
||||
* (fully opaque) for the specified highlight region.
|
||||
* @property {number} outlineOccludedAlpha - ""
|
||||
* @property {number} fillUnoccludedAlpha - ""
|
||||
* @property {number} fillOccludedAlpha - ""
|
||||
* @property {number} outlineWidth - Width of the outline, in pixels.
|
||||
* @property {boolean} isOutlineSmooth - <code>true</code> to enable outline smooth fall-off.
|
||||
* @property {Color} outlineUnoccludedColor=255,178,51 - Unoccluded outline color.
|
||||
* @property {Color} outlineOccludedColor=255,178,51 - Occluded outline color.
|
||||
* @property {Color} fillUnoccludedColor=51,178,255 - Unoccluded fill color.
|
||||
* @property {Color} fillOccludedColor=51,178,255 - Occluded fill color.
|
||||
* @property {number} outlineUnoccludedAlpha=0.9 - Unoccluded outline alpha, range <code>0.0</code> – <code>1.0</code>.
|
||||
* @property {number} outlineOccludedAlpha=0.9 - Occluded outline alpha, range <code>0.0</code> – <code>1.0</code>.
|
||||
* @property {number} fillUnoccludedAlpha=0.0 - Unoccluded fill alpha, range <code>0.0</code> – <code>1.0</code>.
|
||||
* @property {number} fillOccludedAlpha=0.0 - Occluded fill alpha, range <code>0.0</code> – <code>1.0</code>.
|
||||
* @property {number} outlineWidth=2 - Width of the outline, in pixels.
|
||||
* @property {boolean} isOutlineSmooth=false - <code>true</code> to fade the outside edge of the outline, <code>false</code>
|
||||
* to have a sharp edge.
|
||||
*/
|
||||
QVariantMap SelectionHighlightStyle::toVariantMap() const {
|
||||
QVariantMap properties;
|
||||
|
|
|
@ -77,47 +77,45 @@ protected:
|
|||
};
|
||||
|
||||
/**jsdoc
|
||||
* The <code>Selection</code> API provides a means of grouping together avatars and entities in named lists.
|
||||
* The <code>Selection</code> API provides a means of grouping together and highlighting avatars and entities in named lists.
|
||||
*
|
||||
* @namespace Selection
|
||||
*
|
||||
* @hifi-interface
|
||||
* @hifi-client-entity
|
||||
* @hifi-avatar
|
||||
*
|
||||
* @example <caption>Outline an entity when it is grabbed by a controller.</caption>
|
||||
* // Create a box and copy the following text into the entity's "Script URL" field.
|
||||
* @example <caption>Outline an entity when it is grabbed by the mouse or a controller.</caption>
|
||||
* // Create an entity and copy the following script into the entity's "Script URL" field.
|
||||
* // Move the entity behind another entity to see the occluded outline.
|
||||
* (function () {
|
||||
* print("Starting highlight script...............");
|
||||
* var _this = this;
|
||||
* var prevID = 0;
|
||||
* var listName = "contextOverlayHighlightList";
|
||||
* var listType = "entity";
|
||||
*
|
||||
* _this.startNearGrab = function(entityID){
|
||||
* if (prevID !== entityID) {
|
||||
* Selection.addToSelectedItemsList(listName, listType, entityID);
|
||||
* prevID = entityID;
|
||||
* }
|
||||
* var LIST_NAME = "SelectionExample",
|
||||
* ITEM_TYPE = "entity",
|
||||
* HIGHLIGHT_STYLE = {
|
||||
* outlineUnoccludedColor: { red: 0, green: 180, blue: 239 },
|
||||
* outlineUnoccludedAlpha: 0.5,
|
||||
* outlineOccludedColor: { red: 239, green: 180, blue: 0 },
|
||||
* outlineOccludedAlpha: 0.5,
|
||||
* outlineWidth: 4
|
||||
* };
|
||||
*
|
||||
* Selection.enableListHighlight(LIST_NAME, HIGHLIGHT_STYLE);
|
||||
*
|
||||
* this.startNearGrab = function (entityID) {
|
||||
* Selection.addToSelectedItemsList(LIST_NAME, ITEM_TYPE, entityID);
|
||||
* };
|
||||
*
|
||||
* _this.releaseGrab = function(entityID){
|
||||
* if (prevID !== 0) {
|
||||
* Selection.removeFromSelectedItemsList("contextOverlayHighlightList", listType, prevID);
|
||||
* prevID = 0;
|
||||
* }
|
||||
*
|
||||
* this.startDistanceGrab = function (entityID) {
|
||||
* Selection.addToSelectedItemsList(LIST_NAME, ITEM_TYPE, entityID);
|
||||
* };
|
||||
*
|
||||
* var cleanup = function(){
|
||||
* Entities.findEntities(MyAvatar.position, 1000).forEach(function(entity) {
|
||||
* try {
|
||||
* Selection.removeListFromMap(listName);
|
||||
* } catch (e) {
|
||||
* print("Error cleaning up.");
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* this.releaseGrab = function (entityID) {
|
||||
* Selection.removeFromSelectedItemsList(LIST_NAME, ITEM_TYPE, entityID);
|
||||
* };
|
||||
*
|
||||
* Script.scriptEnding.connect(cleanup);
|
||||
*
|
||||
* Script.scriptEnding.connect(function () {
|
||||
* Selection.removeListFromMap(LIST_NAME);
|
||||
* });
|
||||
* });
|
||||
*/
|
||||
class SelectionScriptingInterface : public QObject, public Dependency {
|
||||
|
@ -127,121 +125,119 @@ public:
|
|||
SelectionScriptingInterface();
|
||||
|
||||
/**jsdoc
|
||||
* Get the names of all the selection lists.
|
||||
* @function Selection.getListNames
|
||||
* @returns {list[]} An array of names of all the selection lists.
|
||||
*/
|
||||
* Gets the names of all current selection lists.
|
||||
* @function Selection.getListNames
|
||||
* @returns {string[]} The names of all current selection lists.
|
||||
* @example <caption>List all the current selection lists.</caption>
|
||||
* print("Selection lists: " + Selection.getListNames());
|
||||
*/
|
||||
Q_INVOKABLE QStringList getListNames() const;
|
||||
|
||||
/**jsdoc
|
||||
* Delete a named selection list.
|
||||
* @function Selection.removeListFromMap
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> if the selection existed and was successfully removed, otherwise <code>false</code>.
|
||||
*/
|
||||
* Deletes a selection list.
|
||||
* @function Selection.removeListFromMap
|
||||
* @param {string} listName - The name of the selection list to delete.
|
||||
* @returns {boolean} <code>true</code> if the selection existed and was successfully removed, otherwise <code>false</code>.
|
||||
*/
|
||||
Q_INVOKABLE bool removeListFromMap(const QString& listName);
|
||||
|
||||
/**jsdoc
|
||||
* Add an item to a selection list.
|
||||
* @function Selection.addToSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list to add the item to.
|
||||
* @param {Selection.ItemType} itemType - The type of the item being added.
|
||||
* @param {Uuid} id - The ID of the item to add to the selection.
|
||||
* @returns {boolean} <code>true</code> if the item was successfully added, otherwise <code>false</code>.
|
||||
*/
|
||||
* Adds an item to a selection list. The list is created if it doesn't exist.
|
||||
* @function Selection.addToSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list to add the item to.
|
||||
* @param {Selection.ItemType} itemType - The type of item being added.
|
||||
* @param {Uuid} itemID - The ID of the item to add.
|
||||
* @returns {boolean} <code>true</code> if the item was successfully added or already existed in the list, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
Q_INVOKABLE bool addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id);
|
||||
|
||||
/**jsdoc
|
||||
* Remove an item from a selection list.
|
||||
* @function Selection.removeFromSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list to remove the item from.
|
||||
* @param {Selection.ItemType} itemType - The type of the item being removed.
|
||||
* @param {Uuid} id - The ID of the item to remove.
|
||||
* @returns {boolean} <code>true</code> if the item was successfully removed, otherwise <code>false</code>.
|
||||
* <codefalse</code> is returned if the list doesn't contain any data.
|
||||
*/
|
||||
* Removes an item from a selection list.
|
||||
* @function Selection.removeFromSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list to remove the item from.
|
||||
* @param {Selection.ItemType} itemType - The type of item being removed.
|
||||
* @param {Uuid} itemID - The ID of the item to remove.
|
||||
* @returns {boolean} <code>true</code> if the item was successfully removed or was not in the list, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
Q_INVOKABLE bool removeFromSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id);
|
||||
|
||||
/**jsdoc
|
||||
* Remove all items from a selection.
|
||||
* @function Selection.clearSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> if the item was successfully cleared, otherwise <code>false</code>.
|
||||
*/
|
||||
* Removes all items from a selection list.
|
||||
* @function Selection.clearSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> always.
|
||||
*/
|
||||
Q_INVOKABLE bool clearSelectedItemsList(const QString& listName);
|
||||
|
||||
/**jsdoc
|
||||
* Print out the list of avatars and entities in a selection to the <em>debug log</em> (not the script log).
|
||||
* @function Selection.printList
|
||||
* @param {string} listName - The name of the selection list.
|
||||
*/
|
||||
* Prints the list of avatars and entities in a selection to the program log (but not the Script Log window).
|
||||
* @function Selection.printList
|
||||
* @param {string} listName - The name of the selection list.
|
||||
*/
|
||||
Q_INVOKABLE void printList(const QString& listName);
|
||||
|
||||
/**jsdoc
|
||||
* Get the list of avatars and entities stored in a selection list.
|
||||
* @function Selection.getSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {Selection.SelectedItemsList} The content of a selection list. If the list name doesn't exist, the function
|
||||
* returns an empty object with no properties.
|
||||
*/
|
||||
* Gets the list of avatars and entities in a selection list.
|
||||
* @function Selection.getSelectedItemsList
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {Selection.SelectedItemsList} The content of the selection list if the list exists, otherwise an empty object.
|
||||
*/
|
||||
Q_INVOKABLE QVariantMap getSelectedItemsList(const QString& listName) const;
|
||||
|
||||
/**jsdoc
|
||||
* Get the names of the highlighted selection lists.
|
||||
* @function Selection.getHighlightedListNames
|
||||
* @returns {string[]} An array of names of the selection list currently highlight enabled.
|
||||
*/
|
||||
* Gets the names of all current selection lists that have highlighting enabled.
|
||||
* @function Selection.getHighlightedListNames
|
||||
* @returns {string[]} The names of the selection lists that currently have highlighting enabled.
|
||||
*/
|
||||
Q_INVOKABLE QStringList getHighlightedListNames() const;
|
||||
|
||||
/**jsdoc
|
||||
* Enable highlighting for a selection list.
|
||||
* If the selection list doesn't exist, it will be created.
|
||||
* All objects in the list will be displayed with the highlight effect specified.
|
||||
* The function can be called several times with different values in the style to modify it.<br />
|
||||
* Note: This function implicitly calls {@link Selection.enableListToScene}.
|
||||
* @function Selection.enableListHighlight
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @param {Selection.HighlightStyle} highlightStyle - The highlight style.
|
||||
* @returns {boolean} true if the selection was successfully enabled for highlight.
|
||||
*/
|
||||
* Enables highlighting for a selection list. All items in or subsequently added to the list are displayed with the
|
||||
* highlight effect specified. The method can be called multiple times with different values in the style to modify the
|
||||
* highlighting.
|
||||
* <p>Note: This function implicitly calls {@link Selection.enableListToScene|enableListToScene}.</p>
|
||||
* @function Selection.enableListHighlight
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @param {Selection.HighlightStyle} highlightStyle - The highlight style.
|
||||
* @returns {boolean} <code>true</code> always.
|
||||
*/
|
||||
Q_INVOKABLE bool enableListHighlight(const QString& listName, const QVariantMap& highlightStyle);
|
||||
|
||||
/**jsdoc
|
||||
* Disable highlighting for the selection list.
|
||||
* If the selection list doesn't exist or wasn't enabled for highlighting then nothing happens and <code>false</code> is
|
||||
* returned.<br />
|
||||
* Note: This function implicitly calls {@link Selection.disableListToScene}.
|
||||
* @function Selection.disableListHighlight
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> if the selection was successfully disabled for highlight, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
* Disables highlighting for a selection list.
|
||||
* <p>Note: This function implicitly calls {@link Selection.disableListToScene|disableListToScene}.</p>
|
||||
* @function Selection.disableListHighlight
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> always.
|
||||
*/
|
||||
Q_INVOKABLE bool disableListHighlight(const QString& listName);
|
||||
|
||||
/**jsdoc
|
||||
* Enable scene selection for the selection list.
|
||||
* If the Selection doesn't exist, it will be created.
|
||||
* All objects in the list will be sent to a scene selection.
|
||||
* @function Selection.enableListToScene
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> if the selection was successfully enabled on the scene, otherwise <code>false</code>.
|
||||
*/
|
||||
* Enables scene selection for a selection list. All items in or subsequently added to the list are sent to a scene
|
||||
* selection in the rendering engine for debugging purposes.
|
||||
* @function Selection.enableListToScene
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> always.
|
||||
*/
|
||||
Q_INVOKABLE bool enableListToScene(const QString& listName);
|
||||
|
||||
/**jsdoc
|
||||
* Disable scene selection for the named selection.
|
||||
* If the selection list doesn't exist or wasn't enabled on the scene then nothing happens and <code>false</code> is
|
||||
* returned.
|
||||
* @function Selection.disableListToScene
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} true if the selection was successfully disabled on the scene, false otherwise.
|
||||
*/
|
||||
* Disables scene selection for a selection list.
|
||||
* @function Selection.disableListToScene
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {boolean} <code>true</code> always.
|
||||
*/
|
||||
Q_INVOKABLE bool disableListToScene(const QString& listName);
|
||||
|
||||
/**jsdoc
|
||||
* Get the highlight style values for the a selection list.
|
||||
* If the selection doesn't exist or hasn't been highlight enabled yet, an empty object is returned.
|
||||
* @function Selection.getListHighlightStyle
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {Selection.HighlightStyle} highlight style
|
||||
*/
|
||||
* Gets the current highlighting style for a selection list.
|
||||
* @function Selection.getListHighlightStyle
|
||||
* @param {string} listName - The name of the selection list.
|
||||
* @returns {Selection.HighlightStyle} The highlight style of the selection list if the list exists and highlighting is
|
||||
* enabled, otherwise an empty object.
|
||||
*/
|
||||
Q_INVOKABLE QVariantMap getListHighlightStyle(const QString& listName) const;
|
||||
|
||||
|
||||
|
@ -253,7 +249,7 @@ public:
|
|||
|
||||
signals:
|
||||
/**jsdoc
|
||||
* Triggered when a list's content changes.
|
||||
* Triggered when a selection list's content changes or the list is deleted.
|
||||
* @function Selection.selectedItemsListChanged
|
||||
* @param {string} listName - The name of the selection list that changed.
|
||||
* @returns {Signal}
|
||||
|
@ -276,7 +272,6 @@ private:
|
|||
void setupHandler(const QString& selectionName);
|
||||
void removeHandler(const QString& selectionName);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_SelectionScriptingInterface_h
|
||||
|
|
|
@ -91,10 +91,10 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort)
|
|||
connect(accountManager.data(), &AccountManager::newKeypair, this, &NodeList::sendDomainServerCheckIn);
|
||||
|
||||
// clear out NodeList when login is finished and we know our new username
|
||||
connect(accountManager.data(), SIGNAL(usernameChanged(QString)) , this, SLOT(reset()));
|
||||
connect(accountManager.data(), &AccountManager::usernameChanged , this, [this]{ reset("Username changed"); });
|
||||
|
||||
// clear our NodeList when logout is requested
|
||||
connect(accountManager.data(), SIGNAL(logoutComplete()) , this, SLOT(reset()));
|
||||
connect(accountManager.data(), &AccountManager::logoutComplete , this, [this]{ reset("Logged out"); });
|
||||
|
||||
// anytime we get a new node we will want to attempt to punch to it
|
||||
connect(this, &LimitedNodeList::nodeAdded, this, &NodeList::startNodeHolePunch);
|
||||
|
|
|
@ -238,40 +238,39 @@ function updateOutputDeviceMutedOverlay(isMuted) {
|
|||
}
|
||||
|
||||
|
||||
var savedAvatarGain = Audio.getAvatarGain();
|
||||
var savedInjectorGain = Audio.getInjectorGain();
|
||||
var savedLocalInjectorGain = Audio.getLocalInjectorGain();
|
||||
var savedSystemInjectorGain = Audio.getSystemInjectorGain();
|
||||
var savedAvatarGain = Audio.avatarGain;
|
||||
var savedServerInjectorGain = Audio.serverInjectorGain;
|
||||
var savedLocalInjectorGain = Audio.localInjectorGain;
|
||||
var savedSystemInjectorGain = Audio.systemInjectorGain;
|
||||
var MUTED_VALUE_DB = -60; // This should always match `SimplifiedConstants.qml` -> numericConstants -> mutedValue!
|
||||
function setOutputMuted(outputMuted) {
|
||||
updateOutputDeviceMutedOverlay(outputMuted);
|
||||
|
||||
if (outputMuted) {
|
||||
savedAvatarGain = Audio.getAvatarGain();
|
||||
savedInjectorGain = Audio.getInjectorGain();
|
||||
savedLocalInjectorGain = Audio.getLocalInjectorGain();
|
||||
savedSystemInjectorGain = Audio.getSystemInjectorGain();
|
||||
savedAvatarGain = Audio.avatarGain;
|
||||
savedServerInjectorGain = Audio.serverInjectorGain;
|
||||
savedLocalInjectorGain = Audio.localInjectorGain;
|
||||
savedSystemInjectorGain = Audio.systemInjectorGain;
|
||||
|
||||
Audio.setAvatarGain(-60);
|
||||
Audio.setInjectorGain(-60);
|
||||
Audio.setLocalInjectorGain(-60);
|
||||
Audio.setSystemInjectorGain(-60);
|
||||
Audio.avatarGain = MUTED_VALUE_DB;
|
||||
Audio.serverInjectorGain = MUTED_VALUE_DB;
|
||||
Audio.localInjectorGain = MUTED_VALUE_DB;
|
||||
Audio.systemInjectorGain = MUTED_VALUE_DB;
|
||||
} else {
|
||||
if (savedAvatarGain === -60) {
|
||||
if (savedAvatarGain === MUTED_VALUE_DB) {
|
||||
savedAvatarGain = 0;
|
||||
}
|
||||
Audio.setAvatarGain(savedAvatarGain);
|
||||
if (savedInjectorGain === -60) {
|
||||
savedInjectorGain = 0;
|
||||
Audio.avatarGain = savedAvatarGain;
|
||||
if (savedServerInjectorGain === MUTED_VALUE_DB) {
|
||||
savedServerInjectorGain = 0;
|
||||
}
|
||||
Audio.setInjectorGain(savedInjectorGain);
|
||||
if (savedLocalInjectorGain === -60) {
|
||||
Audio.serverInjectorGain = savedServerInjectorGain;
|
||||
if (savedLocalInjectorGain === MUTED_VALUE_DB) {
|
||||
savedLocalInjectorGain = 0;
|
||||
}
|
||||
Audio.setLocalInjectorGain(savedLocalInjectorGain);
|
||||
if (savedSystemInjectorGain === -60) {
|
||||
Audio.localInjectorGain = savedLocalInjectorGain;
|
||||
if (savedSystemInjectorGain === MUTED_VALUE_DB) {
|
||||
savedSystemInjectorGain = 0;
|
||||
}
|
||||
Audio.setSystemInjectorGain(savedSystemInjectorGain);
|
||||
Audio.systemInjectorGain = savedSystemInjectorGain;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,7 +333,10 @@ function onTopBarClosed() {
|
|||
|
||||
|
||||
function isOutputMuted() {
|
||||
return Audio.getAvatarGain() === -60 && Audio.getInjectorGain() === -60 && Audio.getLocalInjectorGain() === -60 && Audio.getSystemInjectorGain() === -60;
|
||||
return Audio.avatarGain === MUTED_VALUE_DB &&
|
||||
Audio.serverInjectorGain === MUTED_VALUE_DB &&
|
||||
Audio.localInjectorGain === MUTED_VALUE_DB &&
|
||||
Audio.systemInjectorGain === MUTED_VALUE_DB;
|
||||
}
|
||||
|
||||
|
||||
|
@ -370,15 +372,7 @@ function loadSimplifiedTopBar() {
|
|||
|
||||
// The eventbridge takes a nonzero time to initialize, so we have to wait a bit
|
||||
// for the QML to load and for that to happen before updating the UI.
|
||||
Script.setTimeout(function() {
|
||||
topBarWindow.sendToQml({
|
||||
"source": "simplifiedUI.js",
|
||||
"method": "updateOutputMuted",
|
||||
"data": {
|
||||
"outputMuted": isOutputMuted()
|
||||
}
|
||||
});
|
||||
|
||||
Script.setTimeout(function() {
|
||||
sendLocalStatusToQml();
|
||||
}, WAIT_FOR_TOP_BAR_MS);
|
||||
}
|
||||
|
@ -469,6 +463,11 @@ function onStatusChanged() {
|
|||
}
|
||||
|
||||
|
||||
function maybeUpdateOutputDeviceMutedOverlay() {
|
||||
updateOutputDeviceMutedOverlay(isOutputMuted());
|
||||
}
|
||||
|
||||
|
||||
var simplifiedNametag = Script.require("./simplifiedNametag/simplifiedNametag.js?" + Date.now());
|
||||
var SimplifiedStatusIndicator = Script.require("./simplifiedStatusIndicator/simplifiedStatusIndicator.js?" + Date.now());
|
||||
var si;
|
||||
|
@ -501,6 +500,10 @@ function startup() {
|
|||
Audio.mutedDesktopChanged.connect(onDesktopInputDeviceMutedChanged);
|
||||
Window.geometryChanged.connect(onGeometryChanged);
|
||||
HMD.displayModeChanged.connect(ensureFirstPersonCameraInHMD);
|
||||
Audio.avatarGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
Audio.localInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
Audio.systemInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
|
||||
oldShowAudioTools = AvatarInputs.showAudioTools;
|
||||
AvatarInputs.showAudioTools = false;
|
||||
|
@ -551,6 +554,10 @@ function shutdown() {
|
|||
Audio.mutedDesktopChanged.disconnect(onDesktopInputDeviceMutedChanged);
|
||||
Window.geometryChanged.disconnect(onGeometryChanged);
|
||||
HMD.displayModeChanged.disconnect(ensureFirstPersonCameraInHMD);
|
||||
Audio.avatarGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
Audio.systemInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
|
||||
|
||||
AvatarInputs.showAudioTools = oldShowAudioTools;
|
||||
AvatarInputs.showBubbleTools = oldShowBubbleTools;
|
||||
|
|
Loading…
Reference in a new issue