CLOUD: Fix SaveLoadDialogs to check USE_CLOUD

Linking was failing when disabling curl support.
This commit is contained in:
Alexander Tkachev 2016-07-05 13:30:24 +06:00
parent ad069f442c
commit 81c85b6651
3 changed files with 27 additions and 1 deletions

View file

@ -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();
}
@ -264,8 +279,10 @@ void SaveLoadChooserDialog::reflowLayout() {
}
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

View file

@ -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();

View file

@ -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