Showing the changes to interface/src/Application.cpp (1 of 100 files). Show all
Unified · Split
| @@ -351,6 +351,7 @@ static const QString OBJ_EXTENSION = ".obj"; · 350 unmodified lines | ||
| 351 | 351 | static const QString AVA_JSON_EXTENSION = ".ava.json"; |
| 352 | 352 | static const QString WEB_VIEW_TAG = "noDownload=true"; |
| 353 | 353 | static const QString ZIP_EXTENSION = ".zip"; |
| 354 | +static const QString CONTENT_ZIP_EXTENSION = ".content.zip"; | |
| 354 | 355 | |
| 355 | 356 | static const float MIRROR_FULLSCREEN_DISTANCE = 0.789f; |
| 356 | 357 | |
| @@ -378,7 +379,7 @@ static const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system"; · 21 unmodified lines | ||
| 378 | 379 | |
| 379 | 380 | static const QString DOMAIN_SPAWNING_POINT = "/0, -10, 0"; |
| 380 | 381 | |
| 381 | −const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensions { | |
| 382 | +const std::vector<std::pair<QString, Application::AcceptURLMethod>> Application::_acceptedExtensions { | |
| 382 | 383 | { SVO_EXTENSION, &Application::importSVOFromURL }, |
| 383 | 384 | { SVO_JSON_EXTENSION, &Application::importSVOFromURL }, |
| 384 | 385 | { AVA_JSON_EXTENSION, &Application::askToWearAvatarAttachmentUrl }, |
| @@ -386,6 +387,7 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi · 1 unmodified line | ||
| 386 | 387 | { JS_EXTENSION, &Application::askToLoadScript }, |
| 387 | 388 | { FST_EXTENSION, &Application::askToSetAvatarUrl }, |
| 388 | 389 | { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent }, |
| 390 | + { CONTENT_ZIP_EXTENSION, &Application::askToReplaceDomainContent }, | |
| 389 | 391 | { ZIP_EXTENSION, &Application::importFromZIP }, |
| 390 | 392 | { JPG_EXTENSION, &Application::importImage }, |
| 391 | 393 | { PNG_EXTENSION, &Application::importImage } |
| @@ -2704,6 +2706,7 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 2312 unmodified lines | ||
| 2704 | 2706 | |
| 2705 | 2707 | surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor()); |
| 2706 | 2708 | |
| 2709 | + surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); | |
| 2707 | 2710 | surfaceContext->setContextProperty("Selection", DependencyManager::get<SelectionScriptingInterface>().data()); |
| 2708 | 2711 | surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data()); |
| 2709 | 2712 | surfaceContext->setContextProperty("Wallet", DependencyManager::get<WalletScriptingInterface>().data()); |
| @@ -2717,10 +2720,12 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 7 unmodified lines | ||
| 2717 | 2720 | |
| 2718 | 2721 | void Application::onDesktopRootItemCreated(QQuickItem* rootItem) { |
| 2719 | 2722 | Stats::show(); |
| 2720 | − AvatarInputs::show(); | |
| 2721 | 2723 | auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext(); |
| 2722 | 2724 | surfaceContext->setContextProperty("Stats", Stats::getInstance()); |
| 2723 | − surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); | |
| 2725 | + | |
| 2726 | + auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 2727 | + auto qml = PathUtils::qmlUrl("AvatarInputsBar.qml"); | |
| 2728 | + offscreenUi->show(qml, "AvatarInputsBar"); | |
| 2724 | 2729 | } |
| 2725 | 2730 | |
| 2726 | 2731 | void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) { |
| @@ -6159,11 +6164,9 @@ bool Application::canAcceptURL(const QString& urlString) const { · 3432 unmodified lines | ||
| 6159 | 6164 | } else if (urlString.startsWith(HIFI_URL_SCHEME)) { |
| 6160 | 6165 | return true; |
| 6161 | 6166 | } |
| 6162 | − QHashIterator<QString, AcceptURLMethod> i(_acceptedExtensions); | |
| 6163 | 6167 | QString lowerPath = url.path().toLower(); |
| 6164 | − while (i.hasNext()) { | |
| 6165 | − i.next(); | |
| 6166 | − if (lowerPath.endsWith(i.key(), Qt::CaseInsensitive)) { | |
| 6168 | + for (auto& pair : _acceptedExtensions) { | |
| 6169 | + if (lowerPath.endsWith(pair.first, Qt::CaseInsensitive)) { | |
| 6167 | 6170 | return true; |
| 6168 | 6171 | } |
| 6169 | 6172 | } |
| @@ -6180,12 +6183,10 @@ bool Application::acceptURL(const QString& urlString, bool defaultUpload) { · 10 unmodified lines | ||
| 6180 | 6183 | } |
| 6181 | 6184 | |
| 6182 | 6185 | QUrl url(urlString); |
| 6183 | − QHashIterator<QString, AcceptURLMethod> i(_acceptedExtensions); | |
| 6184 | 6186 | QString lowerPath = url.path().toLower(); |
| 6185 | − while (i.hasNext()) { | |
| 6186 | − i.next(); | |
| 6187 | − if (lowerPath.endsWith(i.key(), Qt::CaseInsensitive)) { | |
| 6188 | − AcceptURLMethod method = i.value(); | |
| 6187 | + for (auto& pair : _acceptedExtensions) { | |
| 6188 | + if (lowerPath.endsWith(pair.first, Qt::CaseInsensitive)) { | |
| 6189 | + AcceptURLMethod method = pair.second; | |
| 6189 | 6190 | return (this->*method)(urlString); |
| 6190 | 6191 | } |
| 6191 | 6192 | } |
| @@ -6372,13 +6373,11 @@ void Application::replaceDomainContent(const QString& url) { · 180 unmodified lines | ||
| 6372 | 6373 | QByteArray urlData(url.toUtf8()); |
| 6373 | 6374 | auto limitedNodeList = DependencyManager::get<NodeList>(); |
| 6374 | 6375 | const auto& domainHandler = limitedNodeList->getDomainHandler(); |
| 6375 | − limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) { | |
| 6376 | − return node->getType() == NodeType::EntityServer && node->getActiveSocket(); | |
| 6377 | − }, [&urlData, limitedNodeList, &domainHandler](const SharedNodePointer& octreeNode) { | |
| 6378 | − auto octreeFilePacket = NLPacket::create(PacketType::OctreeFileReplacementFromUrl, urlData.size(), true); | |
| 6379 | − octreeFilePacket->write(urlData); | |
| 6380 | − limitedNodeList->sendPacket(std::move(octreeFilePacket), domainHandler.getSockAddr()); | |
| 6381 | − }); | |
| 6376 | + | |
| 6377 | + auto octreeFilePacket = NLPacket::create(PacketType::DomainContentReplacementFromUrl, urlData.size(), true); | |
| 6378 | + octreeFilePacket->write(urlData); | |
| 6379 | + limitedNodeList->sendPacket(std::move(octreeFilePacket), domainHandler.getSockAddr()); | |
| 6380 | + | |
| 6382 | 6381 | auto addressManager = DependencyManager::get<AddressManager>(); |
| 6383 | 6382 | addressManager->handleLookupString(DOMAIN_SPAWNING_POINT); |
| 6384 | 6383 | QString newHomeAddress = addressManager->getHost() + DOMAIN_SPAWNING_POINT; |