aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/subsurfacewebservices.cpp
AgeCommit message (Collapse)Author
2018-07-04Translations: unify gettextFromC::tr() and QObject::tr()Gravatar Berthold Stoeger
There were two catch-all classes for translations outside of class context. gettextFromC was used exclusively from C, but C++ used both, gettextFromC and QObject. Some of the string were even present in both. Therefore, unify to gettextFromC throughout the code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-16Cleanup: Don't clear WA_QuitOnClose attribute on dialogsGravatar Berthold Stoeger
According to Qt's documentation, the application exits if all windows with the WA_QuitOnClose attribute are closed. This attribute was cleared for three dialogs. This seems not necessary because: 1) The application can't be closed as long as the modal dialog is shown. 2) The flag only concerns primary windows, which these are not. See: http://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-prop Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-05-24desktop-widgets: replace (void) with no parameter nameGravatar jan Iversen
Unused parameters in C++ are "silenced" by removing the name. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21desktop-widgets: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-14Core: remove dive.h from files that don't need itGravatar Dirk Hohndel
Of course, quite a few of them indirectly get it through other header files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14Core: introduce new subsurface-string headerGravatar Dirk Hohndel
First small step to shrinking dive.h. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-03Revert "GPS: use applyGpsLocation::applyLocations from core"Gravatar Dirk Hohndel
This reverts commit 70e0e80de5470216df939f994ffda0222560def0. This caused the GPS workflow to break for Linus. Let's revert for 4.7.8 and figure out how to do this cleanup correctly, later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-03Revert "cleanup: localize global variable"Gravatar Dirk Hohndel
This reverts commit fc7729eb78e7dae803546b3cc0011260e779a2e8. This caused the GPS workflow to break for Linus. Let's revert for 4.7.8 and figure out how to do this cleanup correctly, later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-14Cleanup: consistently use toUtf8() instead of toLocal8Bit()Gravatar Berthold Stoeger
These do the same, since the text-codex is set to UTF-8 on startup. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: consistently use qPrintable()Gravatar Berthold Stoeger
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-02Free various struct membuffer in different functionsGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-11Introduce helper function empty_string()Gravatar Berthold Stoeger
There are ca. 50 constructs of the kind same_string(s, "") to test for empty or null strings. Replace them by the new helper function empty_string(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06Do not save WebserviceID in preferences until asked forGravatar Jan Mulder
Do not save the WebserviceID in the preferences until we ask for this. That is simply wrong. This is definitely not a full fix for all the weirdness that is going in related to the WebserviceID but saving the ID even if we do not ask for it, adds to possible confusion. To always automatically pull in the ID from the server based on cloud credentials, just leave the ID field empty in the network preferences. Fixes: #1013 (well ... a tiny part of this mess) Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06cleanup: use new urlsGravatar Jan Mulder
Just rename some old hohndel.org urls Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06cleanup: localize global variableGravatar Jan Mulder
Not needed to be global. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06GPS: use applyGpsLocation::applyLocations from coreGravatar Jan Mulder
Fixes a big duplication of code. The code to apply GPS locations from the location service was already in core, and used from mobile, but there was an almost literal copy in the desktop code. See also commits 6f42ab46da1b59 and ee9531f76ec31a, where only one side of the duplicated code was fixed. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-10applying gps fixes: group repetitive code under a macroGravatar Salvador Cuñat
Title is self explanatory. [Dirk Hohndel: small edits to remove typo / improve readability] Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-10Do not prefer gps fixes just for being into dive timeGravatar Salvador Cuñat
ATM we were giving preference to a gps fix taken during dive time over another taken before dive start time (proven both in predefined SAME_GROUP 6 hours range). While this logic is right for a static boat or a shore dive - as it ensures a correct position - will fail for drift dives or dives where boat changes its position during dive time. Instead, will choose the gps fix closer to the dive start time. fixes issue #666 Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26desktop UI: no longer attempt to manually show error notificationsGravatar Dirk Hohndel
report_error() now does this automatically. So all these odd places in which we tried to make sure that we show errors are no longer needed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-01Use helper function dive_endtime() where apropriateGravatar Stefan Fuchs
Calculating dive.when + dive.duration doesn't always give the correct endtime of a dive especially when a dive has surface interval(s) in the middle. Using the helper function dive_endtime() fixes this issue. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-09-04remove Marble from the source treeGravatar Lubomir I. Ivanov
In desktop-widgets, remove globe.cpp, globe.h and also remove the NO_MARBLE macro usage. At this point the MapWidget will always be created and there will always be a map in the application. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28subsurfacewebservices: abstract between GlobeGPS and MapWidgetGravatar Lubomir I. Ivanov
Call same methods from the two classes based on NO_MARBLE. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-05-27Random whitespace cleanupGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06Check if we have an instance before dereferencing itGravatar Dirk Hohndel
If we don't have a GPS service userid in the preferences and the GpsLocation class isn't instantiated, this would cause a crash. Fixes #367 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to desktop widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-06Break down MainTab into smaller classesGravatar Tomaz Canabrava
Maintab is one of our most complex classes, and it's something I'm not actually proud of. But it currently works and the idea of splitting it was in my head for quite a while. This is the third or fourth tentative of splitting it, and this time I let the most complex part of it untouched, the Notes and Equipment tab are way too complex to untangle right now on my limited time. A new class 'TabBase' should be used for any new tab that we may create, and added on the MainTab (see the new lines on the MainTab constructor). Also, Extra Info, Information, Photos and Statistics where ported to this new way helping reduce the number of lines and functions on the MainTab quite a bit. Overall this is a step in the right direction for the future. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-18Include geolocation info on export XML (divelogs.de)Gravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2016-11-01More preference handling fixesGravatar Tomaz Canabrava
Remove a few uneeded lines and add more loading code for the preferences. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Fix Facebook Widget to use the SettingsObjectWrapperGravatar Tomaz Canabrava
Fix facebook widget to use the SettingsObjectWrapper instead of figthing our complementary Settings each call. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Some code cleanupGravatar Tomaz Canabrava
The only block of code that I removed here is because the QSettings preferences that is being read is the exact one that we populate on the prefs. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Clean up save user id localGravatar Tomaz Canabrava
So, prefs.save_userid_local is being set outside of a preferences set (it's set to true and false while loading the files via xml or git) and because of that I had to bypass a few method calls. When something triggers a preferences change, the application will be notified that the preferences changed, thing that I couldn't do while reading the xml or git because that should be local-only. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> 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>
2016-03-09Silence warnings in subsurfacewebservices.cppGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23Divelogs.de import: encode + character on passwordGravatar Miika Turkia
Upload seems to work as is... Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-26Move CloudStorage out of the widgetsGravatar Tomaz Canabrava
Cloud Storage is a non-gui based class, we currently use two different approaches for cloud storage, one on the desktop target and other on the mobile target, we should use only one. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-02Fetch the Subsurface webservice userid if cloud credentials were givenGravatar Dirk Hohndel
This allows users to not have to worry about this userid anymore. Both the mobile app and the desktop app can now derive the userid from the cloud storage credentials. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07subsurfacewebservices.cpp: make sure 'changed' is not unusedGravatar Lubomir I. Ivanov
Make sure 'changed' in SubsurfaceWebServices::buttonClicked() is not unused even if NO_MARBLE is defined. It appears to be used only in the #ifndef NO_MARBLE branch. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-11-07subsurfacewebservices.cpp: remove unused FILE variableGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-10-30Move qt-ui to desktop-widgetsGravatar Tomaz Canabrava
Since we have now destkop and mobile versions, 'qt-ui' was a very poor name choice for a folder that contains only destkop-enabled widgets. Also, move the graphicsview-common.h/cpp to subsurface-core because it doesn't depend on qgraphicsview, it merely implements all the colors that we use throughout Subsurface, and we will use colors on both desktop and mobile versions Same thing applies for metrics.h/cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>