From 41e65db7d0468b01f626c6ce21a1b8e6791f58fa Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 23 May 2016 11:23:33 +0600 Subject: CLOUD: Add Storage saving mechanism In this commit CloudManager starts supporting multiple Storage. Now, in its init() it loads all the Storages and determines the current one. It now also has save() method. In that method all Storages are saved with their new saveConfig() method. CloudManager::save() not called from anywhere, though. The only one Storage that could be added is DropboxStorage in case you have no cloud-related config keys or you have no storages connected. --- backends/cloud/dropbox/dropboxstorage.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'backends/cloud/dropbox/dropboxstorage.h') diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h index 3fc38bc1bb..493fcdd25d 100644 --- a/backends/cloud/dropbox/dropboxstorage.h +++ b/backends/cloud/dropbox/dropboxstorage.h @@ -45,7 +45,23 @@ class DropboxStorage: public Cloud::Storage { public: virtual ~DropboxStorage(); - /** Returns pointer to Common::Array. */ + /** + * Storage methods, which are used by CloudManager to save + * storage in configuration file. + */ + + /** + * Save storage data using ConfMan. + * @param keyPrefix all saved keys must start with this prefix. + * @note every Storage must write keyPrefix + "type" key + * with common value (e.g. "Dropbox"). + */ + + virtual void saveConfig(Common::String keyPrefix); + + /** Public Cloud API comes down there. */ + + /** Returns Common::Array. */ virtual void listDirectory(Common::String path, FileArrayCallback callback) {} //TODO /** Calls the callback when finished. */ @@ -66,7 +82,7 @@ public: /** Calls the callback when finished. */ virtual void touch(Common::String path, BoolCallback callback) {} //TODO - /** Returns pointer to the StorageInfo struct. */ + /** Returns the StorageInfo struct. */ virtual void info(StorageInfoCallback callback); /** This method is passed into info(). (Temporary) */ @@ -82,7 +98,7 @@ public: * Load token and user id from configs and return DropboxStorage for those. * @return pointer to the newly created DropboxStorage or 0 if some problem occured. */ - static DropboxStorage *loadFromConfig(); + static DropboxStorage *loadFromConfig(Common::String keyPrefix); /** * Returns Dropbox auth link. -- cgit v1.2.3