mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi
This commit is contained in:
commit
ee00a86915
3 changed files with 48 additions and 16 deletions
|
@ -3,22 +3,22 @@
|
|||
// examples
|
||||
//
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
// This sample script loads a sound file and plays it at the 'fingertip' of the
|
||||
// Plays a sample audio file at the avatar's current location
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
// First, load the clap sound from a URL
|
||||
var clap = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw");
|
||||
// First, load a sample sound from a URL
|
||||
var bird = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw");
|
||||
|
||||
function maybePlaySound(deltaTime) {
|
||||
if (Math.random() < 0.01) {
|
||||
// Set the location and other info for the sound to play
|
||||
var options = new AudioInjectionOptions();
|
||||
var palmPosition = Controller.getSpatialControlPosition(0);
|
||||
options.position = palmPosition;
|
||||
var position = MyAvatar.position;
|
||||
options.position = position;
|
||||
options.volume = 0.5;
|
||||
Audio.playSound(clap, options);
|
||||
Audio.playSound(bird, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ ChatWindow::ChatWindow(QWidget* parent) :
|
|||
} else {
|
||||
ui->numOnlineLabel->hide();
|
||||
ui->closeButton->hide();
|
||||
ui->usersWidget->hide();
|
||||
ui->usersArea->hide();
|
||||
ui->messagesScrollArea->hide();
|
||||
ui->messagePlainTextEdit->hide();
|
||||
connect(&XmppClient::getInstance(), SIGNAL(joinedPublicChatRoom()), this, SLOT(connected()));
|
||||
|
@ -208,7 +208,7 @@ void ChatWindow::connected() {
|
|||
ui->connectingToXMPPLabel->hide();
|
||||
ui->numOnlineLabel->show();
|
||||
ui->closeButton->show();
|
||||
ui->usersWidget->show();
|
||||
ui->usersArea->show();
|
||||
ui->messagesScrollArea->show();
|
||||
ui->messagePlainTextEdit->show();
|
||||
ui->messagePlainTextEdit->setFocus();
|
||||
|
@ -248,6 +248,7 @@ void ChatWindow::notificationClicked() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
Application::processEvents();
|
||||
|
||||
scrollToBottom();
|
||||
}
|
||||
|
@ -262,6 +263,8 @@ void ChatWindow::error(QXmppClient::Error error) {
|
|||
}
|
||||
|
||||
void ChatWindow::participantsChanged() {
|
||||
bool atBottom = isNearBottom();
|
||||
|
||||
QStringList participants = XmppClient::getInstance().getPublicChatRoom()->participants();
|
||||
ui->numOnlineLabel->setText(tr("%1 online now:").arg(participants.count()));
|
||||
|
||||
|
@ -288,6 +291,11 @@ void ChatWindow::participantsChanged() {
|
|||
userLabel->installEventFilter(this);
|
||||
ui->usersWidget->layout()->addWidget(userLabel);
|
||||
}
|
||||
Application::processEvents();
|
||||
|
||||
if (atBottom) {
|
||||
scrollToBottom();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatWindow::messageReceived(const QXmppMessage& message) {
|
||||
|
|
|
@ -128,19 +128,43 @@ QPushButton:pressed {
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="usersWidget" native="true">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#usersWidget {
|
||||
margin-right: 20px;
|
||||
}</string>
|
||||
<widget class="QWidget" name="usersArea" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="usersWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="messagesScrollArea">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">margin-top: 12px;</string>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue