mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 02:43:32 +02:00
saving work
This commit is contained in:
parent
715ee0b019
commit
865a78a8c8
5 changed files with 38 additions and 7 deletions
|
@ -90,7 +90,7 @@ Item {
|
||||||
} else {
|
} else {
|
||||||
breadcrumbText.text = "Menu";
|
breadcrumbText.text = "Menu";
|
||||||
topMenu = null;
|
topMenu = null;
|
||||||
//offscreenFlags.navigationFocused = false;
|
offscreenFlags.navigationFocused = false;
|
||||||
menuRoot.enabled = false;
|
menuRoot.enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ Item {
|
||||||
menuStack.push(newMenu);
|
menuStack.push(newMenu);
|
||||||
topMenu = newMenu;
|
topMenu = newMenu;
|
||||||
topMenu.focus = true;
|
topMenu.focus = true;
|
||||||
//offscreenFlags.navigationFocused = true;
|
offscreenFlags.navigationFocused = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearMenus() {
|
function clearMenus() {
|
||||||
|
|
|
@ -977,7 +977,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
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 offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
if (offscreenUi->navigationFocused()) {
|
if (offscreenUi->navigationFocused()) {
|
||||||
|
qDebug() << "NavigationFocused";
|
||||||
auto actionEnum = static_cast<Action>(action);
|
auto actionEnum = static_cast<Action>(action);
|
||||||
int key = Qt::Key_unknown;
|
int key = Qt::Key_unknown;
|
||||||
static int lastKey = Qt::Key_unknown;
|
static int lastKey = Qt::Key_unknown;
|
||||||
|
@ -1021,25 +1023,27 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (navAxis) {
|
auto window = tabletScriptingInterface->getTabletWindow();
|
||||||
|
if (navAxis && window) {
|
||||||
|
qDebug() << "Sending input to qml";
|
||||||
if (lastKey != Qt::Key_unknown) {
|
if (lastKey != Qt::Key_unknown) {
|
||||||
QKeyEvent event(QEvent::KeyRelease, lastKey, Qt::NoModifier);
|
QKeyEvent event(QEvent::KeyRelease, lastKey, Qt::NoModifier);
|
||||||
sendEvent(offscreenUi->getWindow(), &event);
|
sendEvent(window, &event);
|
||||||
lastKey = Qt::Key_unknown;
|
lastKey = Qt::Key_unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key != Qt::Key_unknown) {
|
if (key != Qt::Key_unknown) {
|
||||||
QKeyEvent event(QEvent::KeyPress, key, Qt::NoModifier);
|
QKeyEvent event(QEvent::KeyPress, key, Qt::NoModifier);
|
||||||
sendEvent(offscreenUi->getWindow(), &event);
|
sendEvent(window, &event);
|
||||||
lastKey = key;
|
lastKey = key;
|
||||||
}
|
}
|
||||||
} else if (key != Qt::Key_unknown) {
|
} else if (key != Qt::Key_unknown) {
|
||||||
if (state) {
|
if (state) {
|
||||||
QKeyEvent event(QEvent::KeyPress, key, Qt::NoModifier);
|
QKeyEvent event(QEvent::KeyPress, key, Qt::NoModifier);
|
||||||
sendEvent(offscreenUi->getWindow(), &event);
|
sendEvent(window, &event);
|
||||||
} else {
|
} else {
|
||||||
QKeyEvent event(QEvent::KeyRelease, key, Qt::NoModifier);
|
QKeyEvent event(QEvent::KeyRelease, key, Qt::NoModifier);
|
||||||
sendEvent(offscreenUi->getWindow(), &event);
|
sendEvent(window, &event);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,8 @@ void Web3DOverlay::loadSourceURL() {
|
||||||
|
|
||||||
if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") {
|
if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") {
|
||||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
|
auto flags = tabletScriptingInterface->getFlags();
|
||||||
|
_webSurface->getRootContext()->setContextProperty("offscreenFlags", flags);
|
||||||
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,20 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QQuickWindow* TabletScriptingInterface::getTabletWindow() {
|
||||||
|
TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
|
QObject* qmlSurface = tablet->getTabletSurface();
|
||||||
|
OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface);
|
||||||
|
QQuickWindow* window = surface->getWindow();
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
QObject* TabletScriptingInterface::getFlags()
|
||||||
|
{
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
return offscreenUi->getFlags();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TabletProxy
|
// TabletProxy
|
||||||
//
|
//
|
||||||
|
@ -200,6 +214,10 @@ void TabletProxy::addButtonsToHomeScreen() {
|
||||||
QObject::disconnect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()));
|
QObject::disconnect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject* TabletProxy::getTabletSurface() {
|
||||||
|
return _qmlOffscreenSurface;
|
||||||
|
}
|
||||||
|
|
||||||
void TabletProxy::addButtonsToMenuScreen() {
|
void TabletProxy::addButtonsToMenuScreen() {
|
||||||
if (!_qmlTabletRoot) {
|
if (!_qmlTabletRoot) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -47,6 +47,10 @@ public:
|
||||||
|
|
||||||
void setQmlTabletRoot(QString tabletId, QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface);
|
void setQmlTabletRoot(QString tabletId, QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface);
|
||||||
|
|
||||||
|
QQuickWindow* getTabletWindow();
|
||||||
|
|
||||||
|
QObject* getFlags();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::mutex _mutex;
|
std::mutex _mutex;
|
||||||
std::map<QString, QSharedPointer<TabletProxy>> _tabletProxies;
|
std::map<QString, QSharedPointer<TabletProxy>> _tabletProxies;
|
||||||
|
@ -112,6 +116,9 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void emitScriptEvent(QVariant msg);
|
Q_INVOKABLE void emitScriptEvent(QVariant msg);
|
||||||
|
|
||||||
|
|
||||||
|
QObject* getTabletSurface();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Signaled when this tablet receives an event from the html/js embedded in the tablet
|
* Signaled when this tablet receives an event from the html/js embedded in the tablet
|
||||||
|
|
Loading…
Reference in a new issue