Commit Graph

248 Commits

Author SHA1 Message Date
aryanrawlani28
4b6976c558 GUI: U32: Reduce number of files changed and fixes
Up until last commit, everything was working fine but the amount of files changed was too large. This commit tries to reduce the changes.

- Add a fake constructor to Keymap, text-to-speech, setDescription (save-state)
- Redirecting functions for PopUpWidget::appendEntry, ButtonWidget::setLabel, GUIErrorMessage
- Use the above functions and constructors to reduce changes in Engines
- Fix warnings being in unicode. Only output english text in - Warnings, Errors, etc.
- Mark some strings as "translation" strings. (Not yet added to POTFILES)
- Remove some CP related things from po/modules.mk
- Previously used some Common::convertToU32 where it was not necessary, replace this with u32constructor
2020-08-30 14:43:41 +02:00
aryanrawlani28
185fb72783 GUI: U32: Improve U32 code
- Revert accidentally put translations in mt32.cpp
- Use U32::format in some places earlier missed
- Add %u and %i for u32::format
- Add support for GUIErrorMsgFormat to use u32::format internally
- Use the above whereever needed
- Improve linux tts by removing redundant code
- Some places I had changed nullptr -> "". Revert this
2020-08-30 14:43:41 +02:00
aryanrawlani28
b9a449480b GUI: U32: Remove u32::format references
- Removed because implicit conversion can simply handle this usecase
2020-08-30 14:43:41 +02:00
aryanrawlani28
f800ca4ada GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes.

- Return U32String from TransMan getTranslation()
- Change tooltips to be U32Strings
- Remove temporary code of convertToU32String
- U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc)
- U32 for music plugins
- U32 for OSD messages
- Add some helper functions to ustr.cpp
- Change default tooltips from nullptr & 0 -> ""
- Some runtime exceptions may occur when changing languages due to incorrect String::Format
2020-08-30 14:43:41 +02:00
Thanasis Antoniou
f971e1e4a8 GUI: OPTIONS: Cloud storage list populated with translated string on addCloudControls()
Resolves a bug with displaying the wrong (previous) translation when switch theme language

Previously, a translated string was stored in cloudmanager _storages config items, which would become stale if the theme language was changed.
2020-02-09 22:06:19 +02:00
Bastien Bouclet
edf82fea97 CLOUD: Remove the saves sync finished OSD message
It's not very good for immersion when it appears after an autosave. The
cloud icon is a good enough indication that cloud synchronization
happened.
2019-11-15 19:32:59 +01:00
Bastien Bouclet
c847476a93 CLOUD: Only download saves when necessary
Prevents the save/load dialog from refreshing and loosing the selection
when there is no file to download.
2019-11-10 11:06:08 +01:00
D G Turner
f47a58ba64 CLOUD: Add Missing Default Switch Cases
These are flagged by GCC if -Wswitch-default is enabled.
2019-10-04 00:08:14 +01:00
D G Turner
78495ae462 CLOUD: Fix MSVC Warning in Google Drive Token Refresher
This was reported by Henke37 on IRC.
2019-09-15 23:56:51 +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
Alexander Tkachev
24b1ec0ded CLOUD: Handle HTTP response headers case-insensitively
RFC 2616 states that HTTP headers are not case-sensitive and also allows
arbitrary number of whitespace characters around header value. Previous
implementation was dependant on headers to be in "Title-Case" and to
have only one space before header value. That has lead to cloud sync
failure on Debian x64 (user's network environment was probably the
reason though).

This commit adds a new method, which parses headers name-value pairs
into HashMap. To ensure case-insensitivity, all headers names are
converted to lowercase, and thus code that uses this method should
specify headers in lowercase. All usages of raw headers contents were
updated to use this method.
2019-08-25 12:15:14 +03:00
D G Turner
fb54cc1f77 CLOUD: Fix Inverted Test Regression in Debug Message Code
This was introduced by my previous commit to this where I accidently
inverted the tests during refactoring.
2019-08-24 16:59:17 +01:00
Alexander Tkachev
1c0b697a59 CLOUD: Fix OneDriveTokenRefresher
If user doesn't have a "saves" folder, listing it as a first step of
syncing save files would result in 404 from OneDrive.
OneDriveTokenRefresher handles token-related errors (401), so when it
meets 404, it calls its finishError method. But because there was some
strange behaviour from OneDrive with sending invalid JSON, this method
tries fixing JSON and parsing it again. If it is valid, it calls
non-error method again, and in result we get stack overflow.

