CR feedback

This commit is contained in:
Atlante45 2016-08-09 09:46:58 -07:00
parent f08b2f9257
commit 25b60d0c62
4 changed files with 7 additions and 219 deletions
interface
libraries/steamworks-wrapper/src/steamworks-wrapper

View file

@ -1,197 +0,0 @@
Window {
id: root
HifiConstants { id: hifi }
width: 550
height: 200
anchors.centerIn: parent
resizable: true
property bool required: false
Component {
id: welcomeBody
Column {
anchors.centerIn: parent
OverlayTitle {
anchors.horizontalCenter: parent.horizontalCenter
text: "Welcomeback Atlante45!"
color: hifi.colors.baseGrayHighlight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
VerticalSpacer {}
HorizontalRule {}
MenuItem {
id: details
anchors.horizontalCenter: parent.horizontalCenter
text: "You are now signed into High Fidelity"
color: hifi.colors.baseGrayHighlight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
VerticalSpacer {}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Close"
}
}
}
Component {
id: signInBody
Column {
anchors.centerIn: parent
OverlayTitle {
anchors.horizontalCenter: parent.horizontalCenter
text: required ? "Sign In Required" : "Sign In"
color: hifi.colors.baseGrayHighlight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
VerticalSpacer {}
HorizontalRule {}
MenuItem {
id: details
anchors.horizontalCenter: parent.horizontalCenter
text: required ? "This domain's owner requires that you sign in:"
: "Sign in to access your user account:"
color: hifi.colors.baseGrayHighlight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
VerticalSpacer {}
Row {
anchors.horizontalCenter: parent.horizontalCenter
Button {
anchors.verticalCenter: parent.verticalCenter
width: undefined // invalidate so that the image's size sets the width
height: undefined // invalidate so that the image's size sets the height
style: Original.ButtonStyle {
background: Image {
id: buttonImage
source: "../images/steam-sign-in.png"
}
}
onClicked: body.sourceComponent = completeProfileBody
}
HorizontalSpacer {}
Button {
anchors.verticalCenter: parent.verticalCenter
text: "Cancel"
onClicked: required = !required
}
}
}
}
Component {
id: completeProfileBody
Column {
anchors.centerIn: parent
Row {
anchors.horizontalCenter: parent.horizontalCenter
HiFiGlyphs {
anchors.verticalCenter: parent.verticalCenter
text: hifi.glyphs.avatar
}
OverlayTitle {
anchors.verticalCenter: parent.verticalCenter
text: "Complete Your Profile"
color: hifi.colors.baseGrayHighlight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
VerticalSpacer {}
HorizontalRule {}
VerticalSpacer {}
Row {
anchors.horizontalCenter: parent.horizontalCenter
Button {
anchors.verticalCenter: parent.verticalCenter
width: 200
text: "Create your profile"
color: hifi.buttons.blue
onClicked: body.sourceComponent = welcomeBody
}
HorizontalSpacer {}
Button {
anchors.verticalCenter: parent.verticalCenter
text: "Cancel"
onClicked: body.sourceComponent = signInBody
}
}
VerticalSpacer {}
ShortcutText {
text: "Already have a High Fidelity profile? Link to an existing profile here."
color: hifi.colors.blueAccent
font.underline: true
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
}
Rectangle {
anchors.fill: root
color: hifi.colors.faintGray
radius: hifi.dimensions.borderRadius
Loader {
id: body
anchors.centerIn: parent
sourceComponent: signInBody
}
}
}

View file

@ -54,11 +54,11 @@ void LoginDialog::toggleAction() {
}
}
bool LoginDialog::isSteamRunning() {
bool LoginDialog::isSteamRunning() const {
return SteamClient::isRunning();
}
void LoginDialog::login(const QString& username, const QString& password) {
void LoginDialog::login(const QString& username, const QString& password) const {
qDebug() << "Attempting to login " << username;
DependencyManager::get<AccountManager>()->requestAccessToken(username, password);
}
@ -131,25 +131,12 @@ void LoginDialog::createAccountFromStream(QString username) {
}
void LoginDialog::openUrl(const QString& url) {
void LoginDialog::openUrl(const QString& url) const {
auto offscreenUi = DependencyManager::get<OffscreenUi>();
auto browser = offscreenUi->load("Browser.qml");
browser->setProperty("url", url);
}
void LoginDialog::sendRecoveryEmail(const QString& email) {
const QString PASSWORD_RESET_PATH = "/users/password";
QJsonObject payload;
payload.insert("user_email", QJsonValue::fromVariant(QVariant(email)));
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(PASSWORD_RESET_PATH, AccountManagerAuth::None,
QNetworkAccessManager::PostOperation, JSONCallbackParameters(),
QJsonDocument(payload).toJson());
}
void LoginDialog::linkCompleted(QNetworkReply& reply) {
emit handleLinkCompleted();
}

View file

@ -45,15 +45,14 @@ public slots:
void createFailed(QNetworkReply& reply);
protected slots:
Q_INVOKABLE bool isSteamRunning();
Q_INVOKABLE bool isSteamRunning() const;
Q_INVOKABLE void login(const QString& username, const QString& password);
Q_INVOKABLE void login(const QString& username, const QString& password) const;
Q_INVOKABLE void loginThroughSteam();
Q_INVOKABLE void linkSteam();
Q_INVOKABLE void createAccountFromStream(QString username = QString());
Q_INVOKABLE void openUrl(const QString& url);
Q_INVOKABLE void sendRecoveryEmail(const QString& email);
Q_INVOKABLE void openUrl(const QString& url) const;
};

View file

@ -301,8 +301,7 @@ void SteamClient::joinLobby(QString lobbyIdStr) {
if (!initialized) {
if (SteamAPI_IsSteamRunning()) {
init();
}
else {
} else {
qWarning() << "Steam is not running";
return;
}