mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Expose the username to scripts (and thus QML)
This commit is contained in:
parent
000130617e
commit
a883891197
2 changed files with 10 additions and 1 deletions
|
@ -17,7 +17,6 @@ AccountScriptingInterface::AccountScriptingInterface() {
|
|||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
connect(&accountManager, &AccountManager::balanceChanged, this,
|
||||
&AccountScriptingInterface::updateBalance);
|
||||
|
||||
}
|
||||
|
||||
AccountScriptingInterface* AccountScriptingInterface::getInstance() {
|
||||
|
@ -39,3 +38,12 @@ void AccountScriptingInterface::updateBalance() {
|
|||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
emit balanceChanged(accountManager.getAccountInfo().getBalanceInSatoshis());
|
||||
}
|
||||
|
||||
QString AccountScriptingInterface::getUsername() {
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
if (accountManager.isLoggedIn()) {
|
||||
return accountManager.getAccountInfo().getUsername();
|
||||
} else {
|
||||
return "Unknown user";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ signals:
|
|||
public slots:
|
||||
static AccountScriptingInterface* getInstance();
|
||||
float getBalance();
|
||||
QString getUsername();
|
||||
bool isLoggedIn();
|
||||
void updateBalance();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue