aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/locationinformation.cpp
AgeCommit message (Collapse)Author
2018-03-14Cleanup: introduce copy_qstring() functionGravatar Berthold Stoeger
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common occurrences that they seem worthy of a short helper-function. 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-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>
2017-12-29cleanup: Unchecked return valueGravatar Jan Mulder
CID 208312 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-28Replace less-or-equal by less-than comparison in lessThan functionGravatar Berthold Stoeger
DiveLocationFilterProxyModel::lessThan() used less-or-equal instead of less-than comparison. This can lead to subtle bugs if two elements compare as equal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-30Use better aliases for icons.Gravatar Martin Měřinský
Icon aliases were complete mess. Some icons had alias some didn't. Named with underscores vs. hyphens vs. camelCase. Lower vs. upper case. "ICON" prefix vs. suffix vs. nothing. With vs. without filename suffix. Some didn't make sence. Eg. mapwidget-marker-gray (I can see, it's grey, but what does it represent?) Some were duplicated, eg warning vs. warning-icon. Some were name after widget, which is wrong. Do not reinvent wheel. Use widely used naming scheme close to Freedesktop Icon Naming Specification. This will enable usage of common icons from current set in the future. Thus Subsurface will fit nicely to GUI. This changes icon aliases to one, easy grep-able style. Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29Revert "Use consistent aliases for all icons."Gravatar Dirk Hohndel
This reverts commit 92e9c6606f6ef3ad16d2e31f9f9a8f5fa14f2c1a.
2017-11-29Use consistent aliases for all icons.Gravatar Martin Měřinský
Icon aliases were inconsistent mess. Underscores vs. hyphens vs. camelCase. With vs. without filename suffix. Lower vs. upper case. "icon" suffix vs. prefix vs. nothing. Some were duplicated, eg warning vs. warning-icon. Some icons didn't have alias at all. This changes all icon aliases to one, easy grep-able style which complies to Freedesktop Icon Naming Specification (Guidelines). Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-27locationinformation: don't update map location on typingGravatar Lubomir I. Ivanov
Currently when the user is typing new coordinates the marker on the map changes location right away. Disable that and add a 'flag' button that should be pressed instead. Also make the coordinates update when pressing Enter or when the text field loses focus. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-26Inform LocationFilterModel of changed dive site nameGravatar Berthold Stoeger
Since commit 01d961086c1d175732c597dc9acdba7cc4cd2d26, the location filter list is updated if a dive site is edited. The problem is that if the name of a selected dive site is changed, the selection is lost. Therefore, before repopulating, inform the location filter that a dive site changed its name. The location filter then internally changes the name and can properly transfer the old selection on repopulate. This is performed via the new LocationInformationWidget::nameChanged signal, which is connected to the new LocationFilterModel::changeName slot. A special case to be handled is the following: [ ] Site 1 [x] Site 2 and "Site 2" being renamed to "Site 1", i.e. both sites being merged. Here, the merging is detected and "Site 1" will likewise be checked: [x] Site 1 [x] Site 1 No merging is performed, as the list will be repopulated anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-09map-widget: allow real-time updates of edited markersGravatar Lubomir I. Ivanov
This patch allows updating the location of map markers while editing a dive site and updating the text in the LocationInformationWidget in real-time. Currently it is only possible to see the marker changes by clicking 'Apply'. The modification required the following changes: - add the MapWidget::updateCurrentDiveSiteCoordinatesToMap() slot and call it each time the GPS text updates - separate the updateCurrentDiveSiteCoordinates(FromMap/ToMap) logic by having the FromMap/ToMap suffix to method names - make MapWidgetHelper::updateCurrentDiveSiteCoordinatesToMap() call a new MapLocationModel::updateMapLocationCoordinates() method, which updates selected location coordinates and the model - add MapLocation::setCoordinateNoEmit() that does not emit a signal when updating a coordinate Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-17Tags for geo references: Nicer look, translations and warning messageGravatar Stefan Fuchs
For the geo references tags update the following: - Nicer look w/o "Tags:" text and brackets when inside location UI - Translation for "Tags:" - Warning message when no dive site layout categories are set Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16In location information UI set reverse geo lookup button activ...Gravatar Stefan Fuchs
as soon as coordinates are available . Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09Use lrint() for all degrees_t related roundingGravatar Lubomir I. Ivanov
In certain places the '(int)' cast is used, while in other the llrint() or lrint() functions. Make the conversation from degrees in the 'double' form to the 'int' degrees_t consistent using lrint(). lrint() is the function which should give the best results, because it accepts a 'double' and results in a 'long' even if degrees_t is 'int'. If the truncation from 'long' to 'int' is discarding some of the precision then the next step would be to turn degrees_t into a 64bit signed integer type. Possible fix for #625. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-07Locationinformation: correctly handle strings on the heapGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07Warn if we edit non-existant dive siteGravatar Dirk Hohndel
And try to add it to the dive - bubt we really shouldn't get here. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07LocationInformationWidget: make sure to clean out fieldsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Simplify the geo reverse lookup functionGravatar Dirk Hohndel
We never actually create a list of dive sites for which we call the reverse lookup service, it's always just displayed_dive_site. So make this all much simpler and just go straight for that. This commit removes a loop, but doesn't change the indentation of the code inside the loop to make it easier to see what was changed. That whitespace change will be in my next commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Remove bogus signalsGravatar Dirk Hohndel
One isn't connected to anything, the other one makes us overwrite the changes to displayed_dive_site. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Change the signature of constructLocationTagsGravatar Dirk Hohndel
We actually want to be able to pass a specific divesite structure and not have it look that up by uuid. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Don't add separate country field, use taxonomyGravatar Dirk Hohndel
The more I looked at the code that added the country to the dive site, the more it seemed redundant given what we have with the taxonomy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-02[Divesite] Hook location information interface for countryGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-28locationinformationwidget: abstract between GlobeGPS and MapWidgetGravatar Lubomir I. Ivanov
Connect the same signals for the two classes based on the NO_MARBLE macro. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-04-29Add SPDX header to desktop widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-24Fix double to int truncation in C++ codeGravatar Jeremie Guichard
Wfloat-conversion enabled for C++ part of the code Fix warnings raised by the flag using lrint Original issue reported on the mailing list: The ascent/descent rates are sometimes not what is expected. E.g. setting the ascent rate to 10m/min results in an actual ascent rate of 9m/min. This is due to truncating the ascent rate preference, then effectively rounding up the time to reach each stop to 2s intervals. The result being that setting the ascent rate to 10m/min results in 20s to ascend 3m (9m/min), when it should be exactly 18s. Reported-by: John Smith <noseygit@hotmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
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 locationinformation.cppGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-19Fix UI issue with location managementGravatar krisalpha
The index in the fixpopup function was incorrect which caused the user to need TWO cursor down presses to move to the second element. I changed the index value so the user now needs only one key press to traverse up/dowm. Fixes #954 Signed-off-by: krishan Chopra <choprakrishan61@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-24Location completion matches on whole nameGravatar Dirk Hohndel
When typing in a partial location name, the match now considers the whole text, not just the start of the text. So typing in "Yell" will match both "Yellow House" and "Mellow Yellow". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07locationinformation.cpp: fix unused 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>