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 | #include <AccountManager.h> | 53 | #include <AccountManager.h> |
| 54 | #include <AddressManager.h> | 54 | #include <AddressManager.h> |
| 55 | #include <AssetClient.h> | ||
| 55 | #include <ApplicationVersion.h> | 56 | #include <ApplicationVersion.h> |
| 56 | #include <CursorManager.h> | 57 | #include <CursorManager.h> |
| 57 | #include <AudioInjector.h> | 58 | #include <AudioInjector.h> |
| @@ -310,6 +311,7 @@ bool setupEssentials(int& argc, char** argv) { · 252 unmodified lines | |||
| 310 | auto autoUpdater = DependencyManager::set<AutoUpdater>(); | 311 | auto autoUpdater = DependencyManager::set<AutoUpdater>(); |
| 311 | auto pathUtils = DependencyManager::set<PathUtils>(); | 312 | auto pathUtils = DependencyManager::set<PathUtils>(); |
| 312 | auto actionFactory = DependencyManager::set<InterfaceActionFactory>(); | 313 | auto actionFactory = DependencyManager::set<InterfaceActionFactory>(); |
| 314 | auto assetClient = DependencyManager::set<AssetClient>(); | ||
| 313 | auto userInputMapper = DependencyManager::set<UserInputMapper>(); | 315 | auto userInputMapper = DependencyManager::set<UserInputMapper>(); |
| 314 | 316 | ||
| 315 | return true; | 317 | return true; |
| @@ -458,6 +460,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 142 unmodified lines | |||
| 458 | 460 | ||
| 459 | audioThread->start(); | 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 | const DomainHandler& domainHandler = nodeList->getDomainHandler(); | 472 | const DomainHandler& domainHandler = nodeList->getDomainHandler(); |
| 462 | 473 | ||
| 463 | connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&))); | 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 | connect(nodeList.data(), &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID); | 498 | connect(nodeList.data(), &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID); |
| 488 | connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID); | 499 | connect(nodeList.data(), &NodeList::uuidChanged, this, &Application::setSessionUUID); |
| 489 | connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset); | 500 | connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset); |
| 490 | connect(&nodeList->getPacketReceiver(), &PacketReceiver::packetVersionMismatch, | 501 | connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch); |
| 491 | this, &Application::notifyPacketVersionMismatch); | ||
| 492 | 502 | ||
| 493 | // connect to appropriate slots on AccountManager | 503 | // connect to appropriate slots on AccountManager |
| 494 | AccountManager& accountManager = AccountManager::getInstance(); | 504 | AccountManager& accountManager = AccountManager::getInstance(); |
| @@ -528,7 +538,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 33 unmodified lines | |||
| 528 | 538 | ||
| 529 | // tell the NodeList instance who to tell the domain server we care about | 539 | // tell the NodeList instance who to tell the domain server we care about |
| 530 | nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer | 540 | nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer |
| 531 | << NodeType::EntityServer); | 541 | << NodeType::EntityServer << NodeType::AssetServer); |
| 532 | 542 | ||
| 533 | // connect to the packet sent signal of the _entityEditSender | 543 | // connect to the packet sent signal of the _entityEditSender |
| 534 | connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent); | 544 | connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent); |
| @@ -878,6 +888,12 @@ Application::~Application() { · 343 unmodified lines | |||
| 878 | DependencyManager::destroy<GeometryCache>(); | 888 | DependencyManager::destroy<GeometryCache>(); |
| 879 | DependencyManager::destroy<ScriptCache>(); | 889 | DependencyManager::destroy<ScriptCache>(); |
| 880 | DependencyManager::destroy<SoundCache>(); | 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 | QThread* nodeThread = DependencyManager::get<NodeList>()->thread(); | 898 | QThread* nodeThread = DependencyManager::get<NodeList>()->thread(); |
| 883 | 899 | ||
| @@ -887,7 +903,7 @@ Application::~Application() { · 3 unmodified lines | |||
| 887 | // ask the node thread to quit and wait until it is done | 903 | // ask the node thread to quit and wait until it is done |
| 888 | nodeThread->quit(); | 904 | nodeThread->quit(); |
| 889 | nodeThread->wait(); | 905 | nodeThread->wait(); |
| 890 | 906 | ||
| 891 | Leapmotion::destroy(); | 907 | Leapmotion::destroy(); |
| 892 | RealSense::destroy(); | 908 | RealSense::destroy(); |
| 893 | ConnexionClient::getInstance().destroy(); | 909 | ConnexionClient::getInstance().destroy(); |
| @@ -2040,6 +2056,7 @@ void Application::sendPingPackets() { · 1146 unmodified lines | |||
| 2040 | case NodeType::AvatarMixer: | 2056 | case NodeType::AvatarMixer: |
| 2041 | case NodeType::AudioMixer: | 2057 | case NodeType::AudioMixer: |
| 2042 | case NodeType::EntityServer: | 2058 | case NodeType::EntityServer: |
| 2059 | case NodeType::AssetServer: | ||
| 2043 | return true; | 2060 | return true; |
| 2044 | default: | 2061 | default: |
| 2045 | return false; | 2062 | return false; |
| @@ -3012,7 +3029,7 @@ int Application::sendNackPackets() { · 966 unmodified lines | |||
| 3012 | return packetsSent; | 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 | //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView(); | 3034 | //qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView(); |
| 3018 | bool wantExtraDebugging = getLogger()->extraDebugging(); | 3035 | bool wantExtraDebugging = getLogger()->extraDebugging(); |
| @@ -3776,6 +3793,9 @@ void Application::nodeAdded(SharedNodePointer node) { · 757 unmodified lines | |||
| 3776 | if (node->getType() == NodeType::AvatarMixer) { | 3793 | if (node->getType() == NodeType::AvatarMixer) { |
| 3777 | // new avatar mixer, send off our identity packet right away | 3794 | // new avatar mixer, send off our identity packet right away |
| 3778 | _myAvatar->sendIdentityPacket(); | 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 | } else if (node->getType() == NodeType::AvatarMixer) { | 3843 | } else if (node->getType() == NodeType::AvatarMixer) { |
| 3824 | // our avatar mixer has gone away - clear the hash of avatars | 3844 | // our avatar mixer has gone away - clear the hash of avatars |
| 3825 | DependencyManager::get<AvatarManager>()->clearOtherAvatars(); | 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 | ||