35 Commits

Author SHA1 Message Date
Alexander Tkachev
b180c73675 CLOUD: Do some refactoring/cleanup
Nothing really major.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
a449ddce15 CLOUD: Fix Cppcheck warnings 2016-08-24 16:07:55 +06:00
Alexander Tkachev
f743b31963 CLOUD: Fix CloudManager::connectStorage() memory leak 2016-08-24 16:07:55 +06:00
Alexander Tkachev
1d78d20fcf CLOUD: Fix Dropbox and Google Drive UploadRequests
Possible segfault there too.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b4e9e35e07 CLOUD: Cleanup in Storages 2016-08-24 16:07:55 +06:00
Alexander Tkachev
0b5bd18d85 CLOUD: Update GoogleDriveStorage
It now derives from IdStorage, so lots of GoogleDrive*Request classes
are removed and replaced with generic IdStorage*Request ones.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
a37c639986 CLOUD: Make Google Drive sort files list
GoogleDriveListDirectoryByIdRequest now uses "orderBy" field to specify
that we want the commonly used "alphabetical, folders first" order.

That's mostly needed for RemoteBrowserDialog, because Requests don't
care about the order, and this one is more user-friendly.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
f3a392359b CLOUD: Fix finishSuccess() warning 2016-08-24 16:07:55 +06:00
Alexander Tkachev
fa3ea83165 CLOUD: Fix some warnings
Mostly on format string
2016-08-24 16:07:55 +06:00
Alexander Tkachev
39eb76f8c2 CLOUD: Fix "zero-length format string" warning 2016-08-24 16:07:55 +06:00
Alexander Tkachev
1addefad7e CLOUD: Use correct redirect_uris
Usage of #ifdef there (and in StorageWizardDialog) means that ScummVM
doesn't support both local webserver and scummvm.org paths at the same
time. It's either built with SDL_net (thus supporting localhost path) or
without it (thus using scummvm.org).
2016-08-24 16:07:55 +06:00
Peter Bozsó
a8eebbe851 CLOUD: Get rid of CloudConfigHelper, use kCloudDomain where approriate 2016-08-24 16:07:55 +06:00
Alexander Tkachev
8a84263d2b CLOUD: Do saves sync on Storage connect 2016-08-24 16:07:55 +06:00
Peter Bozsó
219e565c32 CLOUD: Introduce CloudConfigHelper 2016-08-24 16:07:55 +06:00
Alexander Tkachev
dbafbf2569 CLOUD: Fix getAccessToken()
KEY and SECRET should now load before getAccessToken() uses them, so it
should work now.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
9ee2eb4e60 GUI: Add EditText in StorageWizardDialog
One can enter the code, press 'Connect' button and get a working
Storage!
2016-08-24 16:07:55 +06:00
Alexander Tkachev
3e6503743c CLOUD: Add Request::date()
Used in SavesSyncRequest to update Storage's last sync date.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
6a93e8dd09 CLOUD: Add ConnMan::urlEncode()
Tried to use it everywhere I should've use it.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
c99b24c16d COMMON: Add String::asUint64()
Instead of all these atoull() I've added everywhere.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
e6242b0be8 GUI: Add Refresh button in Options Cloud tab
Commit changes CloudManager and Storages so they would automatically
refresh the fields when the could.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
9b15ec9989 CLOUD: Update CloudManager
It now has methods to update Storage's information.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
af9930482e CLOUD: Update CloudManager
It now supports only one storage of each type. Only one Storage could be
loaded to the memory as well.

Options' Cloud tab now changes the Storage only when user pressed OK
button, giving the ability to look through the Storages without actually
changing them.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
870e96eb9c CLOUD: Update CloudManager and Storage
* Storage::name();
* CloudManager::getStorageName();
* CloudManager::getStorageIndex();
* CloudManager::listStorages();
* CloudManager::switchStorage().
2016-08-24 16:07:55 +06:00
Alexander Tkachev
1479d12652 CLOUD: Minor GoogleDriveUploadRequest fix
Just checked that out on cloud sync: Google Drive is officially
supported!
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b29497effe CLOUD: Add GoogleDriveUploadRequest
Includes NetworkReadStream PATCH method and Headers remembering feature.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
e273e3d6e8 CLOUD: Add GoogleDrive download-related requests
GoogleDriveDownloadRequest, which resolves file id and then downloads it
with GoogleDriveStorage::downloadById().

GoogleDriveStreamFileRequest, which resolves file id and then returns
file stream with GoogleDriveStorage::streamFileById().

This commit also adds GoogleDriveStorage::streamFileById() itself.

A minor GoogleDriveResolveIdRequest fix added.

With these one can download files from Google Drive.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
f0d61084da CLOUD: Update downloading in Storages
Id should be used everywhere.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
7e6a89c141 CLOUD: Update GoogleDriveStorage and StorageFile
Because of the Google Drive StorageFile now contains yet another field,
`id`. For other storages `id` == `path`, and thus all common Requests
(such as SavesSyncRequest, DownloadFolderRequest, etc) must be using
id() instead of path(). That way these Requests won't cause id resolving
which could be quite slow (when you call it for all files in the folder,
for example).
2016-08-24 16:07:55 +06:00
Alexander Tkachev
bf71ba9a1c CLOUD: Update GoogleDriveCreateDirectoryRequest
Now it also creates the "base" ScummVM directory if there is no such
directory yet. This way SavesSyncRequest works fine when no "ScummVM" or
"ScummVM/Saves" folder exist in the Google Drive.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
c968f0143c CLOUD: Make GoogleDriveResolveIdRequest case-insensitive 2016-08-24 16:07:55 +06:00
Alexander Tkachev
505d3764cb CLOUD: Fix GoogleDriveStorage to work with root folder
Now it needs another scope and uses "root" instead of "appDataFolder".
2016-08-24 16:07:55 +06:00
Alexander Tkachev
d1d71afb07 CLOUD: Add GoogleDriveListDirectoryRequest
When listing directories, you get a list of StorageFiles, which path()
is actually Google Drive id. Thus, if you list a directory recursively,
you won't be able to determine whether all files are within one
directory or have some hierarchy. I'd fix that as soon as it would be
needed.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b4b6ee0186 CLOUD: Add GoogleDriveCreateDirectory
Now we can create directories in Google Drive by path, not parent id +
directory name!
2016-08-24 16:07:55 +06:00
Alexander Tkachev
bb207ae513 CLOUD: Add GoogleDriveResolveIdRequest
GoogleDriveResolveIdRequest gets a lowercase path and searches for the
specified file's id. To do that it lists path's subdirectories one by
one with GoogleDriveListDirectoryByIdRequest.

GoogleDriveListDirectoryByIdRequest gets a Google Drive id and lists
that directory (not recursively).
2016-08-24 16:07:55 +06:00
Alexander Tkachev
da3b7bd8d9 CLOUD: Add GoogleDriveStorage
It has its own GoogleDriveTokenRefresher and knows how to do info().

This commit also contains JSON int -> long long int fix and
CurlJsonRequest '\n' -> ' ' fix.
2016-08-24 16:07:55 +06:00