Added settings controls sounds

This commit is contained in:
vladest 2017-09-25 16:46:36 +02:00
parent 5a452fa981
commit b5f0c4d940
5 changed files with 46 additions and 1 deletions

View file

@ -11,6 +11,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4 as Original
import QtQuick.Controls.Styles 1.4
import TabletScriptingInterface 1.0
import "../styles-uit"
@ -23,6 +24,16 @@ Original.Button {
HifiConstants { id: hifi }
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover)
}
}
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick)
}
style: ButtonStyle {
background: Rectangle {

View file

@ -12,6 +12,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4 as Original
import QtQuick.Controls.Styles 1.4
import TabletScriptingInterface 1.0
import "../styles-uit"
@ -24,6 +25,16 @@ Original.Button {
width: 120
height: 28
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover)
}
}
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick)
}
style: ButtonStyle {
background: Rectangle {

View file

@ -9,6 +9,7 @@
//
import QtQuick 2.5
import TabletScriptingInterface 1.0
import "../../controls-uit"
@ -22,7 +23,16 @@ Preference {
Button {
id: button
onClicked: preference.trigger()
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover)
}
}
onClicked: {
preference.trigger()
tabletInterface.playSound(TabletEnums.ButtonClick)
}
width: 180
anchors.bottom: parent.bottom
}

View file

@ -9,6 +9,7 @@
//
import QtQuick 2.5
import TabletScriptingInterface 1.0
import "../../controls-uit"
@ -38,6 +39,16 @@ Preference {
CheckBox {
id: checkBox
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover)
}
}
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick)
}
anchors {
top: spacer.bottom
left: parent.left

View file

@ -2310,6 +2310,8 @@ void Application::initializeUi() {
surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
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("GlobalServices", GlobalServicesScriptingInterface::getInstance());
surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());