History

Make _acceptedExtensions static const

Atlante45 committed 11 years ago

Commit 327154b1 parent 51fc43e2 files · +9 −15Browse files

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

Unified · Split

interface/src/Application.cpp+8−14
@@ -322,6 +322,14 @@ bool setupEssentials(int& argc, char** argv) { · 321 unmodified lines
322 return true;322 return true;
323}323}
324 324
325const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensions{
326 {SNAPSHOT_EXTENSION, &Application::acceptSnapshot},
327 {SVO_EXTENSION, &Application::importSVOFromURL},
328 {SVO_JSON_EXTENSION, &Application::importSVOFromURL},
329 {JS_EXTENSION, &Application::askToLoadScript},
330 {FST_EXTENSION, &Application::askToSetAvatarUrl}
331};
332
325// FIXME move to header, or better yet, design some kind of UI manager333// FIXME move to header, or better yet, design some kind of UI manager
326// to take care of highlighting keyboard focused items, rather than334// to take care of highlighting keyboard focused items, rather than
327// continuing to overburden Application.cpp335// continuing to overburden Application.cpp
@@ -3954,19 +3962,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 3626 unmodified lines
3954#endif3962#endif
3955}3963}
3956 3964
3957void Application::initializeAcceptedFiles() {
3958 if (_acceptedExtensions.size() == 0) {
3959 _acceptedExtensions[SNAPSHOT_EXTENSION] = &Application::acceptSnapshot;
3960 _acceptedExtensions[SVO_EXTENSION] = &Application::importSVOFromURL;
3961 _acceptedExtensions[SVO_JSON_EXTENSION] = &Application::importSVOFromURL;
3962 _acceptedExtensions[JS_EXTENSION] = &Application::askToLoadScript;
3963 _acceptedExtensions[FST_EXTENSION] = &Application::askToSetAvatarUrl;
3964 }
3965}
3966
3967bool Application::canAcceptURL(const QString& urlString) {3965bool Application::canAcceptURL(const QString& urlString) {
3968 initializeAcceptedFiles();
3969
3970 QUrl url(urlString);3966 QUrl url(urlString);
3971 if (urlString.startsWith(HIFI_URL_SCHEME)) {3967 if (urlString.startsWith(HIFI_URL_SCHEME)) {
3972 return true;3968 return true;
@@ -3983,8 +3979,6 @@ bool Application::canAcceptURL(const QString& urlString) { · 10 unmodified lines
3983}3979}
3984 3980
3985bool Application::acceptURL(const QString& urlString) {3981bool Application::acceptURL(const QString& urlString) {
3986 initializeAcceptedFiles();
3987
3988 if (urlString.startsWith(HIFI_URL_SCHEME)) {3982 if (urlString.startsWith(HIFI_URL_SCHEME)) {
3989 // this is a hifi URL - have the AddressManager handle it3983 // this is a hifi URL - have the AddressManager handle it
3990 QMetaObject::invokeMethod(DependencyManager::get<AddressManager>().data(), "handleLookupString",3984 QMetaObject::invokeMethod(DependencyManager::get<AddressManager>().data(), "handleLookupString",