History

remove unused AccountScriptingInterface functions and merge/wrap the rest into GlobalServicesScriptingInterface

David Back committed 9 years ago

Commit b60bf4f1 parent ea38b324 files · +49 −54Browse files

Showing the changes to interface/src/scripting/GlobalServicesScriptingInterface.cpp (1 of 4 files). Show all

Unified · Split

interface/src/scripting/GlobalServicesScriptingInterface.cpp+26−2
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818
1919 GlobalServicesScriptingInterface::GlobalServicesScriptingInterface() {
2020 auto accountManager = DependencyManager::get<AccountManager>();
21− connect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::myUsernameChanged);
21+ connect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::onUsernameChanged);
2222 connect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);
2323 connect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected);
2424
@@ -31,11 +31,14 @@ GlobalServicesScriptingInterface::GlobalServicesScriptingInterface() { · 6 unmodified lines
3131 auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>();
3232 connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged,
3333 this, &GlobalServicesScriptingInterface::discoverabilityModeChanged);
34+
35+ _loggedIn = isLoggedIn();
36+ emit loggedInChanged(_loggedIn);
3437 }
3538
3639 GlobalServicesScriptingInterface::~GlobalServicesScriptingInterface() {
3740 auto accountManager = DependencyManager::get<AccountManager>();
38− disconnect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::myUsernameChanged);
41+ disconnect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::onUsernameChanged);
3942 disconnect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);
4043 disconnect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected);
4144 }
@@ -49,6 +52,21 @@ const QString& GlobalServicesScriptingInterface::getUsername() const { · 7 unmodified lines
4952 return DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();
5053 }
5154
55+bool GlobalServicesScriptingInterface::isLoggedIn() {
56+ auto accountManager = DependencyManager::get<AccountManager>();
57+ return accountManager->isLoggedIn();
58+}
59+
60+bool GlobalServicesScriptingInterface::checkAndSignalForAccessToken() {
61+ auto accountManager = DependencyManager::get<AccountManager>();
62+ return accountManager->checkAndSignalForAccessToken();
63+}
64+
65+void GlobalServicesScriptingInterface::logOut() {
66+ auto accountManager = DependencyManager::get<AccountManager>();
67+ return accountManager->logout();
68+}
69+
5270 void GlobalServicesScriptingInterface::loggedOut() {
5371 emit GlobalServicesScriptingInterface::disconnected(QString("logout"));
5472 }
@@ -77,6 +95,12 @@ void GlobalServicesScriptingInterface::discoverabilityModeChanged(Discoverabilit · 22 unmodified lines
7795 emit findableByChanged(DiscoverabilityManager::findableByString(discoverabilityMode));
7896 }
7997
98+void GlobalServicesScriptingInterface::onUsernameChanged(QString username) {
99+ _loggedIn = (username != QString());
100+ emit myUsernameChanged(username);
101+ emit loggedInChanged(_loggedIn);
102+}
103+
80104 DownloadInfoResult::DownloadInfoResult() :
81105 downloading(QList<float>()),
82106 pending(0.0f)