mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 02:45:56 +02:00
make cmake -DDISABLE_QML=1 work again
This commit is contained in:
parent
d6c7027fea
commit
8f21ade0c7
11 changed files with 185 additions and 76 deletions
|
@ -927,7 +927,9 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
#endif
|
#endif
|
||||||
DependencyManager::set<DiscoverabilityManager>();
|
DependencyManager::set<DiscoverabilityManager>();
|
||||||
DependencyManager::set<SceneScriptingInterface>();
|
DependencyManager::set<SceneScriptingInterface>();
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
DependencyManager::set<OffscreenUi>();
|
DependencyManager::set<OffscreenUi>();
|
||||||
|
#endif
|
||||||
DependencyManager::set<Midi>();
|
DependencyManager::set<Midi>();
|
||||||
DependencyManager::set<PathUtils>();
|
DependencyManager::set<PathUtils>();
|
||||||
DependencyManager::set<InterfaceDynamicFactory>();
|
DependencyManager::set<InterfaceDynamicFactory>();
|
||||||
|
@ -1000,6 +1002,14 @@ const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = false;
|
||||||
const QString DEFAULT_CURSOR_NAME = "DEFAULT";
|
const QString DEFAULT_CURSOR_NAME = "DEFAULT";
|
||||||
const bool DEFAULT_MINI_TABLET_ENABLED = true;
|
const bool DEFAULT_MINI_TABLET_ENABLED = true;
|
||||||
|
|
||||||
|
QSharedPointer<OffscreenUi> getOffscreenUI() {
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
|
return DependencyManager::get<OffscreenUi>();
|
||||||
|
#else
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runningMarkerExisted) :
|
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runningMarkerExisted) :
|
||||||
QApplication(argc, argv),
|
QApplication(argc, argv),
|
||||||
_window(new MainWindow(desktop())),
|
_window(new MainWindow(desktop())),
|
||||||
|
@ -1604,7 +1614,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
||||||
connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) {
|
connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) {
|
||||||
using namespace controller;
|
using namespace controller;
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
|
||||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
{
|
{
|
||||||
auto actionEnum = static_cast<Action>(action);
|
auto actionEnum = static_cast<Action>(action);
|
||||||
|
@ -1743,7 +1752,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
return qApp->getMyAvatar()->getCharacterController()->onGround() ? 1 : 0;
|
return qApp->getMyAvatar()->getCharacterController()->onGround() ? 1 : 0;
|
||||||
});
|
});
|
||||||
_applicationStateDevice->setInputVariant(STATE_NAV_FOCUSED, []() -> float {
|
_applicationStateDevice->setInputVariant(STATE_NAV_FOCUSED, []() -> float {
|
||||||
return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;
|
auto offscreenUi = getOffscreenUI();
|
||||||
|
return offscreenUi ? (offscreenUi->navigationFocused() ? 1 : 0) : 0;
|
||||||
});
|
});
|
||||||
_applicationStateDevice->setInputVariant(STATE_PLATFORM_WINDOWS, []() -> float {
|
_applicationStateDevice->setInputVariant(STATE_PLATFORM_WINDOWS, []() -> float {
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -1809,9 +1819,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
// Now that we've loaded the menu and thus switched to the previous display plugin
|
// Now that we've loaded the menu and thus switched to the previous display plugin
|
||||||
// we can unlock the desktop repositioning code, since all the positions will be
|
// we can unlock the desktop repositioning code, since all the positions will be
|
||||||
// relative to the desktop size for this plugin
|
// relative to the desktop size for this plugin
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = getOffscreenUI();
|
||||||
connect(offscreenUi.data(), &OffscreenUi::desktopReady, []() {
|
connect(offscreenUi.data(), &OffscreenUi::desktopReady, []() {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = getOffscreenUI();
|
||||||
auto desktop = offscreenUi->getDesktop();
|
auto desktop = offscreenUi->getDesktop();
|
||||||
if (desktop) {
|
if (desktop) {
|
||||||
desktop->setProperty("repositionLocked", false);
|
desktop->setProperty("repositionLocked", false);
|
||||||
|
@ -2372,6 +2382,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
|
connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
|
||||||
AndroidHelper::instance().notifyLoadComplete();
|
AndroidHelper::instance().notifyLoadComplete();
|
||||||
#else
|
#else
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
// Do not show login dialog if requested not to on the command line
|
// Do not show login dialog if requested not to on the command line
|
||||||
const QString HIFI_NO_LOGIN_COMMAND_LINE_KEY = "--no-login-suggestion";
|
const QString HIFI_NO_LOGIN_COMMAND_LINE_KEY = "--no-login-suggestion";
|
||||||
int index = arguments().indexOf(HIFI_NO_LOGIN_COMMAND_LINE_KEY);
|
int index = arguments().indexOf(HIFI_NO_LOGIN_COMMAND_LINE_KEY);
|
||||||
|
@ -2396,6 +2407,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
checkLoginTimer->start();
|
checkLoginTimer->start();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateVerboseLogging() {
|
void Application::updateVerboseLogging() {
|
||||||
|
@ -2546,7 +2558,9 @@ void Application::onAboutToQuit() {
|
||||||
DependencyManager::get<CloseEventSender>()->startThread();
|
DependencyManager::get<CloseEventSender>()->startThread();
|
||||||
|
|
||||||
// Hide Running Scripts dialog so that it gets destroyed in an orderly manner; prevents warnings at shutdown.
|
// Hide Running Scripts dialog so that it gets destroyed in an orderly manner; prevents warnings at shutdown.
|
||||||
DependencyManager::get<OffscreenUi>()->hide("RunningScripts");
|
#if !defined(DISABLE_QML)
|
||||||
|
getOffscreenUI()->hide("RunningScripts");
|
||||||
|
#endif
|
||||||
|
|
||||||
_aboutToQuit = true;
|
_aboutToQuit = true;
|
||||||
|
|
||||||
|
@ -2784,10 +2798,10 @@ void Application::initializeGL() {
|
||||||
_glWidget->windowHandle()->setFormat(getDefaultOpenGLSurfaceFormat());
|
_glWidget->windowHandle()->setFormat(getDefaultOpenGLSurfaceFormat());
|
||||||
|
|
||||||
// When loading QtWebEngineWidgets, it creates a global share context on startup.
|
// When loading QtWebEngineWidgets, it creates a global share context on startup.
|
||||||
// We have to account for this possibility by checking here for an existing
|
// We have to account for this possibility by checking here for an existing
|
||||||
// global share context
|
// global share context
|
||||||
auto globalShareContext = qt_gl_global_share_context();
|
auto globalShareContext = qt_gl_global_share_context();
|
||||||
|
|
||||||
#if !defined(DISABLE_QML)
|
#if !defined(DISABLE_QML)
|
||||||
// Build a shared canvas / context for the Chromium processes
|
// Build a shared canvas / context for the Chromium processes
|
||||||
if (!globalShareContext) {
|
if (!globalShareContext) {
|
||||||
|
@ -2974,7 +2988,9 @@ void Application::initializeRenderEngine() {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void setupPreferences();
|
extern void setupPreferences();
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false);
|
static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false);
|
||||||
|
#endif
|
||||||
|
|
||||||
void Application::initializeUi() {
|
void Application::initializeUi() {
|
||||||
AddressBarDialog::registerType();
|
AddressBarDialog::registerType();
|
||||||
|
@ -3024,12 +3040,13 @@ void Application::initializeUi() {
|
||||||
tabletScriptingInterface->getTablet(SYSTEM_TABLET);
|
tabletScriptingInterface->getTablet(SYSTEM_TABLET);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = getOffscreenUI();
|
||||||
connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootContextCreated,
|
connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootContextCreated,
|
||||||
this, &Application::onDesktopRootContextCreated);
|
this, &Application::onDesktopRootContextCreated);
|
||||||
connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootItemCreated,
|
connect(offscreenUi.data(), &hifi::qml::OffscreenSurface::rootItemCreated,
|
||||||
this, &Application::onDesktopRootItemCreated);
|
this, &Application::onDesktopRootItemCreated);
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
offscreenUi->setProxyWindow(_window->windowHandle());
|
offscreenUi->setProxyWindow(_window->windowHandle());
|
||||||
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
|
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
|
||||||
// support the window management and scripting proxies for VR use
|
// support the window management and scripting proxies for VR use
|
||||||
|
@ -3039,9 +3056,13 @@ void Application::initializeUi() {
|
||||||
// FIXME either expose so that dialogs can set this themselves or
|
// FIXME either expose so that dialogs can set this themselves or
|
||||||
// do better detection in the offscreen UI of what has focus
|
// do better detection in the offscreen UI of what has focus
|
||||||
offscreenUi->setNavigationFocused(false);
|
offscreenUi->setNavigationFocused(false);
|
||||||
|
#else
|
||||||
|
_window->setMenuBar(new Menu());
|
||||||
|
#endif
|
||||||
|
|
||||||
setupPreferences();
|
setupPreferences();
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
_glWidget->installEventFilter(offscreenUi.data());
|
_glWidget->installEventFilter(offscreenUi.data());
|
||||||
offscreenUi->setMouseTranslator([=](const QPointF& pt) {
|
offscreenUi->setMouseTranslator([=](const QPointF& pt) {
|
||||||
QPointF result = pt;
|
QPointF result = pt;
|
||||||
|
@ -3054,6 +3075,7 @@ void Application::initializeUi() {
|
||||||
return result.toPoint();
|
return result.toPoint();
|
||||||
});
|
});
|
||||||
offscreenUi->resume();
|
offscreenUi->resume();
|
||||||
|
#endif
|
||||||
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
|
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
|
||||||
resizeGL();
|
resizeGL();
|
||||||
if (_touchscreenVirtualPadDevice) {
|
if (_touchscreenVirtualPadDevice) {
|
||||||
|
@ -3092,6 +3114,7 @@ void Application::initializeUi() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
// Pre-create a couple of Web3D overlays to speed up tablet UI
|
// Pre-create a couple of Web3D overlays to speed up tablet UI
|
||||||
auto offscreenSurfaceCache = DependencyManager::get<OffscreenQmlSurfaceCache>();
|
auto offscreenSurfaceCache = DependencyManager::get<OffscreenQmlSurfaceCache>();
|
||||||
offscreenSurfaceCache->setOnRootContextCreated([&](const QString& rootObject, QQmlContext* surfaceContext) {
|
offscreenSurfaceCache->setOnRootContextCreated([&](const QString& rootObject, QQmlContext* surfaceContext) {
|
||||||
|
@ -3105,9 +3128,11 @@ void Application::initializeUi() {
|
||||||
|
|
||||||
offscreenSurfaceCache->reserve(TabletScriptingInterface::QML, 1);
|
offscreenSurfaceCache->reserve(TabletScriptingInterface::QML, 1);
|
||||||
offscreenSurfaceCache->reserve(Web3DOverlay::QML, 2);
|
offscreenSurfaceCache->reserve(Web3DOverlay::QML, 2);
|
||||||
|
#endif
|
||||||
|
|
||||||
flushMenuUpdates();
|
flushMenuUpdates();
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
// Now that the menu is instantiated, ensure the display plugin menu is properly updated
|
// Now that the menu is instantiated, ensure the display plugin menu is properly updated
|
||||||
{
|
{
|
||||||
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
|
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
|
||||||
|
@ -3126,6 +3151,7 @@ void Application::initializeUi() {
|
||||||
auto parent = getPrimaryMenu()->getMenu(MenuOption::OutputMenu);
|
auto parent = getPrimaryMenu()->getMenu(MenuOption::OutputMenu);
|
||||||
parent->addSeparator();
|
parent->addSeparator();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// The display plugins are created before the menu now, so we need to do this here to hide the menu bar
|
// The display plugins are created before the menu now, so we need to do this here to hide the menu bar
|
||||||
// now that it exists
|
// now that it exists
|
||||||
|
@ -3230,12 +3256,12 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
|
||||||
void Application::onDesktopRootItemCreated(QQuickItem* rootItem) {
|
void Application::onDesktopRootItemCreated(QQuickItem* rootItem) {
|
||||||
Stats::show();
|
Stats::show();
|
||||||
AnimStats::show();
|
AnimStats::show();
|
||||||
auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext();
|
auto surfaceContext = getOffscreenUI()->getSurfaceContext();
|
||||||
surfaceContext->setContextProperty("Stats", Stats::getInstance());
|
surfaceContext->setContextProperty("Stats", Stats::getInstance());
|
||||||
surfaceContext->setContextProperty("AnimStats", AnimStats::getInstance());
|
surfaceContext->setContextProperty("AnimStats", AnimStats::getInstance());
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID)
|
#if !defined(Q_OS_ANDROID)
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = getOffscreenUI();
|
||||||
auto qml = PathUtils::qmlUrl("AvatarInputsBar.qml");
|
auto qml = PathUtils::qmlUrl("AvatarInputsBar.qml");
|
||||||
offscreenUi->show(qml, "AvatarInputsBar");
|
offscreenUi->show(qml, "AvatarInputsBar");
|
||||||
#endif
|
#endif
|
||||||
|
@ -3418,7 +3444,7 @@ void Application::setPreferredCursor(const QString& cursorName) {
|
||||||
|
|
||||||
void Application::setSettingConstrainToolbarPosition(bool setting) {
|
void Application::setSettingConstrainToolbarPosition(bool setting) {
|
||||||
_constrainToolbarPosition.set(setting);
|
_constrainToolbarPosition.set(setting);
|
||||||
DependencyManager::get<OffscreenUi>()->setConstrainToolbarToCenterX(setting);
|
getOffscreenUI()->setConstrainToolbarToCenterX(setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setMiniTabletEnabled(bool enabled) {
|
void Application::setMiniTabletEnabled(bool enabled) {
|
||||||
|
@ -3512,7 +3538,9 @@ void Application::resizeGL() {
|
||||||
_myCamera.loadViewFrustum(_viewFrustum);
|
_myCamera.loadViewFrustum(_viewFrustum);
|
||||||
}
|
}
|
||||||
|
|
||||||
DependencyManager::get<OffscreenUi>()->resize(fromGlm(displayPlugin->getRecommendedUiSize()));
|
#if !defined(DISABLE_QML)
|
||||||
|
getOffscreenUI()->resize(fromGlm(displayPlugin->getRecommendedUiSize()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::handleSandboxStatus(QNetworkReply* reply) {
|
void Application::handleSandboxStatus(QNetworkReply* reply) {
|
||||||
|
@ -3912,10 +3940,12 @@ bool Application::eventFilter(QObject* object, QEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->type() == QEvent::ShortcutOverride) {
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
if (DependencyManager::get<OffscreenUi>()->shouldSwallowShortcut(event)) {
|
#if !defined(DISABLE_QML)
|
||||||
|
if (getOffscreenUI()->shouldSwallowShortcut(event)) {
|
||||||
event->accept();
|
event->accept();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Filter out captured keys before they're used for shortcut actions.
|
// Filter out captured keys before they're used for shortcut actions.
|
||||||
if (_controllerScriptingInterface->isKeyCaptured(static_cast<QKeyEvent*>(event))) {
|
if (_controllerScriptingInterface->isKeyCaptured(static_cast<QKeyEvent*>(event))) {
|
||||||
|
@ -3998,7 +4028,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
|
|
||||||
case Qt::Key_X:
|
case Qt::Key_X:
|
||||||
if (isShifted && isMeta) {
|
if (isShifted && isMeta) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = getOffscreenUI();
|
||||||
offscreenUi->togglePinned();
|
offscreenUi->togglePinned();
|
||||||
//offscreenUi->getSurfaceContext()->engine()->clearComponentCache();
|
//offscreenUi->getSurfaceContext()->engine()->clearComponentCache();
|
||||||
//OffscreenUi::information("Debugging", "Component cache cleared");
|
//OffscreenUi::information("Debugging", "Component cache cleared");
|
||||||
|
@ -4014,7 +4044,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
|
|
||||||
case Qt::Key_B:
|
case Qt::Key_B:
|
||||||
if (isMeta) {
|
if (isMeta) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = getOffscreenUI();
|
||||||
offscreenUi->load("Browser.qml");
|
offscreenUi->load("Browser.qml");
|
||||||
} else if (isOption) {
|
} else if (isOption) {
|
||||||
controller::InputRecorder* inputRecorder = controller::InputRecorder::getInstance();
|
controller::InputRecorder* inputRecorder = controller::InputRecorder::getInstance();
|
||||||
|
@ -4036,7 +4066,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
case Qt::Key_R:
|
case Qt::Key_R:
|
||||||
if (isMeta && !event->isAutoRepeat()) {
|
if (isMeta && !event->isAutoRepeat()) {
|
||||||
DependencyManager::get<ScriptEngines>()->reloadAllScripts();
|
DependencyManager::get<ScriptEngines>()->reloadAllScripts();
|
||||||
DependencyManager::get<OffscreenUi>()->clearCache();
|
getOffscreenUI()->clearCache();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -4233,9 +4263,13 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
||||||
return; // bail
|
return; // bail
|
||||||
}
|
}
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
#if !defined(DISABLE_QML)
|
||||||
|
auto offscreenUi = getOffscreenUI();
|
||||||
auto eventPosition = compositor.getMouseEventPosition(event);
|
auto eventPosition = compositor.getMouseEventPosition(event);
|
||||||
QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition);
|
QPointF transformedPos = offscreenUi ? offscreenUi->mapToVirtualScreen(eventPosition) : QPointF();
|
||||||
|
#else
|
||||||
|
QPointF transformedPos;
|
||||||
|
#endif
|
||||||
auto button = event->button();
|
auto button = event->button();
|
||||||
auto buttons = event->buttons();
|
auto buttons = event->buttons();
|
||||||
// Determine if the ReticleClick Action is 1 and if so, fake include the LeftMouseButton
|
// Determine if the ReticleClick Action is 1 and if so, fake include the LeftMouseButton
|
||||||
|
@ -4273,7 +4307,8 @@ void Application::mousePressEvent(QMouseEvent* event) {
|
||||||
// Inhibit the menu if the user is using alt-mouse dragging
|
// Inhibit the menu if the user is using alt-mouse dragging
|
||||||
_altPressed = false;
|
_altPressed = false;
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
#if !defined(DISABLE_QML)
|
||||||
|
auto offscreenUi = getOffscreenUI();
|
||||||
// If we get a mouse press event it means it wasn't consumed by the offscreen UI,
|
// If we get a mouse press event it means it wasn't consumed by the offscreen UI,
|
||||||
// hence, we should defocus all of the offscreen UI windows, in order to allow
|
// hence, we should defocus all of the offscreen UI windows, in order to allow
|
||||||
// keyboard shortcuts not to be swallowed by them. In particular, WebEngineViews
|
// keyboard shortcuts not to be swallowed by them. In particular, WebEngineViews
|
||||||
|
@ -4282,6 +4317,9 @@ void Application::mousePressEvent(QMouseEvent* event) {
|
||||||
|
|
||||||
auto eventPosition = getApplicationCompositor().getMouseEventPosition(event);
|
auto eventPosition = getApplicationCompositor().getMouseEventPosition(event);
|
||||||
QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition);
|
QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition);
|
||||||
|
#else
|
||||||
|
QPointF transformedPos;
|
||||||
|
#endif
|
||||||
QMouseEvent mappedEvent(event->type(),
|
QMouseEvent mappedEvent(event->type(),
|
||||||
transformedPos,
|
transformedPos,
|
||||||
event->screenPos(), event->button(),
|
event->screenPos(), event->button(),
|
||||||
|
@ -4318,9 +4356,13 @@ void Application::mousePressEvent(QMouseEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::mouseDoublePressEvent(QMouseEvent* event) {
|
void Application::mouseDoublePressEvent(QMouseEvent* event) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
#if !defined(DISABLE_QML)
|
||||||
|
auto offscreenUi = getOffscreenUI();
|
||||||
auto eventPosition = getApplicationCompositor().getMouseEventPosition(event);
|
auto eventPosition = getApplicationCompositor().getMouseEventPosition(event);
|
||||||
QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition);
|
QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition);
|
||||||
|
#else
|
||||||
|
QPointF transformedPos;
|
||||||
|
#endif
|
||||||
QMouseEvent mappedEvent(event->type(),
|
QMouseEvent mappedEvent(event->type(),
|
||||||
transformedPos,
|
transformedPos,
|
||||||
event->screenPos(), event->button(),
|
event->screenPos(), event->button(),
|
||||||
|
@ -4341,9 +4383,13 @@ void Application::mouseDoublePressEvent(QMouseEvent* event) {
|
||||||
|
|
||||||
void Application::mouseReleaseEvent(QMouseEvent* event) {
|
void Application::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
#if !defined(DISABLE_QML)
|
||||||
|
auto offscreenUi = getOffscreenUI();
|
||||||
auto eventPosition = getApplicationCompositor().getMouseEventPosition(event);
|
auto eventPosition = getApplicationCompositor().getMouseEventPosition(event);
|
||||||
QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition);
|
QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition);
|
||||||
|
#else
|
||||||
|
QPointF transformedPos;
|
||||||
|
#endif
|
||||||
QMouseEvent mappedEvent(event->type(),
|
QMouseEvent mappedEvent(event->type(),
|
||||||
transformedPos,
|
transformedPos,
|
||||||
event->screenPos(), event->button(),
|
event->screenPos(), event->button(),
|
||||||
|
@ -4739,7 +4785,8 @@ void Application::idle() {
|
||||||
// Update the deadlock watchdog
|
// Update the deadlock watchdog
|
||||||
updateHeartbeat();
|
updateHeartbeat();
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
#if !defined(DISABLE_QML)
|
||||||
|
auto offscreenUi = getOffscreenUI();
|
||||||
|
|
||||||
// These tasks need to be done on our first idle, because we don't want the showing of
|
// These tasks need to be done on our first idle, because we don't want the showing of
|
||||||
// overlay subwindows to do a showDesktop() until after the first time through
|
// overlay subwindows to do a showDesktop() until after the first time through
|
||||||
|
@ -4748,6 +4795,7 @@ void Application::idle() {
|
||||||
firstIdle = false;
|
firstIdle = false;
|
||||||
connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
|
connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// If tracing is enabled then monitor the CPU in a separate thread
|
// If tracing is enabled then monitor the CPU in a separate thread
|
||||||
|
@ -4764,6 +4812,7 @@ void Application::idle() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto displayPlugin = getActiveDisplayPlugin();
|
auto displayPlugin = getActiveDisplayPlugin();
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
if (displayPlugin) {
|
if (displayPlugin) {
|
||||||
auto uiSize = displayPlugin->getRecommendedUiSize();
|
auto uiSize = displayPlugin->getRecommendedUiSize();
|
||||||
// Bit of a hack since there's no device pixel ratio change event I can find.
|
// Bit of a hack since there's no device pixel ratio change event I can find.
|
||||||
|
@ -4772,6 +4821,7 @@ void Application::idle() {
|
||||||
offscreenUi->resize(fromGlm(uiSize));
|
offscreenUi->resize(fromGlm(uiSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (displayPlugin) {
|
if (displayPlugin) {
|
||||||
PROFILE_COUNTER_IF_CHANGED(app, "present", float, displayPlugin->presentRate());
|
PROFILE_COUNTER_IF_CHANGED(app, "present", float, displayPlugin->presentRate());
|
||||||
|
@ -4806,6 +4856,7 @@ void Application::idle() {
|
||||||
float secondsSinceLastUpdate = (float)_lastTimeUpdated.nsecsElapsed() / NSECS_PER_MSEC / MSECS_PER_SECOND;
|
float secondsSinceLastUpdate = (float)_lastTimeUpdated.nsecsElapsed() / NSECS_PER_MSEC / MSECS_PER_SECOND;
|
||||||
_lastTimeUpdated.start();
|
_lastTimeUpdated.start();
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
// If the offscreen Ui has something active that is NOT the root, then assume it has keyboard focus.
|
// If the offscreen Ui has something active that is NOT the root, then assume it has keyboard focus.
|
||||||
if (offscreenUi && offscreenUi->getWindow()) {
|
if (offscreenUi && offscreenUi->getWindow()) {
|
||||||
auto activeFocusItem = offscreenUi->getWindow()->activeFocusItem();
|
auto activeFocusItem = offscreenUi->getWindow()->activeFocusItem();
|
||||||
|
@ -4817,9 +4868,11 @@ void Application::idle() {
|
||||||
_keyboardDeviceHasFocus = true;
|
_keyboardDeviceHasFocus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
checkChangeCursor();
|
checkChangeCursor();
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
auto stats = Stats::getInstance();
|
auto stats = Stats::getInstance();
|
||||||
if (stats) {
|
if (stats) {
|
||||||
stats->updateStats();
|
stats->updateStats();
|
||||||
|
@ -4828,6 +4881,7 @@ void Application::idle() {
|
||||||
if (animStats) {
|
if (animStats) {
|
||||||
animStats->updateStats();
|
animStats->updateStats();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing
|
// Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing
|
||||||
// details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing
|
// details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing
|
||||||
|
@ -5163,7 +5217,9 @@ QVector<EntityItemID> Application::pasteEntities(float x, float y, float z) {
|
||||||
|
|
||||||
void Application::init() {
|
void Application::init() {
|
||||||
// Make sure Login state is up to date
|
// Make sure Login state is up to date
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
||||||
|
#endif
|
||||||
if (!DISABLE_DEFERRED) {
|
if (!DISABLE_DEFERRED) {
|
||||||
DependencyManager::get<DeferredLightingEffect>()->init();
|
DependencyManager::get<DeferredLightingEffect>()->init();
|
||||||
}
|
}
|
||||||
|
@ -6702,8 +6758,9 @@ void Application::nodeActivated(SharedNodePointer node) {
|
||||||
if (node->getType() == NodeType::AssetServer) {
|
if (node->getType() == NodeType::AssetServer) {
|
||||||
// asset server just connected - check if we have the asset browser showing
|
// asset server just connected - check if we have the asset browser showing
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
#if !defined(DISABLE_QML)
|
||||||
auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer");
|
auto offscreenUi = getOffscreenUI();
|
||||||
|
auto assetDialog = offscreenUi ? offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer") : nullptr;
|
||||||
|
|
||||||
if (assetDialog) {
|
if (assetDialog) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
@ -6716,6 +6773,7 @@ void Application::nodeActivated(SharedNodePointer node) {
|
||||||
assetDialog->setVisible(false);
|
assetDialog->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get a new EntityServer activated, reset lastQueried time
|
// If we get a new EntityServer activated, reset lastQueried time
|
||||||
|
@ -6773,13 +6831,15 @@ void Application::nodeKilled(SharedNodePointer node) {
|
||||||
} else if (node->getType() == NodeType::AssetServer) {
|
} else if (node->getType() == NodeType::AssetServer) {
|
||||||
// asset server going away - check if we have the asset browser showing
|
// asset server going away - check if we have the asset browser showing
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
#if !defined(DISABLE_QML)
|
||||||
auto assetDialog = offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer");
|
auto offscreenUi = getOffscreenUI();
|
||||||
|
auto assetDialog = offscreenUi ? offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer") : nullptr;
|
||||||
|
|
||||||
if (assetDialog) {
|
if (assetDialog) {
|
||||||
// call reload on the shown asset browser dialog
|
// call reload on the shown asset browser dialog
|
||||||
QMetaObject::invokeMethod(assetDialog, "clear");
|
QMetaObject::invokeMethod(assetDialog, "clear");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6886,8 +6946,10 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
|
||||||
qScriptRegisterMetaType(scriptEngine.data(), RayToOverlayIntersectionResultToScriptValue,
|
qScriptRegisterMetaType(scriptEngine.data(), RayToOverlayIntersectionResultToScriptValue,
|
||||||
RayToOverlayIntersectionResultFromScriptValue);
|
RayToOverlayIntersectionResultFromScriptValue);
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("OffscreenFlags", DependencyManager::get<OffscreenUi>()->getFlags());
|
#if !defined(DISABLE_QML)
|
||||||
|
scriptEngine->registerGlobalObject("OffscreenFlags", getOffscreenUI()->getFlags());
|
||||||
scriptEngine->registerGlobalObject("Desktop", DependencyManager::get<DesktopScriptingInterface>().data());
|
scriptEngine->registerGlobalObject("Desktop", DependencyManager::get<DesktopScriptingInterface>().data());
|
||||||
|
#endif
|
||||||
|
|
||||||
qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<ToolbarProxy>, wrapperFromScriptValue<ToolbarProxy>);
|
qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<ToolbarProxy>, wrapperFromScriptValue<ToolbarProxy>);
|
||||||
qScriptRegisterMetaType(scriptEngine.data(),
|
qScriptRegisterMetaType(scriptEngine.data(),
|
||||||
|
@ -6913,14 +6975,16 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
|
||||||
|
|
||||||
bool clientScript = scriptEngine->isClientScript();
|
bool clientScript = scriptEngine->isClientScript();
|
||||||
scriptEngine->registerFunction("OverlayWindow", clientScript ? QmlWindowClass::constructor : QmlWindowClass::restricted_constructor);
|
scriptEngine->registerFunction("OverlayWindow", clientScript ? QmlWindowClass::constructor : QmlWindowClass::restricted_constructor);
|
||||||
#if !defined(Q_OS_ANDROID)
|
#if !defined(Q_OS_ANDROID) && !defined(DISABLE_QML)
|
||||||
scriptEngine->registerFunction("OverlayWebWindow", clientScript ? QmlWebWindowClass::constructor : QmlWebWindowClass::restricted_constructor);
|
scriptEngine->registerFunction("OverlayWebWindow", clientScript ? QmlWebWindowClass::constructor : QmlWebWindowClass::restricted_constructor);
|
||||||
#endif
|
#endif
|
||||||
scriptEngine->registerFunction("QmlFragment", clientScript ? QmlFragmentClass::constructor : QmlFragmentClass::restricted_constructor);
|
scriptEngine->registerFunction("QmlFragment", clientScript ? QmlFragmentClass::constructor : QmlFragmentClass::restricted_constructor);
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
|
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
|
||||||
scriptEngine->registerGlobalObject("DesktopPreviewProvider", DependencyManager::get<DesktopPreviewProvider>().data());
|
scriptEngine->registerGlobalObject("DesktopPreviewProvider", DependencyManager::get<DesktopPreviewProvider>().data());
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
scriptEngine->registerGlobalObject("Stats", Stats::getInstance());
|
scriptEngine->registerGlobalObject("Stats", Stats::getInstance());
|
||||||
|
#endif
|
||||||
scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
|
scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
|
||||||
scriptEngine->registerGlobalObject("Snapshot", DependencyManager::get<Snapshot>().data());
|
scriptEngine->registerGlobalObject("Snapshot", DependencyManager::get<Snapshot>().data());
|
||||||
scriptEngine->registerGlobalObject("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
scriptEngine->registerGlobalObject("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
||||||
|
@ -7116,7 +7180,7 @@ bool Application::askToSetAvatarUrl(const QString& url) {
|
||||||
qCDebug(interfaceapp) << "Declined to agree to avatar license";
|
qCDebug(interfaceapp) << "Declined to agree to avatar license";
|
||||||
}
|
}
|
||||||
|
|
||||||
//auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
//auto offscreenUi = getOffscreenUI();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setAvatar(url, modelName);
|
setAvatar(url, modelName);
|
||||||
|
@ -7314,7 +7378,9 @@ void Application::showDialog(const QUrl& widgetUrl, const QUrl& tabletUrl, const
|
||||||
toggleTabletUI(true);
|
toggleTabletUI(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DependencyManager::get<OffscreenUi>()->show(widgetUrl, name);
|
#if !defined(DISABLE_QML)
|
||||||
|
getOffscreenUI()->show(widgetUrl, name);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7339,10 +7405,10 @@ void Application::showAssetServerWidget(QString filePath) {
|
||||||
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));
|
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));
|
||||||
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
if (tablet->getToolbarMode()) {
|
if (tablet->getToolbarMode()) {
|
||||||
DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload);
|
getOffscreenUI()->show(url, "AssetServer", startUpload);
|
||||||
} else {
|
} else {
|
||||||
if (!hmd->getShouldShowTablet() && !isHMDMode()) {
|
if (!hmd->getShouldShowTablet() && !isHMDMode()) {
|
||||||
DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload);
|
getOffscreenUI()->show(url, "AssetServer", startUpload);
|
||||||
} else {
|
} else {
|
||||||
static const QUrl url("hifi/dialogs/TabletAssetServer.qml");
|
static const QUrl url("hifi/dialogs/TabletAssetServer.qml");
|
||||||
if (!tablet->isPathLoaded(url)) {
|
if (!tablet->isPathLoaded(url)) {
|
||||||
|
@ -7697,7 +7763,7 @@ void Application::addAssetToWorldInfo(QString modelName, QString infoText) {
|
||||||
|
|
||||||
if (!_addAssetToWorldErrorTimer.isActive()) {
|
if (!_addAssetToWorldErrorTimer.isActive()) {
|
||||||
if (!_addAssetToWorldMessageBox) {
|
if (!_addAssetToWorldMessageBox) {
|
||||||
_addAssetToWorldMessageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION,
|
_addAssetToWorldMessageBox = getOffscreenUI()->createMessageBox(OffscreenUi::ICON_INFORMATION,
|
||||||
"Downloading Model", "", QMessageBox::NoButton, QMessageBox::NoButton);
|
"Downloading Model", "", QMessageBox::NoButton, QMessageBox::NoButton);
|
||||||
connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));
|
connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));
|
||||||
}
|
}
|
||||||
|
@ -7780,7 +7846,7 @@ void Application::addAssetToWorldError(QString modelName, QString errorText) {
|
||||||
addAssetToWorldInfoClear(modelName);
|
addAssetToWorldInfoClear(modelName);
|
||||||
|
|
||||||
if (!_addAssetToWorldMessageBox) {
|
if (!_addAssetToWorldMessageBox) {
|
||||||
_addAssetToWorldMessageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION,
|
_addAssetToWorldMessageBox = getOffscreenUI()->createMessageBox(OffscreenUi::ICON_INFORMATION,
|
||||||
"Downloading Model", "", QMessageBox::NoButton, QMessageBox::NoButton);
|
"Downloading Model", "", QMessageBox::NoButton, QMessageBox::NoButton);
|
||||||
connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));
|
connect(_addAssetToWorldMessageBox, SIGNAL(destroyed()), this, SLOT(onAssetToWorldMessageBoxClosed()));
|
||||||
}
|
}
|
||||||
|
@ -8274,6 +8340,8 @@ DisplayPluginPointer Application::getActiveDisplayPlugin() const {
|
||||||
return _displayPlugin;
|
return _displayPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
static const char* EXCLUSION_GROUP_KEY = "exclusionGroup";
|
static const char* EXCLUSION_GROUP_KEY = "exclusionGroup";
|
||||||
|
|
||||||
static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active) {
|
static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active) {
|
||||||
|
@ -8314,6 +8382,7 @@ static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, in
|
||||||
action->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(displayPluginGroup));
|
action->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(displayPluginGroup));
|
||||||
Q_ASSERT(menu->menuItemExists(MenuOption::OutputMenu, name));
|
Q_ASSERT(menu->menuItemExists(MenuOption::OutputMenu, name));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Application::updateDisplayMode() {
|
void Application::updateDisplayMode() {
|
||||||
// Unsafe to call this method from anything but the main thread
|
// Unsafe to call this method from anything but the main thread
|
||||||
|
@ -8358,8 +8427,8 @@ void Application::setDisplayPlugin(DisplayPluginPointer newDisplayPlugin) {
|
||||||
// instead emit a signal that the display plugin is changing and let
|
// instead emit a signal that the display plugin is changing and let
|
||||||
// the desktop lock itself. Reduces coupling between the UI and display
|
// the desktop lock itself. Reduces coupling between the UI and display
|
||||||
// plugins
|
// plugins
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = getOffscreenUI();
|
||||||
auto desktop = offscreenUi->getDesktop();
|
auto desktop = offscreenUi ? offscreenUi->getDesktop() : nullptr;
|
||||||
auto menu = Menu::getInstance();
|
auto menu = Menu::getInstance();
|
||||||
|
|
||||||
// Make the switch atomic from the perspective of other threads
|
// Make the switch atomic from the perspective of other threads
|
||||||
|
@ -8405,7 +8474,9 @@ void Application::setDisplayPlugin(DisplayPluginPointer newDisplayPlugin) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offscreenUi->resize(fromGlm(newDisplayPlugin->getRecommendedUiSize()));
|
if (offscreenUi) {
|
||||||
|
offscreenUi->resize(fromGlm(newDisplayPlugin->getRecommendedUiSize()));
|
||||||
|
}
|
||||||
getApplicationCompositor().setDisplayPlugin(newDisplayPlugin);
|
getApplicationCompositor().setDisplayPlugin(newDisplayPlugin);
|
||||||
_displayPlugin = newDisplayPlugin;
|
_displayPlugin = newDisplayPlugin;
|
||||||
connect(_displayPlugin.get(), &DisplayPlugin::presented, this, &Application::onPresent, Qt::DirectConnection);
|
connect(_displayPlugin.get(), &DisplayPlugin::presented, this, &Application::onPresent, Qt::DirectConnection);
|
||||||
|
|
|
@ -156,12 +156,14 @@ void Application::paintGL() {
|
||||||
renderArgs._blitFramebuffer.reset();
|
renderArgs._blitFramebuffer.reset();
|
||||||
renderArgs._context->enableStereo(false);
|
renderArgs._context->enableStereo(false);
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
{
|
{
|
||||||
auto stats = Stats::getInstance();
|
auto stats = Stats::getInstance();
|
||||||
if (stats) {
|
if (stats) {
|
||||||
stats->setRenderDetails(renderArgs._details);
|
stats->setRenderDetails(renderArgs._details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint64_t lastPaintDuration = usecTimestampNow() - lastPaintBegin;
|
uint64_t lastPaintDuration = usecTimestampNow() - lastPaintBegin;
|
||||||
_frameTimingsScriptingInterface.addValue(lastPaintDuration);
|
_frameTimingsScriptingInterface.addValue(lastPaintDuration);
|
||||||
|
|
|
@ -48,7 +48,9 @@ void ConnectionMonitor::init() {
|
||||||
emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, "", 5);
|
emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, "", 5);
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "ConnectionMonitor: Showing connection failure window";
|
qDebug() << "ConnectionMonitor: Showing connection failure window";
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(true);
|
DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -59,8 +61,10 @@ void ConnectionMonitor::startTimer() {
|
||||||
|
|
||||||
void ConnectionMonitor::stopTimer() {
|
void ConnectionMonitor::stopTimer() {
|
||||||
_timer.stop();
|
_timer.stop();
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
|
bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
|
||||||
if (!enableInterstitial) {
|
if (!enableInterstitial) {
|
||||||
DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(false);
|
DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(false);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,9 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
|
||||||
// Now render the overlay components together into a single texture
|
// Now render the overlay components together into a single texture
|
||||||
renderDomainConnectionStatusBorder(renderArgs); // renders the connected domain line
|
renderDomainConnectionStatusBorder(renderArgs); // renders the connected domain line
|
||||||
renderOverlays(renderArgs); // renders Scripts Overlay and AudioScope
|
renderOverlays(renderArgs); // renders Scripts Overlay and AudioScope
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
renderQmlUi(renderArgs); // renders a unit quad with the QML UI texture, and the text overlays from scripts
|
renderQmlUi(renderArgs); // renders a unit quad with the QML UI texture, and the text overlays from scripts
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
renderArgs->_batch = nullptr; // so future users of renderArgs don't try to use our batch
|
renderArgs->_batch = nullptr; // so future users of renderArgs don't try to use our batch
|
||||||
|
|
|
@ -74,6 +74,7 @@ void OverlayConductor::centerUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayConductor::update(float dt) {
|
void OverlayConductor::update(float dt) {
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
if (!offscreenUi) {
|
if (!offscreenUi) {
|
||||||
return;
|
return;
|
||||||
|
@ -115,4 +116,5 @@ void OverlayConductor::update(float dt) {
|
||||||
if (shouldRecenter && !_suppressedByHead) {
|
if (shouldRecenter && !_suppressedByHead) {
|
||||||
centerUI();
|
centerUI();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,10 @@ private:
|
||||||
bool headOutsideOverlay() const;
|
bool headOutsideOverlay() const;
|
||||||
bool updateAvatarIsAtRest();
|
bool updateAvatarIsAtRest();
|
||||||
|
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
bool _suppressedByHead { false };
|
bool _suppressedByHead { false };
|
||||||
bool _hmdMode { false };
|
bool _hmdMode { false };
|
||||||
|
#endif
|
||||||
|
|
||||||
// used by updateAvatarIsAtRest
|
// used by updateAvatarIsAtRest
|
||||||
uint64_t _desiredAtRestTimer { 0 };
|
uint64_t _desiredAtRestTimer { 0 };
|
||||||
|
|
|
@ -232,11 +232,15 @@ OverlayID Overlays::addOverlay(const QString& type, const QVariant& properties)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (type == ImageOverlay::TYPE) {
|
if (type == ImageOverlay::TYPE) {
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
thisOverlay = Overlay::Pointer(new ImageOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
thisOverlay = Overlay::Pointer(new ImageOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
||||||
|
#endif
|
||||||
} else if (type == Image3DOverlay::TYPE || type == "billboard") { // "billboard" for backwards compatibility
|
} else if (type == Image3DOverlay::TYPE || type == "billboard") { // "billboard" for backwards compatibility
|
||||||
thisOverlay = Overlay::Pointer(new Image3DOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
thisOverlay = Overlay::Pointer(new Image3DOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
||||||
} else if (type == TextOverlay::TYPE) {
|
} else if (type == TextOverlay::TYPE) {
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
thisOverlay = Overlay::Pointer(new TextOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
thisOverlay = Overlay::Pointer(new TextOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
||||||
|
#endif
|
||||||
} else if (type == Text3DOverlay::TYPE) {
|
} else if (type == Text3DOverlay::TYPE) {
|
||||||
thisOverlay = Overlay::Pointer(new Text3DOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
thisOverlay = Overlay::Pointer(new Text3DOverlay(), [](Overlay* ptr) { ptr->deleteLater(); });
|
||||||
} else if (type == Shape3DOverlay::TYPE) {
|
} else if (type == Shape3DOverlay::TYPE) {
|
||||||
|
|
|
@ -27,16 +27,16 @@
|
||||||
class Dependency {
|
class Dependency {
|
||||||
public:
|
public:
|
||||||
typedef std::function<void(Dependency* pointer)> DeleterFunction;
|
typedef std::function<void(Dependency* pointer)> DeleterFunction;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Dependency() {}
|
virtual ~Dependency() {}
|
||||||
virtual void customDeleter() {
|
virtual void customDeleter() {
|
||||||
_customDeleter(this);
|
_customDeleter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCustomDeleter(DeleterFunction customDeleter) { _customDeleter = customDeleter; }
|
void setCustomDeleter(DeleterFunction customDeleter) { _customDeleter = customDeleter; }
|
||||||
DeleterFunction _customDeleter = [](Dependency* pointer) { delete pointer; };
|
DeleterFunction _customDeleter = [](Dependency* pointer) { delete pointer; };
|
||||||
|
|
||||||
friend class DependencyManager;
|
friend class DependencyManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,10 +49,10 @@ class DependencyManager {
|
||||||
public:
|
public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static QSharedPointer<T> get();
|
static QSharedPointer<T> get();
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static bool isSet();
|
static bool isSet();
|
||||||
|
|
||||||
template<typename T, typename ...Args>
|
template<typename T, typename ...Args>
|
||||||
static QSharedPointer<T> set(Args&&... args);
|
static QSharedPointer<T> set(Args&&... args);
|
||||||
|
|
||||||
|
@ -61,10 +61,10 @@ public:
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void destroy();
|
static void destroy();
|
||||||
|
|
||||||
template<typename Base, typename Derived>
|
template<typename Base, typename Derived>
|
||||||
static void registerInheritance();
|
static void registerInheritance();
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static size_t typeHash() {
|
static size_t typeHash() {
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
|
@ -79,9 +79,9 @@ private:
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
size_t getHashCode();
|
size_t getHashCode();
|
||||||
|
|
||||||
QSharedPointer<Dependency>& safeGet(size_t hashCode);
|
QSharedPointer<Dependency>& safeGet(size_t hashCode);
|
||||||
|
|
||||||
QHash<size_t, QSharedPointer<Dependency>> _instanceHash;
|
QHash<size_t, QSharedPointer<Dependency>> _instanceHash;
|
||||||
QHash<size_t, size_t> _inheritanceHash;
|
QHash<size_t, size_t> _inheritanceHash;
|
||||||
};
|
};
|
||||||
|
@ -90,15 +90,17 @@ template <typename T>
|
||||||
QSharedPointer<T> DependencyManager::get() {
|
QSharedPointer<T> DependencyManager::get() {
|
||||||
static size_t hashCode = manager().getHashCode<T>();
|
static size_t hashCode = manager().getHashCode<T>();
|
||||||
static QWeakPointer<T> instance;
|
static QWeakPointer<T> instance;
|
||||||
|
|
||||||
if (instance.isNull()) {
|
if (instance.isNull()) {
|
||||||
instance = qSharedPointerCast<T>(manager().safeGet(hashCode));
|
instance = qSharedPointerCast<T>(manager().safeGet(hashCode));
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG
|
||||||
if (instance.isNull()) {
|
if (instance.isNull()) {
|
||||||
qWarning() << "DependencyManager::get(): No instance available for" << typeid(T).name();
|
qWarning() << "DependencyManager::get(): No instance available for" << typeid(T).name();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance.toStrongRef();
|
return instance.toStrongRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,12 +161,12 @@ template<typename T>
|
||||||
size_t DependencyManager::getHashCode() {
|
size_t DependencyManager::getHashCode() {
|
||||||
size_t hashCode = typeHash<T>();
|
size_t hashCode = typeHash<T>();
|
||||||
auto derivedHashCode = _inheritanceHash.find(hashCode);
|
auto derivedHashCode = _inheritanceHash.find(hashCode);
|
||||||
|
|
||||||
while (derivedHashCode != _inheritanceHash.end()) {
|
while (derivedHashCode != _inheritanceHash.end()) {
|
||||||
hashCode = derivedHashCode.value();
|
hashCode = derivedHashCode.value();
|
||||||
derivedHashCode = _inheritanceHash.find(hashCode);
|
derivedHashCode = _inheritanceHash.find(hashCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -616,7 +616,9 @@ bool OffscreenUi::navigationFocused() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenUi::setNavigationFocused(bool focused) {
|
void OffscreenUi::setNavigationFocused(bool focused) {
|
||||||
offscreenFlags->setNavigationFocused(focused);
|
if (offscreenFlags) {
|
||||||
|
offscreenFlags->setNavigationFocused(focused);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME HACK....
|
// FIXME HACK....
|
||||||
|
|
|
@ -422,9 +422,11 @@ void Menu::removeMenu(const QString& menuName) {
|
||||||
} else {
|
} else {
|
||||||
QMenuBar::removeAction(action);
|
QMenuBar::removeAction(action);
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->removeAction(action);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->removeAction(action);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenuBar::repaint();
|
QMenuBar::repaint();
|
||||||
|
@ -532,9 +534,11 @@ void Menu::setGroupingIsVisible(const QString& grouping, bool isVisible) {
|
||||||
|
|
||||||
MenuWrapper::MenuWrapper(ui::Menu& rootMenu, QMenu* menu) : _rootMenu(rootMenu), _realMenu(menu) {
|
MenuWrapper::MenuWrapper(ui::Menu& rootMenu, QMenu* menu) : _rootMenu(rootMenu), _realMenu(menu) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->addMenu(menu);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->addMenu(menu);
|
||||||
|
});
|
||||||
|
}
|
||||||
_rootMenu._backMap[menu] = this;
|
_rootMenu._backMap[menu] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,50 +557,62 @@ void MenuWrapper::setEnabled(bool enabled) {
|
||||||
QAction* MenuWrapper::addSeparator() {
|
QAction* MenuWrapper::addSeparator() {
|
||||||
QAction* action = _realMenu->addSeparator();
|
QAction* action = _realMenu->addSeparator();
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->addSeparator(_realMenu);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->addSeparator(_realMenu);
|
||||||
|
});
|
||||||
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuWrapper::addAction(QAction* action) {
|
void MenuWrapper::addAction(QAction* action) {
|
||||||
_realMenu->addAction(action);
|
_realMenu->addAction(action);
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->addAction(_realMenu, action);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->addAction(_realMenu, action);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* MenuWrapper::addAction(const QString& menuName) {
|
QAction* MenuWrapper::addAction(const QString& menuName) {
|
||||||
QAction* action = _realMenu->addAction(menuName);
|
QAction* action = _realMenu->addAction(menuName);
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->addAction(_realMenu, action);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->addAction(_realMenu, action);
|
||||||
|
});
|
||||||
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* MenuWrapper::addAction(const QString& menuName, const QObject* receiver, const char* member, const QKeySequence& shortcut) {
|
QAction* MenuWrapper::addAction(const QString& menuName, const QObject* receiver, const char* member, const QKeySequence& shortcut) {
|
||||||
QAction* action = _realMenu->addAction(menuName, receiver, member, shortcut);
|
QAction* action = _realMenu->addAction(menuName, receiver, member, shortcut);
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->addAction(_realMenu, action);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->addAction(_realMenu, action);
|
||||||
|
});
|
||||||
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuWrapper::removeAction(QAction* action) {
|
void MenuWrapper::removeAction(QAction* action) {
|
||||||
_realMenu->removeAction(action);
|
_realMenu->removeAction(action);
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->removeAction(action);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->removeAction(action);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuWrapper::insertAction(QAction* before, QAction* action) {
|
void MenuWrapper::insertAction(QAction* before, QAction* action) {
|
||||||
_realMenu->insertAction(before, action);
|
_realMenu->insertAction(before, action);
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
if (offscreenUi) {
|
||||||
vrMenu->insertAction(before, action);
|
offscreenUi->addMenuInitializer([=](VrMenu* vrMenu) {
|
||||||
});
|
vrMenu->insertAction(before, action);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,6 +366,7 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
|
||||||
if (toolbarMode) {
|
if (toolbarMode) {
|
||||||
|
#if !defined(DISABLE_QML)
|
||||||
// create new desktop window
|
// create new desktop window
|
||||||
auto tabletRootWindow = new TabletRootWindow();
|
auto tabletRootWindow = new TabletRootWindow();
|
||||||
tabletRootWindow->initQml(QVariantMap());
|
tabletRootWindow->initQml(QVariantMap());
|
||||||
|
@ -379,6 +380,7 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
||||||
|
|
||||||
// forward qml surface events to interface js
|
// forward qml surface events to interface js
|
||||||
connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);
|
connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (_currentPathLoaded != TABLET_HOME_SOURCE_URL) {
|
if (_currentPathLoaded != TABLET_HOME_SOURCE_URL) {
|
||||||
loadHomeScreen(true);
|
loadHomeScreen(true);
|
||||||
|
|
Loading…
Reference in a new issue