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
18 18
19GlobalServicesScriptingInterface::GlobalServicesScriptingInterface() {19GlobalServicesScriptingInterface::GlobalServicesScriptingInterface() {
20 auto accountManager = DependencyManager::get<AccountManager>();20 auto accountManager = DependencyManager::get<AccountManager>();
21 connect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::myUsernameChanged);21 connect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::onUsernameChanged);
22 connect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);22 connect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);
23 connect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected);23 connect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected);
24 24
@@ -31,11 +31,14 @@ GlobalServicesScriptingInterface::GlobalServicesScriptingInterface() { · 6 unmodified lines
31 auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>();31 auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>();
32 connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged,32 connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged,
33 this, &GlobalServicesScriptingInterface::discoverabilityModeChanged);33 this, &GlobalServicesScriptingInterface::discoverabilityModeChanged);
34
35 _loggedIn = isLoggedIn();
36 emit loggedInChanged(_loggedIn);
34}37}
35 38
36GlobalServicesScriptingInterface::~GlobalServicesScriptingInterface() {39GlobalServicesScriptingInterface::~GlobalServicesScriptingInterface() {
37 auto accountManager = DependencyManager::get<AccountManager>();40 auto accountManager = DependencyManager::get<AccountManager>();
38 disconnect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::myUsernameChanged);41 disconnect(accountManager.data(), &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::onUsernameChanged);
39 disconnect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);42 disconnect(accountManager.data(), &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);
40 disconnect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected);43 disconnect(accountManager.data(), &AccountManager::loginComplete, this, &GlobalServicesScriptingInterface::connected);
41}44}
@@ -49,6 +52,21 @@ const QString& GlobalServicesScriptingInterface::getUsername() const { · 7 unmodified lines
49 return DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();52 return DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();
50}53}
51 54
55bool GlobalServicesScriptingInterface::isLoggedIn() {
56 auto accountManager = DependencyManager::get<AccountManager>();
57 return accountManager->isLoggedIn();
58}
59
60bool GlobalServicesScriptingInterface::checkAndSignalForAccessToken() {
61 auto accountManager = DependencyManager::get<AccountManager>();
62 return accountManager->checkAndSignalForAccessToken();
63}
64
65void GlobalServicesScriptingInterface::logOut() {
66 auto accountManager = DependencyManager::get<AccountManager>();
67 return accountManager->logout();
68}
69
52void GlobalServicesScriptingInterface::loggedOut() {70void GlobalServicesScriptingInterface::loggedOut() {
53 emit GlobalServicesScriptingInterface::disconnected(QString("logout"));71 emit GlobalServicesScriptingInterface::disconnected(QString("logout"));
54}72}
@@ -77,6 +95,12 @@ void GlobalServicesScriptingInterface::discoverabilityModeChanged(Discoverabilit · 22 unmodified lines
77 emit findableByChanged(DiscoverabilityManager::findableByString(discoverabilityMode));95 emit findableByChanged(DiscoverabilityManager::findableByString(discoverabilityMode));
78}96}
79 97
98void GlobalServicesScriptingInterface::onUsernameChanged(QString username) {
99 _loggedIn = (username != QString());
100 emit myUsernameChanged(username);
101 emit loggedInChanged(_loggedIn);
102}
103
80DownloadInfoResult::DownloadInfoResult() :104DownloadInfoResult::DownloadInfoResult() :
81 downloading(QList<float>()),105 downloading(QList<float>()),
82 pending(0.0f)106 pending(0.0f)