Introducong tablet audio events

This commit is contained in:
vladest 2017-09-08 09:51:10 +02:00
parent 9f8f28dd1e
commit 832e4aa5eb
15 changed files with 26 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import QtQuick 2.0
import Hifi 1.0
import QtQuick.Controls 1.4
import "../../dialogs"
import "../../controls"
@ -145,7 +146,7 @@ Item {
SoundEffect {
id: buttonClickSound
volume: 0.1
source: "../../../sounds/Gamemaster-Audio-button-click.wav"
source: ""
}
function playButtonClickSound() {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -22,12 +22,22 @@
#include "../InfoView.h"
#include "ToolbarScriptingInterface.h"
#include "Logging.h"
#include "SoundCache.h"
#include "SettingHandle.h"
// FIXME move to global app properties
const QString SYSTEM_TOOLBAR = "com.highfidelity.interface.toolbar.system";
const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system";
Setting::Handle<QString> tabletSoundsButtonClick("TabletSounds/buttonClick", "../../../sounds/Button06.wav");
Setting::Handle<QString> tabletSoundsButtonHover("TabletSounds/buttonHover", "../../../sounds/Button04.wav");
Setting::Handle<QString> tabletSoundsTabletOpen("TabletSounds/tabletOpen", "../../../sounds/Button07.wav");
Setting::Handle<QString> tabletSoundsTabletHandsIn("TabletSounds/tabletHandsIn", "../../../sounds/Tab01.wav");
Setting::Handle<QString> tabletSoundsTabletHandsOut("TabletSounds/tabletHandsOut", "../../../sounds/Tab02.wav");
TabletScriptingInterface::TabletScriptingInterface() {
}
TabletScriptingInterface::~TabletScriptingInterface() {
@ -61,6 +71,13 @@ TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) {
return tabletProxy;
}
void TabletScriptingInterface::playSound(QString soundId)
{
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
SharedSoundPointer _snapshotSound = DependencyManager::get<SoundCache>()->
getSound(QUrl::fromLocalFile(inf.absoluteFilePath()));
}
void TabletScriptingInterface::setToolbarMode(bool toolbarMode) {
Q_ASSERT(QThread::currentThread() == qApp->thread());
_toolbarMode = toolbarMode;

View file

@ -34,6 +34,10 @@ class TabletButtonProxy;
class QmlWindowClass;
class OffscreenQmlSurface;
namespace Tablet
{
enum AudioEvents { ButtonClick, ButtonHover, TabletOpen, TabletHandsIn, TabletHandsOut };
}
/**jsdoc
* @namespace Tablet
*/
@ -41,7 +45,7 @@ class TabletScriptingInterface : public QObject, public Dependency {
Q_OBJECT
public:
TabletScriptingInterface();
~TabletScriptingInterface();
virtual ~TabletScriptingInterface();
void setToolbarScriptingInterface(ToolbarScriptingInterface* toolbarScriptingInterface) { _toolbarScriptingInterface = toolbarScriptingInterface; }
@ -53,6 +57,7 @@ public:
*/
Q_INVOKABLE TabletProxy* getTablet(const QString& tabletId);
Q_INVOKABLE void playSound(QString soundId);
void setToolbarMode(bool toolbarMode);
void setQmlTabletRoot(QString tabletId, OffscreenQmlSurface* offscreenQmlSurface);
@ -308,6 +313,7 @@ protected:
};
Q_DECLARE_METATYPE(TabletButtonProxy*);
Q_DECLARE_METATYPE(Tablet::AudioEvents);
/**jsdoc
* @typedef TabletButtonProxy.ButtonProperties