From 3da38ca60b65d3f1bd67b049f3c4b2a90a4d6a19 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Tue, 5 Jul 2016 15:05:30 +0600 Subject: CLOUD: Replace USE_CLOUD with USE_LIBCURL In most cases that's the right one to check. USE_CLOUD is defined when either USE_LIBCURL or USE_SDL_NET are, which means if there is no curl, USE_CLOUD still could be defined and linking errors would appear. --- gui/launcher.cpp | 6 +++--- gui/options.cpp | 22 ++++++++++++---------- gui/options.h | 6 +++--- gui/saveload-dialog.cpp | 18 +++++++++--------- gui/saveload-dialog.h | 4 ++-- gui/saveload.cpp | 2 +- 6 files changed, 30 insertions(+), 28 deletions(-) (limited to 'gui') 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 files = CloudMan.getSyncingFiles(); if (!files.empty()) { @@ -279,7 +279,7 @@ void SaveLoadChooserDialog::reflowLayout() { } void SaveLoadChooserDialog::updateSaveList() { -#ifdef USE_CLOUD +#ifdef USE_LIBCURL Common::Array 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 -- cgit v1.2.3