Merge branch 'master' of https://github.com/highfidelity/hifi into yellow

This commit is contained in:
samcake 2016-10-11 15:45:10 -07:00
commit 3ebab3b017
8 changed files with 69 additions and 75 deletions

View file

@ -4625,11 +4625,15 @@ void Application::resetSensors(bool andReload) {
void Application::updateWindowTitle() const {
QString buildVersion = " (build " + applicationVersion() + ")";
auto nodeList = DependencyManager::get<NodeList>();
auto accountManager = DependencyManager::get<AccountManager>();
QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) ";
QString username = DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();
QString buildVersion = " (build " + applicationVersion() + ")";
QString loginStatus = accountManager->isLoggedIn() ? "" : " (NOT LOGGED IN)";
QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)";
QString username = accountManager->getAccountInfo().getUsername();
QString currentPlaceName = DependencyManager::get<AddressManager>()->getHost();
if (currentPlaceName.isEmpty()) {
@ -4637,7 +4641,7 @@ void Application::updateWindowTitle() const {
}
QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
+ currentPlaceName + connectionStatus + buildVersion;
+ currentPlaceName + connectionStatus + loginStatus + buildVersion;
#ifndef WIN32
// crashes with vs2013/win32

View file

@ -867,6 +867,10 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
void AudioClient::handleAudioInput() {
if (!_inputDevice) {
return;
}
// input samples required to produce exactly NETWORK_FRAME_SAMPLES of output
const int inputSamplesRequired = (_inputToNetworkResampler ?
_inputToNetworkResampler->getMinInput(AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL) :

View file

@ -192,6 +192,11 @@ void GLBackend::resetResourceStage() {
void GLBackend::do_setResourceTexture(const Batch& batch, size_t paramOffset) {
GLuint slot = batch._params[paramOffset + 1]._uint;
if (slot >= (GLuint) MAX_NUM_RESOURCE_TEXTURES) {
// "GLBackend::do_setResourceTexture: Trying to set a resource Texture at slot #" + slot + " which doesn't exist. MaxNumResourceTextures = " + getMaxNumResourceTextures());
return;
}
TexturePointer resourceTexture = batch._textures.get(batch._params[paramOffset + 0]._uint);
if (!resourceTexture) {

View file

@ -11,10 +11,20 @@
#include "AssetResourceRequest.h"
#include <QtCore/QLoggingCategory>
#include "AssetClient.h"
#include "AssetUtils.h"
#include "MappingRequest.h"
#include <QtCore/qloggingcategory.h>
#include "NetworkLogging.h"
static const int DOWNLOAD_PROGRESS_LOG_INTERVAL_SECONDS = 5;
AssetResourceRequest::AssetResourceRequest(const QUrl& url) :
ResourceRequest(url)
{
_lastProgressDebug = p_high_resolution_clock::now() - std::chrono::seconds(DOWNLOAD_PROGRESS_LOG_INTERVAL_SECONDS);
}
AssetResourceRequest::~AssetResourceRequest() {
if (_assetMappingRequest) {
@ -24,10 +34,6 @@ AssetResourceRequest::~AssetResourceRequest() {
if (_assetRequest) {
_assetRequest->deleteLater();
}
if (_sendTimer) {
cleanupTimer();
}
}
bool AssetResourceRequest::urlIsAssetHash() const {
@ -37,24 +43,6 @@ bool AssetResourceRequest::urlIsAssetHash() const {
return hashRegex.exactMatch(_url.toString());
}
void AssetResourceRequest::setupTimer() {
Q_ASSERT(!_sendTimer);
static const int TIMEOUT_MS = 2000;
_sendTimer = new QTimer(this);
connect(_sendTimer, &QTimer::timeout, this, &AssetResourceRequest::onTimeout);
_sendTimer->setSingleShot(true);
_sendTimer->start(TIMEOUT_MS);
}
void AssetResourceRequest::cleanupTimer() {
Q_ASSERT(_sendTimer);
disconnect(_sendTimer, 0, this, 0);
_sendTimer->deleteLater();
_sendTimer = nullptr;
}
void AssetResourceRequest::doSend() {
// We'll either have a hash or an ATP path to a file (that maps to a hash)
if (urlIsAssetHash()) {
@ -81,8 +69,6 @@ void AssetResourceRequest::requestMappingForPath(const AssetPath& path) {
Q_ASSERT(_state == InProgress);
Q_ASSERT(request == _assetMappingRequest);
cleanupTimer();
switch (request->getError()) {
case MappingRequest::NoError:
// we have no error, we should have a resulting hash - use that to send of a request for that asset
@ -118,7 +104,6 @@ void AssetResourceRequest::requestMappingForPath(const AssetPath& path) {
_assetMappingRequest = nullptr;
});
setupTimer();
_assetMappingRequest->start();
}
@ -133,8 +118,6 @@ void AssetResourceRequest::requestHash(const AssetHash& hash) {
Q_ASSERT(_state == InProgress);
Q_ASSERT(req == _assetRequest);
Q_ASSERT(req->getState() == AssetRequest::Finished);
cleanupTimer();
switch (req->getError()) {
case AssetRequest::Error::NoError:
@ -162,35 +145,29 @@ void AssetResourceRequest::requestHash(const AssetHash& hash) {
_assetRequest = nullptr;
});
setupTimer();
_assetRequest->start();
}
void AssetResourceRequest::onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) {
Q_ASSERT(_state == InProgress);
// We've received data, so reset the timer
_sendTimer->start();
emit progress(bytesReceived, bytesTotal);
auto now = p_high_resolution_clock::now();
// if we haven't received the full asset check if it is time to output progress to log
// we do so every X seconds to assist with ATP download tracking
if (bytesReceived != bytesTotal
&& now - _lastProgressDebug > std::chrono::seconds(DOWNLOAD_PROGRESS_LOG_INTERVAL_SECONDS)) {
int percentage = roundf((float) bytesReceived / (float) bytesTotal * 100.0f);
qCDebug(networking).nospace() << "Progress for " << _url.path() << " - "
<< bytesReceived << " of " << bytesTotal << " bytes - " << percentage << "%";
_lastProgressDebug = now;
}
}
void AssetResourceRequest::onTimeout() {
if (_state == InProgress) {
qWarning() << "Asset request timed out: " << _url;
if (_assetRequest) {
disconnect(_assetRequest, 0, this, 0);
_assetRequest->deleteLater();
_assetRequest = nullptr;
}
if (_assetMappingRequest) {
disconnect(_assetMappingRequest, 0, this, 0);
_assetMappingRequest->deleteLater();
_assetMappingRequest = nullptr;
}
_result = Timeout;
_state = Finished;
emit finished();
}
cleanupTimer();
}

View file

@ -14,13 +14,15 @@
#include <QUrl>
#include <PortableHighResolutionClock.h>
#include "AssetRequest.h"
#include "ResourceRequest.h"
class AssetResourceRequest : public ResourceRequest {
Q_OBJECT
public:
AssetResourceRequest(const QUrl& url) : ResourceRequest(url) { }
AssetResourceRequest(const QUrl& url);
virtual ~AssetResourceRequest() override;
protected:
@ -28,21 +30,17 @@ protected:
private slots:
void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
void onTimeout();
private:
void setupTimer();
void cleanupTimer();
bool urlIsAssetHash() const;
void requestMappingForPath(const AssetPath& path);
void requestHash(const AssetHash& hash);
QTimer* _sendTimer { nullptr };
GetMappingRequest* _assetMappingRequest { nullptr };
AssetRequest* _assetRequest { nullptr };
p_high_resolution_clock::time_point _lastProgressDebug;
};
#endif

View file

@ -54,7 +54,7 @@ void ReceivedMessage::appendPacket(NLPacket& packet) {
"We should not be appending to a complete message");
// Limit progress signal to every X packets
const int EMIT_PROGRESS_EVERY_X_PACKETS = 100;
const int EMIT_PROGRESS_EVERY_X_PACKETS = 50;
++_numPackets;

View file

@ -63,7 +63,6 @@ void OculusBaseDisplayPlugin::customizeContext() {
void OculusBaseDisplayPlugin::uncustomizeContext() {
Parent::uncustomizeContext();
internalPresent();
}
bool OculusBaseDisplayPlugin::internalActivate() {

View file

@ -469,7 +469,7 @@ var usersWindow = (function () {
Overlays.editOverlay(minimizeButton, {
x: windowLeft + WINDOW_WIDTH - WINDOW_MARGIN / 2 - MIN_MAX_BUTTON_WIDTH,
y: windowTop + WINDOW_MARGIN / 2
y: windowTop + WINDOW_MARGIN
});
scrollbarBackgroundPosition.x = windowLeft + WINDOW_WIDTH - 0.5 * WINDOW_MARGIN - SCROLLBAR_BACKGROUND_WIDTH;
@ -559,34 +559,34 @@ var usersWindow = (function () {
});
Overlays.editOverlay(windowHeading, {
text: linesOfUsers.length > 0 ? "Users online" : "No users online"
text: isLoggedIn ? (linesOfUsers.length > 0 ? "Users online" : "No users online") : "Users online - log in to view"
});
}
function updateOverlayVisibility() {
Overlays.editOverlay(windowBorder, {
visible: isLoggedIn && isVisible && isBorderVisible
visible: isVisible && isBorderVisible
});
Overlays.editOverlay(windowPane, {
visible: isLoggedIn && isVisible
visible: isVisible
});
Overlays.editOverlay(windowHeading, {
visible: isLoggedIn && isVisible
visible: isVisible
});
Overlays.editOverlay(minimizeButton, {
visible: isLoggedIn && isVisible
});
Overlays.editOverlay(scrollbarBackground, {
visible: isLoggedIn && isVisible && isUsingScrollbars && !isMinimized
visible: isVisible && isUsingScrollbars && !isMinimized
});
Overlays.editOverlay(scrollbarBar, {
visible: isLoggedIn && isVisible && isUsingScrollbars && !isMinimized
visible: isVisible && isUsingScrollbars && !isMinimized
});
Overlays.editOverlay(friendsButton, {
visible: isLoggedIn && isVisible && !isMinimized
visible: isVisible && !isMinimized
});
displayControl.setVisible(isLoggedIn && isVisible && !isMinimized);
visibilityControl.setVisible(isLoggedIn && isVisible && !isMinimized);
displayControl.setVisible(isVisible && !isMinimized);
visibilityControl.setVisible(isVisible && !isMinimized);
}
function checkLoggedIn() {
@ -594,6 +594,13 @@ var usersWindow = (function () {
isLoggedIn = Account.isLoggedIn();
if (isLoggedIn !== wasLoggedIn) {
if (wasLoggedIn) {
setMinimized(true);
calculateWindowHeight();
updateOverlayPositions();
updateUsersDisplay();
}
updateOverlayVisibility();
}
}
@ -1021,7 +1028,7 @@ var usersWindow = (function () {
color: WINDOW_HEADING_COLOR,
alpha: WINDOW_HEADING_ALPHA,
backgroundAlpha: 0.0,
text: "No users online",
text: "Users online",
font: WINDOW_FONT,
visible: false
});