GUI: JANITORIAL: Fix code formatting
This commit is contained in:
parent
eb268cd14f
commit
53aa0c46f1
5 changed files with 169 additions and 93 deletions
|
@ -92,12 +92,12 @@ void DownloadDialog::close() {
|
||||||
void DownloadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
|
void DownloadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case kDownloadDialogButtonCmd:
|
case kDownloadDialogButtonCmd:
|
||||||
{
|
{
|
||||||
CloudMan.setDownloadTarget(nullptr);
|
CloudMan.setDownloadTarget(nullptr);
|
||||||
CloudMan.cancelDownload();
|
CloudMan.cancelDownload();
|
||||||
close();
|
close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kDownloadProgressCmd:
|
case kDownloadProgressCmd:
|
||||||
if (!_close) {
|
if (!_close) {
|
||||||
refreshWidgets();
|
refreshWidgets();
|
||||||
|
@ -116,16 +116,19 @@ bool DownloadDialog::selectDirectories() {
|
||||||
if (Networking::Connection::isLimited()) {
|
if (Networking::Connection::isLimited()) {
|
||||||
MessageDialog alert(_("It looks like your connection is limited. "
|
MessageDialog alert(_("It looks like your connection is limited. "
|
||||||
"Do you really want to download files with it?"), _("Yes"), _("No"));
|
"Do you really want to download files with it?"), _("Yes"), _("No"));
|
||||||
if (alert.runModal() != GUI::kMessageOK) return false;
|
if (alert.runModal() != GUI::kMessageOK)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//first user should select remote directory to download
|
//first user should select remote directory to download
|
||||||
if (_remoteBrowser->runModal() <= 0) return false;
|
if (_remoteBrowser->runModal() <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
Cloud::StorageFile remoteDirectory = _remoteBrowser->getResult();
|
Cloud::StorageFile remoteDirectory = _remoteBrowser->getResult();
|
||||||
|
|
||||||
//now user should select local directory to download into
|
//now user should select local directory to download into
|
||||||
if (_browser->runModal() <= 0) return false;
|
if (_browser->runModal() <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
Common::FSNode dir(_browser->getResult());
|
Common::FSNode dir(_browser->getResult());
|
||||||
Common::FSList files;
|
Common::FSList files;
|
||||||
|
@ -149,7 +152,8 @@ bool DownloadDialog::selectDirectories() {
|
||||||
_("Yes"),
|
_("Yes"),
|
||||||
_("No")
|
_("No")
|
||||||
);
|
);
|
||||||
if (alert.runModal() != GUI::kMessageOK) return false;
|
if (alert.runModal() != GUI::kMessageOK)
|
||||||
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,12 +165,18 @@ bool DownloadDialog::selectDirectories() {
|
||||||
if (localPath.size() && localPath.lastChar() != '/' && localPath.lastChar() != '\\') {
|
if (localPath.size() && localPath.lastChar() != '/' && localPath.lastChar() != '\\') {
|
||||||
int backslashes = 0;
|
int backslashes = 0;
|
||||||
for (uint32 i = 0; i < localPath.size(); ++i)
|
for (uint32 i = 0; i < localPath.size(); ++i)
|
||||||
if (localPath[i] == '/') --backslashes;
|
if (localPath[i] == '/')
|
||||||
else if (localPath[i] == '\\') ++backslashes;
|
--backslashes;
|
||||||
|
else if (localPath[i] == '\\')
|
||||||
|
++backslashes;
|
||||||
|
|
||||||
if (backslashes > 0) localPath += '\\' + remoteDirectory.name();
|
if (backslashes > 0)
|
||||||
else localPath += '/' + remoteDirectory.name();
|
localPath += '\\' + remoteDirectory.name();
|
||||||
} else localPath += remoteDirectory.name();
|
else
|
||||||
|
localPath += '/' + remoteDirectory.name();
|
||||||
|
} else {
|
||||||
|
localPath += remoteDirectory.name();
|
||||||
|
}
|
||||||
|
|
||||||
CloudMan.startDownload(remoteDirectory.path(), localPath);
|
CloudMan.startDownload(remoteDirectory.path(), localPath);
|
||||||
CloudMan.setDownloadTarget(this);
|
CloudMan.setDownloadTarget(this);
|
||||||
|
|
139
gui/options.cpp
139
gui/options.cpp
|
@ -1502,7 +1502,8 @@ void GlobalOptionsDialog::close() {
|
||||||
uint32 port = Networking::LocalWebserver::getPort();
|
uint32 port = Networking::LocalWebserver::getPort();
|
||||||
if (_serverPort) {
|
if (_serverPort) {
|
||||||
uint64 contents = _serverPort->getEditString().asUint64();
|
uint64 contents = _serverPort->getEditString().asUint64();
|
||||||
if (contents != 0) port = contents;
|
if (contents != 0)
|
||||||
|
port = contents;
|
||||||
}
|
}
|
||||||
ConfMan.setInt("local_server_port", port);
|
ConfMan.setInt("local_server_port", port);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1638,7 +1639,8 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
uint32 port = Networking::LocalWebserver::getPort();
|
uint32 port = Networking::LocalWebserver::getPort();
|
||||||
if (_serverPort) {
|
if (_serverPort) {
|
||||||
uint64 contents = _serverPort->getEditString().asUint64();
|
uint64 contents = _serverPort->getEditString().asUint64();
|
||||||
if (contents != 0) port = contents;
|
if (contents != 0)
|
||||||
|
port = contents;
|
||||||
}
|
}
|
||||||
ConfMan.setInt("local_server_port", port);
|
ConfMan.setInt("local_server_port", port);
|
||||||
ConfMan.flushToDisk();
|
ConfMan.flushToDisk();
|
||||||
|
@ -1656,7 +1658,8 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback)
|
new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback)
|
||||||
);
|
);
|
||||||
Common::String dir = CloudMan.savesDirectoryPath();
|
Common::String dir = CloudMan.savesDirectoryPath();
|
||||||
if (dir.lastChar() == '/') dir.deleteLastChar();
|
if (dir.lastChar() == '/')
|
||||||
|
dir.deleteLastChar();
|
||||||
CloudMan.listDirectory(
|
CloudMan.listDirectory(
|
||||||
dir,
|
dir,
|
||||||
new Common::Callback<GlobalOptionsDialog, Cloud::Storage::ListDirectoryResponse>(this, &GlobalOptionsDialog::storageListDirectoryCallback),
|
new Common::Callback<GlobalOptionsDialog, Cloud::Storage::ListDirectoryResponse>(this, &GlobalOptionsDialog::storageListDirectoryCallback),
|
||||||
|
@ -1665,30 +1668,34 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kDownloadStorageCmd:
|
case kDownloadStorageCmd:
|
||||||
{
|
{
|
||||||
DownloadDialog dialog(_selectedStorageIndex, _launcher);
|
DownloadDialog dialog(_selectedStorageIndex, _launcher);
|
||||||
dialog.runModal();
|
dialog.runModal();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_SDL_NET
|
#ifdef USE_SDL_NET
|
||||||
case kRunServerCmd:
|
case kRunServerCmd:
|
||||||
{
|
{
|
||||||
#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
|
#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
|
||||||
// save server's port
|
// save server's port
|
||||||
uint32 port = Networking::LocalWebserver::getPort();
|
uint32 port = Networking::LocalWebserver::getPort();
|
||||||
if (_serverPort) {
|
if (_serverPort) {
|
||||||
uint64 contents = _serverPort->getEditString().asUint64();
|
uint64 contents = _serverPort->getEditString().asUint64();
|
||||||
if (contents != 0) port = contents;
|
if (contents != 0)
|
||||||
}
|
port = contents;
|
||||||
ConfMan.setInt("local_server_port", port);
|
}
|
||||||
ConfMan.flushToDisk();
|
ConfMan.setInt("local_server_port", port);
|
||||||
|
ConfMan.flushToDisk();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (LocalServer.isRunning()) LocalServer.stopOnIdle();
|
if (LocalServer.isRunning())
|
||||||
else LocalServer.start();
|
LocalServer.stopOnIdle();
|
||||||
break;
|
else
|
||||||
}
|
LocalServer.start();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kServerPortClearCmd: {
|
case kServerPortClearCmd: {
|
||||||
if (_serverPort) {
|
if (_serverPort) {
|
||||||
|
@ -1787,7 +1794,8 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
if (_storageUsernameDesc) _storageUsernameDesc->setVisible(shown);
|
if (_storageUsernameDesc) _storageUsernameDesc->setVisible(shown);
|
||||||
if (_storageUsername) {
|
if (_storageUsername) {
|
||||||
Common::String username = CloudMan.getStorageUsername(_selectedStorageIndex);
|
Common::String username = CloudMan.getStorageUsername(_selectedStorageIndex);
|
||||||
if (username == "") username = _("<none>");
|
if (username == "")
|
||||||
|
username = _("<none>");
|
||||||
_storageUsername->setLabel(username);
|
_storageUsername->setLabel(username);
|
||||||
_storageUsername->setVisible(shown);
|
_storageUsername->setVisible(shown);
|
||||||
}
|
}
|
||||||
|
@ -1801,31 +1809,49 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
if (_storageLastSync) {
|
if (_storageLastSync) {
|
||||||
Common::String sync = CloudMan.getStorageLastSync(_selectedStorageIndex);
|
Common::String sync = CloudMan.getStorageLastSync(_selectedStorageIndex);
|
||||||
if (sync == "") {
|
if (sync == "") {
|
||||||
if (_selectedStorageIndex == CloudMan.getStorageIndex() && CloudMan.isSyncing()) sync = _("<right now>");
|
if (_selectedStorageIndex == CloudMan.getStorageIndex() && CloudMan.isSyncing())
|
||||||
else sync = _("<never>");
|
sync = _("<right now>");
|
||||||
|
else
|
||||||
|
sync = _("<never>");
|
||||||
}
|
}
|
||||||
_storageLastSync->setLabel(sync);
|
_storageLastSync->setLabel(sync);
|
||||||
_storageLastSync->setVisible(shown);
|
_storageLastSync->setVisible(shown);
|
||||||
}
|
}
|
||||||
if (_storageConnectButton) _storageConnectButton->setVisible(shown);
|
if (_storageConnectButton)
|
||||||
if (_storageRefreshButton) _storageRefreshButton->setVisible(shown && _selectedStorageIndex == CloudMan.getStorageIndex());
|
_storageConnectButton->setVisible(shown);
|
||||||
if (_storageDownloadButton) _storageDownloadButton->setVisible(shown && _selectedStorageIndex == CloudMan.getStorageIndex());
|
if (_storageRefreshButton)
|
||||||
if (!shown) serverLabelPosition = (_storageUsernameDesc ? _storageUsernameDesc->getRelY() : 0);
|
_storageRefreshButton->setVisible(shown && _selectedStorageIndex == CloudMan.getStorageIndex());
|
||||||
|
if (_storageDownloadButton)
|
||||||
|
_storageDownloadButton->setVisible(shown && _selectedStorageIndex == CloudMan.getStorageIndex());
|
||||||
|
if (!shown)
|
||||||
|
serverLabelPosition = (_storageUsernameDesc ? _storageUsernameDesc->getRelY() : 0);
|
||||||
#else
|
#else
|
||||||
_selectedStorageIndex = 0;
|
_selectedStorageIndex = 0;
|
||||||
|
|
||||||
if (_storagePopUpDesc) _storagePopUpDesc->setVisible(false);
|
if (_storagePopUpDesc)
|
||||||
if (_storagePopUp) _storagePopUp->setVisible(false);
|
_storagePopUpDesc->setVisible(false);
|
||||||
if (_storageUsernameDesc) _storageUsernameDesc->setVisible(false);
|
if (_storagePopUp)
|
||||||
if (_storageUsernameDesc) _storageUsernameDesc->setVisible(false);
|
_storagePopUp->setVisible(false);
|
||||||
if (_storageUsername) _storageUsername->setVisible(false);
|
if (_storageUsernameDesc)
|
||||||
if (_storageUsedSpaceDesc) _storageUsedSpaceDesc->setVisible(false);
|
_storageUsernameDesc->setVisible(false);
|
||||||
if (_storageUsedSpace) _storageUsedSpace->setVisible(false);
|
if (_storageUsernameDesc)
|
||||||
if (_storageLastSyncDesc) _storageLastSyncDesc->setVisible(false);
|
_storageUsernameDesc->setVisible(false);
|
||||||
if (_storageLastSync) _storageLastSync->setVisible(false);
|
if (_storageUsername)
|
||||||
if (_storageConnectButton) _storageConnectButton->setVisible(false);
|
_storageUsername->setVisible(false);
|
||||||
if (_storageRefreshButton) _storageRefreshButton->setVisible(false);
|
if (_storageUsedSpaceDesc)
|
||||||
if (_storageDownloadButton) _storageDownloadButton->setVisible(false);
|
_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);
|
serverLabelPosition = (_storagePopUpDesc ? _storagePopUpDesc->getRelY() : 0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1852,7 +1878,8 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
|
|
||||||
bool serverIsRunning = LocalServer.isRunning();
|
bool serverIsRunning = LocalServer.isRunning();
|
||||||
|
|
||||||
if (serverLabelPosition < 0) serverLabelPosition = serverInfoY;
|
if (serverLabelPosition < 0)
|
||||||
|
serverLabelPosition = serverInfoY;
|
||||||
if (_runServerButton) {
|
if (_runServerButton) {
|
||||||
_runServerButton->setVisible(true);
|
_runServerButton->setVisible(true);
|
||||||
_runServerButton->setPos(_runServerButton->getRelX(), serverLabelPosition + serverButtonY - serverInfoY);
|
_runServerButton->setPos(_runServerButton->getRelX(), serverLabelPosition + serverButtonY - serverInfoY);
|
||||||
|
@ -1861,8 +1888,10 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
if (_serverInfoLabel) {
|
if (_serverInfoLabel) {
|
||||||
_serverInfoLabel->setVisible(true);
|
_serverInfoLabel->setVisible(true);
|
||||||
_serverInfoLabel->setPos(_serverInfoLabel->getRelX(), serverLabelPosition);
|
_serverInfoLabel->setPos(_serverInfoLabel->getRelX(), serverLabelPosition);
|
||||||
if (serverIsRunning) _serverInfoLabel->setLabel(LocalServer.getAddress());
|
if (serverIsRunning)
|
||||||
else _serverInfoLabel->setLabel(_("Not running"));
|
_serverInfoLabel->setLabel(LocalServer.getAddress());
|
||||||
|
else
|
||||||
|
_serverInfoLabel->setLabel(_("Not running"));
|
||||||
}
|
}
|
||||||
#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
|
#ifdef NETWORKING_LOCALWEBSERVER_ENABLE_PORT_OVERRIDE
|
||||||
if (_serverPortDesc) {
|
if (_serverPortDesc) {
|
||||||
|
@ -1881,16 +1910,24 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
_serverPortClearButton->setEnabled(!serverIsRunning);
|
_serverPortClearButton->setEnabled(!serverIsRunning);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (_serverPortDesc) _serverPortDesc->setVisible(false);
|
if (_serverPortDesc)
|
||||||
if (_serverPort) _serverPort->setVisible(false);
|
_serverPortDesc->setVisible(false);
|
||||||
if (_serverPortClearButton) _serverPortClearButton->setVisible(false);
|
if (_serverPort)
|
||||||
|
_serverPort->setVisible(false);
|
||||||
|
if (_serverPortClearButton)
|
||||||
|
_serverPortClearButton->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
if (_runServerButton) _runServerButton->setVisible(false);
|
if (_runServerButton)
|
||||||
if (_serverInfoLabel) _serverInfoLabel->setVisible(false);
|
_runServerButton->setVisible(false);
|
||||||
if (_serverPortDesc) _serverPortDesc->setVisible(false);
|
if (_serverInfoLabel)
|
||||||
if (_serverPort) _serverPort->setVisible(false);
|
_serverInfoLabel->setVisible(false);
|
||||||
if (_serverPortClearButton) _serverPortClearButton->setVisible(false);
|
if (_serverPortDesc)
|
||||||
|
_serverPortDesc->setVisible(false);
|
||||||
|
if (_serverPort)
|
||||||
|
_serverPort->setVisible(false);
|
||||||
|
if (_serverPortClearButton)
|
||||||
|
_serverPortClearButton->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -135,8 +135,10 @@ void RemoteBrowserDialog::handleTickle() {
|
||||||
void RemoteBrowserDialog::updateListing() {
|
void RemoteBrowserDialog::updateListing() {
|
||||||
// Update the path display
|
// Update the path display
|
||||||
Common::String path = _node.path();
|
Common::String path = _node.path();
|
||||||
if (path.empty()) path = "/"; //root
|
if (path.empty())
|
||||||
if (_navigationLocked) path = "Loading... " + path;
|
path = "/"; //root
|
||||||
|
if (_navigationLocked)
|
||||||
|
path = "Loading... " + path;
|
||||||
_currentPath->setLabel(path);
|
_currentPath->setLabel(path);
|
||||||
|
|
||||||
if (!_navigationLocked) {
|
if (!_navigationLocked) {
|
||||||
|
@ -168,7 +170,8 @@ void RemoteBrowserDialog::goUp() {
|
||||||
_rememberedNodeContents.erase(_node.path());
|
_rememberedNodeContents.erase(_node.path());
|
||||||
|
|
||||||
Common::String path = _node.path();
|
Common::String path = _node.path();
|
||||||
if (path.size() && (path.lastChar() == '/' || path.lastChar() == '\\')) path.deleteLastChar();
|
if (path.size() && (path.lastChar() == '/' || path.lastChar() == '\\'))
|
||||||
|
path.deleteLastChar();
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
_rememberedNodeContents.erase("");
|
_rememberedNodeContents.erase("");
|
||||||
} else {
|
} else {
|
||||||
|
@ -183,7 +186,8 @@ void RemoteBrowserDialog::goUp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {
|
void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {
|
||||||
if (_navigationLocked || _workingRequest) return;
|
if (_navigationLocked || _workingRequest)
|
||||||
|
return;
|
||||||
|
|
||||||
if (_rememberedNodeContents.contains(node.path())) {
|
if (_rememberedNodeContents.contains(node.path())) {
|
||||||
_nodeContent = _rememberedNodeContents[node.path()];
|
_nodeContent = _rememberedNodeContents[node.path()];
|
||||||
|
@ -205,7 +209,8 @@ void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {
|
||||||
|
|
||||||
void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryResponse response) {
|
void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryResponse response) {
|
||||||
_workingRequest = nullptr;
|
_workingRequest = nullptr;
|
||||||
if (_ignoreCallback) return;
|
if (_ignoreCallback)
|
||||||
|
return;
|
||||||
|
|
||||||
_navigationLocked = false;
|
_navigationLocked = false;
|
||||||
_nodeContent = response.value;
|
_nodeContent = response.value;
|
||||||
|
@ -215,7 +220,8 @@ void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryR
|
||||||
|
|
||||||
void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse error) {
|
void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse error) {
|
||||||
_workingRequest = nullptr;
|
_workingRequest = nullptr;
|
||||||
if (_ignoreCallback) return;
|
if (_ignoreCallback)
|
||||||
|
return;
|
||||||
|
|
||||||
_navigationLocked = false;
|
_navigationLocked = false;
|
||||||
_node = _backupNode;
|
_node = _backupNode;
|
||||||
|
|
|
@ -111,9 +111,9 @@ SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine &metaEngine) {
|
||||||
g_gui.checkScreenChange();
|
g_gui.checkScreenChange();
|
||||||
|
|
||||||
if (g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400
|
if (g_gui.getWidth() >= 640 && g_gui.getHeight() >= 400
|
||||||
&& metaEngine.hasFeature(MetaEngine::kSavesSupportMetaInfo)
|
&& metaEngine.hasFeature(MetaEngine::kSavesSupportMetaInfo)
|
||||||
&& metaEngine.hasFeature(MetaEngine::kSavesSupportThumbnail)
|
&& metaEngine.hasFeature(MetaEngine::kSavesSupportThumbnail)
|
||||||
&& userConfig.equalsIgnoreCase("grid")) {
|
&& userConfig.equalsIgnoreCase("grid")) {
|
||||||
// In case we are 640x400 or higher, this dialog is not in save mode,
|
// In case we are 640x400 or higher, this dialog is not in save mode,
|
||||||
// the user requested the grid dialog and the engines supports it we
|
// the user requested the grid dialog and the engines supports it we
|
||||||
// try to set it up.
|
// try to set it up.
|
||||||
|
@ -232,7 +232,8 @@ void SaveLoadChooserDialog::runSaveSync(bool hasSavepathOverride) {
|
||||||
ConnMan.showCloudDisabledIcon();
|
ConnMan.showCloudDisabledIcon();
|
||||||
} else {
|
} else {
|
||||||
Cloud::SavesSyncRequest *request = CloudMan.syncSaves();
|
Cloud::SavesSyncRequest *request = CloudMan.syncSaves();
|
||||||
if (request) request->setTarget(this);
|
if (request)
|
||||||
|
request->setTarget(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,13 +297,15 @@ void SaveLoadChooserDialog::listSaves() {
|
||||||
Common::String pattern = _target + ".###";
|
Common::String pattern = _target + ".###";
|
||||||
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
|
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
|
||||||
for (uint32 i = 0; i < files.size(); ++i) {
|
for (uint32 i = 0; i < files.size(); ++i) {
|
||||||
if (!files[i].matchString(pattern, true)) continue;
|
if (!files[i].matchString(pattern, true))
|
||||||
|
continue;
|
||||||
|
|
||||||
//make up some slot number
|
//make up some slot number
|
||||||
int slotNum = 0;
|
int slotNum = 0;
|
||||||
for (uint32 j = (files[i].size() > 3 ? files[i].size() - 3 : 0); j < files[i].size(); ++j) { //3 last chars
|
for (uint32 j = (files[i].size() > 3 ? files[i].size() - 3 : 0); j < files[i].size(); ++j) { //3 last chars
|
||||||
char c = files[i][j];
|
char c = files[i][j];
|
||||||
if (c < '0' || c > '9') continue;
|
if (c < '0' || c > '9')
|
||||||
|
continue;
|
||||||
slotNum = slotNum * 10 + (c - '0');
|
slotNum = slotNum * 10 + (c - '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,15 +80,18 @@ void StorageWizardDialog::open() {
|
||||||
|
|
||||||
MessageDialog alert(_("The other Storage is working. Do you want to interrupt it?"), _("Yes"), _("No"));
|
MessageDialog alert(_("The other Storage is working. Do you want to interrupt it?"), _("Yes"), _("No"));
|
||||||
if (alert.runModal() == GUI::kMessageOK) {
|
if (alert.runModal() == GUI::kMessageOK) {
|
||||||
if (CloudMan.isDownloading()) CloudMan.cancelDownload();
|
if (CloudMan.isDownloading())
|
||||||
if (CloudMan.isSyncing()) CloudMan.cancelSync();
|
CloudMan.cancelDownload();
|
||||||
|
if (CloudMan.isSyncing())
|
||||||
|
CloudMan.cancelSync();
|
||||||
|
|
||||||
// I believe it still would return `true` here, but just in case
|
// I believe it still would return `true` here, but just in case
|
||||||
if (CloudMan.isWorking()) {
|
if (CloudMan.isWorking()) {
|
||||||
MessageDialog alert2(_("Wait until current Storage finishes up and try again."));
|
MessageDialog alert2(_("Wait until current Storage finishes up and try again."));
|
||||||
alert2.runModal();
|
alert2.runModal();
|
||||||
} else
|
} else {
|
||||||
doClose = false;
|
doClose = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doClose) {
|
if (doClose) {
|
||||||
|
@ -106,7 +109,8 @@ void StorageWizardDialog::open() {
|
||||||
|
|
||||||
void StorageWizardDialog::close() {
|
void StorageWizardDialog::close() {
|
||||||
if (Cloud::CloudManager::couldUseLocalServer()) {
|
if (Cloud::CloudManager::couldUseLocalServer()) {
|
||||||
if (_stopServerOnClose) LocalServer.stopOnIdle();
|
if (_stopServerOnClose)
|
||||||
|
LocalServer.stopOnIdle();
|
||||||
LocalServer.indexPageHandler().setTarget(nullptr);
|
LocalServer.indexPageHandler().setTarget(nullptr);
|
||||||
}
|
}
|
||||||
Dialog::close();
|
Dialog::close();
|
||||||
|
@ -139,8 +143,10 @@ void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
|
|
||||||
if (message.size() > 0) {
|
if (message.size() > 0) {
|
||||||
Common::String messageTemplate;
|
Common::String messageTemplate;
|
||||||
if (CODE_FIELDS - correctFields == 1) messageTemplate = _("Field %s has a mistake in it.");
|
if (CODE_FIELDS - correctFields == 1)
|
||||||
else messageTemplate = _("Fields %s have mistakes in them.");
|
messageTemplate = _("Field %s has a mistake in it.");
|
||||||
|
else
|
||||||
|
messageTemplate = _("Fields %s have mistakes in them.");
|
||||||
message = Common::String::format(messageTemplate.c_str(), message.c_str());
|
message = Common::String::format(messageTemplate.c_str(), message.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +160,10 @@ void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
uint32 crc = crc16(code);
|
uint32 crc = crc16(code);
|
||||||
ok = (crc == gotcrc);
|
ok = (crc == gotcrc);
|
||||||
}
|
}
|
||||||
if (ok) message = _("All OK!");
|
if (ok)
|
||||||
else message = _("Invalid code");
|
message = _("All OK!");
|
||||||
|
else
|
||||||
|
message = _("Invalid code");
|
||||||
}
|
}
|
||||||
_connectWidget->setEnabled(ok);
|
_connectWidget->setEnabled(ok);
|
||||||
_messageWidget->setLabel(message);
|
_messageWidget->setLabel(message);
|
||||||
|
@ -172,7 +180,8 @@ void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
Common::String code;
|
Common::String code;
|
||||||
for (uint32 i = 0; i < CODE_FIELDS; ++i) {
|
for (uint32 i = 0; i < CODE_FIELDS; ++i) {
|
||||||
Common::String subcode = _codeWidget[i]->getEditString();
|
Common::String subcode = _codeWidget[i]->getEditString();
|
||||||
if (subcode.size() == 0) continue;
|
if (subcode.size() == 0)
|
||||||
|
continue;
|
||||||
code += subcode;
|
code += subcode;
|
||||||
code.deleteLastChar();
|
code.deleteLastChar();
|
||||||
}
|
}
|
||||||
|
@ -203,13 +212,23 @@ void StorageWizardDialog::handleTickle() {
|
||||||
Common::String StorageWizardDialog::getUrl() const {
|
Common::String StorageWizardDialog::getUrl() const {
|
||||||
Common::String url = "https://www.scummvm.org/c/";
|
Common::String url = "https://www.scummvm.org/c/";
|
||||||
switch (_storageId) {
|
switch (_storageId) {
|
||||||
case Cloud::kStorageDropboxId: url += "db"; break;
|
case Cloud::kStorageDropboxId:
|
||||||
case Cloud::kStorageOneDriveId: url += "od"; break;
|
url += "db";
|
||||||
case Cloud::kStorageGoogleDriveId: url += "gd"; break;
|
break;
|
||||||
case Cloud::kStorageBoxId: url += "bx"; break;
|
case Cloud::kStorageOneDriveId:
|
||||||
|
url += "od";
|
||||||
|
break;
|
||||||
|
case Cloud::kStorageGoogleDriveId:
|
||||||
|
url += "gd";
|
||||||
|
break;
|
||||||
|
case Cloud::kStorageBoxId:
|
||||||
|
url += "bx";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cloud::CloudManager::couldUseLocalServer()) url += "s";
|
if (Cloud::CloudManager::couldUseLocalServer())
|
||||||
|
url += "s";
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +241,8 @@ int StorageWizardDialog::decodeHashchar(char c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StorageWizardDialog::correctChecksum(Common::String s) {
|
bool StorageWizardDialog::correctChecksum(Common::String s) {
|
||||||
if (s.size() == 0) return false; //no last char
|
if (s.size() == 0)
|
||||||
|
return false; //no last char
|
||||||
int providedChecksum = decodeHashchar(s.lastChar());
|
int providedChecksum = decodeHashchar(s.lastChar());
|
||||||
int calculatedChecksum = 0x2A; //any initial value would do, but it must equal to the one used on the page where these checksums were generated
|
int calculatedChecksum = 0x2A; //any initial value would do, but it must equal to the one used on the page where these checksums were generated
|
||||||
for (uint32 i = 0; i < s.size()-1; ++i) {
|
for (uint32 i = 0; i < s.size()-1; ++i) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue