From 327154b0c01ac765c3c78422b1e5ad0bc39ff6e5 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 5 Oct 2015 14:53:03 -0700 Subject: [PATCH] Make _acceptedExtensions static const --- interface/src/Application.cpp | 22 ++++++++-------------- interface/src/Application.h | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c427379f74..8655105ab0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -322,6 +322,14 @@ bool setupEssentials(int& argc, char** argv) { return true; } +const QHash Application::_acceptedExtensions{ + {SNAPSHOT_EXTENSION, &Application::acceptSnapshot}, + {SVO_EXTENSION, &Application::importSVOFromURL}, + {SVO_JSON_EXTENSION, &Application::importSVOFromURL}, + {JS_EXTENSION, &Application::askToLoadScript}, + {FST_EXTENSION, &Application::askToSetAvatarUrl} +}; + // FIXME move to header, or better yet, design some kind of UI manager // to take care of highlighting keyboard focused items, rather than // continuing to overburden Application.cpp @@ -3954,19 +3962,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri #endif } -void Application::initializeAcceptedFiles() { - if (_acceptedExtensions.size() == 0) { - _acceptedExtensions[SNAPSHOT_EXTENSION] = &Application::acceptSnapshot; - _acceptedExtensions[SVO_EXTENSION] = &Application::importSVOFromURL; - _acceptedExtensions[SVO_JSON_EXTENSION] = &Application::importSVOFromURL; - _acceptedExtensions[JS_EXTENSION] = &Application::askToLoadScript; - _acceptedExtensions[FST_EXTENSION] = &Application::askToSetAvatarUrl; - } -} - bool Application::canAcceptURL(const QString& urlString) { - initializeAcceptedFiles(); - QUrl url(urlString); if (urlString.startsWith(HIFI_URL_SCHEME)) { return true; @@ -3983,8 +3979,6 @@ bool Application::canAcceptURL(const QString& urlString) { } bool Application::acceptURL(const QString& urlString) { - initializeAcceptedFiles(); - if (urlString.startsWith(HIFI_URL_SCHEME)) { // this is a hifi URL - have the AddressManager handle it QMetaObject::invokeMethod(DependencyManager::get().data(), "handleLookupString", diff --git a/interface/src/Application.h b/interface/src/Application.h index 0b75a94232..cfdd7681e1 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -500,7 +500,7 @@ private: GLCanvas* _glWidget{ nullptr }; typedef bool (Application::* AcceptURLMethod)(const QString &); - QHash _acceptedExtensions; + static const QHash _acceptedExtensions; QList _domainConnectionRefusals; glm::uvec2 _renderResolution;