History

merge from upstream

Seth Alves committed 11 years ago

Commit 9c4fdfd2 parents 8a60bba e06461e197 files · +8488 −1901Browse files

Showing the changes to interface/src/Application.cpp (1 of 197 files). Show all

Unified · Split

interface/src/Application.cpp+29−5
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252
5353 #include <AccountManager.h>
5454 #include <AddressManager.h>
55+#include <AssetClient.h>
5556 #include <ApplicationVersion.h>
5657 #include <CursorManager.h>
5758 #include <AudioInjector.h>
@@ -310,6 +311,7 @@ bool setupEssentials(int& argc, char** argv) { · 252 unmodified lines
310311 auto autoUpdater = DependencyManager::set<AutoUpdater>();
311312 auto pathUtils = DependencyManager::set<PathUtils>();
312313 auto actionFactory = DependencyManager::set<InterfaceActionFactory>();
314+ auto assetClient = DependencyManager::set<AssetClient>();
313315 auto userInputMapper = DependencyManager::set<UserInputMapper>();
314316
315317 return true;
@@ -458,6 +460,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 142 unmodified lines
458460
459461 audioThread->start();
460462
463+ QThread* assetThread = new QThread;
464+
465+ assetThread->setObjectName("Asset Thread");
466+ auto assetClient = DependencyManager::get<AssetClient>();
467+
468+ assetClient->moveToThread(assetThread);
469+
470+ assetThread->start();
471+
461472 const DomainHandler& domainHandler = nodeList->getDomainHandler();
462473
463474 connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
@@ -487,8 +498,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 23 unmodified lines
487498 connect(nodeList.data(), &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID);
488499 connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID);
489500 connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
490− connect(&nodeList->getPacketReceiver(), &PacketReceiver::packetVersionMismatch,
491− this, &Application::notifyPacketVersionMismatch);
501+ connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch);
492502
493503 // connect to appropriate slots on AccountManager
494504 AccountManager& accountManager = AccountManager::getInstance();
@@ -528,7 +538,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 33 unmodified lines
528538
529539 // tell the NodeList instance who to tell the domain server we care about
530540 nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer
531− << NodeType::EntityServer);
541+ << NodeType::EntityServer << NodeType::AssetServer);
532542
533543 // connect to the packet sent signal of the _entityEditSender
534544 connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
@@ -878,6 +888,12 @@ Application::~Application() { · 343 unmodified lines
878888 DependencyManager::destroy<GeometryCache>();
879889 DependencyManager::destroy<ScriptCache>();
880890 DependencyManager::destroy<SoundCache>();
891+
892+ // cleanup the AssetClient thread
893+ QThread* assetThread = DependencyManager::get<AssetClient>()->thread();
894+ DependencyManager::destroy<AssetClient>();
895+ assetThread->quit();
896+ assetThread->wait();
881897
882898 QThread* nodeThread = DependencyManager::get<NodeList>()->thread();
883899
@@ -887,7 +903,7 @@ Application::~Application() { · 3 unmodified lines
887903 // ask the node thread to quit and wait until it is done
888904 nodeThread->quit();
889905 nodeThread->wait();
890−
906+
891907 Leapmotion::destroy();
892908 RealSense::destroy();
893909 ConnexionClient::getInstance().destroy();
@@ -2040,6 +2056,7 @@ void Application::sendPingPackets() { · 1146 unmodified lines
20402056 case NodeType::AvatarMixer:
20412057 case NodeType::AudioMixer:
20422058 case NodeType::EntityServer:
2059+ case NodeType::AssetServer:
20432060 return true;
20442061 default:
20452062 return false;
@@ -3012,7 +3029,7 @@ int Application::sendNackPackets() { · 966 unmodified lines
30123029 return packetsSent;
30133030 }
30143031
3015−void Application::queryOctree(NodeType_t serverType, PacketType::Value packetType, NodeToJurisdictionMap& jurisdictions) {
3032+void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
30163033
30173034 //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
30183035 bool wantExtraDebugging = getLogger()->extraDebugging();
@@ -3776,6 +3793,9 @@ void Application::nodeAdded(SharedNodePointer node) { · 757 unmodified lines
37763793 if (node->getType() == NodeType::AvatarMixer) {
37773794 // new avatar mixer, send off our identity packet right away
37783795 _myAvatar->sendIdentityPacket();
3796+ } else if (node->getType() == NodeType::AssetServer) {
3797+ // the addition of an asset-server always re-enables the upload to asset server menu option
3798+ Menu::getInstance()->getActionForOption(MenuOption::UploadAsset)->setEnabled(true);
37793799 }
37803800 }
37813801
@@ -3823,6 +3843,10 @@ void Application::nodeKilled(SharedNodePointer node) { · 41 unmodified lines
38233843 } else if (node->getType() == NodeType::AvatarMixer) {
38243844 // our avatar mixer has gone away - clear the hash of avatars
38253845 DependencyManager::get<AvatarManager>()->clearOtherAvatars();
3846+ } else if (node->getType() == NodeType::AssetServer
3847+ && !DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::AssetServer)) {
3848+ // this was our last asset server - disable the menu option to upload an asset
3849+ Menu::getInstance()->getActionForOption(MenuOption::UploadAsset)->setEnabled(false);
38263850 }
38273851 }
38283852