mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
Make the tablet's mic icon reflect the current mute state
This commit is contained in:
parent
8a995cc1d2
commit
b5b92c1508
4 changed files with 26 additions and 2 deletions
|
@ -6,10 +6,16 @@ Item {
|
||||||
id: tablet
|
id: tablet
|
||||||
objectName: "tablet"
|
objectName: "tablet"
|
||||||
property double micLevel: 0.8
|
property double micLevel: 0.8
|
||||||
|
property bool micEnabled: true
|
||||||
property int rowIndex: 0
|
property int rowIndex: 0
|
||||||
property int columnIndex: 0
|
property int columnIndex: 0
|
||||||
property int count: (flowMain.children.length - 1)
|
property int count: (flowMain.children.length - 1)
|
||||||
|
|
||||||
|
// called by C++ code to keep mic state updated
|
||||||
|
function setMicEnabled(newMicEnabled) {
|
||||||
|
tablet.micEnabled = newMicEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
// called by C++ code to keep audio bar updated
|
// called by C++ code to keep audio bar updated
|
||||||
function setMicLevel(newMicLevel) {
|
function setMicLevel(newMicLevel) {
|
||||||
tablet.micLevel = newMicLevel;
|
tablet.micLevel = newMicLevel;
|
||||||
|
@ -102,7 +108,7 @@ Item {
|
||||||
id: muteIcon
|
id: muteIcon
|
||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
source: "../../../icons/tablet-mute-icon.svg"
|
source: tablet.micEnabled ? "../../../icons/tablet-icons/mic-i.svg" : "../../../icons/tablet-icons/mic-a.svg"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +181,6 @@ Item {
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 0
|
position: 0
|
||||||
color: "#2b2b2b"
|
color: "#2b2b2b"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GradientStop {
|
GradientStop {
|
||||||
|
|
|
@ -309,6 +309,15 @@ void TabletProxy::removeButton(QObject* tabletButtonProxy) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabletProxy::updateMicEnabled(const bool micOn) {
|
||||||
|
auto tablet = getQmlTablet();
|
||||||
|
if (!tablet) {
|
||||||
|
//qCCritical(scriptengine) << "Could not find tablet in TabletRoot.qml";
|
||||||
|
} else {
|
||||||
|
QMetaObject::invokeMethod(tablet, "setMicEnabled", Qt::AutoConnection, Q_ARG(QVariant, QVariant(micOn)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TabletProxy::updateAudioBar(const double micLevel) {
|
void TabletProxy::updateAudioBar(const double micLevel) {
|
||||||
auto tablet = getQmlTablet();
|
auto tablet = getQmlTablet();
|
||||||
if (!tablet) {
|
if (!tablet) {
|
||||||
|
|
|
@ -106,6 +106,13 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void removeButton(QObject* tabletButtonProxy);
|
Q_INVOKABLE void removeButton(QObject* tabletButtonProxy);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Updates the tablet's mic enabled state
|
||||||
|
* @function TabletProxy#updateMicEnabled
|
||||||
|
* @param micEnabled {bool} mic enabled state
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void updateMicEnabled(const bool micEnabled);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Updates the audio bar in tablet to reflect latest mic level
|
* Updates the audio bar in tablet to reflect latest mic level
|
||||||
* @function TabletProxy#updateAudioBar
|
* @function TabletProxy#updateAudioBar
|
||||||
|
|
|
@ -53,8 +53,11 @@
|
||||||
|
|
||||||
function updateShowTablet() {
|
function updateShowTablet() {
|
||||||
if (tabletShown) {
|
if (tabletShown) {
|
||||||
|
var MUTE_MICROPHONE_MENU_ITEM = "Mute Microphone";
|
||||||
|
var currentMicEnabled = !Menu.isOptionChecked(MUTE_MICROPHONE_MENU_ITEM);
|
||||||
var currentMicLevel = getMicLevel();
|
var currentMicLevel = getMicLevel();
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
tablet.updateMicEnabled(currentMicEnabled);
|
||||||
tablet.updateAudioBar(currentMicLevel);
|
tablet.updateAudioBar(currentMicLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue