mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
update QML with Audio.muted
This commit is contained in:
parent
337b6bca14
commit
20c0dac8e8
6 changed files with 5 additions and 38 deletions
|
@ -6,16 +6,10 @@ 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;
|
||||||
|
@ -121,8 +115,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
visible: (!tablet.micEnabled && !toggleMuteMouseArea.containsMouse)
|
visible: (Audio.muted && !toggleMuteMouseArea.containsMouse)
|
||||||
|| (tablet.micEnabled && toggleMuteMouseArea.containsMouse)
|
|| (!Audio.muted && toggleMuteMouseArea.containsMouse)
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: muteIcon
|
id: muteIcon
|
||||||
|
@ -201,7 +195,7 @@ Item {
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
propagateComposedEvents: false
|
propagateComposedEvents: false
|
||||||
scrollGestureEnabled: false
|
scrollGestureEnabled: false
|
||||||
onClicked: tabletRoot.toggleMicEnabled()
|
onClicked: { Audio.muted = !Audio.muted }
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
|
@ -271,7 +265,7 @@ Item {
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: muteIcon
|
target: muteIcon
|
||||||
visible: micEnabled
|
visible: !Audio.muted
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
|
|
|
@ -150,10 +150,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMicEnabled() {
|
|
||||||
Audio.mute = !Audio.mute;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUsername(newUsername) {
|
function setUsername(newUsername) {
|
||||||
username = newUsername;
|
username = newUsername;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,10 +72,6 @@ Windows.ScrollingWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMicEnabled() {
|
|
||||||
Audio.mute = !Audio.mute;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUsername(newUsername) {
|
function setUsername(newUsername) {
|
||||||
username = newUsername;
|
username = newUsername;
|
||||||
}
|
}
|
||||||
|
|
|
@ -606,15 +606,6 @@ 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) {
|
||||||
|
|
|
@ -152,13 +152,6 @@ 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
|
||||||
|
|
|
@ -185,10 +185,7 @@
|
||||||
|
|
||||||
//TODO: move to tablet qml?
|
//TODO: move to tablet qml?
|
||||||
if (tabletShown) {
|
if (tabletShown) {
|
||||||
var currentMicEnabled = !Menu.isOptionChecked(MUTE_MICROPHONE_MENU_ITEM);
|
gTablet.updateAudioBar(getMicLevel());
|
||||||
var currentMicLevel = getMicLevel();
|
|
||||||
gTablet.updateMicEnabled(currentMicEnabled);
|
|
||||||
gTablet.updateAudioBar(currentMicLevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validCheckTime - now > MSECS_PER_SEC/4) {
|
if (validCheckTime - now > MSECS_PER_SEC/4) {
|
||||||
|
|
Loading…
Reference in a new issue