In order to fix that, I've added a non-JSON prefix "<irrecoverable>", so
finishError won't be able to parse JSON and thus won't call finishJson
again. Saves syncing callback does check string contents apart from
trying to parse JSON, so it still works and correctly handles the
situation when "saves" directory is missing. But, if needed, code can be
updated to search for the prefix I've added and remove it before parsing
original JSON.
2019-08-04 04:36:59 +07:00
D G Turner
466b162996 CLOUD: Fix GCC Compilation Warning in Debug Code.
The warning emitted here was due to debug() call with an empty format
string, so this could have been fixed by replacing this with "%s", "".

However, this change should be better since it avoids the duplication
of the number of file check over several lines and reduces the string
duplication i.e. DRY improvements.
2019-08-03 14:52:57 +01:00
Alexander Tkachev
f6a17e679f CLOUD: Ask user to manually enable Storage
For more security, newly connected Storage only gets username/used space
information and is disabled until user manually presses the button.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
85431c39bf CLOUD: Change interaction with /refresh endpoint
Refresh token is now passed as custom HTTP header, not in GET parameter,
to prevent them being written into server logs.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
e7ca2b8db0 CLOUD: Ignore hidden files in sync/download
In PR#1754 we've discussed and decided to ignore hidden (having a name
starting with '.') files while syncing saves or downloading game files.
This commit adds a CloudManager method to test whether file should be
ignored, and this method could be extended later if we need to ignore
some other specific file names.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
16d97b6948 CLOUD: Minor fixes for the PR#1754
- added missing 'd' in "%d" in SavesSyncRequest;
- removed trailing ',' in enum in gui/options.h;
- fixed #endif to have // before USE_LIBCURL in gui/options.h.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
99c2418d1a GUI: Rewrite Cloud tab
- StorageWizardDialog is removed, along with bmps it was using;
- EditTextWidget now accepts custom font in constructor;
- ScrollContainer scrollbar now jumps to top when content height changes
so it's "overscrolled";
- IndexPageHandler now does not awaits for `code` GET-parameter, as
local webserver is no longer used to connect Storages;
- CloudManager and all corresponding Storages are updated to support
disconnecting and to notify about successful connection.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
31628d6428 CLOUD: Refactor BaseStorage largest methods
Not sure if that's really better, but it was really annoying to
copy-paste `delete a; delete b; return;` in every error-handling
section.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
72c7f8226c CLOUD: Minor cleanup in OneDriveTokenRefresher 2019-07-30 14:51:41 -04:00
Alexander Tkachev
1e92e7b9f3 CLOUD: Fix saves syncing
This mostly affects OneDrive saves syncing, because it is the only cloud
provider to return 0 as timestamp of (non-)created file. 0 is treated as
EOF in /saves/timestamps file, thus all timestamps after such 0
timestamps were ignored and files were reuploaded as being "new". This
commit also adds more verbose debug information on SavesSyncRequest
decisions making for easier debugging.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
edbea10c2e CLOUD: Fix OneDriveStorage API interaction
Something changed and old API endpoint "api.onedrive.com" now does not
work. The other one, "graph.microsoft.com", does, but there were some
other changes in JSON it returns. These changes are also in this commit.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
e8669f693c CLOUD: Update BaseStorage to expect no refresh_token
While refreshing access_token, some cloud providers also pass a new
refresh_token. Google Drive does not, and accepts the same refresh_token
next time. These changes allow this to happen.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
60504dce75 CLOUD: Update storages to refresh token via cloud.scummvm.org 2019-07-30 14:51:41 -04:00
Alexander Tkachev
4a427faf9c CLOUD: Get rid of 'dists/clouds/cloud_keys.h' 2019-07-30 14:51:41 -04:00
Alexander Tkachev
0ee0e2d537 CLOUD: Update GoogleDriveStorage and BoxStorage to auth via cloud.scummvm.org 2019-07-30 14:51:41 -04:00
Alexander Tkachev
8333cce498 CLOUD: Update OneDriveStorage to work via cloud.scummvm.org 2019-07-30 14:51:41 -04:00
Alexander Tkachev
64fd116092 CLOUD: Add BaseStorage, which does auth via cloud.scummvm.org 2019-07-30 14:51:41 -04:00
Alexander Tkachev
faa19c7bf0 CLOUD: Cleanup a little bit - remove unused config keys usage 2019-07-30 14:51:41 -04:00
Alexander Tkachev
2a56328d35 CLOUD: Update DropboxStorage to work with cloud.scummvm.org 2019-07-30 14:51:41 -04:00
Alexander Tkachev
ddcfcc18b2 CLOUD: Update DropboxStorage to work via scummvm.org & StorageWizardDialog correspondingly 2019-07-30 14:51:41 -04:00
SupSuper
03c43f0588 CLOUD: Fix MSVC warnings
Fixes warning C4305: truncation from 'double' to 'float'
2019-05-09 18:13:10 +10:00
SupSuper
272d4105b2 WIN32: Fix libcurl redefining ARRAYSIZE
libcurl pulls in Windows headers, so let's include it first to avoid clashing with common headers
2018-12-17 12:28:33 +02:00
Eugene Sandulenko
940b2a20f1 Revert "COMMON: Change way the Singleton instances are instantiated"
This reverts commit eefa72afa1.

