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