dev feedback

This commit is contained in:
Wayne Chen 2018-12-13 13:47:07 -08:00
parent 34130778ec
commit 1ce7d8a31c
10 changed files with 68 additions and 106 deletions

View file

@ -30,6 +30,7 @@ Item {
property int fontSize: 15
property int textFieldFontSize: 18
property bool fontBold: true
readonly property var passwordImageRatio: 16 / 23
property bool keyboardEnabled: false
property bool keyboardRaised: false
@ -213,8 +214,8 @@ Item {
Image {
id: showPasswordImage
width: passwordField.height * 16 / 23
height: passwordField.height * 16 / 23
width: passwordField.height * passwordImageRatio
height: passwordField.height * passwordImageRatio
anchors {
right: parent.right
rightMargin: 8

View file

@ -28,6 +28,7 @@ Item {
property int fontSize: 15
property int textFieldFontSize: 18
property bool fontBold: true
readonly property var passwordImageRatio: 16 / 23
property bool keyboardEnabled: false
property bool keyboardRaised: false
@ -249,8 +250,8 @@ Item {
Image {
id: showPasswordImage
width: passwordField.height * 16 / 23
height: passwordField.height * 16 / 23
width: passwordField.height * passwordImageRatio
height: passwordField.height * passwordImageRatio
anchors {
right: parent.right
rightMargin: 8

View file

@ -85,35 +85,6 @@ Frame {
y: -hifi.dimensions.modalDialogTitleHeight
anchors.right: parent.right
}
// spacer for closeButton
Rectangle {
id: closeButtonSpacer
width: parent.width - closeButton.width - 50
height: 20
color: "transparent"
anchors.left: title.right
y: -hifi.dimensions.modalDialogTitleHeight
visible: window.closeButtonVisible
}
GlyphButton {
id: closeButton
visible: window.closeButtonVisible
width: 30
y: -hifi.dimensions.modalDialogTitleHeight - 20
anchors {
// top: parent.top
left: closeButtonSpacer.right
// topMargin: 10
// rightMargin: 10
}
glyph: hifi.glyphs.close
size: 23
onClicked: {
window.clickedCloseButton = true;
window.destroy();
}
}
}
Rectangle {
@ -123,5 +94,25 @@ Frame {
color: hifi.colors.lightGray
}
}
GlyphButton {
id: closeButton
visible: window.closeButtonVisible
width: 30
y: -hifi.dimensions.modalDialogTitleHeight
anchors {
top: parent.top
right: parent.right
topMargin: 10
rightMargin: 10
}
glyph: hifi.glyphs.close
size: 23
onClicked: {
window.clickedCloseButton = true;
window.destroy();
}
}
}
}

View file

@ -1785,7 +1785,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
});
connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {
#if !defined(Q_OS_ANDROID)
#if !defined(Q_OS_ANDROID) && !defined(DISABLE_QML)
// Do not show login dialog if requested not to on the command line
QString hifiNoLoginCommandLineKey = QString("--").append(HIFI_NO_LOGIN_COMMAND_LINE_KEY);
int index = arguments().indexOf(hifiNoLoginCommandLineKey);
@ -1794,7 +1794,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
return;
}
// only for non-android. QML is ready to be shown at this time.
showLoginScreen();
#else
resumeAfterLoginDialogActionTaken();
@ -5266,7 +5265,6 @@ void Application::resumeAfterLoginDialogActionTaken() {
addressManager->goToEntry();
} else {
QVariant testProperty = property(hifi::properties::TEST);
qDebug() << testProperty;
if (testProperty.isValid()) {
const auto testScript = property(hifi::properties::TEST).toUrl();
// Set last parameter to exit interface when the test script finishes, if so requested
@ -8624,14 +8622,14 @@ void Application::setShowBulletConstraintLimits(bool value) {
}
void Application::createLoginDialogOverlay() {
auto cameraPosition = _myCamera.getPosition();
auto cameraOrientation = _myCamera.getOrientation();
auto upVec = getMyAvatar()->getWorldOrientation() * Vectors::UNIT_Y;
auto headLookVec = (cameraOrientation * Vectors::FRONT);
const auto cameraPosition = _myCamera.getPosition();
const auto cameraOrientation = _myCamera.getOrientation();
const auto upVec = getMyAvatar()->getWorldOrientation() * Vectors::UNIT_Y;
const auto headLookVec = (cameraOrientation * Vectors::FRONT);
// DEFAULT_DPI / tablet scale percentage
float overlayDpi = 31.0f / (75.0f / 100.0f);
auto offset = headLookVec * 0.7f;
auto overlayPosition = (cameraPosition + offset) + (upVec * -0.1f);
const float overlayDpi = 31.0f / (75.0f / 100.0f);
const auto offset = headLookVec * 0.7f;
const auto overlayPosition = (cameraPosition + offset) + (upVec * -0.1f);
const glm::vec2 LOGIN_OVERLAY_DIMENSIONS{ 0.89f, 0.5f };
QVariantMap overlayProperties = {
@ -8652,9 +8650,11 @@ void Application::createLoginDialogOverlay() {
auto loginOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays.getOverlay(_loginDialogOverlayID));
auto keyboard = DependencyManager::get<Keyboard>().data();
if (!keyboard->getAnchorID().isNull() && !_loginDialogOverlayID.isNull()) {
const auto keyboardLocalOrientation = glm::quat(0.0f, 0.0, 1.0f, 0.25f);
const auto keyboardLocalOffset = glm::vec3(-0.4f * getMyAvatar()->getSensorToWorldScale(), -0.3f, 0.2f);
QVariantMap properties {
{ "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)) },
{ "position", vec3toVariant(loginOverlay->getWorldPosition() + keyboardLocalOffset) },
{ "orientation", quatToVariant(loginOverlay->getWorldOrientation() * keyboardLocalOrientation) },
};
overlays.editOverlay(keyboard->getAnchorID(), properties);
keyboard->setResetKeyboardPositionOnRaise(false);
@ -8670,32 +8670,28 @@ void Application::createLoginDialogOverlay() {
void Application::updateLoginDialogOverlayPosition() {
const float LOOK_AWAY_THRESHOLD_ANGLE = 40.0f;
const auto overlayOffset = glm::vec2(0.7f, -0.1f);
auto& overlays = getOverlays();
auto loginOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays.getOverlay(_loginDialogOverlayID));
auto overlayPositionVec = loginOverlay->getWorldPosition();
auto cameraPositionVec = _myCamera.getPosition();
auto cameraOrientation = _myCamera.getOrientation();
cameraOrientation = cancelOutRollAndPitch(cameraOrientation);
auto headLookVec = (cameraOrientation * Vectors::FRONT);
auto overlayToHeadVec = overlayPositionVec - cameraPositionVec;
auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI);
auto upVec = getMyAvatar()->getWorldOrientation() * Vectors::UNIT_Y;
auto offset = headLookVec * 0.7f;
auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * -0.1f);
auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180;
const auto overlayPositionVec = loginOverlay->getWorldPosition();
const auto cameraPositionVec = _myCamera.getPosition();
const auto cameraOrientation = cancelOutRollAndPitch(_myCamera.getOrientation());
const auto headLookVec = (cameraOrientation * Vectors::FRONT);
const auto overlayToHeadVec = overlayPositionVec - cameraPositionVec;
const auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI);
const auto upVec = getMyAvatar()->getWorldOrientation() * Vectors::UNIT_Y;
const auto offset = headLookVec * overlayOffset.x;
const auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * overlayOffset.y);
const auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180;
bool overlayOutOfBounds = glm::distance(overlayPositionVec, cameraPositionVec) > 1.0f;
const bool overlayOutOfBounds = glm::distance(overlayPositionVec, cameraPositionVec) > 1.0f;
if (pointAngle > LOOK_AWAY_THRESHOLD_ANGLE || overlayOutOfBounds) {
QVariantMap properties {
{"position", vec3toVariant(newOverlayPositionVec)},
{"orientation", quatToVariant(newOverlayOrientation)}
};
overlays.editOverlay(_loginDialogOverlayID, properties);
auto keyboardPositionOffsetVec = newOverlayOrientation * glm::vec3(-0.4f * getMyAvatar()->getSensorToWorldScale(), -0.3f, 0.2f);
const auto keyboardLocalOrientation = glm::quat(0.0f, 0.0, 1.0f, 0.25f);
const auto keyboardLocalOffset = glm::vec3(-0.4f * getMyAvatar()->getSensorToWorldScale(), -0.3f, 0.2f);
QVariantMap keyboardProperties {
{ "position", vec3toVariant(newOverlayPositionVec + keyboardPositionOffsetVec) },
{ "orientation", quatToVariant(newOverlayOrientation * glm::quat(0.0f, 0.0, 1.0f, 0.25f)) },
{ "position", vec3toVariant(loginOverlay->getWorldPosition() + keyboardLocalOffset) },
{ "orientation", quatToVariant(loginOverlay->getWorldOrientation() * keyboardLocalOrientation) },
};
auto keyboard = DependencyManager::get<Keyboard>().data();
overlays.editOverlay(keyboard->getAnchorID(), keyboardProperties);
@ -8709,7 +8705,6 @@ void Application::onDismissedLoginDialog() {
keyboard->setResetKeyboardPositionOnRaise(true);
if (!_loginDialogOverlayID.isNull()) {
// deleting overlay.
qDebug() << "Deleting overlay";
getOverlays().deleteOverlay(_loginDialogOverlayID);
_loginDialogOverlayID = OverlayID();
_loginStateManager.tearDown();

View file

@ -690,7 +690,6 @@ private:
bool _interstitialModeEnabled{ false };
bool _loginDialogPoppedUp = false;
// if visible before login popped up.
bool _developerMenuVisible{ false };
CameraMode _previousCameraMode;
OverlayID _loginDialogOverlayID;

View file

@ -149,12 +149,12 @@ void LoginStateManager::setUp() {
_renderStates = QList<QVariant>({halfRenderStateIdentifier, fullRenderStateIdentifier, holdRenderStateIdentifier});
_defaultRenderStates = QList<QVariant>({halfDefaultRenderStateIdentifier, fullDefaultRenderStateIdentifier, holdDefaultRenderStateIdentifier});
auto pointers = DependencyManager::get<PointerScriptingInterface>().data();
auto controller = DependencyManager::get<controller::ScriptingInterface>().data();
auto pointers = DependencyManager::get<PointerScriptingInterface>();
auto controller = DependencyManager::get<controller::ScriptingInterface>();
glm::vec3 grabPointSphereOffsetLeft { -0.04f, 0.13f, 0.039f }; // x = upward, y = forward, z = lateral
glm::vec3 grabPointSphereOffsetRight { 0.04f, 0.13f, 0.039f }; // x = upward, y = forward, z = lateral
glm::vec3 malletOffset {glm::vec3(0.0f, 0.18f - 0.050f, 0.0f)};
const glm::vec3 grabPointSphereOffsetLeft { -0.04f, 0.13f, 0.039f }; // x = upward, y = forward, z = lateral
const glm::vec3 grabPointSphereOffsetRight { 0.04f, 0.13f, 0.039f }; // x = upward, y = forward, z = lateral
const glm::vec3 malletOffset {glm::vec3(0.0f, 0.18f - 0.050f, 0.0f)};
QList<QVariant> leftPointerTriggerProperties;
QVariantMap ltClick1 {
@ -222,10 +222,10 @@ void LoginStateManager::update(const QString dominantHand, const QUuid loginOver
auto pointers = DependencyManager::get<PointerScriptingInterface>();
auto raypicks = DependencyManager::get<RayPickScriptingInterface>();
if (pointers && raypicks) {
auto rightObjectID = raypicks->getPrevRayPickResult(_rightLoginPointerID)["objectID"].toUuid();
auto leftObjectID = raypicks->getPrevRayPickResult(_leftLoginPointerID)["objectID"].toUuid();
QString leftMode = (leftObjectID.isNull() || leftObjectID != loginOverlayID) ? "" : "full";
QString rightMode = (rightObjectID.isNull() || rightObjectID != loginOverlayID) ? "" : "full";
const auto rightObjectID = raypicks->getPrevRayPickResult(_rightLoginPointerID)["objectID"].toUuid();
const auto leftObjectID = raypicks->getPrevRayPickResult(_leftLoginPointerID)["objectID"].toUuid();
const QString leftMode = (leftObjectID.isNull() || leftObjectID != loginOverlayID) ? "" : "full";
const QString rightMode = (rightObjectID.isNull() || rightObjectID != loginOverlayID) ? "" : "full";
pointers->setRenderState(_leftLoginPointerID, leftMode);
pointers->setRenderState(_rightLoginPointerID, rightMode);
if (_dominantHand == "left" && !leftObjectID.isNull()) {

View file

@ -413,7 +413,6 @@ public:
QVariant getPlayAreaRect();
QVector<glm::vec3> getSensorPositions();
// Get the position of the HMD
glm::vec3 getPosition() const;
private:

View file

@ -109,9 +109,6 @@ bool LoginDialog::isOculusStoreRunning() const {
}
void LoginDialog::dismissLoginDialog() {
// it'll only pop up once.
qDebug() << "LoginDialog::dismissLoginDialog";
QAction* loginAction = Menu::getInstance()->getActionForOption(MenuOption::Login);
Q_CHECK_PTR(loginAction);
loginAction->setEnabled(true);
@ -124,25 +121,6 @@ void LoginDialog::login(const QString& username, const QString& password) const
DependencyManager::get<AccountManager>()->requestAccessToken(username, password);
}
void LoginDialog::loginThroughOculus() {
qDebug() << "Attempting to login through Oculus";
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
DependencyManager::get<AccountManager>()->requestAccessTokenWithSteam(ticket);
});
}
}
void LoginDialog::linkOculus() {
qDebug() << "Attempting to link Oculus account";
}
void LoginDialog::loginThroughSteam() {
qDebug() << "Attempting to login through Steam";
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {

View file

@ -70,8 +70,6 @@ protected slots:
Q_INVOKABLE bool isOculusStoreRunning() const;
Q_INVOKABLE void login(const QString& username, const QString& password) const;
Q_INVOKABLE void loginThroughOculus();
Q_INVOKABLE void linkOculus();
Q_INVOKABLE void loginThroughSteam();
Q_INVOKABLE void linkSteam();
Q_INVOKABLE void createAccountFromSteam(QString username = QString());

View file

@ -232,12 +232,12 @@ void Web3DOverlay::setupQmlSurface(bool isTablet, bool isLoginDialog) {
_webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
_webSurface->getSurfaceContext()->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
_webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("KeyboardScriptingInterface", DependencyManager::get<KeyboardScriptingInterface>().data());
if (isTablet || isLoginDialog) {
_webSurface->getSurfaceContext()->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
_webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("KeyboardScriptingInterface", DependencyManager::get<KeyboardScriptingInterface>().data());
}
if (isTablet) {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
@ -545,7 +545,7 @@ void Web3DOverlay::setProperties(const QVariantMap& properties) {
* @property {boolean} visible=true - If <code>true</code>, the overlay is rendered, otherwise it is not rendered.
*
* @property {string} name="" - A friendly name for the overlay.
* @property {Vec3} position - The position of the overlay center. Synonyms: <code>p1</code>, <code>point</code>, and
* @property {Vec3} position - The position of the overlay center. Synonyms: <code>p1</code>, <code>point</code>, and
* <code>start</code>.
* @property {Vec3} localPosition - The local position of the overlay relative to its parent if the overlay has a
* <code>parentID</code> set, otherwise the same value as <code>position</code>.
@ -570,7 +570,7 @@ void Web3DOverlay::setProperties(const QVariantMap& properties) {
* @property {string} url - The URL of the Web page to display.
* @property {string} scriptURL="" - The URL of a JavaScript file to inject into the Web page.
* @property {number} dpi=30 - The dots per inch to display the Web page at, on the overlay.
* @property {Vec2} dimensions=1,1 - The size of the overlay to display the Web page on, in meters. Synonyms:
* @property {Vec2} dimensions=1,1 - The size of the overlay to display the Web page on, in meters. Synonyms:
* <code>scale</code>, <code>size</code>.
* @property {number} maxFPS=10 - The maximum update rate for the Web overlay content, in frames/second.
* @property {boolean} showKeyboardFocusHighlight=true - If <code>true</code>, the Web overlay is highlighted when it has