diff options
-rw-r--r-- | backends/module.mk | 8 | ||||
-rw-r--r-- | backends/saves/default/default-saves.cpp | 12 | ||||
-rw-r--r-- | backends/saves/default/default-saves.h | 2 | ||||
-rw-r--r-- | backends/saves/savefile.cpp | 4 | ||||
-rw-r--r-- | base/main.cpp | 8 | ||||
-rw-r--r-- | gui/launcher.cpp | 6 | ||||
-rw-r--r-- | gui/options.cpp | 22 | ||||
-rw-r--r-- | gui/options.h | 6 | ||||
-rw-r--r-- | gui/saveload-dialog.cpp | 18 | ||||
-rw-r--r-- | gui/saveload-dialog.h | 4 | ||||
-rw-r--r-- | gui/saveload.cpp | 2 |
11 files changed, 43 insertions, 49 deletions
diff --git a/backends/module.mk b/backends/module.mk index ecdca2e0a7..ece3128d74 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -19,7 +19,7 @@ MODULE_OBJS := \ saves/default/default-saves.o \ timer/default/default-timer.o -ifdef USE_CLOUD +ifdef USE_LIBCURL MODULE_OBJS += \ cloud/cloudmanager.o \ cloud/iso8601.o \ @@ -45,11 +45,7 @@ MODULE_OBJS += \ cloud/onedrive/onedrivecreatedirectoryrequest.o \ cloud/onedrive/onedrivetokenrefresher.o \ cloud/onedrive/onedrivelistdirectoryrequest.o \ - cloud/onedrive/onedriveuploadrequest.o -endif - -ifdef USE_LIBCURL -MODULE_OBJS += \ + cloud/onedrive/onedriveuploadrequest.o \ networking/curl/connectionmanager.o \ networking/curl/networkreadstream.o \ networking/curl/cloudicon.o \ diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 06d4047a4e..7f96868934 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -27,7 +27,7 @@ #include "common/scummsys.h" -#ifdef USE_CLOUD +#ifdef USE_LIBCURL #include "backends/cloud/cloudmanager.h" #include "common/file.h" #endif @@ -47,7 +47,7 @@ #include <errno.h> // for removeSavefile() #endif -#ifdef USE_CLOUD +#ifdef USE_LIBCURL const char *DefaultSaveFileManager::TIMESTAMPS_FILENAME = "timestamps"; #endif @@ -147,7 +147,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String } } -#ifdef USE_CLOUD +#ifdef USE_LIBCURL // Update file's timestamp Common::HashMap<Common::String, uint32> timestamps = loadTimestamps(); timestamps[filename] = INVALID_TIMESTAMP; @@ -237,7 +237,7 @@ void DefaultSaveFileManager::assureCached(const Common::String &savePathName) { // Check that path exists and is usable. checkPath(Common::FSNode(savePathName)); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing if (!files.empty()) updateSavefilesList(files); //makes this cache invalid else _lockedFiles = files; @@ -278,7 +278,7 @@ void DefaultSaveFileManager::assureCached(const Common::String &savePathName) { _cachedDirectory = savePathName; } -#ifdef USE_CLOUD +#ifdef USE_LIBCURL Common::HashMap<Common::String, uint32> DefaultSaveFileManager::loadTimestamps() { Common::HashMap<Common::String, uint32> timestamps; @@ -374,6 +374,6 @@ Common::String DefaultSaveFileManager::concatWithSavesPath(Common::String name) return path + '/' + name; } -#endif // ifdef USE_CLOUD +#endif // ifdef USE_LIBCURL #endif // !defined(DISABLE_DEFAULT_SAVEFILEMANAGER) diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index e9edfb1f36..f2453810bf 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -45,7 +45,7 @@ public: virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true); virtual bool removeSavefile(const Common::String &filename); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL static const uint32 INVALID_TIMESTAMP = UINT_MAX; static const char *TIMESTAMPS_FILENAME; diff --git a/backends/saves/savefile.cpp b/backends/saves/savefile.cpp index 1f007ca713..5e983472da 100644 --- a/backends/saves/savefile.cpp +++ b/backends/saves/savefile.cpp @@ -23,7 +23,7 @@ #include "common/util.h" #include "common/savefile.h" #include "common/str.h" -#ifdef USE_CLOUD +#ifdef USE_LIBCURL #include "backends/cloud/cloudmanager.h" #endif @@ -39,7 +39,7 @@ void OutSaveFile::clearErr() { _wrapped->clearErr(); } void OutSaveFile::finalize() { _wrapped->finalize(); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL CloudMan.syncSaves(); #endif } diff --git a/base/main.cpp b/base/main.cpp index 6c91305381..dd2c3f54e6 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -66,10 +66,8 @@ #endif #include "backends/keymapper/keymapper.h" -#ifdef USE_CLOUD -#include "backends/cloud/cloudmanager.h" -#endif #ifdef USE_LIBCURL +#include "backends/cloud/cloudmanager.h" #include "backends/networking/curl/connectionmanager.h" #endif #ifdef USE_SDL_NET @@ -485,7 +483,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { } #endif -#ifdef USE_CLOUD +#ifdef USE_LIBCURL CloudMan.init(); CloudMan.syncSaves(); CloudMan.testFeature(); //TODO: remove later @@ -604,8 +602,6 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { #endif #ifdef USE_LIBCURL Networking::ConnectionManager::destroy(); -#endif -#ifdef USE_CLOUD //I think it's important to destroy it after ConnectionManager Cloud::CloudManager::destroy(); #endif diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 1ea3169f5e..309c7479a3 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -51,7 +51,7 @@ #include "gui/ThemeEval.h" #include "graphics/cursorman.h" -#ifdef USE_CLOUD +#ifdef USE_LIBCURL #include "backends/cloud/cloudmanager.h" #endif @@ -566,7 +566,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat // User made his choice... Common::FSNode dir(browser.getResult()); _savePathWidget->setLabel(dir.getPath()); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL MessageDialog warningMessage(_("Saves sync feature doesn't work with non-default directories. If you want your saves to sync, use default directory.")); warningMessage.runModal(); #endif @@ -847,7 +847,7 @@ void LauncherDialog::addGame() { if (_browser->runModal() > 0) { // User made his choice... Common::FSNode dir(_browser->getResult()); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL String selectedDirectory = dir.getPath(); String bannedDirectory = CloudMan.getDownloadLocalDirectory(); if (selectedDirectory.size() && selectedDirectory.lastChar() != '/' && selectedDirectory.lastChar() != '\\') diff --git a/gui/options.cpp b/gui/options.cpp index bf692f8fad..9d9833496f 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -44,7 +44,7 @@ #include "audio/fmopl.h" #include "downloaddialog.h" -#ifdef USE_CLOUD +#ifdef USE_LIBCURL #include "backends/cloud/cloudmanager.h" #include "gui/storagewizarddialog.h" #endif @@ -90,7 +90,7 @@ enum { }; #endif -#if defined USE_CLOUD || defined USE_SDL_NET +#ifdef USE_CLOUD enum { kConfigureStorageCmd = 'cfst', kRefreshStorageCmd = 'rfst', @@ -1266,7 +1266,7 @@ GlobalOptionsDialog::GlobalOptionsDialog() new ButtonWidget(tab, "GlobalOptions_Misc.UpdatesCheckManuallyButton", _("Check now"), 0, kUpdatesCheckCmd); #endif -#if defined USE_CLOUD || defined USE_SDL_NET +#ifdef USE_CLOUD // // 7) The cloud tab // @@ -1275,7 +1275,7 @@ GlobalOptionsDialog::GlobalOptionsDialog() else tab->addTab(_c("Cloud", "lowres")); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL _selectedStorageIndex = CloudMan.getStorageIndex(); #else _selectedStorageIndex = 0; @@ -1283,7 +1283,7 @@ GlobalOptionsDialog::GlobalOptionsDialog() _storagePopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Cloud.StoragePopupDesc", _("Storage:"), _("Active cloud storage")); _storagePopUp = new PopUpWidget(tab, "GlobalOptions_Cloud.StoragePopup"); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL Common::StringArray list = CloudMan.listStorages(); for (uint32 i = 0; i < list.size(); ++i) _storagePopUp->appendEntry(list[i], i); @@ -1463,7 +1463,7 @@ void GlobalOptionsDialog::close() { } #endif -#ifdef USE_CLOUD +#ifdef USE_LIBCURL if (CloudMan.getStorageIndex() != _selectedStorageIndex) { if (!CloudMan.switchStorage(_selectedStorageIndex)) { bool anotherStorageIsWorking = CloudMan.isWorking(); @@ -1590,7 +1590,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 } break; } -#ifdef USE_CLOUD +#ifdef USE_LIBCURL case kPopUpItemSelectedCmd: { setupCloudTab(); @@ -1694,13 +1694,15 @@ void GlobalOptionsDialog::reflowLayout() { _tabWidget->setActiveTab(activeTab); OptionsDialog::reflowLayout(); +#ifdef USE_CLOUD setupCloudTab(); +#endif } -#if defined USE_CLOUD || defined USE_SDL_NET +#ifdef USE_CLOUD void GlobalOptionsDialog::setupCloudTab() { int serverLabelPosition = -1; //no override -#ifdef USE_CLOUD +#ifdef USE_LIBCURL _selectedStorageIndex = _storagePopUp->getSelectedTag(); bool shown = (_selectedStorageIndex != Cloud::kStorageNoneId); @@ -1770,7 +1772,7 @@ void GlobalOptionsDialog::setupCloudTab() { #endif } #endif -#ifdef USE_CLOUD +#ifdef USE_LIBCURL void GlobalOptionsDialog::storageInfoCallback(Cloud::Storage::StorageInfoResponse response) { //we could've used response.value.email() //but Storage already notified CloudMan diff --git a/gui/options.h b/gui/options.h index 77470aef57..c4c70aa369 100644 --- a/gui/options.h +++ b/gui/options.h @@ -37,7 +37,7 @@ #include "gui/fluidsynth-dialog.h" #endif -#ifdef USE_CLOUD +#ifdef USE_LIBCURL #include "backends/cloud/storage.h" #endif @@ -247,7 +247,7 @@ protected: PopUpWidget *_updatesPopUp; #endif -#if defined USE_CLOUD || defined USE_SDL_NET +#ifdef USE_CLOUD // // Cloud controls // @@ -269,7 +269,7 @@ protected: void setupCloudTab(); #endif -#ifdef USE_CLOUD +#ifdef USE_LIBCURL void storageInfoCallback(Cloud::Storage::StorageInfoResponse response); void storageListDirectoryCallback(Cloud::Storage::ListDirectoryResponse response); #endif diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index faf6fa9dfe..222f637872 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -22,7 +22,7 @@ #include "gui/saveload-dialog.h" -#ifdef USE_CLOUD +#ifdef USE_LIBCURL #include "backends/cloud/cloudmanager.h" #include "backends/cloud/savessyncrequest.h" #include "backends/networking/curl/connectionmanager.h" @@ -41,7 +41,7 @@ namespace GUI { -#ifdef USE_CLOUD +#ifdef USE_LIBCURL enum { kCancelSyncCmd = 'PDCS', @@ -157,7 +157,7 @@ SaveLoadChooserDialog::SaveLoadChooserDialog(int x, int y, int w, int h, const b } SaveLoadChooserDialog::~SaveLoadChooserDialog() { -#ifdef USE_CLOUD +#ifdef USE_LIBCURL CloudMan.setSyncTarget(nullptr); //not that dialog, at least #endif } @@ -173,7 +173,7 @@ void SaveLoadChooserDialog::open() { } void SaveLoadChooserDialog::close() { -#ifdef USE_CLOUD +#ifdef USE_LIBCURL CloudMan.setSyncTarget(nullptr); //not that dialog, at least #endif Dialog::close(); @@ -215,7 +215,7 @@ void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uin } #endif // !DISABLE_SAVELOADCHOOSER_GRID -#ifdef USE_CLOUD +#ifdef USE_LIBCURL 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(); @@ -225,7 +225,7 @@ void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uin return Dialog::handleCommand(sender, cmd, data); } -#ifdef USE_CLOUD +#ifdef USE_LIBCURL void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) { if (!CloudMan.isSyncing()) { if (hasSavepathOverride) { @@ -239,7 +239,7 @@ void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) { #endif void SaveLoadChooserDialog::handleTickle() { -#ifdef USE_CLOUD +#ifdef USE_LIBCURL if (!_dialogWasShown && CloudMan.isSyncing()) { Common::Array<Common::String> files = CloudMan.getSyncingFiles(); if (!files.empty()) { @@ -279,7 +279,7 @@ void SaveLoadChooserDialog::reflowLayout() { } void SaveLoadChooserDialog::updateSaveList() { -#ifdef USE_CLOUD +#ifdef USE_LIBCURL Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing g_system->getSavefileManager()->updateSavefilesList(files); #endif @@ -290,7 +290,7 @@ void SaveLoadChooserDialog::listSaves() { if (!_metaEngine) return; //very strange _saveList = _metaEngine->listSaves(_target.c_str()); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL //if there is Cloud support, add currently synced files as "locked" saves in the list if (_metaEngine->simpleSaveNames()) { Common::String pattern = _target + ".###"; diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h index ba2c2bea0e..4e375bfc2e 100644 --- a/gui/saveload-dialog.h +++ b/gui/saveload-dialog.h @@ -30,7 +30,7 @@ namespace GUI { -#ifdef USE_CLOUD +#ifdef USE_LIBCURL enum SaveLoadCloudSyncProgress { kSavesSyncProgressCmd = 'SSPR', kSavesSyncEndedCmd = 'SSEN' @@ -81,7 +81,7 @@ public: virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); -#ifdef USE_CLOUD +#ifdef USE_LIBCURL virtual void runSaveSync(bool hasSavepathOverride); #endif diff --git a/gui/saveload.cpp b/gui/saveload.cpp index b08ab7fd1a..3072aa6082 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -87,7 +87,7 @@ int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, con if (!_impl) return -1; -#ifdef USE_CLOUD +#ifdef USE_LIBCURL _impl->runSaveSync(ConfMan.hasKey("savepath", target)); #endif |