mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +02:00
Merge pull request #11387 from vladest/tablet_extended_sounds
Tablet extended sounds
This commit is contained in:
commit
f6af1d1ecf
29 changed files with 174 additions and 18 deletions
|
@ -11,6 +11,7 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4 as Original
|
import QtQuick.Controls 1.4 as Original
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
|
|
||||||
|
@ -26,6 +27,16 @@ Original.Button {
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
|
onHoveredChanged: {
|
||||||
|
if (hovered) {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
|
|
||||||
style: ButtonStyle {
|
style: ButtonStyle {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
|
@ -14,6 +14,8 @@ import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
|
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Original.CheckBox {
|
Original.CheckBox {
|
||||||
id: checkBox
|
id: checkBox
|
||||||
|
|
||||||
|
@ -28,6 +30,15 @@ Original.CheckBox {
|
||||||
readonly property int checkRadius: 2
|
readonly property int checkRadius: 2
|
||||||
activeFocusOnPress: true
|
activeFocusOnPress: true
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: doesnt works for QQC1. check with QQC2
|
||||||
|
// onHovered: {
|
||||||
|
// tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
// }
|
||||||
|
|
||||||
style: CheckBoxStyle {
|
style: CheckBoxStyle {
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
id: box
|
id: box
|
||||||
|
|
|
@ -13,6 +13,7 @@ import QtQuick.Controls 2.2
|
||||||
|
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
import "../controls-uit" as HiFiControls
|
import "../controls-uit" as HiFiControls
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: checkBox
|
id: checkBox
|
||||||
|
@ -32,6 +33,17 @@ CheckBox {
|
||||||
readonly property int checkSize: Math.max(boxSize - 8, 10)
|
readonly property int checkSize: Math.max(boxSize - 8, 10)
|
||||||
readonly property int checkRadius: isRound ? checkSize / 2 : 2
|
readonly property int checkRadius: isRound ? checkSize / 2 : 2
|
||||||
focusPolicy: Qt.ClickFocus
|
focusPolicy: Qt.ClickFocus
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
onHoveredChanged: {
|
||||||
|
if (hovered) {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
id: box
|
id: box
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4 as Original
|
import QtQuick.Controls 1.4 as Original
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
|
|
||||||
|
@ -24,6 +25,16 @@ Original.Button {
|
||||||
width: 120
|
width: 120
|
||||||
height: 28
|
height: 28
|
||||||
|
|
||||||
|
onHoveredChanged: {
|
||||||
|
if (hovered) {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
|
|
||||||
style: ButtonStyle {
|
style: ButtonStyle {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: keyItem
|
id: keyItem
|
||||||
|
@ -32,8 +33,15 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
if (containsMouse) {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
mouse.accepted = true;
|
mouse.accepted = true;
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
|
||||||
webEntity.synthesizeKeyPress(glyph);
|
webEntity.synthesizeKeyPress(glyph);
|
||||||
webEntity.synthesizeKeyPress(glyph, mirrorText);
|
webEntity.synthesizeKeyPress(glyph, mirrorText);
|
||||||
|
|
|
@ -15,6 +15,8 @@ import QtQuick.Controls.Styles 1.4
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
import "../controls-uit" as HifiControls
|
import "../controls-uit" as HifiControls
|
||||||
|
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Original.RadioButton {
|
Original.RadioButton {
|
||||||
id: radioButton
|
id: radioButton
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
@ -27,6 +29,15 @@ Original.RadioButton {
|
||||||
readonly property int checkSize: 10
|
readonly property int checkSize: 10
|
||||||
readonly property int checkRadius: 2
|
readonly property int checkRadius: 2
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: doesnt works for QQC1. check with QQC2
|
||||||
|
// onHovered: {
|
||||||
|
// tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
// }
|
||||||
|
|
||||||
style: RadioButtonStyle {
|
style: RadioButtonStyle {
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
id: box
|
id: box
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
import "../../controls-uit"
|
import "../../controls-uit"
|
||||||
|
|
||||||
|
@ -22,7 +23,16 @@ Preference {
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: button
|
||||||
onClicked: preference.trigger()
|
onHoveredChanged: {
|
||||||
|
if (hovered) {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
preference.trigger();
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
width: 180
|
width: 180
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
import "../../controls-uit"
|
import "../../controls-uit"
|
||||||
|
|
||||||
|
@ -38,6 +39,16 @@ Preference {
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: checkBox
|
id: checkBox
|
||||||
|
onHoveredChanged: {
|
||||||
|
if (hovered) {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: spacer.bottom
|
top: spacer.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
|
|
@ -14,6 +14,8 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
readonly property var level: Audio.inputLevel;
|
readonly property var level: Audio.inputLevel;
|
||||||
|
|
||||||
|
@ -57,8 +59,16 @@ Rectangle {
|
||||||
|
|
||||||
hoverEnabled: true;
|
hoverEnabled: true;
|
||||||
scrollGestureEnabled: false;
|
scrollGestureEnabled: false;
|
||||||
onClicked: { Audio.muted = !Audio.muted; }
|
onClicked: {
|
||||||
|
Audio.muted = !Audio.muted;
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
|
}
|
||||||
drag.target: dragTarget;
|
drag.target: dragTarget;
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
if (containsMouse) {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: tabletButton
|
id: tabletButton
|
||||||
|
@ -130,11 +131,13 @@ Item {
|
||||||
}
|
}
|
||||||
tabletButton.clicked();
|
tabletButton.clicked();
|
||||||
if (tabletRoot) {
|
if (tabletRoot) {
|
||||||
tabletRoot.playButtonClickSound();
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
tabletButton.isEntered = true;
|
tabletButton.isEntered = true;
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
|
||||||
if (tabletButton.isActive) {
|
if (tabletButton.isActive) {
|
||||||
tabletButton.state = "hover active state";
|
tabletButton.state = "hover active state";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,9 +9,13 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import TabletScriptingInterface 1.0
|
||||||
|
|
||||||
import "../../styles-uit"
|
import "../../styles-uit"
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
FocusScope {
|
FocusScope {
|
||||||
id: root
|
id: root
|
||||||
implicitHeight: background.height
|
implicitHeight: background.height
|
||||||
|
@ -69,12 +73,17 @@ FocusScope {
|
||||||
onImplicitWidthChanged: listView !== null ? listView.recalcSize() : 0
|
onImplicitWidthChanged: listView !== null ? listView.recalcSize() : 0
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
enabled: name !== "" && item.enabled
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onEntered: listView.currentIndex = index
|
onEntered: {
|
||||||
|
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||||
|
listView.currentIndex = index
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.selected(item)
|
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||||
tabletRoot.playButtonClickSound();
|
root.selected(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
|
|
||||||
import "../../dialogs"
|
import "../../dialogs"
|
||||||
import "../../controls"
|
import "../../controls"
|
||||||
|
|
||||||
|
|
BIN
interface/resources/sounds/Button01.wav
Normal file
BIN
interface/resources/sounds/Button01.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Button02.wav
Normal file
BIN
interface/resources/sounds/Button02.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Button03.wav
Normal file
BIN
interface/resources/sounds/Button03.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Button04.wav
Normal file
BIN
interface/resources/sounds/Button04.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Button05.wav
Normal file
BIN
interface/resources/sounds/Button05.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Button06.wav
Normal file
BIN
interface/resources/sounds/Button06.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Button07.wav
Normal file
BIN
interface/resources/sounds/Button07.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Collapse.wav
Normal file
BIN
interface/resources/sounds/Collapse.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Expand.wav
Normal file
BIN
interface/resources/sounds/Expand.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Tab01.wav
Normal file
BIN
interface/resources/sounds/Tab01.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Tab02.wav
Normal file
BIN
interface/resources/sounds/Tab02.wav
Normal file
Binary file not shown.
BIN
interface/resources/sounds/Tab03.wav
Normal file
BIN
interface/resources/sounds/Tab03.wav
Normal file
Binary file not shown.
|
@ -1847,6 +1847,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_rayPickManager.setPrecisionPicking(rayPickID, value);
|
_rayPickManager.setPrecisionPicking(rayPickID, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Preload Tablet sounds
|
||||||
|
DependencyManager::get<TabletScriptingInterface>()->preloadSounds();
|
||||||
|
|
||||||
qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
|
qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2324,6 +2327,8 @@ void Application::initializeUi() {
|
||||||
|
|
||||||
surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
||||||
surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
|
// Tablet inteference with Tablet.qml. Need to avoid this in QML space
|
||||||
|
surfaceContext->setContextProperty("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
|
surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
|
||||||
surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
||||||
surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
|
surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
|
||||||
|
@ -5812,6 +5817,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
|
||||||
qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<TabletProxy>, wrapperFromScriptValue<TabletProxy>);
|
qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<TabletProxy>, wrapperFromScriptValue<TabletProxy>);
|
||||||
qScriptRegisterMetaType(scriptEngine.data(),
|
qScriptRegisterMetaType(scriptEngine.data(),
|
||||||
wrapperToScriptValue<TabletButtonProxy>, wrapperFromScriptValue<TabletButtonProxy>);
|
wrapperToScriptValue<TabletButtonProxy>, wrapperFromScriptValue<TabletButtonProxy>);
|
||||||
|
// Tablet inteference with Tablet.qml. Need to avoid this in QML space
|
||||||
|
scriptEngine->registerGlobalObject("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
|
|
||||||
auto toolbarScriptingInterface = DependencyManager::get<ToolbarScriptingInterface>().data();
|
auto toolbarScriptingInterface = DependencyManager::get<ToolbarScriptingInterface>().data();
|
||||||
|
|
|
@ -63,7 +63,6 @@ static const float OPAQUE_ALPHA_THRESHOLD = 0.99f;
|
||||||
|
|
||||||
const QString Web3DOverlay::TYPE = "web3d";
|
const QString Web3DOverlay::TYPE = "web3d";
|
||||||
const QString Web3DOverlay::QML = "Web3DOverlay.qml";
|
const QString Web3DOverlay::QML = "Web3DOverlay.qml";
|
||||||
|
|
||||||
Web3DOverlay::Web3DOverlay() : _dpi(DPI) {
|
Web3DOverlay::Web3DOverlay() : _dpi(DPI) {
|
||||||
_touchDevice.setCapabilities(QTouchDevice::Position);
|
_touchDevice.setCapabilities(QTouchDevice::Position);
|
||||||
_touchDevice.setType(QTouchDevice::TouchScreen);
|
_touchDevice.setType(QTouchDevice::TouchScreen);
|
||||||
|
@ -248,6 +247,9 @@ void Web3DOverlay::setupQmlSurface() {
|
||||||
|
|
||||||
_webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../");
|
_webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../");
|
||||||
|
|
||||||
|
// Tablet inteference with Tablet.qml. Need to avoid this in QML space
|
||||||
|
_webSurface->getSurfaceContext()->setContextProperty("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
|
|
||||||
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface.data());
|
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface.data());
|
||||||
// mark the TabletProxy object as cpp ownership.
|
// mark the TabletProxy object as cpp ownership.
|
||||||
QObject* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
|
QObject* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
|
@ -23,16 +23,28 @@
|
||||||
#include "ToolbarScriptingInterface.h"
|
#include "ToolbarScriptingInterface.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
|
|
||||||
|
#include <AudioInjector.h>
|
||||||
|
|
||||||
|
#include "SettingHandle.h"
|
||||||
|
|
||||||
// FIXME move to global app properties
|
// FIXME move to global app properties
|
||||||
const QString SYSTEM_TOOLBAR = "com.highfidelity.interface.toolbar.system";
|
const QString SYSTEM_TOOLBAR = "com.highfidelity.interface.toolbar.system";
|
||||||
const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system";
|
const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system";
|
||||||
const QString TabletScriptingInterface::QML = "hifi/tablet/TabletRoot.qml";
|
const QString TabletScriptingInterface::QML = "hifi/tablet/TabletRoot.qml";
|
||||||
|
|
||||||
|
|
||||||
|
static Setting::Handle<QStringList> tabletSoundsButtonClick("TabletSounds", QStringList { "/sounds/Button06.wav",
|
||||||
|
"/sounds/Button04.wav",
|
||||||
|
"/sounds/Button07.wav",
|
||||||
|
"/sounds/Tab01.wav",
|
||||||
|
"/sounds/Tab02.wav" });
|
||||||
|
|
||||||
TabletScriptingInterface::TabletScriptingInterface() {
|
TabletScriptingInterface::TabletScriptingInterface() {
|
||||||
|
qmlRegisterType<TabletScriptingInterface>("TabletScriptingInterface", 1, 0, "TabletEnums");
|
||||||
}
|
}
|
||||||
|
|
||||||
TabletScriptingInterface::~TabletScriptingInterface() {
|
TabletScriptingInterface::~TabletScriptingInterface() {
|
||||||
|
tabletSoundsButtonClick.set(tabletSoundsButtonClick.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolbarProxy* TabletScriptingInterface::getSystemToolbarProxy() {
|
ToolbarProxy* TabletScriptingInterface::getSystemToolbarProxy() {
|
||||||
|
@ -63,6 +75,29 @@ TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) {
|
||||||
return tabletProxy;
|
return tabletProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabletScriptingInterface::preloadSounds() {
|
||||||
|
//preload audio events
|
||||||
|
const QStringList &audioSettings = tabletSoundsButtonClick.get();
|
||||||
|
for (int i = 0; i < TabletAudioEvents::Last; i++) {
|
||||||
|
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + audioSettings.at(i));
|
||||||
|
SharedSoundPointer sound = DependencyManager::get<SoundCache>()->
|
||||||
|
getSound(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
||||||
|
_audioEvents.insert(static_cast<TabletAudioEvents>(i), sound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabletScriptingInterface::playSound(TabletAudioEvents aEvent) {
|
||||||
|
SharedSoundPointer sound = _audioEvents[aEvent];
|
||||||
|
if (sound) {
|
||||||
|
AudioInjectorOptions options;
|
||||||
|
options.stereo = sound->isStereo();
|
||||||
|
options.ambisonic = sound->isAmbisonic();
|
||||||
|
options.localOnly = true;
|
||||||
|
|
||||||
|
AudioInjectorPointer injector = AudioInjector::playSoundAndDelete(sound->getByteArray(), options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TabletScriptingInterface::setToolbarMode(bool toolbarMode) {
|
void TabletScriptingInterface::setToolbarMode(bool toolbarMode) {
|
||||||
Q_ASSERT(QThread::currentThread() == qApp->thread());
|
Q_ASSERT(QThread::currentThread() == qApp->thread());
|
||||||
_toolbarMode = toolbarMode;
|
_toolbarMode = toolbarMode;
|
||||||
|
@ -323,9 +358,12 @@ void TabletProxy::emitWebEvent(const QVariant& msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::onTabletShown() {
|
void TabletProxy::onTabletShown() {
|
||||||
if (_tabletShown && _showRunningScripts) {
|
if (_tabletShown) {
|
||||||
_showRunningScripts = false;
|
static_cast<TabletScriptingInterface*>(parent())->playSound(TabletScriptingInterface::TabletOpen);
|
||||||
pushOntoStack("../../hifi/dialogs/TabletRunningScripts.qml");
|
if (_showRunningScripts) {
|
||||||
|
_showRunningScripts = false;
|
||||||
|
pushOntoStack("../../hifi/dialogs/TabletRunningScripts.qml");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
#include "SoundCache.h"
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
class ToolbarProxy;
|
class ToolbarProxy;
|
||||||
|
@ -40,8 +40,11 @@ class OffscreenQmlSurface;
|
||||||
class TabletScriptingInterface : public QObject, public Dependency {
|
class TabletScriptingInterface : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
enum TabletAudioEvents { ButtonClick, ButtonHover, TabletOpen, TabletHandsIn, TabletHandsOut, Last};
|
||||||
|
Q_ENUM(TabletAudioEvents)
|
||||||
|
|
||||||
TabletScriptingInterface();
|
TabletScriptingInterface();
|
||||||
~TabletScriptingInterface();
|
virtual ~TabletScriptingInterface();
|
||||||
static const QString QML;
|
static const QString QML;
|
||||||
|
|
||||||
void setToolbarScriptingInterface(ToolbarScriptingInterface* toolbarScriptingInterface) { _toolbarScriptingInterface = toolbarScriptingInterface; }
|
void setToolbarScriptingInterface(ToolbarScriptingInterface* toolbarScriptingInterface) { _toolbarScriptingInterface = toolbarScriptingInterface; }
|
||||||
|
@ -54,6 +57,9 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE TabletProxy* getTablet(const QString& tabletId);
|
Q_INVOKABLE TabletProxy* getTablet(const QString& tabletId);
|
||||||
|
|
||||||
|
void preloadSounds();
|
||||||
|
Q_INVOKABLE void playSound(TabletAudioEvents aEvent);
|
||||||
|
|
||||||
void setToolbarMode(bool toolbarMode);
|
void setToolbarMode(bool toolbarMode);
|
||||||
|
|
||||||
void setQmlTabletRoot(QString tabletId, OffscreenQmlSurface* offscreenQmlSurface);
|
void setQmlTabletRoot(QString tabletId, OffscreenQmlSurface* offscreenQmlSurface);
|
||||||
|
@ -77,6 +83,7 @@ private:
|
||||||
void processTabletEvents(QObject* object, const QKeyEvent* event);
|
void processTabletEvents(QObject* object, const QKeyEvent* event);
|
||||||
ToolbarProxy* getSystemToolbarProxy();
|
ToolbarProxy* getSystemToolbarProxy();
|
||||||
|
|
||||||
|
QMap<TabletAudioEvents, SharedSoundPointer> _audioEvents;
|
||||||
protected:
|
protected:
|
||||||
std::map<QString, TabletProxy*> _tabletProxies;
|
std::map<QString, TabletProxy*> _tabletProxies;
|
||||||
ToolbarScriptingInterface* _toolbarScriptingInterface { nullptr };
|
ToolbarScriptingInterface* _toolbarScriptingInterface { nullptr };
|
||||||
|
|
|
@ -33,10 +33,4 @@ Audio.disconnected.connect(function(){
|
||||||
Audio.playSound(disconnectSound, soundOptions);
|
Audio.playSound(disconnectSound, soundOptions);
|
||||||
});
|
});
|
||||||
|
|
||||||
Audio.mutedChanged.connect(function () {
|
|
||||||
if (Audio.muted) {
|
|
||||||
Audio.playSound(micMutedSound, soundOptions);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
Loading…
Reference in a new issue