aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-05 13:30:24 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit81c85b6651fcb4ba2f1dc0ba2955e34cb541fc35 (patch)
tree980057e919213c41739aeb12e4d34645dc095e2b
parentad069f442ce1a042361620f30d5b313668df23c4 (diff)
downloadscummvm-rg350-81c85b6651fcb4ba2f1dc0ba2955e34cb541fc35.tar.gz
scummvm-rg350-81c85b6651fcb4ba2f1dc0ba2955e34cb541fc35.tar.bz2
scummvm-rg350-81c85b6651fcb4ba2f1dc0ba2955e34cb541fc35.zip
CLOUD: Fix SaveLoadDialogs to check USE_CLOUD
Linking was failing when disabling curl support.
-rw-r--r--gui/saveload-dialog.cpp22
-rw-r--r--gui/saveload-dialog.h4
-rw-r--r--gui/saveload.cpp2
3 files changed, 27 insertions, 1 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index eff4a5a0a3..faf6fa9dfe 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -22,9 +22,11 @@
#include "gui/saveload-dialog.h"
+#ifdef USE_CLOUD
#include "backends/cloud/cloudmanager.h"
#include "backends/cloud/savessyncrequest.h"
#include "backends/networking/curl/connectionmanager.h"
+#endif
#include "common/translation.h"
#include "common/config-manager.h"
@@ -39,6 +41,8 @@
namespace GUI {
+#ifdef USE_CLOUD
+
enum {
kCancelSyncCmd = 'PDCS',
kBackgroundSyncCmd = 'PDBS'
@@ -93,6 +97,7 @@ void SaveLoadCloudSyncProgressDialog::handleTickle() {
Dialog::handleTickle();
}
+#endif
#ifndef DISABLE_SAVELOADCHOOSER_GRID
SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine) {
@@ -152,7 +157,9 @@ SaveLoadChooserDialog::SaveLoadChooserDialog(int x, int y, int w, int h, const b
}
SaveLoadChooserDialog::~SaveLoadChooserDialog() {
+#ifdef USE_CLOUD
CloudMan.setSyncTarget(nullptr); //not that dialog, at least
+#endif
}
void SaveLoadChooserDialog::open() {
@@ -166,7 +173,9 @@ void SaveLoadChooserDialog::open() {
}
void SaveLoadChooserDialog::close() {
+#ifdef USE_CLOUD
CloudMan.setSyncTarget(nullptr); //not that dialog, at least
+#endif
Dialog::close();
}
@@ -206,14 +215,17 @@ void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uin
}
#endif // !DISABLE_SAVELOADCHOOSER_GRID
+#ifdef USE_CLOUD
if (cmd == kSavesSyncProgressCmd || cmd == kSavesSyncEndedCmd) {
//this dialog only gets these commands if the progress dialog was shown and user clicked "run in background"
return updateSaveList();
}
+#endif
return Dialog::handleCommand(sender, cmd, data);
}
+#ifdef USE_CLOUD
void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) {
if (!CloudMan.isSyncing()) {
if (hasSavepathOverride) {
@@ -224,8 +236,10 @@ void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) {
}
}
}
+#endif
void SaveLoadChooserDialog::handleTickle() {
+#ifdef USE_CLOUD
if (!_dialogWasShown && CloudMan.isSyncing()) {
Common::Array<Common::String> files = CloudMan.getSyncingFiles();
if (!files.empty()) {
@@ -243,6 +257,7 @@ void SaveLoadChooserDialog::handleTickle() {
updateSaveList();
}
}
+#endif
Dialog::handleTickle();
}
@@ -263,9 +278,11 @@ void SaveLoadChooserDialog::reflowLayout() {
Dialog::reflowLayout();
}
-void SaveLoadChooserDialog::updateSaveList() {
+void SaveLoadChooserDialog::updateSaveList() {
+#ifdef USE_CLOUD
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
g_system->getSavefileManager()->updateSavefilesList(files);
+#endif
listSaves();
}
@@ -273,6 +290,8 @@ void SaveLoadChooserDialog::listSaves() {
if (!_metaEngine) return; //very strange
_saveList = _metaEngine->listSaves(_target.c_str());
+#ifdef USE_CLOUD
+ //if there is Cloud support, add currently synced files as "locked" saves in the list
if (_metaEngine->simpleSaveNames()) {
Common::String pattern = _target + ".###";
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
@@ -294,6 +313,7 @@ void SaveLoadChooserDialog::listSaves() {
Common::sort(_saveList.begin(), _saveList.end(), SaveStateDescriptorSlotComparator());
}
+#endif
}
#ifndef DISABLE_SAVELOADCHOOSER_GRID
diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h
index 9c601fd2cb..ba2c2bea0e 100644
--- a/gui/saveload-dialog.h
+++ b/gui/saveload-dialog.h
@@ -30,6 +30,7 @@
namespace GUI {
+#ifdef USE_CLOUD
enum SaveLoadCloudSyncProgress {
kSavesSyncProgressCmd = 'SSPR',
kSavesSyncEndedCmd = 'SSEN'
@@ -46,6 +47,7 @@ public:
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
virtual void handleTickle();
};
+#endif
#define kSwitchSaveLoadDialog -2
@@ -79,7 +81,9 @@ public:
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+#ifdef USE_CLOUD
virtual void runSaveSync(bool hasSavepathOverride);
+#endif
virtual void handleTickle();
diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index b3e669899f..b08ab7fd1a 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -87,7 +87,9 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, con
if (!_impl)
return -1;
+#ifdef USE_CLOUD
_impl->runSaveSync(ConfMan.hasKey("savepath", target));
+#endif
// Set up the game domain as newly active domain, so
// target specific savepath will be checked