mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 03:04:40 +02:00
Merge pull request #10153 from druiz17/goto-fix
Ability to toggle goto with the crt-l and enter keys
This commit is contained in:
commit
8e12f62cbb
8 changed files with 84 additions and 13 deletions
|
@ -243,12 +243,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DropShadow {
|
|
||||||
anchors.fill: actionIcon
|
|
||||||
radius: 8.0
|
|
||||||
color: "#80000000"
|
|
||||||
source: actionIcon
|
|
||||||
}
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: messageArea;
|
id: messageArea;
|
||||||
width: rectIcon.width;
|
width: rectIcon.width;
|
||||||
|
|
|
@ -33,14 +33,25 @@ StackView {
|
||||||
property int cardHeight: 320;
|
property int cardHeight: 320;
|
||||||
property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/";
|
property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/";
|
||||||
|
|
||||||
|
property var tablet: null;
|
||||||
|
property bool isDesktop: false;
|
||||||
|
|
||||||
Component { id: tabletStoryCard; TabletStoryCard {} }
|
Component { id: tabletStoryCard; TabletStoryCard {} }
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
root.currentItem.focus = true;
|
root.currentItem.focus = true;
|
||||||
root.currentItem.forceActiveFocus();
|
root.currentItem.forceActiveFocus();
|
||||||
|
addressLine.focus = true;
|
||||||
|
addressLine.forceActiveFocus();
|
||||||
fillDestinations();
|
fillDestinations();
|
||||||
updateLocationText(false);
|
updateLocationText(false);
|
||||||
root.parentChanged.connect(center);
|
root.parentChanged.connect(center);
|
||||||
center();
|
center();
|
||||||
|
isDesktop = (typeof desktop !== "undefined");
|
||||||
|
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
||||||
|
if (desktop) {
|
||||||
|
root.title = "GOTO";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
root.parentChanged.disconnect(center);
|
root.parentChanged.disconnect(center);
|
||||||
|
@ -108,6 +119,8 @@ StackView {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
addressBarDialog.loadHome();
|
addressBarDialog.loadHome();
|
||||||
tabletRoot.shown = false;
|
tabletRoot.shown = false;
|
||||||
|
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
tablet.gotoHomeScreen();
|
||||||
}
|
}
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
@ -294,6 +307,7 @@ StackView {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
leftMargin: 10
|
leftMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
model: suggestions
|
model: suggestions
|
||||||
orientation: ListView.Vertical
|
orientation: ListView.Vertical
|
||||||
|
|
||||||
|
@ -547,6 +561,13 @@ StackView {
|
||||||
if (addressLine.text !== "") {
|
if (addressLine.text !== "") {
|
||||||
addressBarDialog.loadAddress(addressLine.text, fromSuggestions)
|
addressBarDialog.loadAddress(addressLine.text, fromSuggestions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDesktop) {
|
||||||
|
tablet.gotoHomeScreen();
|
||||||
|
} else {
|
||||||
|
HMD.closeTablet();
|
||||||
|
}
|
||||||
|
|
||||||
tabletRoot.shown = false;
|
tabletRoot.shown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2013,6 +2013,7 @@ void Application::initializeUi() {
|
||||||
rootContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
|
rootContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
|
||||||
|
|
||||||
rootContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
rootContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
||||||
|
rootContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
rootContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
|
rootContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
|
||||||
rootContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
rootContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
||||||
rootContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
|
rootContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "TabletScriptingInterface.h"
|
#include "TabletScriptingInterface.h"
|
||||||
#include "scripting/HMDScriptingInterface.h"
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
|
|
||||||
|
static const QVariant TABLET_ADDRESS_DIALOG = "TabletAddressDialog.qml";
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DialogsManager::maybeCreateDialog(QPointer<T>& member) {
|
void DialogsManager::maybeCreateDialog(QPointer<T>& member) {
|
||||||
if (!member) {
|
if (!member) {
|
||||||
|
@ -46,12 +47,48 @@ void DialogsManager::maybeCreateDialog(QPointer<T>& member) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsManager::toggleAddressBar() {
|
void DialogsManager::toggleAddressBar() {
|
||||||
AddressBarDialog::toggle();
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
emit addressBarToggled();
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
|
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
|
if (tablet->getToolbarMode()) {
|
||||||
|
if (tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) {
|
||||||
|
tablet->gotoHomeScreen();
|
||||||
|
emit addressBarToggled();
|
||||||
|
} else {
|
||||||
|
tablet->loadQMLSource(TABLET_ADDRESS_DIALOG);
|
||||||
|
emit addressBarToggled();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (hmd->getShouldShowTablet()) {
|
||||||
|
if (tablet->isPathLoaded(TABLET_ADDRESS_DIALOG) && _closeAddressBar) {
|
||||||
|
tablet->gotoHomeScreen();
|
||||||
|
hmd->closeTablet();
|
||||||
|
_closeAddressBar = false;
|
||||||
|
emit addressBarToggled();
|
||||||
|
} else {
|
||||||
|
tablet->loadQMLSource(TABLET_ADDRESS_DIALOG);
|
||||||
|
_closeAddressBar = true;
|
||||||
|
emit addressBarToggled();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tablet->loadQMLSource(TABLET_ADDRESS_DIALOG);
|
||||||
|
hmd->openTablet();
|
||||||
|
_closeAddressBar = true;
|
||||||
|
emit addressBarToggled();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsManager::showAddressBar() {
|
void DialogsManager::showAddressBar() {
|
||||||
AddressBarDialog::show();
|
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||||
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
|
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
|
tablet->loadQMLSource(TABLET_ADDRESS_DIALOG);
|
||||||
|
|
||||||
|
if (!hmd->getShouldShowTablet()) {
|
||||||
|
hmd->openTablet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsManager::showFeed() {
|
void DialogsManager::showFeed() {
|
||||||
|
|
|
@ -79,6 +79,7 @@ private:
|
||||||
QPointer<OctreeStatsDialog> _octreeStatsDialog;
|
QPointer<OctreeStatsDialog> _octreeStatsDialog;
|
||||||
QPointer<TestingDialog> _testingDialog;
|
QPointer<TestingDialog> _testingDialog;
|
||||||
QPointer<DomainConnectionDialog> _domainConnectionDialog;
|
QPointer<DomainConnectionDialog> _domainConnectionDialog;
|
||||||
|
bool _closeAddressBar { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_DialogsManager_h
|
#endif // hifi_DialogsManager_h
|
||||||
|
|
|
@ -275,6 +275,9 @@ void TabletProxy::emitWebEvent(QVariant msg) {
|
||||||
emit webEventReceived(msg);
|
emit webEventReceived(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TabletProxy::isPathLoaded(QVariant path) {
|
||||||
|
return path.toString() == _currentPathLoaded.toString();
|
||||||
|
}
|
||||||
void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {
|
void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {
|
||||||
std::lock_guard<std::mutex> guard(_mutex);
|
std::lock_guard<std::mutex> guard(_mutex);
|
||||||
_qmlOffscreenSurface = qmlOffscreenSurface;
|
_qmlOffscreenSurface = qmlOffscreenSurface;
|
||||||
|
@ -322,6 +325,7 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr
|
||||||
removeButtonsFromHomeScreen();
|
removeButtonsFromHomeScreen();
|
||||||
_state = State::Uninitialized;
|
_state = State::Uninitialized;
|
||||||
emit screenChanged(QVariant("Closed"), QVariant(""));
|
emit screenChanged(QVariant("Closed"), QVariant(""));
|
||||||
|
_currentPathLoaded = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,6 +349,7 @@ void TabletProxy::gotoMenuScreen(const QString& submenu) {
|
||||||
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL)));
|
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL)));
|
||||||
_state = State::Menu;
|
_state = State::Menu;
|
||||||
emit screenChanged(QVariant("Menu"), QVariant(VRMENU_SOURCE_URL));
|
emit screenChanged(QVariant("Menu"), QVariant(VRMENU_SOURCE_URL));
|
||||||
|
_currentPathLoaded = VRMENU_SOURCE_URL;
|
||||||
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,6 +369,7 @@ void TabletProxy::loadQMLSource(const QVariant& path) {
|
||||||
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, path));
|
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, path));
|
||||||
_state = State::QML;
|
_state = State::QML;
|
||||||
emit screenChanged(QVariant("QML"), path);
|
emit screenChanged(QVariant("QML"), path);
|
||||||
|
_currentPathLoaded = path;
|
||||||
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -426,6 +432,7 @@ void TabletProxy::loadHomeScreen(bool forceOntoHomeScreen) {
|
||||||
}
|
}
|
||||||
_state = State::Home;
|
_state = State::Home;
|
||||||
emit screenChanged(QVariant("Home"), QVariant(TABLET_SOURCE_URL));
|
emit screenChanged(QVariant("Home"), QVariant(TABLET_SOURCE_URL));
|
||||||
|
_currentPathLoaded = TABLET_SOURCE_URL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,6 +457,7 @@ void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaS
|
||||||
}
|
}
|
||||||
_state = State::Web;
|
_state = State::Web;
|
||||||
emit screenChanged(QVariant("Web"), QVariant(url));
|
emit screenChanged(QVariant("Web"), QVariant(url));
|
||||||
|
_currentPathLoaded = QVariant(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* TabletProxy::addButton(const QVariant& properties) {
|
QObject* TabletProxy::addButton(const QVariant& properties) {
|
||||||
|
|
|
@ -183,6 +183,8 @@ public:
|
||||||
Q_INVOKABLE void setLandscape(bool landscape) { _landscape = landscape; }
|
Q_INVOKABLE void setLandscape(bool landscape) { _landscape = landscape; }
|
||||||
Q_INVOKABLE bool getLandscape() { return _landscape; }
|
Q_INVOKABLE bool getLandscape() { return _landscape; }
|
||||||
|
|
||||||
|
Q_INVOKABLE bool isPathLoaded(QVariant path);
|
||||||
|
|
||||||
QQuickItem* getTabletRoot() const { return _qmlTabletRoot; }
|
QQuickItem* getTabletRoot() const { return _qmlTabletRoot; }
|
||||||
|
|
||||||
QObject* getTabletSurface();
|
QObject* getTabletSurface();
|
||||||
|
@ -235,6 +237,7 @@ protected:
|
||||||
|
|
||||||
bool _initialScreen { false };
|
bool _initialScreen { false };
|
||||||
QVariant _initialPath { "" };
|
QVariant _initialPath { "" };
|
||||||
|
QVariant _currentPathLoaded { "" };
|
||||||
QString _name;
|
QString _name;
|
||||||
std::mutex _mutex;
|
std::mutex _mutex;
|
||||||
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
||||||
|
|
|
@ -29,10 +29,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
if (url === gotoQmlSource) {
|
||||||
button.editProperties({isActive: shouldActivateButton});
|
onGotoScreen = true;
|
||||||
shouldActivateButton = false;
|
shouldActivateButton = true;
|
||||||
onGotoScreen = false;
|
button.editProperties({isActive: shouldActivateButton});
|
||||||
|
} else {
|
||||||
|
shouldActivateButton = false;
|
||||||
|
onGotoScreen = false;
|
||||||
|
button.editProperties({isActive: shouldActivateButton});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
Loading…
Reference in a new issue