aboutsummaryrefslogtreecommitdiff
path: root/gui/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/options.cpp')
-rw-r--r--gui/options.cpp484
1 files changed, 481 insertions, 3 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index e410971818..3f2674b016 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -42,6 +42,18 @@
#include "audio/musicplugin.h"
#include "audio/mixer.h"
#include "audio/fmopl.h"
+#include "widgets/scrollcontainer.h"
+#include "widgets/edittext.h"
+
+#ifdef USE_LIBCURL
+#include "backends/cloud/cloudmanager.h"
+#include "gui/downloaddialog.h"
+#include "gui/storagewizarddialog.h"
+#endif
+
+#ifdef USE_SDL_NET
+#include "backends/networking/sdl_net/localwebserver.h"
+#endif
namespace GUI {
@@ -84,6 +96,19 @@ enum {
};
#endif
+#ifdef USE_CLOUD
+enum {
+ kConfigureStorageCmd = 'cfst',
+ kRefreshStorageCmd = 'rfst',
+ kDownloadStorageCmd = 'dlst',
+ kRunServerCmd = 'rnsv',
+ kCloudTabContainerReflowCmd = 'ctcr',
+ kServerPortClearCmd = 'spcl',
+ kChooseRootDirCmd = 'chrp',
+ kRootPathClearCmd = 'clrp'
+};
+#endif
+
static const char *savePeriodLabels[] = { _s("Never"), _s("every 5 mins"), _s("every 10 mins"), _s("every 15 mins"), _s("every 30 mins"), 0 };
static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 };
static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11 kHz"), _s("22 kHz"), _s("44 kHz"), _s("48 kHz"), 0 };
@@ -1078,8 +1103,8 @@ void OptionsDialog::reflowLayout() {
#pragma mark -
-GlobalOptionsDialog::GlobalOptionsDialog()
- : OptionsDialog(Common::ConfigManager::kApplicationDomain, "GlobalOptions") {
+GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher)
+ : OptionsDialog(Common::ConfigManager::kApplicationDomain, "GlobalOptions"), _launcher(launcher) {
// The tab widget
TabWidget *tab = new TabWidget(this, "GlobalOptions.TabWidget");
@@ -1251,6 +1276,76 @@ GlobalOptionsDialog::GlobalOptionsDialog()
new ButtonWidget(tab, "GlobalOptions_Misc.UpdatesCheckManuallyButton", _("Check now"), 0, kUpdatesCheckCmd);
#endif
+#ifdef USE_CLOUD
+ //
+ // 7) The cloud tab
+ //
+ if (g_system->getOverlayWidth() > 320)
+ tab->addTab(_("Cloud"));
+ else
+ tab->addTab(_c("Cloud", "lowres"));
+
+ ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", kCloudTabContainerReflowCmd);
+ container->setTarget(this);
+
+#ifdef USE_LIBCURL
+ _selectedStorageIndex = CloudMan.getStorageIndex();
+#else
+ _selectedStorageIndex = 0;
+#endif
+
+ _storagePopUpDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StoragePopupDesc", _("Storage:"), _("Active cloud storage"));
+ _storagePopUp = new PopUpWidget(container, "GlobalOptions_Cloud_Container.StoragePopup");
+#ifdef USE_LIBCURL
+ Common::StringArray list = CloudMan.listStorages();
+ for (uint32 i = 0; i < list.size(); ++i)
+ _storagePopUp->appendEntry(list[i], i);
+#else
+ _storagePopUp->appendEntry(_("<none>"), 0);
+#endif
+ _storagePopUp->setSelected(_selectedStorageIndex);
+
+ _storageUsernameDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StorageUsernameDesc", _("Username:"), _("Username used by this storage"));
+ _storageUsername = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StorageUsernameLabel", "<none>");
+
+ _storageUsedSpaceDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StorageUsedSpaceDesc", _("Used space:"), _("Space used by ScummVM's saves on this storage"));
+ _storageUsedSpace = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StorageUsedSpaceLabel", "0 bytes");
+
+ _storageLastSyncDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StorageLastSyncDesc", _("Last sync time:"), _("When this storage did saves sync last time"));
+ _storageLastSync = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StorageLastSyncLabel", "<never>");
+
+ _storageConnectButton = new ButtonWidget(container, "GlobalOptions_Cloud_Container.ConnectButton", _("Connect"), _("Open wizard dialog to connect your cloud storage account"), kConfigureStorageCmd);
+ _storageRefreshButton = new ButtonWidget(container, "GlobalOptions_Cloud_Container.RefreshButton", _("Refresh"), _("Refresh current cloud storage information (username and usage)"), kRefreshStorageCmd);
+ _storageDownloadButton = new ButtonWidget(container, "GlobalOptions_Cloud_Container.DownloadButton", _("Downloads"), _("Open downloads manager dialog"), kDownloadStorageCmd);
+
+ _runServerButton = new ButtonWidget(container, "GlobalOptions_Cloud_Container.RunServerButton", _("Run server"), _("Run local webserver"), kRunServerCmd);
+ _serverInfoLabel = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.ServerInfoLabel", _("Not running"));
+
+ // Root path
+ if (g_system->getOverlayWidth() > 320)
+ _rootPathButton = new ButtonWidget(container, "GlobalOptions_Cloud_Container.RootPathButton", _("/root/ Path:"), _("Specifies where Files Manager can access to"), kChooseRootDirCmd);
+ else
+ _rootPathButton = new ButtonWidget(container, "GlobalOptions_Cloud_Container.RootPathButton", _c("/root/ Path:", "lowres"), _("Specifies where Files Manager can access to"), kChooseRootDirCmd);
+ _rootPath = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.RootPath", "/foo/bar", _("Specifies where Files Manager can access to"));
+
+ _rootPathClearButton = addClearButton(container, "GlobalOptions_Cloud_Container.RootPathClearButton", kRootPathClearCmd);
+
+#ifdef USE_SDL_NET
+ uint32 port = Networking::LocalWebserver::getPort();
+#else
+ uint32 port = 0; // the following widgets are hidden anyway
+#endif
+ _serverPortDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.ServerPortDesc", _("Server's port:"), _("Which port is used by server\nAuth with server is not available with non-default port"));
+ _serverPort = new EditTextWidget(container, "GlobalOptions_Cloud_Container.ServerPortEditText", Common::String::format("%u", port), 0);
+ _serverPortClearButton = addClearButton(container, "GlobalOptions_Cloud_Container.ServerPortClearButton", kServerPortClearCmd);
+
+ setupCloudTab();
+ _redrawCloudTab = false;
+#ifdef USE_SDL_NET
+ _serverWasRunning = false;
+#endif
+#endif
+
// Activate the first tab
tab->setActiveTab(0);
_tabWidget = tab;
@@ -1327,6 +1422,15 @@ void GlobalOptionsDialog::open() {
if (mode == ThemeEngine::kGfxDisabled)
mode = ThemeEngine::_defaultRendererMode;
_rendererPopUp->setSelectedTag(mode);
+
+#ifdef USE_CLOUD
+ Common::String rootPath(ConfMan.get("rootpath", "cloud"));
+ if (rootPath.empty() || !ConfMan.hasKey("rootpath", "cloud")) {
+ _rootPath->setLabel(_c("None", "path"));
+ } else {
+ _rootPath->setLabel(rootPath);
+ }
+#endif
}
void GlobalOptionsDialog::close() {
@@ -1357,6 +1461,14 @@ void GlobalOptionsDialog::close() {
ConfMan.removeKey("pluginspath", _domain);
#endif
+#ifdef USE_CLOUD
+ Common::String rootPath(_rootPath->getLabel());
+ if (!rootPath.empty() && (rootPath != _c("None", "path")))
+ ConfMan.set("rootpath", rootPath, "cloud");
+ else
+ ConfMan.removeKey("rootpath", "cloud");
+#endif
+
ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain);
GUI::ThemeEngine::GraphicsMode selected = (GUI::ThemeEngine::GraphicsMode)_rendererPopUp->getSelectedTag();
@@ -1402,7 +1514,38 @@ void GlobalOptionsDialog::close() {
}
#endif
+#ifdef USE_LIBCURL
+ if (CloudMan.getStorageIndex() != _selectedStorageIndex) {
+ if (!CloudMan.switchStorage(_selectedStorageIndex)) {
+ bool anotherStorageIsWorking = CloudMan.isWorking();
+ Common::String message = _("Failed to change cloud storage!");
+ if (anotherStorageIsWorking) {
+ message += "\n";
+ message += _("Current cloud storage is working at the moment.");
+ }
+ MessageDialog dialog(message);
+ dialog.runModal();
+ }
+ }
+#endif
+#ifdef USE_SDL_NET
+#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
+ // save server's port
+ uint32 port = Networking::LocalWebserver::getPort();
+ if (_serverPort) {
+ uint64 contents = _serverPort->getEditString().asUint64();
+ if (contents != 0)
+ port = contents;
+ }
+ ConfMan.setInt("local_server_port", port);
+#endif
+#endif
}
+#ifdef USE_SDL_NET
+ if (LocalServer.isRunning()) {
+ LocalServer.stop();
+ }
+#endif
OptionsDialog::close();
}
@@ -1456,6 +1599,21 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
break;
}
#endif
+#ifdef USE_CLOUD
+ case kChooseRootDirCmd: {
+ BrowserDialog browser(_("Select directory for Files Manager /root/"), true);
+ if (browser.runModal() > 0) {
+ // User made his choice...
+ Common::FSNode dir(browser.getResult());
+ Common::String path = dir.getPath();
+ if (path.empty())
+ path = "/"; // absolute root
+ _rootPath->setLabel(path);
+ draw();
+ }
+ break;
+ }
+#endif
case kThemePathClearCmd:
_themePath->setLabel(_c("None", "path"));
break;
@@ -1465,6 +1623,11 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
case kSavePathClearCmd:
_savePath->setLabel(_("Default"));
break;
+#ifdef USE_CLOUD
+ case kRootPathClearCmd:
+ _rootPath->setLabel(_c("None", "path"));
+ break;
+#endif
case kChooseSoundFontCmd: {
BrowserDialog browser(_("Select SoundFont"), false);
if (browser.runModal() > 0) {
@@ -1481,7 +1644,8 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
break;
}
- case kChooseThemeCmd: {
+ case kChooseThemeCmd:
+ {
ThemeBrowser browser;
if (browser.runModal() > 0) {
// User made his choice...
@@ -1513,6 +1677,91 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
break;
}
+#ifdef USE_CLOUD
+ case kCloudTabContainerReflowCmd:
+ setupCloudTab();
+ break;
+#endif
+#ifdef USE_LIBCURL
+ case kPopUpItemSelectedCmd:
+ {
+ //update container's scrollbar
+ reflowLayout();
+ break;
+ }
+ case kConfigureStorageCmd:
+ {
+#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
+ // save server's port
+ uint32 port = Networking::LocalWebserver::getPort();
+ if (_serverPort) {
+ uint64 contents = _serverPort->getEditString().asUint64();
+ if (contents != 0)
+ port = contents;
+ }
+ ConfMan.setInt("local_server_port", port);
+ ConfMan.flushToDisk();
+#endif
+ StorageWizardDialog dialog(_selectedStorageIndex);
+ dialog.runModal();
+ //update container's scrollbar
+ reflowLayout();
+ break;
+ }
+ case kRefreshStorageCmd:
+ {
+ CloudMan.info(
+ new Common::Callback<GlobalOptionsDialog, Cloud::Storage::StorageInfoResponse>(this, &GlobalOptionsDialog::storageInfoCallback),
+ new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback)
+ );
+ Common::String dir = CloudMan.savesDirectoryPath();
+ if (dir.lastChar() == '/')
+ dir.deleteLastChar();
+ CloudMan.listDirectory(
+ dir,
+ new Common::Callback<GlobalOptionsDialog, Cloud::Storage::ListDirectoryResponse>(this, &GlobalOptionsDialog::storageListDirectoryCallback),
+ new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback)
+ );
+ break;
+ }
+ case kDownloadStorageCmd:
+ {
+ DownloadDialog dialog(_selectedStorageIndex, _launcher);
+ dialog.runModal();
+ break;
+ }
+#endif
+#ifdef USE_SDL_NET
+ case kRunServerCmd:
+ {
+#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
+ // save server's port
+ uint32 port = Networking::LocalWebserver::getPort();
+ if (_serverPort) {
+ uint64 contents = _serverPort->getEditString().asUint64();
+ if (contents != 0)
+ port = contents;
+ }
+ ConfMan.setInt("local_server_port", port);
+ ConfMan.flushToDisk();
+#endif
+
+ if (LocalServer.isRunning())
+ LocalServer.stopOnIdle();
+ else
+ LocalServer.start();
+
+ break;
+ }
+
+ case kServerPortClearCmd: {
+ if (_serverPort) {
+ _serverPort->setEditString(Common::String::format("%u", Networking::LocalWebserver::DEFAULT_SERVER_PORT));
+ }
+ draw();
+ break;
+ }
+#endif
#ifdef GUI_ENABLE_KEYSDIALOG
case kChooseKeyMappingCmd:
_keysDialog->runModal();
@@ -1534,6 +1783,23 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
}
+void GlobalOptionsDialog::handleTickle() {
+ OptionsDialog::handleTickle();
+#ifdef USE_CLOUD
+#ifdef USE_SDL_NET
+ if (LocalServer.isRunning() != _serverWasRunning) {
+ _serverWasRunning = !_serverWasRunning;
+ _redrawCloudTab = true;
+ }
+#endif
+ if (_redrawCloudTab) {
+ setupCloudTab();
+ draw();
+ _redrawCloudTab = false;
+ }
+#endif
+}
+
void GlobalOptionsDialog::reflowLayout() {
int activeTab = _tabWidget->getActiveTab();
@@ -1567,6 +1833,218 @@ void GlobalOptionsDialog::reflowLayout() {
_tabWidget->setActiveTab(activeTab);
OptionsDialog::reflowLayout();
+#ifdef USE_CLOUD
+ setupCloudTab();
+#endif
}
+#ifdef USE_CLOUD
+void GlobalOptionsDialog::setupCloudTab() {
+ int serverLabelPosition = -1; //no override
+#ifdef USE_LIBCURL
+ _selectedStorageIndex = _storagePopUp->getSelectedTag();
+
+ if (_storagePopUpDesc) _storagePopUpDesc->setVisible(true);
+ if (_storagePopUp) _storagePopUp->setVisible(true);
+
+ bool shown = (_selectedStorageIndex != Cloud::kStorageNoneId);
+ if (_storageUsernameDesc) _storageUsernameDesc->setVisible(shown);
+ if (_storageUsername) {
+ Common::String username = CloudMan.getStorageUsername(_selectedStorageIndex);
+ if (username == "")
+ username = _("<none>");
+ _storageUsername->setLabel(username);
+ _storageUsername->setVisible(shown);
+ }
+ if (_storageUsedSpaceDesc) _storageUsedSpaceDesc->setVisible(shown);
+ if (_storageUsedSpace) {
+ uint64 usedSpace = CloudMan.getStorageUsedSpace(_selectedStorageIndex);
+ _storageUsedSpace->setLabel(Common::String::format(_("%llu bytes"), usedSpace));
+ _storageUsedSpace->setVisible(shown);
+ }
+ if (_storageLastSyncDesc) _storageLastSyncDesc->setVisible(shown);
+ if (_storageLastSync) {
+ Common::String sync = CloudMan.getStorageLastSync(_selectedStorageIndex);
+ if (sync == "") {
+ if (_selectedStorageIndex == CloudMan.getStorageIndex() && CloudMan.isSyncing())
+ sync = _("<right now>");
+ else
+ sync = _("<never>");
+ }
+ _storageLastSync->setLabel(sync);
+ _storageLastSync->setVisible(shown);
+ }
+ if (_storageConnectButton)
+ _storageConnectButton->setVisible(shown);
+ if (_storageRefreshButton)
+ _storageRefreshButton->setVisible(shown && _selectedStorageIndex == CloudMan.getStorageIndex());
+ if (_storageDownloadButton)
+ _storageDownloadButton->setVisible(shown && _selectedStorageIndex == CloudMan.getStorageIndex());
+ if (!shown)
+ serverLabelPosition = (_storageUsernameDesc ? _storageUsernameDesc->getRelY() : 0);
+#else
+ _selectedStorageIndex = 0;
+
+ if (_storagePopUpDesc)
+ _storagePopUpDesc->setVisible(false);
+ if (_storagePopUp)
+ _storagePopUp->setVisible(false);
+ if (_storageUsernameDesc)
+ _storageUsernameDesc->setVisible(false);
+ if (_storageUsernameDesc)
+ _storageUsernameDesc->setVisible(false);
+ if (_storageUsername)
+ _storageUsername->setVisible(false);
+ if (_storageUsedSpaceDesc)
+ _storageUsedSpaceDesc->setVisible(false);
+ if (_storageUsedSpace)
+ _storageUsedSpace->setVisible(false);
+ if (_storageLastSyncDesc)
+ _storageLastSyncDesc->setVisible(false);
+ if (_storageLastSync)
+ _storageLastSync->setVisible(false);
+ if (_storageConnectButton)
+ _storageConnectButton->setVisible(false);
+ if (_storageRefreshButton)
+ _storageRefreshButton->setVisible(false);
+ if (_storageDownloadButton)
+ _storageDownloadButton->setVisible(false);
+
+ serverLabelPosition = (_storagePopUpDesc ? _storagePopUpDesc->getRelY() : 0);
+#endif
+#ifdef USE_SDL_NET
+ //determine original widget's positions
+ int16 x, y;
+ uint16 w, h;
+ int serverButtonY, serverInfoY;
+ int serverRootButtonY, serverRootY, serverRootClearButtonY;
+ int serverPortDescY, serverPortY, serverPortClearButtonY;
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.RunServerButton", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.RunServerButton's position is undefined");
+ serverButtonY = y;
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.ServerInfoLabel", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.ServerInfoLabel's position is undefined");
+ serverInfoY = y;
+
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.RootPathButton", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.RootPathButton's position is undefined");
+ serverRootButtonY = y;
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.RootPath", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.RootPath's position is undefined");
+ serverRootY = y;
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.RootPathClearButton", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.RootPathClearButton's position is undefined");
+ serverRootClearButtonY = y;
+
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.ServerPortDesc", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.ServerPortDesc's position is undefined");
+ serverPortDescY = y;
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.ServerPortEditText", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.ServerPortEditText's position is undefined");
+ serverPortY = y;
+ if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.ServerPortClearButton", x, y, w, h))
+ warning("GlobalOptions_Cloud_Container.ServerPortClearButton's position is undefined");
+ serverPortClearButtonY = y;
+
+ bool serverIsRunning = LocalServer.isRunning();
+
+ if (serverLabelPosition < 0)
+ serverLabelPosition = serverInfoY;
+ if (_runServerButton) {
+ _runServerButton->setVisible(true);
+ _runServerButton->setPos(_runServerButton->getRelX(), serverLabelPosition + serverButtonY - serverInfoY);
+ _runServerButton->setLabel(_(serverIsRunning ? "Stop server" : "Run server"));
+ _runServerButton->setTooltip(_(serverIsRunning ? "Stop local webserver" : "Run local webserver"));
+ }
+ if (_serverInfoLabel) {
+ _serverInfoLabel->setVisible(true);
+ _serverInfoLabel->setPos(_serverInfoLabel->getRelX(), serverLabelPosition);
+ if (serverIsRunning)
+ _serverInfoLabel->setLabel(LocalServer.getAddress());
+ else
+ _serverInfoLabel->setLabel(_("Not running"));
+ }
+ if (_rootPathButton) {
+ _rootPathButton->setVisible(true);
+ _rootPathButton->setPos(_rootPathButton->getRelX(), serverLabelPosition + serverRootButtonY - serverInfoY);
+ }
+ if (_rootPath) {
+ _rootPath->setVisible(true);
+ _rootPath->setPos(_rootPath->getRelX(), serverLabelPosition + serverRootY - serverInfoY);
+ }
+ if (_rootPathClearButton) {
+ _rootPathClearButton->setVisible(true);
+ _rootPathClearButton->setPos(_rootPathClearButton->getRelX(), serverLabelPosition + serverRootClearButtonY - serverInfoY);
+ }
+#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
+ if (_serverPortDesc) {
+ _serverPortDesc->setVisible(true);
+ _serverPortDesc->setPos(_serverPortDesc->getRelX(), serverLabelPosition + serverPortDescY - serverInfoY);
+ _serverPortDesc->setEnabled(!serverIsRunning);
+ }
+ if (_serverPort) {
+ _serverPort->setVisible(true);
+ _serverPort->setPos(_serverPort->getRelX(), serverLabelPosition + serverPortY - serverInfoY);
+ _serverPort->setEnabled(!serverIsRunning);
+ }
+ if (_serverPortClearButton) {
+ _serverPortClearButton->setVisible(true);
+ _serverPortClearButton->setPos(_serverPortClearButton->getRelX(), serverLabelPosition + serverPortClearButtonY - serverInfoY);
+ _serverPortClearButton->setEnabled(!serverIsRunning);
+ }
+#else
+ if (_serverPortDesc)
+ _serverPortDesc->setVisible(false);
+ if (_serverPort)
+ _serverPort->setVisible(false);
+ if (_serverPortClearButton)
+ _serverPortClearButton->setVisible(false);
+#endif
+#else
+ if (_runServerButton)
+ _runServerButton->setVisible(false);
+ if (_serverInfoLabel)
+ _serverInfoLabel->setVisible(false);
+ if (_rootPathButton)
+ _rootPathButton->setVisible(false);
+ if (_rootPath)
+ _rootPath->setVisible(false);
+ if (_rootPathClearButton)
+ _rootPathClearButton->setVisible(false);
+ if (_serverPortDesc)
+ _serverPortDesc->setVisible(false);
+ if (_serverPort)
+ _serverPort->setVisible(false);
+ if (_serverPortClearButton)
+ _serverPortClearButton->setVisible(false);
+#endif
+}
+#endif
+#ifdef USE_LIBCURL
+void GlobalOptionsDialog::storageInfoCallback(Cloud::Storage::StorageInfoResponse response) {
+ //we could've used response.value.email()
+ //but Storage already notified CloudMan
+ //so we just set the flag to redraw our cloud tab
+ _redrawCloudTab = true;
+}
+
+void GlobalOptionsDialog::storageListDirectoryCallback(Cloud::Storage::ListDirectoryResponse response) {
+ Common::Array<Cloud::StorageFile> &files = response.value;
+ uint64 totalSize = 0;
+ for (uint32 i = 0; i < files.size(); ++i)
+ if (!files[i].isDirectory())
+ totalSize += files[i].size();
+ CloudMan.setStorageUsedSpace(CloudMan.getStorageIndex(), totalSize);
+ _redrawCloudTab = true;
+}
+
+void GlobalOptionsDialog::storageErrorCallback(Networking::ErrorResponse response) {
+ debug(9, "GlobalOptionsDialog: error response (%s, %ld):", (response.failed ? "failed" : "interrupted"), response.httpResponseCode);
+ debug(9, "%s", response.response.c_str());
+
+ if (!response.interrupted)
+ g_system->displayMessageOnOSD(_("Request failed.\nCheck your Internet connection."));
+}
+#endif
+
} // End of namespace GUI