24 Commits

Author SHA1 Message Date
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Eugene Sandulenko
65020829fc
BACKENDS: CLOUD: Fix overridden methods 2021-11-18 22:38:42 +01:00
Alexander Tkachev
5b5a89e3e7 CLOUD: Make Network::ErrorResponse messages more verbose
This commit updates all usages of Network::ErrorResponse to specify at
least method name if not precise reason why operation failed.
2019-08-25 12:15:14 +03:00
Eugene Sandulenko
fab199d37e JANITORIAL: Make GPL headers uniform 2016-09-03 12:46:38 +02:00
Alexander Tkachev
15c6772ff7 ALL: Fix debug, warning and error usage
Added prefixes, used debug(9).
2016-08-24 16:07:55 +06:00
Eugene Sandulenko
d57fca4665 CLOUD: JANITORIAL: Fix code formatting 2016-08-24 16:07:55 +06:00
Alexander Tkachev
a30d0d1994 CLOUD: Update DownloadRequest's TODO
We need a way to reopen DumpFile if we want DownloadRequest to support
restarting.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
438ba985a4 JANITORIAL: Remove spaces at the end of the line
I knew there were some, but I wanted to fix them once, instead of doing
it all the time.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b180c73675 CLOUD: Do some refactoring/cleanup
Nothing really major.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
dfd68306de CLOUD: Upgrade FolderDownloadRequest::getProgress()
Now NetworkReadStream, which is used in DownloadRequest, which is used
in FolderDownloadRequest, returns progress information provided by
libcurl.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
1a53dccf51 CLOUD: Update DownloadRequest
It now uses a dynamically allocated 1 MB buffer.
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
4c381dafa3 CLOUD: Delete the incomplete file (when downloading) 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
eb63b50b7f CLOUD: Refactor Request
Added ErrorResponse and ErrorCallback. Each Request now has an
ErrorCallback, which should be called instead of usual callback in case
of failure.
2016-08-24 16:07:55 +06:00
Peter Bozsó
81c34adaef Fix comment formatting 2016-08-24 16:07:55 +06:00
Alexander Tkachev
98150beb38 CLOUD: Refactor ConnectionManager/Requests system
ConnectionManager now storages Request * (not generates ids for it),
Requests have control on their RequestState, RequestIdPair is now called
Response and storages Request * with some response together.

All related classes are changed to use it in more clean and
understandable way.

Request, RequestState and Response are carefully commented/documented.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
83b349a033 CLOUD: Make OneDriveStorage::download() work fine
Well, it takes two API calls instead of one now, but there are no
problems with expired token because of it.

This commit changes Storage::streamFile() to pass NetworkReadStream *
through callback.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
a7b28605a0 CLOUD: Change Request::handle()
With new ConnectionManager upgrade Requests indicate that they are
finished with RequestInfo.state. No need to use handle() return value
anymore.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
f4547f44df CLOUD: Add RequestIdPair struct
Can be used with Callback<T> (means it's still type safe). It's used to
pass not only Request id to user's callback, but also a value user
wanted.

void *data field is removed from RequestInfo.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
62ccf1f902 CLOUD: Add RequestInfo struct
ConnectionManager upgrade: it now contains a special struct for each
request, so you can access request status and data by request id.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
5f4bbe6e9e CLOUD: Add OneDrive Storage stub
Knows how to OAuth already.

This commit also adds CloudManager::addStorage(), so OneDriveStorage can
add newly created Storage and CloudManager can save it in the
configuration file.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
caaa4c5a5d CLOUD: Make DownloadRequest write to local file
Tested with .jpg file. Transfer complete, CRC-32 is the same.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
826a2a921c CLOUD: Add DownloadRequest stub
It reads the passed NetworkReadStream and prints its contents onto
console (for now). It would be writing contents into file.

To simplify work with raw NetworkReadStream there is a new CurlRequest.
It basically does nothing, but as ConnMan handles transfers only if
there is an active Request, you need some Request to get
NetworkReadStream working. Thus, there is a CurlRequest, which is active
until NetworkReadStream is completely read. CurlRequest also has useful
addHeader() and addPostField() methods in order to customize the request
easily. Use execute() method to get its NetworkReadStream.

DropboxStorage implements streamFile() and download() API methods. As
DownloadRequest is incomplete, it is not actually downloading a file,
though.
2016-08-24 16:07:55 +06:00