aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/cloudmanager.h
diff options
context:
space:
mode:
authorBastien Bouclet2016-09-18 13:05:16 +0200
committerBastien Bouclet2016-09-18 17:54:12 +0200
commit1a1a5b5f692ac74e25b03ba2bdc09e0af3606a4a (patch)
tree462f5a2740370259327a51959a0923da4f28ed0d /backends/cloud/cloudmanager.h
parent361d84ca74b82151509378e1a5bb868b52049502 (diff)
downloadscummvm-rg350-1a1a5b5f692ac74e25b03ba2bdc09e0af3606a4a.tar.gz
scummvm-rg350-1a1a5b5f692ac74e25b03ba2bdc09e0af3606a4a.tar.bz2
scummvm-rg350-1a1a5b5f692ac74e25b03ba2bdc09e0af3606a4a.zip
CLOUD: Change the cloud icon to be updated by the main thread
The cloud manager registers itself as an event source as a mean to be polled periodically by the GUI or engine code. The periodical polling is used to update the OSD icon indicating background sync activity. Also move the cloud icon from ConnectionManager to CloudManager, allowing to decouple icon handling from network connections updates.
Diffstat (limited to 'backends/cloud/cloudmanager.h')
-rw-r--r--backends/cloud/cloudmanager.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/backends/cloud/cloudmanager.h b/backends/cloud/cloudmanager.h
index 8a99d5bebb..f58ea8373a 100644
--- a/backends/cloud/cloudmanager.h
+++ b/backends/cloud/cloudmanager.h
@@ -24,9 +24,12 @@
#define CLOUD_CLOUDMANAGER_H
#include "backends/cloud/storage.h"
+#include "backends/cloud/cloudicon.h"
+
#include "common/array.h"
#include "common/singleton.h"
#include "common/str-array.h"
+#include "common/events.h"
namespace GUI {
@@ -47,7 +50,7 @@ enum StorageID {
kStorageTotal
};
-class CloudManager : public Common::Singleton<CloudManager> {
+class CloudManager : public Common::Singleton<CloudManager>, public Common::EventSource {
static const char *const kStoragePrefix;
struct StorageConfig {
@@ -61,6 +64,8 @@ class CloudManager : public Common::Singleton<CloudManager> {
Storage *_activeStorage;
Common::Array<Storage *> _storagesToRemove;
+ CloudIcon _icon;
+
void loadStorage();
Common::String getStorageConfigName(uint32 index) const;
@@ -71,6 +76,18 @@ class CloudManager : public Common::Singleton<CloudManager> {
/** Calls the error callback with a special "no storage connected" message. */
void passNoStorageConnected(Networking::ErrorCallback errorCallback) const;
+ /**
+ * Common::EventSource interface
+ *
+ * The cloud manager registers itself as an event source even if does not
+ * actually produce events as a mean to be polled periodically by the GUI
+ * or engine code.
+ *
+ * The periodical polling is used to update the OSD icon indicating
+ * background sync activity.
+ */
+ virtual bool pollEvent(Common::Event &event) override;
+
public:
CloudManager();
virtual ~CloudManager();
@@ -233,6 +250,9 @@ public:
/** Sets SavesSyncRequest's target to given CommandReceiver. */
void setSyncTarget(GUI::CommandReceiver *target) const;
+ /** Shows a "cloud disabled" icon for three seconds. */
+ void showCloudDisabledIcon();
+
///// DownloadFolderRequest-related /////
/** Starts a folder download. */