Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -1057,6 +1057,40 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 1056 unmodified lines | ||
| 1057 | 1057 | firstRun.set(false); |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | +QString Application::getUserAgent() { | |
| 1061 | + if (QThread::currentThread() != thread()) { | |
| 1062 | + QString userAgent; | |
| 1063 | + | |
| 1064 | + QMetaObject::invokeMethod(this, "getUserAgent", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, userAgent)); | |
| 1065 | + | |
| 1066 | + return userAgent; | |
| 1067 | + } | |
| 1068 | + | |
| 1069 | + QString userAgent = "Mozilla/5.0 (HighFidelityInterface/" + BuildInfo::VERSION + "; " | |
| 1070 | + + QSysInfo::productType() + " " + QSysInfo::productVersion() + ")"; | |
| 1071 | + | |
| 1072 | + auto formatPluginName = [](QString name) -> QString { return name.trimmed().replace(" ", "-"); }; | |
| 1073 | + | |
| 1074 | + // For each plugin, add to userAgent | |
| 1075 | + auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins(); | |
| 1076 | + foreach(auto dp, displayPlugins) { | |
| 1077 | + if (dp->isActive() && dp->isHmd()) { | |
| 1078 | + userAgent += " " + formatPluginName(dp->getName()); | |
| 1079 | + } | |
| 1080 | + } | |
| 1081 | + | |
| 1082 | + // For each plugin, add to userAgent | |
| 1083 | + auto inputPlugins= PluginManager::getInstance()->getInputPlugins(); | |
| 1084 | + foreach(auto ip, inputPlugins) { | |
| 1085 | + if (ip->isActive()) { | |
| 1086 | + userAgent += " " + formatPluginName(ip->getName()); | |
| 1087 | + } | |
| 1088 | + } | |
| 1089 | + | |
| 1090 | + return userAgent; | |
| 1091 | +} | |
| 1092 | + | |
| 1093 | + | |
| 1060 | 1094 | |
| 1061 | 1095 | void Application::checkChangeCursor() { |
| 1062 | 1096 | QMutexLocker locker(&_changeCursorLock); |