mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:14:34 +02:00
make sure balance is cleared on logout and re-launch
This commit is contained in:
parent
79f09605d5
commit
164d3c5fb3
3 changed files with 9 additions and 2 deletions
|
@ -3103,7 +3103,6 @@ void Application::updateWindowTitle(){
|
||||||
QString username = AccountManager::getInstance().getAccountInfo().getUsername();
|
QString username = AccountManager::getInstance().getAccountInfo().getUsername();
|
||||||
QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
|
QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
|
||||||
+ nodeList->getDomainHandler().getHostname() + buildVersion;
|
+ nodeList->getDomainHandler().getHostname() + buildVersion;
|
||||||
qDebug("Application title set to: %s", title.toStdString().c_str());
|
|
||||||
|
|
||||||
AccountManager& accountManager = AccountManager::getInstance();
|
AccountManager& accountManager = AccountManager::getInstance();
|
||||||
if (accountManager.getAccountInfo().hasBalance()) {
|
if (accountManager.getAccountInfo().hasBalance()) {
|
||||||
|
@ -3115,6 +3114,7 @@ void Application::updateWindowTitle(){
|
||||||
title += " - ₵" + creditBalanceString;
|
title += " - ₵" + creditBalanceString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug("Application title set to: %s", title.toStdString().c_str());
|
||||||
_window->setWindowTitle(title);
|
_window->setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@ DataServerAccountInfo::DataServerAccountInfo() :
|
||||||
DataServerAccountInfo::DataServerAccountInfo(const QJsonObject& jsonObject) :
|
DataServerAccountInfo::DataServerAccountInfo(const QJsonObject& jsonObject) :
|
||||||
_accessToken(jsonObject),
|
_accessToken(jsonObject),
|
||||||
_username(),
|
_username(),
|
||||||
_xmppPassword()
|
_xmppPassword(),
|
||||||
|
_balance(0),
|
||||||
|
_hasBalance(false)
|
||||||
{
|
{
|
||||||
QJsonObject userJSONObject = jsonObject["user"].toObject();
|
QJsonObject userJSONObject = jsonObject["user"].toObject();
|
||||||
setUsername(userJSONObject["username"].toString());
|
setUsername(userJSONObject["username"].toString());
|
||||||
|
@ -40,6 +42,8 @@ DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherI
|
||||||
_username = otherInfo._username;
|
_username = otherInfo._username;
|
||||||
_xmppPassword = otherInfo._xmppPassword;
|
_xmppPassword = otherInfo._xmppPassword;
|
||||||
_discourseApiKey = otherInfo._discourseApiKey;
|
_discourseApiKey = otherInfo._discourseApiKey;
|
||||||
|
_balance = otherInfo._balance;
|
||||||
|
_hasBalance = otherInfo._hasBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataServerAccountInfo& DataServerAccountInfo::operator=(const DataServerAccountInfo& otherInfo) {
|
DataServerAccountInfo& DataServerAccountInfo::operator=(const DataServerAccountInfo& otherInfo) {
|
||||||
|
@ -55,6 +59,8 @@ void DataServerAccountInfo::swap(DataServerAccountInfo& otherInfo) {
|
||||||
swap(_username, otherInfo._username);
|
swap(_username, otherInfo._username);
|
||||||
swap(_xmppPassword, otherInfo._xmppPassword);
|
swap(_xmppPassword, otherInfo._xmppPassword);
|
||||||
swap(_discourseApiKey, otherInfo._discourseApiKey);
|
swap(_discourseApiKey, otherInfo._discourseApiKey);
|
||||||
|
swap(_balance, otherInfo._balance);
|
||||||
|
swap(_hasBalance, otherInfo._hasBalance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataServerAccountInfo::setUsername(const QString& username) {
|
void DataServerAccountInfo::setUsername(const QString& username) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
quint64 getBalance() const { return _balance; }
|
quint64 getBalance() const { return _balance; }
|
||||||
void setBalance(quint64 balance);
|
void setBalance(quint64 balance);
|
||||||
bool hasBalance() const { return _hasBalance; }
|
bool hasBalance() const { return _hasBalance; }
|
||||||
|
void setHasBalance(bool hasBalance) { _hasBalance = hasBalance; }
|
||||||
Q_INVOKABLE void setBalanceFromJSON(const QJsonObject& jsonObject);
|
Q_INVOKABLE void setBalanceFromJSON(const QJsonObject& jsonObject);
|
||||||
|
|
||||||
friend QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info);
|
friend QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info);
|
||||||
|
|
Loading…
Reference in a new issue