diff options
-rw-r--r-- | backends/cloud/cloudmanager.cpp | 24 | ||||
-rw-r--r-- | backends/cloud/cloudmanager.h | 12 | ||||
-rw-r--r-- | backends/networking/curl/cloudicon.cpp | 5 |
3 files changed, 38 insertions, 3 deletions
diff --git a/backends/cloud/cloudmanager.cpp b/backends/cloud/cloudmanager.cpp index 92e45e8811..20d75726af 100644 --- a/backends/cloud/cloudmanager.cpp +++ b/backends/cloud/cloudmanager.cpp @@ -126,4 +126,28 @@ void CloudManager::testFeature() { if (storage) storage->info(nullptr, nullptr); } +bool CloudManager::isWorking() { + Storage *storage = getCurrentStorage(); + if (storage) return storage->isWorking(); + return false; +} + +bool CloudManager::isSyncing() { + Storage *storage = getCurrentStorage(); + if (storage) return storage->isSyncing(); + return false; +} + +double CloudManager::getSyncProgress() { + Storage *storage = getCurrentStorage(); + if (storage) return storage->getSyncProgress(); + return 1; +} + +Common::Array<Common::String> CloudManager::getSyncingFiles() { + Storage *storage = getCurrentStorage(); + if (storage) return storage->getSyncingFiles(); + return Common::Array<Common::String>(); +} + } // End of namespace Common diff --git a/backends/cloud/cloudmanager.h b/backends/cloud/cloudmanager.h index a13eeebb94..fa3a87de8b 100644 --- a/backends/cloud/cloudmanager.h +++ b/backends/cloud/cloudmanager.h @@ -77,6 +77,18 @@ public: * Starts feature testing (the one I'm working on currently). (Temporary) */ void testFeature(); + + /** Returns whether there are any requests running. */ + bool isWorking(); + + /** Returns whether there is a SavesSyncRequest running. */ + bool isSyncing(); + + /** Returns a number in [0, 1] range which represents current sync progress (1 = complete). */ + double getSyncProgress(); + + /** Returns an array of saves names which are not yet synced (thus cannot be used). */ + Common::Array<Common::String> getSyncingFiles(); }; /** Shortcut for accessing the connection manager. */ diff --git a/backends/networking/curl/cloudicon.cpp b/backends/networking/curl/cloudicon.cpp index d6a6b517ba..882b0ab34c 100644 --- a/backends/networking/curl/cloudicon.cpp +++ b/backends/networking/curl/cloudicon.cpp @@ -43,9 +43,8 @@ CloudIcon::~CloudIcon() {} bool CloudIcon::draw() { bool stop = false; initIcons(); - - Cloud::Storage *storage = CloudMan.getCurrentStorage(); - if (storage && storage->isWorking()) { + + if (CloudMan.isWorking()) { if (g_system) { if (!_wasVisible) { g_system->clearOSD(); |