mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 00:56:48 +02:00
More improvements
This commit is contained in:
parent
f23f9ec698
commit
d9dc8ebc41
7 changed files with 95 additions and 111 deletions
|
@ -21,7 +21,7 @@ import "../../styles-uit" as HifiStyles
|
|||
import "../../controls-uit" as HifiControls
|
||||
|
||||
StackView {
|
||||
id: root
|
||||
id: root;
|
||||
HifiConstants { id: hifi }
|
||||
HifiStyles.HifiConstants { id: hifiStyleConstants }
|
||||
initialItem: addressBarDialog
|
||||
|
@ -34,24 +34,16 @@ StackView {
|
|||
property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/";
|
||||
|
||||
property var tablet: null;
|
||||
property bool isDesktop: false;
|
||||
|
||||
Component { id: tabletStoryCard; TabletStoryCard {} }
|
||||
Component.onCompleted: {
|
||||
root.currentItem.focus = true;
|
||||
root.currentItem.forceActiveFocus();
|
||||
addressLine.focus = true;
|
||||
addressLine.forceActiveFocus();
|
||||
fillDestinations();
|
||||
updateLocationText(false);
|
||||
fillDestinations();
|
||||
addressLine.focus = true;
|
||||
root.parentChanged.connect(center);
|
||||
center();
|
||||
isDesktop = (typeof desktop !== "undefined");
|
||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
||||
if (desktop) {
|
||||
root.title = "GOTO";
|
||||
}
|
||||
}
|
||||
Component.onDestruction: {
|
||||
root.parentChanged.disconnect(center);
|
||||
|
@ -78,8 +70,6 @@ StackView {
|
|||
toggleOrGo(true, targetString);
|
||||
clearAddressLineTimer.start();
|
||||
}
|
||||
|
||||
property bool isCursorVisible: false // Override default cursor visibility.
|
||||
|
||||
|
||||
AddressBarDialog {
|
||||
|
@ -102,16 +92,11 @@ StackView {
|
|||
onMetaverseServerUrlChanged: updateLocationTextTimer.start();
|
||||
Rectangle {
|
||||
id: navBar
|
||||
width: 480
|
||||
height: 70
|
||||
width: parent.width
|
||||
height: 50;
|
||||
color: hifiStyleConstants.colors.white
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
rightMargin: 0
|
||||
left: parent.left
|
||||
leftMargin: 0
|
||||
}
|
||||
anchors.top: parent.top;
|
||||
anchors.left: parent.left;
|
||||
|
||||
ToolbarButton {
|
||||
id: homeButton
|
||||
|
@ -149,85 +134,77 @@ StackView {
|
|||
|
||||
Rectangle {
|
||||
id: addressBar
|
||||
width: 480
|
||||
width: parent.width
|
||||
height: 70
|
||||
color: hifiStyleConstants.colors.white
|
||||
anchors {
|
||||
top: navBar.bottom
|
||||
right: parent.right
|
||||
rightMargin: 16
|
||||
left: parent.left
|
||||
leftMargin: 16
|
||||
top: navBar.bottom;
|
||||
left: parent.left;
|
||||
}
|
||||
|
||||
property int inputAreaHeight: 70
|
||||
property int inputAreaStep: (height - inputAreaHeight) / 2
|
||||
|
||||
HifiStyles.RalewayLight {
|
||||
id: notice;
|
||||
font.pixelSize: hifi.fonts.pixelSize * 0.50;
|
||||
font.pixelSize: hifi.fonts.pixelSize * 0.7;
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: parent.inputAreaStep + 12
|
||||
left: addressLine.left
|
||||
right: addressLine.right
|
||||
top: parent.top;
|
||||
left: addressLineContainer.left;
|
||||
right: addressLineContainer.right;
|
||||
}
|
||||
}
|
||||
|
||||
HifiStyles.FiraSansRegular {
|
||||
id: location;
|
||||
anchors {
|
||||
left: addressLineContainer.left;
|
||||
leftMargin: 8;
|
||||
verticalCenter: addressLineContainer.verticalCenter;
|
||||
}
|
||||
font.pixelSize: addressLine.font.pixelSize;
|
||||
color: "gray";
|
||||
clip: true;
|
||||
anchors.fill: addressLine;
|
||||
visible: addressLine.text.length === 0
|
||||
}
|
||||
|
||||
TextInput {
|
||||
id: addressLine
|
||||
focus: true
|
||||
width: addressLineContainer.width - addressLineContainer.anchors.leftMargin - addressLineContainer.anchors.rightMargin;
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 16
|
||||
rightMargin: 16
|
||||
topMargin: parent.inputAreaStep + (2 * hifi.layout.spacing)
|
||||
bottomMargin: parent.inputAreaStep
|
||||
left: addressLineContainer.left;
|
||||
leftMargin: 8;
|
||||
verticalCenter: addressLineContainer.verticalCenter;
|
||||
}
|
||||
font.pixelSize: hifi.fonts.pixelSize * 0.75
|
||||
cursorVisible: false
|
||||
onTextChanged: {
|
||||
filterChoicesByText();
|
||||
updateLocationText(text.length > 0);
|
||||
if (!isCursorVisible && text.length > 0) {
|
||||
isCursorVisible = true;
|
||||
cursorVisible = true;
|
||||
}
|
||||
}
|
||||
onAccepted: {
|
||||
addressBarDialog.keyboardEnabled = false;
|
||||
}
|
||||
onActiveFocusChanged: {
|
||||
cursorVisible = isCursorVisible && focus;
|
||||
}
|
||||
MouseArea {
|
||||
// If user clicks in address bar show cursor to indicate ability to enter address.
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
isCursorVisible = true;
|
||||
parent.cursorVisible = true;
|
||||
parent.focus = true;
|
||||
parent.forceActiveFocus();
|
||||
addressBarDialog.keyboardEnabled = HMD.active
|
||||
tabletRoot.playButtonClickSound();
|
||||
}
|
||||
toggleOrGo();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: addressLine
|
||||
id: addressLineContainer;
|
||||
height: 40;
|
||||
anchors {
|
||||
top: notice.bottom;
|
||||
topMargin: 2;
|
||||
left: parent.left;
|
||||
leftMargin: 16;
|
||||
right: parent.right;
|
||||
rightMargin: 16;
|
||||
}
|
||||
color: hifiStyleConstants.colors.lightGray
|
||||
opacity: 0.1
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
addressLine.focus = true;
|
||||
addressBarDialog.keyboardEnabled = HMD.active;
|
||||
tabletRoot.playButtonClickSound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
|
@ -347,13 +324,12 @@ StackView {
|
|||
|
||||
Timer {
|
||||
// Delay clearing address line so as to avoid flicker of "not connected" being displayed after entering an address.
|
||||
id: clearAddressLineTimer
|
||||
running: false
|
||||
interval: 100 // ms
|
||||
repeat: false
|
||||
id: clearAddressLineTimer;
|
||||
running: false;
|
||||
interval: 100; // ms
|
||||
repeat: false;
|
||||
onTriggered: {
|
||||
addressLine.text = "";
|
||||
isCursorVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,46 +521,14 @@ StackView {
|
|||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
updateLocationText(false);
|
||||
if (visible) {
|
||||
addressLine.forceActiveFocus();
|
||||
fillDestinations();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleOrGo(fromSuggestions, address) {
|
||||
if (address !== undefined && address !== "") {
|
||||
addressBarDialog.loadAddress(address, fromSuggestions)
|
||||
}
|
||||
|
||||
if (addressLine.text !== "") {
|
||||
addressBarDialog.loadAddress(addressLine.text, fromSuggestions)
|
||||
}
|
||||
|
||||
if (isDesktop) {
|
||||
tablet.gotoHomeScreen();
|
||||
} else {
|
||||
HMD.closeTablet();
|
||||
}
|
||||
|
||||
tabletRoot.shown = false;
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
switch (event.key) {
|
||||
case Qt.Key_Escape:
|
||||
case Qt.Key_Back:
|
||||
tabletRoot.shown = false
|
||||
clearAddressLineTimer.start();
|
||||
event.accepted = true
|
||||
break
|
||||
case Qt.Key_Enter:
|
||||
case Qt.Key_Return:
|
||||
toggleOrGo()
|
||||
clearAddressLineTimer.start();
|
||||
event.accepted = true
|
||||
break
|
||||
addressBarDialog.loadAddress(address, fromSuggestions);
|
||||
clearAddressLineTimer.start();
|
||||
} else if (addressLine.text !== "") {
|
||||
addressBarDialog.loadAddress(addressLine.text, fromSuggestions);
|
||||
clearAddressLineTimer.start();
|
||||
}
|
||||
DialogsManager.hideAddressBar();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ Menu::Menu() {
|
|||
|
||||
// Navigate > Show Address Bar
|
||||
addActionToQMenuAndActionHash(navigateMenu, MenuOption::AddressBar, Qt::CTRL | Qt::Key_L,
|
||||
dialogsManager.data(), SLOT(toggleAddressBar()));
|
||||
dialogsManager.data(), SLOT(showAddressBar()));
|
||||
|
||||
// Navigate > Bookmark related menus -- Note: the Bookmark class adds its own submenus here.
|
||||
qApp->getBookmarks()->setupMenus(this, navigateMenu);
|
||||
|
|
|
@ -22,11 +22,27 @@ DialogsManagerScriptingInterface::DialogsManagerScriptingInterface() {
|
|||
this, &DialogsManagerScriptingInterface::addressBarShown);
|
||||
}
|
||||
|
||||
|
||||
DialogsManagerScriptingInterface* DialogsManagerScriptingInterface::getInstance() {
|
||||
static DialogsManagerScriptingInterface sharedInstance;
|
||||
return &sharedInstance;
|
||||
}
|
||||
|
||||
void DialogsManagerScriptingInterface::toggleAddressBar() {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<DialogsManager>().data(),
|
||||
"toggleAddressBar", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void DialogsManagerScriptingInterface::showAddressBar() {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<DialogsManager>().data(),
|
||||
"showAddressBar", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void DialogsManagerScriptingInterface::hideAddressBar() {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<DialogsManager>().data(),
|
||||
"hideAddressBar", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void DialogsManagerScriptingInterface::showFeed() {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<DialogsManager>().data(),
|
||||
"showFeed", Qt::QueuedConnection);
|
||||
|
|
|
@ -18,10 +18,13 @@ class DialogsManagerScriptingInterface : public QObject {
|
|||
Q_OBJECT
|
||||
public:
|
||||
DialogsManagerScriptingInterface();
|
||||
static DialogsManagerScriptingInterface* getInstance();
|
||||
Q_INVOKABLE void showFeed();
|
||||
|
||||
public slots:
|
||||
void toggleAddressBar();
|
||||
void showAddressBar();
|
||||
void hideAddressBar();
|
||||
|
||||
signals:
|
||||
void addressBarToggled();
|
||||
|
|
|
@ -67,12 +67,14 @@ void DialogsManager::toggleAddressBar() {
|
|||
emit addressBarToggled();
|
||||
} else {
|
||||
tablet->loadQMLSource(TABLET_ADDRESS_DIALOG);
|
||||
qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID());
|
||||
_closeAddressBar = true;
|
||||
emit addressBarToggled();
|
||||
}
|
||||
} else {
|
||||
tablet->loadQMLSource(TABLET_ADDRESS_DIALOG);
|
||||
hmd->openTablet();
|
||||
qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID());
|
||||
_closeAddressBar = true;
|
||||
emit addressBarToggled();
|
||||
}
|
||||
|
@ -84,11 +86,28 @@ void DialogsManager::showAddressBar() {
|
|||
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 (!tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) {
|
||||
tablet->loadQMLSource(TABLET_ADDRESS_DIALOG);
|
||||
}
|
||||
if (!hmd->getShouldShowTablet()) {
|
||||
hmd->openTablet();
|
||||
}
|
||||
qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID());
|
||||
emit addressBarShown(true);
|
||||
}
|
||||
|
||||
void DialogsManager::hideAddressBar() {
|
||||
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||
|
||||
if (tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) {
|
||||
tablet->gotoHomeScreen();
|
||||
hmd->closeTablet();
|
||||
}
|
||||
qApp->setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID);
|
||||
emit addressBarShown(false);
|
||||
}
|
||||
|
||||
void DialogsManager::showFeed() {
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
public slots:
|
||||
void toggleAddressBar();
|
||||
void showAddressBar();
|
||||
void hideAddressBar();
|
||||
void showFeed();
|
||||
void setDomainConnectionFailureVisibility(bool visible);
|
||||
void toggleLoginDialog();
|
||||
|
|
|
@ -198,6 +198,7 @@ void Web3DOverlay::loadSourceURL() {
|
|||
_webSurface->getRootContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
||||
_webSurface->getRootContext()->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
|
||||
_webSurface->getRootContext()->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
||||
_webSurface->getRootContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance());
|
||||
|
||||
_webSurface->getRootContext()->setContextProperty("pathToFonts", "../../");
|
||||
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
||||
|
|
Loading…
Reference in a new issue