Showing the changes to interface/src/scripting/AccountScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -18,6 +18,8 @@ AccountScriptingInterface* AccountScriptingInterface::getInstance() { · 17 unmodified lines | ||
| 18 | 18 | auto accountManager = DependencyManager::get<AccountManager>(); |
| 19 | 19 | QObject::connect(accountManager.data(), &AccountManager::profileChanged, |
| 20 | 20 | &sharedInstance, &AccountScriptingInterface::usernameChanged); |
| 21 | + QObject::connect(accountManager.data(), &AccountManager::usernameChanged, | |
| 22 | + &sharedInstance, &AccountScriptingInterface::onUsernameChanged); | |
| 21 | 23 | return &sharedInstance; |
| 22 | 24 | } |
| 23 | 25 | |
| @@ -36,6 +38,16 @@ void AccountScriptingInterface::logOut() { · 12 unmodified lines | ||
| 36 | 38 | return accountManager->logout(); |
| 37 | 39 | } |
| 38 | 40 | |
| 41 | +AccountScriptingInterface::AccountScriptingInterface(QObject *parent): QObject(parent) { | |
| 42 | + m_loggedIn = isLoggedIn(); | |
| 43 | + emit loggedInChanged(m_loggedIn); | |
| 44 | +} | |
| 45 | + | |
| 46 | +void AccountScriptingInterface::onUsernameChanged(QString username) { | |
| 47 | + m_loggedIn = (username != QString()); | |
| 48 | + emit loggedInChanged(m_loggedIn); | |
| 49 | +} | |
| 50 | + | |
| 39 | 51 | QString AccountScriptingInterface::getUsername() { |
| 40 | 52 | auto accountManager = DependencyManager::get<AccountManager>(); |
| 41 | 53 | if (accountManager->isLoggedIn()) { |