mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
adding focus disable signal to fix focus
This commit is contained in:
parent
1a86b8d172
commit
2f4805dc04
7 changed files with 67 additions and 17 deletions
|
@ -37,6 +37,7 @@ Item {
|
||||||
property bool linkSteam: linkSteam
|
property bool linkSteam: linkSteam
|
||||||
property bool withOculus: false
|
property bool withOculus: false
|
||||||
property string errorString: errorString
|
property string errorString: errorString
|
||||||
|
property bool lostFocus: false
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -475,9 +476,20 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: loginDialog
|
target: loginDialog
|
||||||
onFocusEnabled: {
|
onFocusEnabled: {
|
||||||
Qt.callLater(function() {
|
if (!linkAccountBody.lostFocus) {
|
||||||
emailField.forceActiveFocus();
|
Qt.callLater(function() {
|
||||||
});
|
emailField.forceActiveFocus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onFocusDisabled: {
|
||||||
|
linkAccountBody.lostFocus = !root.isTablet && !root.isOverlay;
|
||||||
|
if (linkAccountBody.lostFocus) {
|
||||||
|
Qt.callLater(function() {
|
||||||
|
emailField.focus = false;
|
||||||
|
passwordField.focus = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,9 +500,6 @@ Item {
|
||||||
root.text = "";
|
root.text = "";
|
||||||
d.resize();
|
d.resize();
|
||||||
init();
|
init();
|
||||||
Qt.callLater(function() {
|
|
||||||
emailField.forceActiveFocus();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
|
|
|
@ -37,6 +37,7 @@ Item {
|
||||||
|
|
||||||
property string errorString: errorString
|
property string errorString: errorString
|
||||||
property bool linkSteam: linkSteam
|
property bool linkSteam: linkSteam
|
||||||
|
property bool lostFocus: false
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -425,5 +426,22 @@ Item {
|
||||||
errorContainer.anchors.left = usernameField.left;
|
errorContainer.anchors.left = usernameField.left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onFocusEnabled: {
|
||||||
|
if (!signUpBody.lostFocus) {
|
||||||
|
Qt.callLater(function() {
|
||||||
|
emailField.forceActiveFocus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onFocusDisabled: {
|
||||||
|
signUpBody.lostFocus = !root.isTablet && !root.isOverlay;
|
||||||
|
if (signUpBody.lostFocus) {
|
||||||
|
Qt.callLater(function() {
|
||||||
|
usernameField.focus = false;
|
||||||
|
emailField.focus = false;
|
||||||
|
passwordField.focus = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ Item {
|
||||||
|
|
||||||
onKeyboardRaisedChanged: d.resize();
|
onKeyboardRaisedChanged: d.resize();
|
||||||
|
|
||||||
|
property bool lostFocus: false
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
readonly property int minWidth: 480
|
readonly property int minWidth: 480
|
||||||
|
@ -222,5 +224,22 @@ Item {
|
||||||
console.log("Login Failed")
|
console.log("Login Failed")
|
||||||
mainTextContainer.text = "Login Failed";
|
mainTextContainer.text = "Login Failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onFocusEnabled: {
|
||||||
|
if (!usernameCollisionBody.lostFocus) {
|
||||||
|
Qt.callLater(function() {
|
||||||
|
textField.forceActiveFocus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onFocusDisabled: {
|
||||||
|
usernameCollisionBody.lostFocus = !root.isTablet && !root.isOverlay;
|
||||||
|
if (nusernameCollisionBody.lostFocus) {
|
||||||
|
Qt.callLater(function() {
|
||||||
|
textField.focus = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1276,15 +1276,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
});
|
});
|
||||||
connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateSystemTabletMode);
|
connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateSystemTabletMode);
|
||||||
connect(this, &Application::activeDisplayPluginChanged, this, [&](){
|
connect(this, &Application::activeDisplayPluginChanged, this, [&](){
|
||||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
|
||||||
auto keyboard = DependencyManager::get<Keyboard>();
|
|
||||||
if (getLoginDialogPoppedUp()) {
|
if (getLoginDialogPoppedUp()) {
|
||||||
|
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||||
|
auto keyboard = DependencyManager::get<Keyboard>();
|
||||||
if (_firstRun.get()) {
|
if (_firstRun.get()) {
|
||||||
// display mode changed. Don't allow auto-switch to work after this session.
|
// display mode changed. Don't allow auto-switch to work after this session.
|
||||||
_firstRun.set(false);
|
_firstRun.set(false);
|
||||||
}
|
}
|
||||||
if (isHMDMode()) {
|
if (isHMDMode()) {
|
||||||
dialogsManager->hideLoginDialog();
|
dialogsManager->hideLoginDialog();
|
||||||
|
emit loginDialogFocusDisabled();
|
||||||
createLoginDialogOverlay();
|
createLoginDialogOverlay();
|
||||||
} else {
|
} else {
|
||||||
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
getOverlays().deleteOverlay(_loginDialogOverlayID);
|
||||||
|
@ -1293,6 +1294,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
||||||
toolbar->writeProperty("visible", false);
|
toolbar->writeProperty("visible", false);
|
||||||
dialogsManager->showLoginDialog();
|
dialogsManager->showLoginDialog();
|
||||||
|
emit loginDialogFocusEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2897,6 +2899,7 @@ void Application::showLoginScreen() {
|
||||||
}
|
}
|
||||||
_loginDialogPoppedUp = true;
|
_loginDialogPoppedUp = true;
|
||||||
dialogsManager->showLoginDialog();
|
dialogsManager->showLoginDialog();
|
||||||
|
emit loginDialogFocusEnabled();
|
||||||
QJsonObject loginData = {};
|
QJsonObject loginData = {};
|
||||||
loginData["action"] = "login dialog shown";
|
loginData["action"] = "login dialog shown";
|
||||||
UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData);
|
UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData);
|
||||||
|
@ -8651,13 +8654,14 @@ void Application::createLoginDialogOverlay() {
|
||||||
auto keyboard = DependencyManager::get<Keyboard>().data();
|
auto keyboard = DependencyManager::get<Keyboard>().data();
|
||||||
if (!keyboard->getAnchorID().isNull() && !_loginDialogOverlayID.isNull()) {
|
if (!keyboard->getAnchorID().isNull() && !_loginDialogOverlayID.isNull()) {
|
||||||
QVariantMap properties {
|
QVariantMap properties {
|
||||||
{ "position", vec3toVariant(loginOverlay->getWorldPosition() + glm::vec3(-0.4, -0.3f, 0.2f)) },
|
{ "position", vec3toVariant(loginOverlay->getWorldPosition() + glm::vec3(-0.4f * getMyAvatar()->getSensorToWorldScale(), -0.3f, 0.2f)) },
|
||||||
{ "orientation", quatToVariant(loginOverlay->getWorldOrientation() * glm::quat(0.0f, 0.0, 1.0f, 0.25f)) },
|
{ "orientation", quatToVariant(loginOverlay->getWorldOrientation() * glm::quat(0.0f, 0.0, 1.0f, 0.25f)) },
|
||||||
};
|
};
|
||||||
overlays.editOverlay(keyboard->getAnchorID(), properties);
|
overlays.editOverlay(keyboard->getAnchorID(), properties);
|
||||||
keyboard->setResetKeyboardPositionOnRaise(false);
|
keyboard->setResetKeyboardPositionOnRaise(false);
|
||||||
}
|
}
|
||||||
setKeyboardFocusOverlay(_loginDialogOverlayID);
|
setKeyboardFocusOverlay(_loginDialogOverlayID);
|
||||||
|
emit loginDialogFocusEnabled();
|
||||||
getApplicationCompositor().getReticleInterface()->setAllowMouseCapture(false);
|
getApplicationCompositor().getReticleInterface()->setAllowMouseCapture(false);
|
||||||
getApplicationCompositor().getReticleInterface()->setVisible(false);
|
getApplicationCompositor().getReticleInterface()->setVisible(false);
|
||||||
if (!_loginStateManager.isSetUp()) {
|
if (!_loginStateManager.isSetUp()) {
|
||||||
|
|
|
@ -346,6 +346,7 @@ signals:
|
||||||
void interstitialModeChanged(bool isInInterstitialMode);
|
void interstitialModeChanged(bool isInInterstitialMode);
|
||||||
|
|
||||||
void loginDialogFocusEnabled();
|
void loginDialogFocusEnabled();
|
||||||
|
void loginDialogFocusDisabled();
|
||||||
|
|
||||||
void miniTabletEnabledChanged(bool enabled);
|
void miniTabletEnabledChanged(bool enabled);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,12 @@ LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent) {
|
||||||
this, &LoginDialog::handleLoginCompleted);
|
this, &LoginDialog::handleLoginCompleted);
|
||||||
connect(accountManager.data(), &AccountManager::loginFailed,
|
connect(accountManager.data(), &AccountManager::loginFailed,
|
||||||
this, &LoginDialog::handleLoginFailed);
|
this, &LoginDialog::handleLoginFailed);
|
||||||
connect(qApp, SIGNAL(loginDialogFocusEnabled()), this, SLOT(onFocusEnabled()));
|
connect(qApp, &Application::loginDialogFocusEnabled, [this]() {
|
||||||
|
emit focusEnabled();
|
||||||
|
});
|
||||||
|
connect(qApp, &Application::loginDialogFocusDisabled, [this]() {
|
||||||
|
emit focusDisabled();
|
||||||
|
});
|
||||||
connect(this, SIGNAL(dismissedLoginDialog()), qApp, SLOT(onDismissedLoginDialog()));
|
connect(this, SIGNAL(dismissedLoginDialog()), qApp, SLOT(onDismissedLoginDialog()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -308,8 +313,3 @@ void LoginDialog::signupFailed(QNetworkReply* reply) {
|
||||||
emit handleSignupFailed(DEFAULT_SIGN_UP_FAILURE_MESSAGE);
|
emit handleSignupFailed(DEFAULT_SIGN_UP_FAILURE_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::onFocusEnabled() {
|
|
||||||
forceActiveFocus();
|
|
||||||
emit focusEnabled();
|
|
||||||
}
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ signals:
|
||||||
void dismissedLoginDialog();
|
void dismissedLoginDialog();
|
||||||
|
|
||||||
void focusEnabled();
|
void focusEnabled();
|
||||||
|
void focusDisabled();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void linkCompleted(QNetworkReply* reply);
|
void linkCompleted(QNetworkReply* reply);
|
||||||
|
@ -60,8 +61,6 @@ public slots:
|
||||||
void signupCompleted(QNetworkReply* reply);
|
void signupCompleted(QNetworkReply* reply);
|
||||||
void signupFailed(QNetworkReply* reply);
|
void signupFailed(QNetworkReply* reply);
|
||||||
|
|
||||||
void onFocusEnabled();
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
Q_INVOKABLE void dismissLoginDialog();
|
Q_INVOKABLE void dismissLoginDialog();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue