Commit Graph
86814 Commits
Author SHA1 Message Date
Alexander Tkachev 1c823b6c1d CLOUD: Fix SavesSyncRequest
Now it would finish with error if spawned Request is nullptr.
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
Alexander Tkachev b02b16ab98 CLOUD: Document ConnectionManager's onDeleteCallback 2016-08-24 16:07:55 +06:00
Eugene Sandulenko a686049c46 GUI: Fix widget clipping 2016-08-24 16:07:55 +06:00
Eugene Sandulenko ea80e24481 GUI: Added animation classes 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 6524a8d103 GUI: Added transparency to PicWidgets 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 8c7a8116be GUI: Implemented test point method to GuiObject 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 30f7556bee GUI: Added support for alphabitmaps in picbuttons 2016-08-24 16:07:55 +06:00
Eugene Sandulenko c6e04845cc GUI: Switched GUI to draw on TransparentSurface 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 1359255ea8 GUI: Added empty dialog background 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 94bc75ae46 GUI: Implemented centering of dialog background 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 75f9b099dc GUI: Added possibility to specify scale mode for AlphaBitmaps 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 38114eb760 GUI: Plug NinePatch bitmaps into parser 2016-08-24 16:07:55 +06:00
Eugene Sandulenko ec7312ac13 GUI: Implemented more modes to autoscale 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 4474ccf814 GUI: Implemented alphabitmap autoscale 2016-08-24 16:07:55 +06:00
Eugene Sandulenko f0c52096f3 GUI: Implemented possibility to use alphabitmaps in GraphicsWidget 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 53a42ececf GUI: Added new alphabitmap image type 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 762671ccd8 GUI: Added possibility to specify several state images for PicButtonWidget 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 0281b1eba8 GUI: Added support for PNG images 2016-08-24 16:07:55 +06:00
Eugene Sandulenko 2a9cf65eeb GUI: Add mode to skip drawing of button for PicButton 2016-08-24 16:07:55 +06:00
Alexander Tkachev 00d8d23236 CLOUD: Add mutexes in Storage 2016-08-24 16:07:55 +06:00
Alexander Tkachev b3bf532211 CLOUD: Make CloudManager singleton
It's needed to ::destroy() it in main().
2016-08-24 16:07:55 +06:00
Alexander Tkachev 1f974a7a2a CLOUD: Fix ConnectionManager's destructor
It now terminates active Requests.
2016-08-24 16:07:55 +06:00
Alexander Tkachev a66322408f CLOUD: Implement Storage's isWorking()
It now keeps track of how many Requests are running.

To achieve that, we had to pass a callback to ConnectionManager, so each
Request has a callback paired with it. If that's one of Storage's
Requests, it has a callback, which would decrease a counter. When
Storage adds a Request, it also increases a counter and passes that
callback. Callback is called by ConnMan when Request is deleted.

isWorking() returns true if there is at least one Request running.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 4b3a8be0b9 CLOUD: Shorten Cloud API
touch() and isSyncing() are not needed.

remove() is not needed too, but it could be used in the future.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 06163cb8b9 CLOUD: Fix SavesSyncRequest to create saves folder 2016-08-24 16:07:55 +06:00
Alexander Tkachev 8cdde307f7 CLOUD: Add OneDriveCreateDirectoryRequest 2016-08-24 16:07:55 +06:00
Alexander Tkachev 4e7dec5500 CLOUD: Add DropboxCreateDirectoryRequest
Also add CloudManager::testFeature(), because syncSaves() now works fine
and I don't want to break it again and again with my testing requests.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 675e7a6ed1 CLOUD: Move download methods into Storage
DownloadRequest and FolderDownloadRequest are using other Storage's
methods. Thus, download() and downloadFolder() could be implemented in
base Storage class.
2016-08-24 16:07:55 +06:00
Alexander Tkachev ca85d4482a CLOUD: Use uint64 in StorageInfo
There was a warning regarding 25 GB constant.

By the way, I'm not sure how to print uint64 (%llu is available in C99
only, and gcc produces a warning about that).
2016-08-24 16:07:55 +06:00
Alexander Tkachev 0d0033fb6a CLOUD: Make syncSaves() common for all Storages
As it uses SavesSyncRequest and this request is using Storage's
upload(), download() and listDirectory(), there is no need to make
storage-dependent version of that request and so method could be
implemented in base Storage.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 13351a730d CLOUD: Add OneDrive::info()
Unfortunately, OneDrive doesn't share quota information anymore because
of some reason. I had to get as much information as I could.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 3638c8348d CLOUD: Make SavesSyncRequest work with OneDrive
It actually works fine, but small Storage::savesDirectoryPath() was
added, because Dropbox's directories must start with a slash, and
OneDrive's directories must not.

Saves sync tested and it works fine with OneDrive.
2016-08-24 16:07:55 +06:00
Alexander Tkachev b39f46788a CLOUD: Add OneDriveUploadRequest
Doesn't support server's requested ranges yet.

Commit also adds some PUT-related code in NetworkReadStream and
CurlRequest.
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
Alexander Tkachev 001b417f33 CLOUD: Fix OneDriveTokenRefresher
It was calling finish(), causing stack overflow.

Some minor changes are added also.
2016-08-24 16:07:55 +06:00
Alexander Tkachev af37ecca34 CLOUD: Make SavesSyncRequest work
It now actually read the "timestamps" file, loads and saves files as it
should, ignores Dropbox's "not_found" error.
2016-08-24 16:07:55 +06:00
Alexander Tkachev cc4512e50b COMMON: Add SaveFileManager::openRawFile()
It's needed for the cloud saves upload/sync feature.
2016-08-24 16:07:55 +06:00
Alexander Tkachev aa987e5c52 CLOUD: Add ListDirectoryStatus struct
It contains flags to indicate whether Request was interrupted or failed,
so dependent Requests may see that list is incomplete.
2016-08-24 16:07:55 +06:00
Alexander Tkachev a19fc52c32 CLOUD: Make DropboxUploadRequest use "/upload" too
If file could be uploaded in one API call, no need to create a session
(which requires at least two calls: to start and then to finish it).
2016-08-24 16:07:55 +06:00
Alexander Tkachev b9e3730ccd CLOUD: Add UploadStatus struct
It contains not just "success" flag, but also "file" struct, so the
caller can find out some information about uploaded file - like
timestamp.
2016-08-24 16:07:55 +06:00
Alexander Tkachev d917592099 CLOUD: Add DropboxUploadRequest 2016-08-24 16:07:55 +06:00
Alexander Tkachev 701b07adfb COMMON: Fix JSON to understand integers correctly 2016-08-24 16:07:55 +06:00
Alexander Tkachev c235aa29f9 CLOUD: Add SavesSyncRequest sketch
Never tested it, actually. It requires Storage to implement upload()
method and me to find some way to get saves' ReadStream.

The saveTimestamps() and loadTimestamps() part should be tested, other
parts should work fine.
2016-08-24 16:07:55 +06:00
Alexander Tkachev 1747f8ec42 CLOUD: Add "device_id" into configuration file 2016-08-24 16:07:55 +06:00
Peter Bozsó 86d5b1b2e1 Remove some unnecessary blank lines 2016-08-24 16:07:55 +06:00
Peter Bozsó 81c34adaef Fix comment formatting 2016-08-24 16:07:55 +06:00
Peter Bozsó f4dfaed19d Replace 0 constant with nullptr in getCurrentStorage() 2016-08-24 16:07:55 +06:00
Alexander Tkachev 6f35fc4272 CLOUD: Add OneDriveStorage::downloadFolder()
Just uses FolderDownloadRequest the way DropboxStorage does.
2016-08-24 16:07:55 +06:00
Alexander Tkachev b74d7a6861 CLOUD: Fix Requests destructors
I forgot to delete callbacks!
2016-08-24 16:07:55 +06:00