mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 12:12:39 +02:00
readding render session, adding newlines for oculus failure
This commit is contained in:
parent
512805d48f
commit
9da7465698
5 changed files with 35 additions and 15 deletions
|
@ -75,7 +75,7 @@ Item {
|
|||
|
||||
Item {
|
||||
id: errorContainer
|
||||
width: parent.width
|
||||
width: root.bannerWidth
|
||||
height: loginErrorMessageTextMetrics.height
|
||||
anchors {
|
||||
bottom: completeProfileBody.withOculus ? fields.top : buttons.top;
|
||||
|
@ -98,16 +98,11 @@ Item {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
text: completeProfileBody.errorString
|
||||
visible: true
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (loginErrorMessageTextMetrics.width > root.bannerWidth) {
|
||||
loginErrorMessage.wrapMode = Text.WordWrap;
|
||||
loginErrorMessage.verticalAlignment = Text.AlignLeft;
|
||||
loginErrorMessage.horizontalAlignment = Text.AlignLeft;
|
||||
errorContainer.height = (loginErrorMessageTextMetrics.width / root.bannerWidth) * loginErrorMessageTextMetrics.height;
|
||||
} else {
|
||||
loginErrorMessage.wrapMode = Text.NoWrap;
|
||||
errorContainer.height = loginErrorMessageTextMetrics.height;
|
||||
onTextChanged: {
|
||||
mainContainer.recalculateErrorMessage();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
mainContainer.recalculateErrorMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -469,6 +464,30 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
function recalculateErrorMessage() {
|
||||
if (completeProfileBody.errorString !== "") {
|
||||
loginErrorMessage.visible = true;
|
||||
var errorLength = completeProfileBody.errorString.split(/\r\n|\r|\n/).length;
|
||||
var errorStringEdited = completeProfileBody.errorString.replace(/[\n\r]+/g, "\n");
|
||||
loginErrorMessage.text = errorStringEdited;
|
||||
if (errorLength > 1.0) {
|
||||
loginErrorMessage.wrapMode = Text.WordWrap;
|
||||
loginErrorMessage.verticalAlignment = Text.AlignLeft;
|
||||
loginErrorMessage.horizontalAlignment = Text.AlignLeft;
|
||||
errorContainer.height = errorLength * loginErrorMessageTextMetrics.height;
|
||||
} else if (loginErrorMessageTextMetrics.width > root.bannerWidth) {
|
||||
loginErrorMessage.wrapMode = Text.WordWrap;
|
||||
loginErrorMessage.verticalAlignment = Text.AlignLeft;
|
||||
loginErrorMessage.horizontalAlignment = Text.AlignLeft;
|
||||
errorContainer.height = (loginErrorMessageTextMetrics.width / root.bannerWidth) * loginErrorMessageTextMetrics.height;
|
||||
} else {
|
||||
loginErrorMessage.wrapMode = Text.NoWrap;
|
||||
loginErrorMessage.verticalAlignment = Text.AlignVCenter;
|
||||
loginErrorMessage.horizontalAlignment = Text.AlignHCenter;
|
||||
errorContainer.height = loginErrorMessageTextMetrics.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
|
@ -299,7 +299,6 @@ Item {
|
|||
console.log("Create Succeeded")
|
||||
if (loggingInBody.withOculus) {
|
||||
if (loggingInBody.loginDialogPoppedUp) {
|
||||
loginDialog.dismissLoginDialog();
|
||||
var data = {
|
||||
"action": "user created Oculus account successfully"
|
||||
};
|
||||
|
@ -315,7 +314,6 @@ Item {
|
|||
console.log("Create Failed: " + error);
|
||||
if (loggingInBody.withOculus) {
|
||||
if (loggingInBody.loginDialogPoppedUp) {
|
||||
loginDialog.dismissLoginDialog();
|
||||
var data = {
|
||||
"action": "user created Oculus account unsuccessfully"
|
||||
};
|
||||
|
|
|
@ -330,14 +330,14 @@ void LoginDialog::createFailed(QNetworkReply* reply) {
|
|||
if (!email.isNull() && !email.isUndefined()) {
|
||||
QJsonArray arr = email.toArray();
|
||||
if (!arr.isEmpty()) {
|
||||
reply.append((!reply.isEmpty()) ? " " : "");
|
||||
reply.append((!reply.isEmpty()) ? "\n" : "");
|
||||
reply.append("Email " + arr.at(0).toString() + ".");
|
||||
}
|
||||
}
|
||||
if (!password.isNull() && !password.isUndefined()) {
|
||||
QJsonArray arr = password.toArray();
|
||||
if (!arr.isEmpty()) {
|
||||
reply.append((!reply.isEmpty()) ? " " : "");
|
||||
reply.append((!reply.isEmpty()) ? "\n" : "");
|
||||
reply.append("Password " + arr.at(0).toString() + ".");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
const char* OculusAPIPlugin::NAME { "Oculus Rift" };
|
||||
|
||||
OculusAPIPlugin::OculusAPIPlugin() {
|
||||
_session = hifi::ovr::acquireRenderSession();
|
||||
}
|
||||
|
||||
OculusAPIPlugin::~OculusAPIPlugin() {
|
||||
hifi::ovr::releaseRenderSession(_session);
|
||||
}
|
||||
|
||||
bool OculusAPIPlugin::isRunning() {
|
||||
|
|
|
@ -34,4 +34,5 @@ private:
|
|||
bool _nonceChanged{ false };
|
||||
QString _user;
|
||||
ovrID _userID;
|
||||
ovrSession _session;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue