aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.cpp
AgeCommit message (Collapse)Author
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-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-09Change taglist_get_tagstring to support 'unlimited' tag list sizeGravatar Jeremie Guichard
Previous taglist_get_tagstring signature/implementation did not allow handling of cases where inputted buffer could not contain all tags. New implementation allocates buffer based on pre-computed size allowing to insert all tags in the returned string. Added get_taglist_string in qthelper to handle conversion to QString Added TestTagList with tests for taglist_get_tagstring Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2018-04-04Add "Tags" column in Desktop app's dive list viewGravatar Jeremie Guichard
Add DiveItem::displayTags helper method to return Tags as a QString New Tags column is by default inserted before "Photos" column by default disabled Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2018-03-05Cleanup: Remove superfluous QString constructions in divetripmodel.cppGravatar Stefan Fuchs
Remove superfluous QString constructions in a couple of simple functions in divetripmodel.cpp Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-05Use correct numeric format based on selected locale (Qt domain part)Gravatar Stefan Fuchs
This changes the numeric format of many values printed to the UI to reflect the correct numeric format of the selected locale: - dot or comma as decimal separator - comma or dot as thousands separator In the Qt domain the `L` flag is used case specific mostly in qthelper.cpp. Then the helper functions get_xxx_string() are used more consistently. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-11Use helper function empty_string() instead of manual checksGravatar Berthold Stoeger
For code consistency, substitute boolean expressions: s && *s -> !empty_string(s) s && s[0] -> !empty_string(s) !s || !*s -> empty_string(s) !s || !s[0] -> empty_string(s) Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-28cleanup: Logically dead codeGravatar Jan Mulder
CID 208318 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
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-10-09Display units in dive list table based on prefs optionGravatar Stefan Fuchs
Add a preferences option which enables or disables display of units in the main dive liste table. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-03divelist: prevent a crash for missing column widthGravatar Lubomir I. Ivanov
The `static int defaultWidth[]` definition in divelistview.cpp could potentially end up missing an element which can later result in out-of-bounds access when iterating through the list of columns and updating their widths. Add a couple of methods in DiveTripModel for setting and getting the widths and use those. The default values are now pre-set in a QVector in the DiveTripModel() constructor. Throw warnings if out-of-bounds columns are requested. Reported-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-02[Divesite] Hook qt model for countryGravatar Tomaz Canabrava
See #144 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> 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-05-26Creation of dive duration string and surface interval stringGravatar Stefan Fuchs
Update the function to create the dive duration string in a way that it can be used also in info and stats tab and added some more flexibility. Changed layout for <1h freedives to "0:05:35" (w/o units) or "5:35min" (with units and :) or "5min 35sec" (with units with space). Add a new function to create the surface interval string. Completely remove old function get_time_string() and get_time_string_s(). Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-06Consistently show dive duration based on preferencesGravatar Dirk Hohndel
We now respect the settings in the preferences and also only show the duration as minutes and seconds if the dive is a free dive. Fixes #361 Fixes #362 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to Qt modelsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-11Use abbreviations with dots.Gravatar Martin Měřinský
2017-03-11Use 'Temp.' for abbreviations.Gravatar Martin Měřinský
2017-03-11Cyl > CylinderGravatar Martin Měřinský
2017-02-17Handle negative dates (before the epoch) betterGravatar Linus Torvalds
The Qt model sorting for the dive date was using a unsigned number, which doesn't work for dates before 1970. Also, the dive date parsing got the year 1900 wrong. Not that we really care, because other parts of date handling will screw up with any date before the year 1904. So if you claim to be diving before 1904, you get basically random behavior. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-26Remove unused variableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-24Provide phots summary on dive list (Part 2)Gravatar Willem Ferguson
Please apply this patch on top of the previous patch with the same title. 1) Provide icons with white margin to look more like photos 2) Optimise code, following Robert's suggestions. 3) Column heading for photos column is now: Photos. This takes up extra horizontal space but makes the user interface more understandable. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-24Provide photos summary on dive listGravatar Willem Ferguson
1) Add an extra column to dive list, just left of Locality field. 2) For each dive, give summary of photos as follows: i) no photos: no icon in that column ii) photos taken during dive: show icon of fish iii) photos taken before/after dive: show icon of sun iv) photos taken during as well as before/after dive: show icon with both fish and sun 3) Provide information for the sort operation to work on this column of the dive list. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> 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>
2015-10-18Display day number in trips longer than 1 dayGravatar Giorgio Marzano
Signed-off-by: Giorgio Marzano <marzano.giorgio@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08Deal with weird transifex issue involving leading spaceGravatar Dirk Hohndel
Apparently transifex drops the leading space in the translation string and then at runtime the string no longer matches. So let's just code this differently. This of course creates a new string but that new string should be the string that transifex already asks people to translate... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-29Show icon in dive list to mark dives that have GPS dataGravatar Dirk Hohndel
The icon is public domain and came from https://commons.wikimedia.org/wiki/File:Emblem-earth.svg (also removed the redundant entry for "edit" from the .qrc file) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Address uninitialized member warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move DiveTripModel to qt-modelsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>