With this patch ConfigManager is broken.
2017-07-10 21:17:41 +02:00
Thierry Crozat
eefa72afa1 COMMON: Change way the Singleton instances are instantiated
This fixes tons of warnings with clang from a recent xcode version on
macOS (and possibly other systems) complaining that an instantiation
of _singleton is required but no definition is available.
2017-07-10 21:11:20 +02:00
D G Turner
b779f20502 CLOUD: Fix GCC Unused Variable Warning.
This variable is not used as the constructors for the storage type
classes store the resulting objects into the Cloud Manager using
replaceStorage(this) instead.
2017-02-28 20:42:17 +00:00
D G Turner
df84aee6a3 CLOUD: Add FIXME comment.
This is generating a compiler warning for set-but-unused, but it looks
as if this is meant to be used in some way i.e. code is unfinished or
orphaned.
2017-01-10 05:19:13 +00:00
D G Turner
32809534fd CLOUD: Fix Remaining Shadowing Compiler Warnings. 2017-01-10 05:15:56 +00:00
D G Turner
ace486cef4 CLOUD: Fix Various Shadowing Compiler Warnings from errorCallback. 2017-01-10 04:45:22 +00:00
Thierry Crozat
8906868ee0 CLOUD: Use OSDMessageQueue to post OSD messages from the cloud thread 2016-10-29 15:13:32 +01:00
Bastien Bouclet
c1070e6929 CLOUD: Don't error out when PNG support is not enabled 2016-10-20 19:21:56 +02:00
Bastien Bouclet
1a1a5b5f69 CLOUD: Change the cloud icon to be updated by the main thread
The cloud manager registers itself as an event source as a mean to be polled
periodically by the GUI or engine code. The periodical polling is used to
update the OSD icon indicating background sync activity.

Also move the cloud icon from ConnectionManager to CloudManager,
allowing to decouple icon handling from network connections updates.
2016-09-18 17:54:12 +02:00
Thierry Crozat
a87a702eb2 ALL: Homogeneize use of 'saved game' in messages 2016-09-18 16:40:34 +01:00
Thierry Crozat
973df9d2fd CLOUD: Fix compilation for integer constant too large for 'long' type
Hopefully all ports we have support LL constants. Otherwise we will
have to find a different way to fix this.
2016-09-17 21:45:46 +01:00
Bastien Bouclet
4d68b93aba CLOUD: Switch to the new OSD API 2016-09-13 20:29:09 +02:00
Eugene Sandulenko
fab199d37e JANITORIAL: Make GPL headers uniform 2016-09-03 12:46:38 +02:00
Peter Bozsó
02a997e468 CLOUD: Remove unused includes 2016-08-24 16:07:55 +06:00
Eugene Sandulenko
0558ba423c CLOUD: Fix warnings 2016-08-24 16:07:55 +06:00
Alexander Tkachev
37859a9203 CLOUD: Fix Requests
Remove unnecessary JSON warnings, fix a few places.
2016-08-24 16:07:55 +06:00