aboutsummaryrefslogtreecommitdiffstats
path: root/core/qt-init.cpp
AgeCommit message (Collapse)Author
2020-12-29cleanup: remove getDivesInTrip() in qthelper.cppGravatar Berthold Stoeger
This function was not used anywhere. Moreover, remove a few unused includes from qthelper.h. Surprisingly, a number of users of qthelper.h depend on these, so readd them at the appropriate places. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-23android: find the translationsv4.9.10Gravatar Dirk Hohndel
As we switched to the qmake based build we now bundle the translations via the Qt resource system instead of explicitly as Android assets. This adjusts the code that opens the translations accordingly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-15translations: use the right Qt translations (part 2)Gravatar Dirk Hohndel
It turns out that contrary to what the documentation states, a few languages are still only using the 'qt' translation. But those exist for all languages, so we need to first search for the 'qtbase' translations, and only if that fails do we try to load the 'qt' translations. And even that will fail for languages in which Qt simply isn't localized (like Dutch). To make the code more readable, the check for 'US English' was moved earlier as there is no point to look for a Qt translation for that (simply doesn't exist). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-15translations: use the right Qt translations and try harder to find themGravatar Dirk Hohndel
We were still using the 'qt' translations instead of 'qtbase' as we should have been using since forever - it's a little unclear from reading the documentation when in the Qt5 life cycle this happened, but definitely several years ago. These are the strings used in situations where Qt already provides us with text (e.g., the entries in the 'Subsurface' menu on Mac, or the button labels in many dialogs). Additionally we didn't try hard enough to find those translations in cases where they are bundled with the app; so basically all scenarios except for Linux distro specific packages or 'build from source' on macOS or Linux were not going to work, even after addressing the qt->qtbase conversion. But of course the developers pretty much all fall into those last two categories. Still, I cannot believe we never fixed this in all those years... To make it more obvious if we still aren't finding the Qt translations this commit also makes that warning be shown in all cases, not just when running in verbose mode. Fixes #2954 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-22translations: use German translation for non-Swiss German localesGravatar Dirk Hohndel
Unless a German speaker explicitly asks for the Swiss localization, give them the German localization. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-22cleanup: don't allocate translators on heapGravatar Berthold Stoeger
This is pointless bike-shedding: instead of allocating the QTranslators on the heap an assigning them to a variable at translation-unit scope, we can simply generate them as static objects. That makes 1) two fewer lines of code 2) the translator-resources are properly released when the application closes. Not that either of these points would make *any* difference. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-22cleanup: split uiLanguage() in two functionsGravatar Berthold Stoeger
The uiLanguage() function was used for two purposes: to initialize the language related preferences and to read the current language. To make things more easy to follow, split this function in two: one for initializing, one for getting the current language. Moreover, don't return the current locale in an out-parameter as there is already a function to do that [getLocale()]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-26code cleanup: QLatin1Literal is deprecated in Qt 5.14Gravatar Dirk Hohndel
Simply replace it with QLatin1String. There is a tiny performance penalty, but none of that code would care. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-20Translations: try to be smarter when picking the right localeGravatar Dirk Hohndel
I was reminded to do this when a user in French speaking Switzerland reasonably suggested that fr_FR would be a much better fallback than en_US in their situation. Fixes: #2388 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14Stop support Qt versions before 5.9Gravatar Dirk Hohndel
There's just no point to testing these outdated versions. Everything we build is now Qt 5.9 or newer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-08-08Cleanup: move error reporting function declarations to errorhelper.hGravatar Berthold Stoeger
Move the declarations of the "report_error()" and "set_error_cb()" functions and the "verbose" variable to errorhelper.h. Thus, error-reporting translation units don't have to import the big dive.h header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove includes from qthelper.hGravatar Berthold Stoeger
To reduce interdependencies, remove the dive.h and divelist.h includes in qthelper.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-01Core: use British translations in South AfricaGravatar Dirk Hohndel
For unrecognized locales we use en_US by default. It makes much more sense for South Africa to use en_GB. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-09Set desktop file name to avoid a broken icon under KDE WaylandGravatar Alexander Wilms
Signed-off-by: Alexander Wilms <f.alexander.wilms@gmail.com>
2018-08-15core: remove SettingsObjectWrapper and update qPref callsGravatar jan Iversen
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-15core: use qPref::load/syncGravatar jan Iversen
use qPref instead of SettingsObjectWrapper for load/sync (seems sync is only used for testing) Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-13Disable the WindowContextHelpButtonHint for Qt >=5.10Gravatar Stefan Fuchs
Disables the WindowContextHelpButtonHint by default on Qt::Sheet and Qt::Dialog widgets. This hides the ? button on Windows, which only makes sense if you use QWhatsThis functionality. This value has been added in Qt 5.10. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-07-03iOS: find translations againGravatar Dirk Hohndel
commit ec0511e824 ("ios: concentrate build dirs") moved the translations around without updating the way they are accessed, causing our release 2.1.0 on iOS to not be localized. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: Set text encoding to UTF-8 for all platforms.Gravatar Berthold Stoeger
This was only done explicitly for Windows. Other platforms were implicitly supposed to be UTF-8. Suggested-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19Use different preference file for mobileGravatar Jan Mulder
This is a change mainly for developers working on both mobile and desktop application. As the current setup is that all preferences are stored in one file (Subsurface.conf), for both mobile and desktop, the unwary developer might get confused that the things tested on mobile-on-desktop are not working on mobile-on-device. As we share a lot of code between the desktop and the mobile code, also our fairly extensive set of preferences play a significant role in the inner workings of our applications. So, this commit introduces an own preferences file for mobile (on desktop) resulting in the preferences between the plain desktop apllication now invisible to the mobile-on-desktop application and vise versa. Making the mobile-on-desktop a much more realistic test plaform for mobile development. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18code cleanup: translators are not globalGravatar Jan Mulder
Un-globalize unused global variables. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-20Don't show localization warning unless verboseGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03Don't warn about missing en-US translation for QtGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-22Add en_US translation for pluralsGravatar Dirk Hohndel
This way in the en_US locale we no longer get shown the odd "dive(s)" and instead get correct singular and plural forms. Most of the patch is just a reindentation as it removes the if clause that used to do the special case of NOT loading a translation for the en_US case. Right now we start with a trivial en_US translation file. My guess is that this will be overwritten once we do the next round of "new strings, new translations". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to remaining core filesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Move loadPreferences out of qt-helper.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-04Find bundled translations on iOSGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-03Android build: prepare and copy translations into the APKGravatar Dirk Hohndel
And then load them at runtime. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-02Move the qtTranslator and ssrfTranslator pointers to qt-init.cppGravatar Thiago Macieira
No point in having it defined in each main program's .cpp. Especially since the unit tests don't define them. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29Allow switching the user from the command lineGravatar Dirk Hohndel
This is a feature that many people have asked for. This implementation is somewhat simplistic because we simply use a different name for the program settings - but interestingly enough this appears to be enough to capture a lot of the core functionality that people are looking for in multi-user support. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>