Showing the changes to interface/src/Application.cpp (1 of 197 files). Show all
Unified · Split
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | #include <AccountManager.h> |
| 54 | 54 | #include <AddressManager.h> |
| 55 | +#include <AssetClient.h> | |
| 55 | 56 | #include <ApplicationVersion.h> |
| 56 | 57 | #include <CursorManager.h> |
| 57 | 58 | #include <AudioInjector.h> |
| @@ -310,6 +311,7 @@ bool setupEssentials(int& argc, char** argv) { · 252 unmodified lines | ||
| 310 | 311 | auto autoUpdater = DependencyManager::set<AutoUpdater>(); |
| 311 | 312 | auto pathUtils = DependencyManager::set<PathUtils>(); |
| 312 | 313 | auto actionFactory = DependencyManager::set<InterfaceActionFactory>(); |
| 314 | + auto assetClient = DependencyManager::set<AssetClient>(); | |
| 313 | 315 | auto userInputMapper = DependencyManager::set<UserInputMapper>(); |
| 314 | 316 | |
| 315 | 317 | return true; |
| @@ -458,6 +460,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 142 unmodified lines | ||
| 458 | 460 | |
| 459 | 461 | audioThread->start(); |
| 460 | 462 | |
| 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 | + | |
| 461 | 472 | const DomainHandler& domainHandler = nodeList->getDomainHandler(); |
| 462 | 473 | |
| 463 | 474 | 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 | ||
| 487 | 498 | connect(nodeList.data(), &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID); |
| 488 | 499 | connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID); |
| 489 | 500 | 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); | |
| 492 | 502 | |
| 493 | 503 | // connect to appropriate slots on AccountManager |
| 494 | 504 | AccountManager& accountManager = AccountManager::getInstance(); |
| @@ -528,7 +538,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 33 unmodified lines | ||
| 528 | 538 | |
| 529 | 539 | // tell the NodeList instance who to tell the domain server we care about |
| 530 | 540 | nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer |
| 531 | − << NodeType::EntityServer); | |
| 541 | + << NodeType::EntityServer << NodeType::AssetServer); | |
| 532 | 542 | |
| 533 | 543 | // connect to the packet sent signal of the _entityEditSender |
| 534 | 544 | connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent); |
| @@ -878,6 +888,12 @@ Application::~Application() { · 343 unmodified lines | ||
| 878 | 888 | DependencyManager::destroy<GeometryCache>(); |
| 879 | 889 | DependencyManager::destroy<ScriptCache>(); |
| 880 | 890 | 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(); | |
| 881 | 897 | |
| 882 | 898 | QThread* nodeThread = DependencyManager::get<NodeList>()->thread(); |
| 883 | 899 | |
| @@ -887,7 +903,7 @@ Application::~Application() { · 3 unmodified lines | ||
| 887 | 903 | // ask the node thread to quit and wait until it is done |
| 888 | 904 | nodeThread->quit(); |
| 889 | 905 | nodeThread->wait(); |
| 890 | − | |
| 906 | + | |
| 891 | 907 | Leapmotion::destroy(); |
| 892 | 908 | RealSense::destroy(); |
| 893 | 909 | ConnexionClient::getInstance().destroy(); |
| @@ -2040,6 +2056,7 @@ void Application::sendPingPackets() { · 1146 unmodified lines | ||
| 2040 | 2056 | case NodeType::AvatarMixer: |
| 2041 | 2057 | case NodeType::AudioMixer: |
| 2042 | 2058 | case NodeType::EntityServer: |
| 2059 | + case NodeType::AssetServer: | |
| 2043 | 2060 | return true; |
| 2044 | 2061 | default: |
| 2045 | 2062 | return false; |
| @@ -3012,7 +3029,7 @@ int Application::sendNackPackets() { · 966 unmodified lines | ||
| 3012 | 3029 | return packetsSent; |
| 3013 | 3030 | } |
| 3014 | 3031 | |
| 3015 | −void Application::queryOctree(NodeType_t serverType, PacketType::Value packetType, NodeToJurisdictionMap& jurisdictions) { | |
| 3032 | +void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) { | |
| 3016 | 3033 | |
| 3017 | 3034 | //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView(); |
| 3018 | 3035 | bool wantExtraDebugging = getLogger()->extraDebugging(); |
| @@ -3776,6 +3793,9 @@ void Application::nodeAdded(SharedNodePointer node) { · 757 unmodified lines | ||
| 3776 | 3793 | if (node->getType() == NodeType::AvatarMixer) { |
| 3777 | 3794 | // new avatar mixer, send off our identity packet right away |
| 3778 | 3795 | _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); | |
| 3779 | 3799 | } |
| 3780 | 3800 | } |
| 3781 | 3801 | |
| @@ -3823,6 +3843,10 @@ void Application::nodeKilled(SharedNodePointer node) { · 41 unmodified lines | ||
| 3823 | 3843 | } else if (node->getType() == NodeType::AvatarMixer) { |
| 3824 | 3844 | // our avatar mixer has gone away - clear the hash of avatars |
| 3825 | 3845 | 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); | |
| 3826 | 3850 | } |
| 3827 | 3851 | } |
| 3828 | 3852 | |