Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -322,6 +322,14 @@ bool setupEssentials(int& argc, char** argv) { · 321 unmodified lines | |||
| 322 | return true; | 322 | return true; |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | const 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 manager | 333 | // FIXME move to header, or better yet, design some kind of UI manager |
| 326 | // to take care of highlighting keyboard focused items, rather than | 334 | // to take care of highlighting keyboard focused items, rather than |
| 327 | // continuing to overburden Application.cpp | 335 | // continuing to overburden Application.cpp |
| @@ -3954,19 +3962,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 3626 unmodified lines | |||
| 3954 | #endif | 3962 | #endif |
| 3955 | } | 3963 | } |
| 3956 | 3964 | ||
| 3957 | void 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 | |||
| 3967 | bool Application::canAcceptURL(const QString& urlString) { | 3965 | bool 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 | ||
| 3985 | bool Application::acceptURL(const QString& urlString) { | 3981 | bool 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 it | 3983 | // 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", |