aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
AgeCommit message (Collapse)Author
2016-07-09Add MOD and MND fields to cylindermodelGravatar Rick Walsh
Adds fields to the planner cylinder model for maximum operating depth (MOD) for a bottom mix gas, and maximum narcotic depth (MND). Fields are read/write, so changing MOD changes %O2 and vice-versa. Changing MND changes %He and vice-versa. When setting MOD directly, the %O2 is truncated (rounded down) to an integer, which re-calculates the MOD, which is sometimes a few metres greater than the input depth. This is desireable behaviour, as the rounding is conservative. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09Update gas deco MOD when deco pO2 is changedGravatar Rick Walsh
This fix is reasonably straightforward when the divedatapoint structure stores the cylinder rather than gasmix. Fixes #970 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09Have divedatapoint store cylinder id instead of gasmixGravatar Rick Walsh
Determining the correct cylinder index from a known gas mix can be complicated, but it is trivial to look up the gasmix from the cylinder_t structure. It makes sense to remember which cylinder is being used. This simplifies handling changing a cylinder's gas mix, either directly by the user, or indirectly in the planner. It also permits tracking of multiple cylinders of the same mix, e.g. independent twins / sidemount. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-28Add some gas mix validation to the plannerGravatar Rick Walsh
A few basic rules for gas validation: We can't have <0%, or >100% of either O2 or He O2 + He must not be >100% Switch depth can't be <0% This places limits on user-input values Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-21Add best mix function to planner cylinder modelGravatar Rick Walsh
This allows calculation and selection of best mix in the planner cylinder entry, by entering the gas depth, followed by "b" for best (trimix) mix, or "bn" for best nitrox mix. The UI is not intuitive, but it is quick and easy. At the very least, it should be documented. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29CylindersModel: clamp the "cylinderuse" valuesGravatar Lubomir I. Ivanov
If the value for "use" is negative or larger than the number of elements in "enum cylinderuse", later CylindersModel::data() can request a string in the lines of cylinderuse_text[cyl->cylinder_use], which can SIGSEGV. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05DiveListModel: don't add the dives one at a timeGravatar Dirk Hohndel
Most of the time we are adding all the dives, so do this in a single model operation. This makes the case when adding a single dive (in the undo delete function) slightly more complicated, but that seems totally worth it for the speedup in the common case. 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-22Make the reserve gas units awareGravatar Robert C. Helling
In the planner, for recreational mode, there is a setting indicating the pressure at which the diver should be back at the surface. This pressure was hardcoded to bar. Fixes #1027 [Dirk Hohndel: small modifications, more reasonable step for psi, more reasonable maxima] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09Silence warnings in diveplannermodel.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09Silence warnings in divecomputermodel.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in divepicturemodel.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in weightsysteminfomodelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in weightmodelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in treemodelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in tankinfomodelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in models.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in GpsListModelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in diveplotdatamodel.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in DiveplannermodelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in divelocationmodel.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in divecomputermodelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in Divecomputerextradatamodel.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in CylinderModelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in cleanerTableModelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07Silence more warningsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06Clean up handling of various include fileGravatar Tomaz Canabrava
This is in the context of the iOS port and shouldn't impact any of the other builds. [Dirk Hohndel: refactored the iOS patches] Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: resolve confusion about dive list model orderingGravatar Dirk Hohndel
Oops, I forgot to take the sort model on top of the model into account. Now everything should stay consistent - ListView order when accessed from QML, but internal order when accessing the underlying array. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: create a chronological dive list when manually adding diveGravatar Dirk Hohndel
The dive list might contain dives in the future, don't add the new dive to then end but instead add it at the correct spot in the list Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02Add helper functions to identify the position of a dive in the dive listGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25Show both the nominal and "real" size for an imperial cylinderGravatar Linus Torvalds
This is questionable, but perhaps useful. When showing imperial cylinder sizes, show both the nominal value (with no compensation for compressibility of the gas) and the "actual" amount of gas the cylinder contains. So an AL80 will show as a size of "80 (77)cuft", because while 80 is the nominal size, the actual amount of gas that will fit is just 77 cuft. [Dirk Hohndel: adjusted to take translation of the unit into account] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25Don't use "get_volume_string()" for cylinder size stringGravatar Linus Torvalds
We had two totally different usage cases for "get_volume_string()": one that did the obvious "show this volume as a string", and one that tried to show a cylinder size. The function used a magic third argument (the working pressure of the cylinder) to distinguish between the two cases, but it still got it wrong. A metric cylinder doesn't necessarily have a working pressure at all, and the size is a wet size in liters. We'd pass in zero as the working pressure, and if the volume units were set to cubic feet, the logic in "get_volume_string()" would happily convert the metric wet size into the wet size in cubic feet. But that's completely wrong. An imperial cylinder size simply isn't a wet size. If you don't have a working pressure, you cannot convert the cylinder size to cubic feet. End of story. So instead of having "get_volume_string()" have magical behavior depending on working pressure, and getting it wrong anyway, just make get_volume_string do a pure volume conversion, and create a whole new function for showing the size of a cylinder. Now, if the cylinder doesn't have a working pressure, we just show the metric size, even if the user had asked for cubic feet. [Dirk Hohndel: added call to translation functions for the units] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-05Do not run the deco calculations in the mobile appGravatar Dirk Hohndel
We don't show the calculated ceilings and calculating them is compute intensive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-29QML UI: pick new highest dive number when manually adding diveGravatar Dirk Hohndel
It's possible that this will create an out of order dive list, but it seems the most consistent way to do things and to avoid more than one dive with the same dive number (which could have happened if you add several dives manually that are not the newest dives in the dive list). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-29Add helper to remove dive from modelGravatar Dirk Hohndel
I tried various things to do this from QML but it just doesn't seem to work at all. So I gave up and instead added a trivial helper function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-28Add our own sort proxy class which provides two helper functionsGravatar Dirk Hohndel
These can then be used from QML to map the index into the model (the sort model corresponds directly to the indices in QML) to the dive id and back. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27Change the api to update a single diveGravatar Dirk Hohndel
Instead of searching for the dive in the list, just make sure we are given the index. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27QML UI: correctly notify of model changeGravatar Dirk Hohndel
This may seem weird, but it seems to work to make sure that the model actually is correctly updated when updating a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-24Show only as many stats as there are DC typesGravatar Miika Turkia
After reserving only the required amount of data for stats_by_type, we showed an extra DC type on the statistics (no more extra space filled with 0 at the end of the buffer) Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-19Don't blindly copy a pointer to the heapGravatar Dirk Hohndel
Copying the entry pointer and assuming that it stays valid is of course totally bogus. This is most likely the reason for the random crashes people have observed. See #992 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-18Add dive type to statistics windowGravatar Miika Turkia
This adds dive type based division to the "yearly statistics" window. Thus people can see the stats from individually from OC, CCR, PSCR and freedive. See #949 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10Reimplement the internal repesentation of GPS fixesGravatar Dirk Hohndel
Instead of using the Settings as our data structure and constantly accessing them, we now have a QMap for the GPS fixes and only access the Settings to keep them in sync with the QMap. This should significantly speed things up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08Gps list: include the time_t timestamp in the modelGravatar Dirk Hohndel
Just having the string means we lost the unique value that we can use as key to indentify a specific GPS fix. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08Move Dive class from qthelper.h/cpp to it's own fileGravatar Tomaz Canabrava
and rename it to DiveObjectHelper, since it should be an QObject based class to make it easier on the QML, grantlee and widgets side to display the dive's internal data. each Q_PROPERTY defined in the DiveObjectHelper.h file can be acessed directly via it's name. So, if you are on a model that returns a dive, acess it's name by dive.name Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08Untangle Library LinkageGravatar Tomaz Canabrava
with the adittion of gpslistmodel/location, the libraries qt-models had a direct dependency on subsurface-core, and subsurface-core had a direct dependency on qt-models, this is bad. Moving a bit of code around I'v managed to clean this out, and also to clear a bit of uneeded code (GpsTracker and gpsTracker where basically the same thing.) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07Create GpsListModel in order to be able to display GPS fixesGravatar Dirk Hohndel
This will allow us to visualize the GPS fixes that are currently stored in the QML UI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01QML UI: handle editing of depthGravatar Dirk Hohndel
Getting closer to being able to really edit / add dives in the mobile UI. This works for manually added dives - needs a bit more thought for dives downloaded from dive computers as we don't necessarily want to change the maxdepth in conflict with the samples. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26QML UI: get add dive closer to being usefulGravatar Dirk Hohndel
Now we at least start out with the corret date, time and number. This still isn't functional as a lot of the data aren't used and the way you save the data is completely silly, but it's another step in the right direction. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26QML UI: set up time and dive number when adding diveGravatar Dirk Hohndel
Most likely when you manually add a dive on a device it is just about to happen or just ended, so starting out with the current time is likely a good guess. Which makes it the last dive in the dive list, so give it the next sequential number. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26Dive list model: add GPS string accessGravatar Dirk Hohndel
If the QML UI needs the GPS information, we need a way to get to it. I'm not convinced that having it as comma separated string is the best way to go, but that's what I need for the Google API so that's what I picked for now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>