mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
Fix location not being updated after using back and forwards buttons
This commit is contained in:
parent
2807f76e68
commit
a347936b68
3 changed files with 25 additions and 1 deletions
|
@ -70,11 +70,15 @@ Window {
|
||||||
id: addressBarDialog
|
id: addressBarDialog
|
||||||
implicitWidth: backgroundImage.width
|
implicitWidth: backgroundImage.width
|
||||||
implicitHeight: backgroundImage.height
|
implicitHeight: backgroundImage.height
|
||||||
|
|
||||||
// The buttons have their button state changed on hover, so we have to manually fix them up here
|
// The buttons have their button state changed on hover, so we have to manually fix them up here
|
||||||
onBackEnabledChanged: backArrow.buttonState = addressBarDialog.backEnabled ? 1 : 0;
|
onBackEnabledChanged: backArrow.buttonState = addressBarDialog.backEnabled ? 1 : 0;
|
||||||
onForwardEnabledChanged: forwardArrow.buttonState = addressBarDialog.forwardEnabled ? 1 : 0;
|
onForwardEnabledChanged: forwardArrow.buttonState = addressBarDialog.forwardEnabled ? 1 : 0;
|
||||||
onReceivedHifiSchemeURL: resetAfterTeleport();
|
onReceivedHifiSchemeURL: resetAfterTeleport();
|
||||||
|
|
||||||
|
// Update location after using back and forward buttons.
|
||||||
|
onMetaverseServerUrlChanged: updateLocationTextTimer.start();
|
||||||
|
|
||||||
ListModel { id: suggestions }
|
ListModel { id: suggestions }
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
|
@ -225,6 +229,24 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
// Delay updating location text a bit to avoid flicker of content and so that connection status is valid.
|
||||||
|
id: updateLocationTextTimer
|
||||||
|
running: false
|
||||||
|
interval: 500 // ms
|
||||||
|
repeat: false
|
||||||
|
onTriggered: updateLocationText(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
onTriggered: addressLine.text = ""
|
||||||
|
}
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
width: 938;
|
width: 938;
|
||||||
height: 625;
|
height: 625;
|
||||||
|
@ -403,6 +425,7 @@ Window {
|
||||||
if (addressLine.text !== "") {
|
if (addressLine.text !== "") {
|
||||||
addressBarDialog.loadAddress(addressLine.text, fromSuggestions)
|
addressBarDialog.loadAddress(addressLine.text, fromSuggestions)
|
||||||
}
|
}
|
||||||
|
clearAddressLineTimer.start();
|
||||||
isCursorVisible = false;
|
isCursorVisible = false;
|
||||||
root.shown = false;
|
root.shown = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare
|
||||||
});
|
});
|
||||||
_backEnabled = !(DependencyManager::get<AddressManager>()->getBackStack().isEmpty());
|
_backEnabled = !(DependencyManager::get<AddressManager>()->getBackStack().isEmpty());
|
||||||
_forwardEnabled = !(DependencyManager::get<AddressManager>()->getForwardStack().isEmpty());
|
_forwardEnabled = !(DependencyManager::get<AddressManager>()->getForwardStack().isEmpty());
|
||||||
|
connect(addressManager.data(), &AddressManager::hostChanged, this, &AddressBarDialog::metaverseServerUrlChanged);
|
||||||
connect(DependencyManager::get<DialogsManager>().data(), &DialogsManager::setUseFeed, this, &AddressBarDialog::setUseFeed);
|
connect(DependencyManager::get<DialogsManager>().data(), &DialogsManager::setUseFeed, this, &AddressBarDialog::setUseFeed);
|
||||||
connect(qApp, &Application::receivedHifiSchemeURL, this, &AddressBarDialog::receivedHifiSchemeURL);
|
connect(qApp, &Application::receivedHifiSchemeURL, this, &AddressBarDialog::receivedHifiSchemeURL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ signals:
|
||||||
void forwardEnabledChanged();
|
void forwardEnabledChanged();
|
||||||
void useFeedChanged();
|
void useFeedChanged();
|
||||||
void receivedHifiSchemeURL(const QString& url);
|
void receivedHifiSchemeURL(const QString& url);
|
||||||
void metaverseServerUrlChanged(); // While it is a constant, qml will complain about not seeing a change signal.
|
void metaverseServerUrlChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void displayAddressOfflineMessage();
|
void displayAddressOfflineMessage();
|
||||||
|
|
Loading…
Reference in a new issue