Merge branch 'stable' of https://github.com/highfidelity/hifi into new-master

This commit is contained in:
Atlante45 2018-03-15 15:22:43 -07:00
commit d96f7553d9
4 changed files with 14 additions and 12 deletions

View file

@ -14,9 +14,9 @@ import Qt.labs.settings 1.0
import "./hifi/audio" as HifiAudio
Hifi.AvatarInputs {
Item {
id: root;
objectName: "AvatarInputs"
objectName: "AvatarInputsBar"
property int modality: Qt.NonModal
width: audio.width;
height: audio.height;
@ -26,7 +26,7 @@ Hifi.AvatarInputs {
HifiAudio.MicBar {
id: audio;
visible: root.showAudioTools;
visible: AvatarInputs.showAudioTools;
standalone: true;
dragTarget: parent;
}

View file

@ -2717,10 +2717,12 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
void Application::onDesktopRootItemCreated(QQuickItem* rootItem) {
Stats::show();
AvatarInputs::show();
auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext();
surfaceContext->setContextProperty("Stats", Stats::getInstance());
surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
auto offscreenUi = DependencyManager::get<OffscreenUi>();
auto qml = PathUtils::qmlUrl("AvatarInputsBar.qml");
offscreenUi->show(qml, "AvatarInputsBar");
}
void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {

View file

@ -16,19 +16,19 @@
#include "Application.h"
#include "Menu.h"
HIFI_QML_DEF(AvatarInputs)
static AvatarInputs* INSTANCE{ nullptr };
Setting::Handle<bool> showAudioToolsSetting { QStringList { "AvatarInputs", "showAudioTools" }, false };
AvatarInputs* AvatarInputs::getInstance() {
Q_ASSERT(INSTANCE);
if (!INSTANCE) {
INSTANCE = new AvatarInputs();
Q_ASSERT(INSTANCE);
}
return INSTANCE;
}
AvatarInputs::AvatarInputs(QQuickItem* parent) : QQuickItem(parent) {
INSTANCE = this;
AvatarInputs::AvatarInputs(QObject* parent) : QObject(parent) {
_showAudioTools = showAudioToolsSetting.get();
}

View file

@ -19,7 +19,7 @@ public: \
private: \
type _##name{ initialValue };
class AvatarInputs : public QQuickItem {
class AvatarInputs : public QObject {
Q_OBJECT
HIFI_QML_DECL
@ -32,7 +32,7 @@ class AvatarInputs : public QQuickItem {
public:
static AvatarInputs* getInstance();
Q_INVOKABLE float loudnessToAudioLevel(float loudness);
AvatarInputs(QQuickItem* parent = nullptr);
AvatarInputs(QObject* parent = nullptr);
void update();
bool showAudioTools() const { return _showAudioTools; }