mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 04:53: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 withOculus: false
|
||||
property string errorString: errorString
|
||||
property bool lostFocus: false
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
|
@ -475,9 +476,20 @@ Item {
|
|||
Connections {
|
||||
target: loginDialog
|
||||
onFocusEnabled: {
|
||||
Qt.callLater(function() {
|
||||
emailField.forceActiveFocus();
|
||||
});
|
||||
if (!linkAccountBody.lostFocus) {
|
||||
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 = "";
|
||||
d.resize();
|
||||
init();
|
||||
Qt.callLater(function() {
|
||||
emailField.forceActiveFocus();
|
||||
});
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
|
|
|
@ -37,6 +37,7 @@ Item {
|
|||
|
||||
property string errorString: errorString
|
||||
property bool linkSteam: linkSteam
|
||||
property bool lostFocus: false
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
|
@ -425,5 +426,22 @@ Item {
|
|||
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();
|
||||
|
||||
property bool lostFocus: false
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
readonly property int minWidth: 480
|
||||
|
@ -222,5 +224,22 @@ Item {
|
|||
console.log("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, [&](){
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
auto keyboard = DependencyManager::get<Keyboard>();
|
||||
if (getLoginDialogPoppedUp()) {
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
auto keyboard = DependencyManager::get<Keyboard>();
|
||||
if (_firstRun.get()) {
|
||||
// display mode changed. Don't allow auto-switch to work after this session.
|
||||
_firstRun.set(false);
|
||||
}
|
||||
if (isHMDMode()) {
|
||||
dialogsManager->hideLoginDialog();
|
||||
emit loginDialogFocusDisabled();
|
||||
createLoginDialogOverlay();
|
||||
} else {
|
||||
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");
|
||||
toolbar->writeProperty("visible", false);
|
||||
dialogsManager->showLoginDialog();
|
||||
emit loginDialogFocusEnabled();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2897,6 +2899,7 @@ void Application::showLoginScreen() {
|
|||
}
|
||||
_loginDialogPoppedUp = true;
|
||||
dialogsManager->showLoginDialog();
|
||||
emit loginDialogFocusEnabled();
|
||||
QJsonObject loginData = {};
|
||||
loginData["action"] = "login dialog shown";
|
||||
UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData);
|
||||
|
@ -8651,13 +8654,14 @@ void Application::createLoginDialogOverlay() {
|
|||
auto keyboard = DependencyManager::get<Keyboard>().data();
|
||||
if (!keyboard->getAnchorID().isNull() && !_loginDialogOverlayID.isNull()) {
|
||||
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)) },
|
||||
};
|
||||
overlays.editOverlay(keyboard->getAnchorID(), properties);
|
||||
keyboard->setResetKeyboardPositionOnRaise(false);
|
||||
}
|
||||
setKeyboardFocusOverlay(_loginDialogOverlayID);
|
||||
emit loginDialogFocusEnabled();
|
||||
getApplicationCompositor().getReticleInterface()->setAllowMouseCapture(false);
|
||||
getApplicationCompositor().getReticleInterface()->setVisible(false);
|
||||
if (!_loginStateManager.isSetUp()) {
|
||||
|
|
|
@ -346,6 +346,7 @@ signals:
|
|||
void interstitialModeChanged(bool isInInterstitialMode);
|
||||
|
||||
void loginDialogFocusEnabled();
|
||||
void loginDialogFocusDisabled();
|
||||
|
||||
void miniTabletEnabledChanged(bool enabled);
|
||||
|
||||
|
|
|
@ -42,7 +42,12 @@ LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent) {
|
|||
this, &LoginDialog::handleLoginCompleted);
|
||||
connect(accountManager.data(), &AccountManager::loginFailed,
|
||||
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()));
|
||||
#endif
|
||||
}
|
||||
|
@ -308,8 +313,3 @@ void LoginDialog::signupFailed(QNetworkReply* reply) {
|
|||
emit handleSignupFailed(DEFAULT_SIGN_UP_FAILURE_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginDialog::onFocusEnabled() {
|
||||
forceActiveFocus();
|
||||
emit focusEnabled();
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ signals:
|
|||
void dismissedLoginDialog();
|
||||
|
||||
void focusEnabled();
|
||||
void focusDisabled();
|
||||
|
||||
public slots:
|
||||
void linkCompleted(QNetworkReply* reply);
|
||||
|
@ -60,8 +61,6 @@ public slots:
|
|||
void signupCompleted(QNetworkReply* reply);
|
||||
void signupFailed(QNetworkReply* reply);
|
||||
|
||||
void onFocusEnabled();
|
||||
|
||||
protected slots:
|
||||
Q_INVOKABLE void dismissLoginDialog();
|
||||
|
||||
|
|
Loading…
Reference in a new issue