History

Merge branch 'master' of github.com:highfidelity/hifi into remap-keybaord

Dante Ruiz committed 8 years ago

Commit 86cd5ff2 parents 1dcdcff 4341347100 files · +3419 −1824Browse files

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

Unified · Split

interface/src/Application.cpp+18−19
@@ -351,6 +351,7 @@ static const QString OBJ_EXTENSION = ".obj"; · 350 unmodified lines
351351 static const QString AVA_JSON_EXTENSION = ".ava.json";
352352 static const QString WEB_VIEW_TAG = "noDownload=true";
353353 static const QString ZIP_EXTENSION = ".zip";
354+static const QString CONTENT_ZIP_EXTENSION = ".content.zip";
354355
355356 static const float MIRROR_FULLSCREEN_DISTANCE = 0.789f;
356357
@@ -378,7 +379,7 @@ static const QString SYSTEM_TABLET = "com.highfidelity.interface.tablet.system"; · 21 unmodified lines
378379
379380 static const QString DOMAIN_SPAWNING_POINT = "/0, -10, 0";
380381
381−const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensions {
382+const std::vector<std::pair<QString, Application::AcceptURLMethod>> Application::_acceptedExtensions {
382383 { SVO_EXTENSION, &Application::importSVOFromURL },
383384 { SVO_JSON_EXTENSION, &Application::importSVOFromURL },
384385 { AVA_JSON_EXTENSION, &Application::askToWearAvatarAttachmentUrl },
@@ -386,6 +387,7 @@ const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensi · 1 unmodified line
386387 { JS_EXTENSION, &Application::askToLoadScript },
387388 { FST_EXTENSION, &Application::askToSetAvatarUrl },
388389 { JSON_GZ_EXTENSION, &Application::askToReplaceDomainContent },
390+ { CONTENT_ZIP_EXTENSION, &Application::askToReplaceDomainContent },
389391 { ZIP_EXTENSION, &Application::importFromZIP },
390392 { JPG_EXTENSION, &Application::importImage },
391393 { PNG_EXTENSION, &Application::importImage }
@@ -2704,6 +2706,7 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 2312 unmodified lines
27042706
27052707 surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
27062708
2709+ surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
27072710 surfaceContext->setContextProperty("Selection", DependencyManager::get<SelectionScriptingInterface>().data());
27082711 surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());
27092712 surfaceContext->setContextProperty("Wallet", DependencyManager::get<WalletScriptingInterface>().data());
@@ -2717,10 +2720,12 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 7 unmodified lines
27172720
27182721 void Application::onDesktopRootItemCreated(QQuickItem* rootItem) {
27192722 Stats::show();
2720− AvatarInputs::show();
27212723 auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext();
27222724 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");
27242729 }
27252730
27262731 void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
@@ -6159,11 +6164,9 @@ bool Application::canAcceptURL(const QString& urlString) const { · 3432 unmodified lines
61596164 } else if (urlString.startsWith(HIFI_URL_SCHEME)) {
61606165 return true;
61616166 }
6162− QHashIterator<QString, AcceptURLMethod> i(_acceptedExtensions);
61636167 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)) {
61676170 return true;
61686171 }
61696172 }
@@ -6180,12 +6183,10 @@ bool Application::acceptURL(const QString& urlString, bool defaultUpload) { · 10 unmodified lines
61806183 }
61816184
61826185 QUrl url(urlString);
6183− QHashIterator<QString, AcceptURLMethod> i(_acceptedExtensions);
61846186 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;
61896190 return (this->*method)(urlString);
61906191 }
61916192 }
@@ -6372,13 +6373,11 @@ void Application::replaceDomainContent(const QString& url) { · 180 unmodified lines
63726373 QByteArray urlData(url.toUtf8());
63736374 auto limitedNodeList = DependencyManager::get<NodeList>();
63746375 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+
63826381 auto addressManager = DependencyManager::get<AddressManager>();
63836382 addressManager->handleLookupString(DOMAIN_SPAWNING_POINT);
63846383 QString newHomeAddress = addressManager->getHost() + DOMAIN_SPAWNING_POINT;