mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
parse username returned from data-server
This commit is contained in:
parent
9d2d9c5071
commit
76e6c9342f
3 changed files with 17 additions and 3 deletions
|
@ -3928,7 +3928,8 @@ void Application::updateWindowTitle(){
|
||||||
QString buildVersion = " (build " + applicationVersion() + ")";
|
QString buildVersion = " (build " + applicationVersion() + ")";
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
|
|
||||||
QString title = QString() + nodeList->getSessionUUID().toString()
|
QString username = AccountManager::getInstance().getUsername();
|
||||||
|
QString title = QString() + (!username.isEmpty() ? username : "") + nodeList->getSessionUUID().toString()
|
||||||
+ " @ " + nodeList->getDomainInfo().getHostname() + buildVersion;
|
+ " @ " + nodeList->getDomainInfo().getHostname() + buildVersion;
|
||||||
|
|
||||||
qDebug("Application title set to: %s", title.toStdString().c_str());
|
qDebug("Application title set to: %s", title.toStdString().c_str());
|
||||||
|
|
|
@ -58,7 +58,6 @@ AccountManager::AccountManager() :
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountManager::setRootURL(const QUrl& rootURL) {
|
void AccountManager::setRootURL(const QUrl& rootURL) {
|
||||||
|
|
||||||
if (_rootURL != rootURL) {
|
if (_rootURL != rootURL) {
|
||||||
_rootURL = rootURL;
|
_rootURL = rootURL;
|
||||||
|
|
||||||
|
@ -71,6 +70,16 @@ void AccountManager::setRootURL(const QUrl& rootURL) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AccountManager::setUsername(const QString& username) {
|
||||||
|
if (_username != username) {
|
||||||
|
_username = username;
|
||||||
|
|
||||||
|
qDebug() << "Changing username to" << username;
|
||||||
|
|
||||||
|
emit usernameChanged(username);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AccountManager::authenticatedRequest(const QString& path, QNetworkAccessManager::Operation operation,
|
void AccountManager::authenticatedRequest(const QString& path, QNetworkAccessManager::Operation operation,
|
||||||
const JSONCallbackParameters& callbackParams, const QByteArray& dataByteArray) {
|
const JSONCallbackParameters& callbackParams, const QByteArray& dataByteArray) {
|
||||||
QMetaObject::invokeMethod(this, "invokedRequest",
|
QMetaObject::invokeMethod(this, "invokedRequest",
|
||||||
|
@ -224,6 +233,9 @@ void AccountManager::requestFinished() {
|
||||||
OAuthAccessToken freshAccessToken(rootObject);
|
OAuthAccessToken freshAccessToken(rootObject);
|
||||||
_accessTokens.insert(rootURL, freshAccessToken);
|
_accessTokens.insert(rootURL, freshAccessToken);
|
||||||
|
|
||||||
|
// pull username from the response
|
||||||
|
setUsername(rootObject["user"].toObject()["username"].toString());
|
||||||
|
|
||||||
emit receivedAccessToken(rootURL);
|
emit receivedAccessToken(rootURL);
|
||||||
|
|
||||||
// store this access token into the local settings
|
// store this access token into the local settings
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
void requestAccessToken(const QString& login, const QString& password);
|
void requestAccessToken(const QString& login, const QString& password);
|
||||||
|
|
||||||
const QString& getUsername() const { return _username; }
|
const QString& getUsername() const { return _username; }
|
||||||
void setUsername(const QString& username) { _username = username; }
|
void setUsername(const QString& username);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void requestFinished();
|
void requestFinished();
|
||||||
|
@ -58,6 +58,7 @@ public slots:
|
||||||
signals:
|
signals:
|
||||||
void authenticationRequired();
|
void authenticationRequired();
|
||||||
void receivedAccessToken(const QUrl& rootURL);
|
void receivedAccessToken(const QUrl& rootURL);
|
||||||
|
void usernameChanged(const QString& username);
|
||||||
private slots:
|
private slots:
|
||||||
void passSuccessToCallback();
|
void passSuccessToCallback();
|
||||||
void passErrorToCallback(QNetworkReply::NetworkError errorCode);
|
void passErrorToCallback(QNetworkReply::NetworkError errorCode);
|
||||||
|
|
Loading…
Reference in a new issue