aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
AgeCommit message (Collapse)Author
2015-10-09Do not show lack of coordinates as having same gps informationGravatar Tomaz Canabrava
The filter that takes care to show the dive sites that have the same gps information should not take into account dives that have no gps information. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08Fix a crash when editing manually added diveGravatar Miika Turkia
I have manually added dives from an ancient version of Subsurface. Trying to edit these caused Subsurface to crash due to comparison of string of dc.model that did not exist (to a static string). And further down the execution path we were crashing as there were no samples associated with the dive. See #941 Signed-off-by: Miika Turkia <miika.turkia@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-10-03Make logical block match indentationGravatar Dirk Hohndel
Coverity CID 1325519 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-18Spelling correctionsGravatar Robert C. Helling
Spell Setpoint without space in user visable strings. Explain authorized_paired. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-17Planner: show new icon to indicate that last point can't be deletedGravatar Dirk Hohndel
Having the trash can disappear is somewhat intuitive, but I'd argue this is even more so. Fixes #789 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-12Hide current dive site from dive sites with same coordinates.Gravatar Sander Kleijwegt
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-12Remove id from divelocation selection listGravatar Sander Kleijwegt
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-09Do not ignore the first tag on autocompletion.Gravatar Sander Kleijwegt
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31UI code to merge dive sitesGravatar Tomaz Canabrava
Get the Qt data structures and convert to something that we can use in our C - core. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Display dive sites with same gps as the currentGravatar Tomaz Canabrava
So we can merge them later - currently we are showing only the ID, ugly - fixing next. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Fix recursive stack-overflowGravatar Tomaz Canabrava
Only call this when needed, if there's no function set as callback, always return true. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Add function to filter same-gps dive sitesGravatar Tomaz Canabrava
This should be userfull to show dive sites that are mergeable. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Add a new model: SsrfFilterProxyModelGravatar Tomaz Canabrava
Add a new Model, it's the QSortFilterProxyModel that accepts functions to filter / sort. so instead of creating a new class for each different sorting (overkill), now we can just create a function and pass to this class. I'll rework the filtering system of subsurface to use this - in the meantime I've created this to ease the creation of another filter: the dive sites by gps coordinates. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31QML UI: Remove unneeded MobileDive classGravatar Grace Karanja
The MobileDive class in divelistmodel.h is a duplication of the Dive class in templatelayout.h. This patch moves the Dive to the qthelper file. [Dirk Hohndel: merged with upstream master - let's hope I didn't mess anything up] Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31QML UI: Use AddDive instead of clear diveGravatar Grace Karanja
No need to clear the dives when adding a new one. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31QML UI: Clear divelist model before starting new diveGravatar Grace Karanja
When user clicks on AddDive, we should clear the model. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-25Create a new dive site and edit it automaticallyGravatar Tomaz Canabrava
If the user clicks on the first or second option of the drop down list, subsurface will move him to the dive site edit panel automatically, since it's a new dive site and there's no information about it yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25Make created dive site uuid deterministicGravatar Dirk Hohndel
Having random uuids seemed like a good idea, but there are several situations where they really cause problems. One is merging dive file imports from V2 logfiles. Another is testing such imports. Instead of making the uuid random we now hash the name and add the timestamp of the first dive associated with this dive site to the hash (first in this context is "first encountered" with no guarantee that it is the chronologically first). This way V2 imports create deterministic uuids but uuid conflicts are still extremely unlikely, even if the user has multiple dive sites with the same name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Display dives from the same location on the listGravatar Tomaz Canabrava
Some dive sites are separated in more than one real dive site (for instance, a 'blue hole' dive site that has different entry points on the gps), so instead of checking only the dive_site id, also check it's name. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Merge branch 'boyle-ready' of https://github.com/Slagvi/subsurfaceGravatar Dirk Hohndel
Fixed merge conflicts in deco.c dive.h planner.c Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15VPM-B: Add conservatism levels to the ui. Fix planner settings disabling.Gravatar Jan Darowski
Conservatism level can now be changed from gui, is saved in settings. Also way of disabling the planner settings in the ui was improved to support more deco models and be called at the widget creation. Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15Remove obsolete commentGravatar Tomaz Canabrava
We don't allow building against Qt4 anymore. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15Add DiveSitePicturesModelGravatar Tomaz Canabrava
This model should be used inside the Edit Dive Site mode. It should display all photos from all dives that are part of this dive site, ignoring trips. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24QML UI: sort by date, not by date stringGravatar Dirk Hohndel
Just a quick bit of cleanup to separate date (the sortable, numeric value) from the date string that we want to display (but not sort by). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17QL UI: Add DiveId role to DiveListModelGravatar Grace Karanja
This will be used when rendering the dive profile and also when saving the dive changes. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-17Better invalid dive site nameGravatar Dirk Hohndel
This should ensure that no one ever might end up with our "invalid" name for real. And it allows us to more easily test elsewhere for that invalid value. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Show only 1 possibility if string is uniqueGravatar Tomaz Canabrava
We should only show one possibility if the dive_site name string is unique - we don't have that dive_site yet - so we pass to the Completer filter a Dummy string that will surelly not be a dive site - konami code. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Dive site edit: add second "create" line without completionGravatar Dirk Hohndel
We now have TWO special entries. One with just what the user has typed and one with the first completion of that text. This way both Henrik and Linus can get what they want. I'm not sure I love this, but it's easy to revert if the consensus is that this is too confusing. But it's much easier to discuss this if people can actually play with it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-15Better text for fake completion entryGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Offer an option to just complete the textGravatar Tomaz Canabrava
Make the kids fight no more. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-10QML UI: whitespace fixGravatar Grace Karanja
Fix some whitespace issues in the QMLManager and DiveListModel classes. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-07Planner: disable unrelated planner settingsGravatar Joakim Bygdell
When VPM-B is the choosen deco algorithm changing, GF low and high have no effect. So lets disable them similar to what we do for recreational mode. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05Round MOD of gas rather than truncateGravatar Robert C. Helling
For the proper calculation, we need to take salinity and surface pressure into account (rather than depth = bar * 10 - 10) Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05Read planner preferences when we use themGravatar Rick Walsh
Read and use the last_stop preference in the plan function. Read the plan notes preferences and set variables (plan_verbatim, plan_display_runtime, plan_display_duration, and plan_display_transitions) in the add_plan_to_notes function. Don't read the preferences and set variables otherwise. Both plan and add_plan_to_notes functions are called on data change. Previous behaviour was: - Set variables on declaration - Reset variables in plan function (even variables that only relate to planner notes output) - Changing a preference triggered set_xxx function which sets variable, then plan function, which sets variable again. Apart from being inefficient, the previous behaviour made it difficult to track down where and when variables were set. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-03VPM-B: add deco choice to the ui.Gravatar Jan Darowski
Removed recreational mode from ui and pref and replaced it with new deco_mode enum. Added radio button ui selection. Set default deco_mode to Buehlmann algorithm. Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-02Rename enum values for taxonomyGravatar Dirk Hohndel
This avoids confusion and namespace collisions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02Merge branch 'taxonomy'Gravatar Dirk Hohndel
2015-07-01Correctly removes the Location Completion ModelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01More information on dive site modelGravatar Tomaz Canabrava
All of dive site information is now exposed to the model Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Remove location completion modelGravatar Tomaz Canabrava
This is a functional but hard to expand model for the dive sites. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Geo taxonomy: adjust the preferences to the new data structuresGravatar Dirk Hohndel
This allows us to pick which three categories of geo taxonomy will be shown in the UI. 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-26Add only switch at required stop optionGravatar Rick Walsh
Add the option to only switch at required stop to the planner UI. This is not actually used yet. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Add model to populate the Preferences for GeoRefGravatar Tomaz Canabrava
Simple model that list the options for GeoRef. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> 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-06-21Cylinder model: fix an obscure case that would access cylinder -1Gravatar Dirk Hohndel
If we remove a cylidner for a unique gas and that is allowable, then don't try to copy from cylinder with index same_gas (which is still -1). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21Fix a number of resource leaksGravatar Dirk Hohndel
Free memory returned from parse_mkvi_value() Free memory returned from printGPSCoords() Free memory allocated in added_list and removed_list Free memory allocated when adding suffix to dive site name Free memory allocated in cache_deco_state() Free memory allocated in build_filename() Free memory allocated in get_utf8() Free memory allocated in alloc_dive() Free memory allocated as cache but never used Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20Rename dive class to avoid conflictGravatar Grace Karanja
Rename the Dive class in divelistmodel.h to a void a conflict with the Dive class in templatelayout.h Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20Add more dive details to the DiveListModelGravatar Grace Karanja
Add some more details to the model. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>