CLOUD: Make DefaultSaveFileManager ignore syncing files

MetaEngines don't get "locked" files in the list, so won't try to open
these.

Save/Load dialog updates save list every time SavesSyncRequest tells it
to.
This commit is contained in:
Alexander Tkachev 2016-06-05 22:26:51 +06:00
parent 0ce7be17d3
commit 9eb4aad7fd
6 changed files with 57 additions and 13 deletions

View file

@ -35,6 +35,7 @@
#include "gui/widgets/edittext.h"
#include "graphics/scaler.h"
#include <common/savefile.h>
namespace GUI {
@ -201,12 +202,9 @@ void SaveLoadChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uin
//this dialog only gets these commands if the progress dialog was shown and user clicked "run in background"
switch (cmd) {
case kSavesSyncProgressCmd:
//TODO: unlock that save which was downloaded
break;
case kSavesSyncProgressCmd:
case kSavesSyncEndedCmd:
//TODO: ?
updateSaveList();
break;
}
}
@ -237,6 +235,7 @@ void SaveLoadChooserDialog::handleTickle() {
}
CloudMan.setSyncTarget(this);
_dialogWasShown = true;
updateSaveList();
}
}
Dialog::handleTickle();
@ -259,6 +258,11 @@ void SaveLoadChooserDialog::reflowLayout() {
Dialog::reflowLayout();
}
void SaveLoadChooserDialog::updateSaveList() {
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
g_system->getSavefileManager()->updateSavefilesList(files);
}
#ifndef DISABLE_SAVELOADCHOOSER_GRID
void SaveLoadChooserDialog::addChooserButtons() {
if (_listButton) {
@ -570,6 +574,7 @@ void SaveLoadChooserSimple::close() {
}
void SaveLoadChooserSimple::updateSaveList() {
SaveLoadChooserDialog::updateSaveList();
_saveList = _metaEngine->listSaves(_target.c_str());
int curSlot = 0;
@ -631,6 +636,7 @@ void SaveLoadChooserSimple::updateSaveList() {
}
_list->setList(saveNames, &colors);
draw();
}
// SaveLoadChooserGrid implementation
@ -726,6 +732,13 @@ void SaveLoadChooserGrid::handleMouseWheel(int x, int y, int direction) {
}
}
void SaveLoadChooserGrid::updateSaveList() {
SaveLoadChooserDialog::updateSaveList();
_saveList = _metaEngine->listSaves(_target.c_str());
updateSaves();
draw();
}
void SaveLoadChooserGrid::open() {
SaveLoadChooserDialog::open();