Merge branch 'master' of https://github.com/worklist/hifi into octreeWireformatImprovements

This commit is contained in:
ZappoMan 2014-06-11 16:01:58 -07:00
commit 1cb5521f01
7 changed files with 34 additions and 7 deletions

View file

@ -244,7 +244,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), &_voxels, SLOT(nodeAdded(SharedNodePointer))); connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), &_voxels, SLOT(nodeAdded(SharedNodePointer)));
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), &_voxels, SLOT(nodeKilled(SharedNodePointer))); connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), &_voxels, SLOT(nodeKilled(SharedNodePointer)));
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), &_octreeProcessor, SLOT(nodeKilled(SharedNodePointer)));
connect(nodeList, &NodeList::uuidChanged, this, &Application::updateWindowTitle); connect(nodeList, &NodeList::uuidChanged, this, &Application::updateWindowTitle);
connect(nodeList, SIGNAL(uuidChanged(const QUuid&)), _myAvatar, SLOT(setSessionUUID(const QUuid&))); connect(nodeList, SIGNAL(uuidChanged(const QUuid&)), _myAvatar, SLOT(setSessionUUID(const QUuid&)));
connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset); connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset);
@ -3249,6 +3248,11 @@ void Application::nodeAdded(SharedNodePointer node) {
} }
void Application::nodeKilled(SharedNodePointer node) { void Application::nodeKilled(SharedNodePointer node) {
// this is here because connecting NodeList::nodeKilled to OctreePacketProcessor::nodeKilled doesn't work:
// OctreePacketProcessor::nodeKilled is not called when NodeList::nodeKilled is emitted for some reason.
_octreeProcessor.nodeKilled(node);
if (node->getType() == NodeType::VoxelServer) { if (node->getType() == NodeType::VoxelServer) {
QUuid nodeUUID = node->getUUID(); QUuid nodeUUID = node->getUUID();
// see if this is the first we've heard of this node... // see if this is the first we've heard of this node...

View file

@ -103,6 +103,7 @@ Menu::Menu() :
_fastFPSAverage(ONE_SECOND_OF_FRAMES), _fastFPSAverage(ONE_SECOND_OF_FRAMES),
_loginAction(NULL), _loginAction(NULL),
_preferencesDialog(NULL), _preferencesDialog(NULL),
_loginDialog(NULL),
_snapshotsLocation() _snapshotsLocation()
{ {
Application *appInstance = Application::getInstance(); Application *appInstance = Application::getInstance();
@ -913,9 +914,11 @@ void sendFakeEnterEvent() {
const float DIALOG_RATIO_OF_WINDOW = 0.30f; const float DIALOG_RATIO_OF_WINDOW = 0.30f;
void Menu::loginForCurrentDomain() { void Menu::loginForCurrentDomain() {
LoginDialog* loginDialog = new LoginDialog(Application::getInstance()->getWindow()); if (!_loginDialog) {
loginDialog->show(); _loginDialog = new LoginDialog(Application::getInstance()->getWindow());
loginDialog->resizeAndPosition(false); _loginDialog->show();
_loginDialog->resizeAndPosition(false);
}
} }
void Menu::editPreferences() { void Menu::editPreferences() {

View file

@ -27,6 +27,7 @@
#include "ui/PreferencesDialog.h" #include "ui/PreferencesDialog.h"
#include "ui/ChatWindow.h" #include "ui/ChatWindow.h"
#include "ui/JSConsole.h" #include "ui/JSConsole.h"
#include "ui/LoginDialog.h"
#include "ui/ScriptEditorWindow.h" #include "ui/ScriptEditorWindow.h"
const float ADJUST_LOD_DOWN_FPS = 40.0; const float ADJUST_LOD_DOWN_FPS = 40.0;
@ -270,6 +271,7 @@ private:
QPointer<PreferencesDialog> _preferencesDialog; QPointer<PreferencesDialog> _preferencesDialog;
QPointer<AttachmentsDialog> _attachmentsDialog; QPointer<AttachmentsDialog> _attachmentsDialog;
QPointer<AnimationsDialog> _animationsDialog; QPointer<AnimationsDialog> _animationsDialog;
QPointer<LoginDialog> _loginDialog;
QAction* _chatAction; QAction* _chatAction;
QString _snapshotsLocation; QString _snapshotsLocation;
}; };

View file

@ -103,8 +103,9 @@ void OAuthWebViewHandler::displayWebviewForAuthorizationURL(const QUrl& authoriz
codedAuthorizationURL.setQuery(authQuery); codedAuthorizationURL.setQuery(authQuery);
} }
connect(_activeWebView.data(), &QWebView::urlChanged, this, &OAuthWebViewHandler::handleURLChanged);
_activeWebView->load(codedAuthorizationURL); _activeWebView->load(codedAuthorizationURL);
_activeWebView->show();
connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::sslErrors, connect(_activeWebView->page()->networkAccessManager(), &QNetworkAccessManager::sslErrors,
this, &OAuthWebViewHandler::handleSSLErrors); this, &OAuthWebViewHandler::handleSSLErrors);
@ -137,3 +138,17 @@ void OAuthWebViewHandler::handleLoadFinished(bool success) {
void OAuthWebViewHandler::handleWebViewDestroyed(QObject* destroyedObject) { void OAuthWebViewHandler::handleWebViewDestroyed(QObject* destroyedObject) {
_webViewRedisplayTimer.restart(); _webViewRedisplayTimer.restart();
} }
void OAuthWebViewHandler::handleURLChanged(const QUrl& url) {
// check if this is the authorization screen - if it is then we need to show the OAuthWebViewHandler
const QString ACCESS_TOKEN_URL_REGEX_STRING = "redirect_uri=[\\w:\\/\\.]+&access_token=";
QRegExp accessTokenRegex(ACCESS_TOKEN_URL_REGEX_STRING);
if (accessTokenRegex.indexIn(url.toString()) != -1) {
_activeWebView->show();
} else if (url.toString() == DEFAULT_NODE_AUTH_URL.toString() + "/login") {
// this is a login request - we're going to close the webview and signal the AccountManager that we need a login
_activeWebView->close();
AccountManager::getInstance().checkAndSignalForAccessToken();
}
}

View file

@ -32,6 +32,7 @@ private slots:
void handleSSLErrors(QNetworkReply* networkReply, const QList<QSslError>& errorList); void handleSSLErrors(QNetworkReply* networkReply, const QList<QSslError>& errorList);
void handleLoadFinished(bool success); void handleLoadFinished(bool success);
void handleWebViewDestroyed(QObject* destroyedObject); void handleWebViewDestroyed(QObject* destroyedObject);
void handleURLChanged(const QUrl& url);
private: private:
QPointer<QWebView> _activeWebView; QPointer<QWebView> _activeWebView;
QElapsedTimer _webViewRedisplayTimer; QElapsedTimer _webViewRedisplayTimer;

View file

@ -50,6 +50,8 @@ bool ReceivedPacketProcessor::process() {
return isStillRunning(); // keep running till they terminate us return isStillRunning(); // keep running till they terminate us
} }
void ReceivedPacketProcessor::killNode(const SharedNodePointer& node) { void ReceivedPacketProcessor::nodeKilled(SharedNodePointer node) {
lock();
_nodePacketCounts.remove(node->getUUID()); _nodePacketCounts.remove(node->getUUID());
unlock();
} }

View file

@ -42,7 +42,7 @@ public:
int packetsToProcessCount() const { return _packets.size(); } int packetsToProcessCount() const { return _packets.size(); }
public slots: public slots:
void killNode(const SharedNodePointer& node); void nodeKilled(SharedNodePointer node);
protected: protected:
/// Callback for processing of recieved packets. Implement this to process the incoming packets. /// Callback for processing of recieved packets. Implement this to process the incoming packets.