aboutsummaryrefslogtreecommitdiffstats
path: root/dive.h
AgeCommit message (Collapse)Author
2013-11-02Replaced the tag implementationGravatar Maximilian Güntner
The new implementation supports custom tags which are provided by the user as well as default tags which are provided by subsurface. Default tags can be translated and will be written to XML in their non-localized form. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-10-20Export dives in UDDF formatGravatar Miika Turkia
Implement exporting in UDDF format as was done in Gtk version. File menu exports all the dives, right click on selection exports the selected ones. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-16GUI for CSV importGravatar Miika Turkia
This patch implements GUI for importing CSV log files. One is able to configure what columns contain time, depth and temperature fields. Pre-configured log applications currently included are ADP log viewer and XP5. (Both of these use actually tab as separator, so the field separator currently hard-coded.) [Dirk Hohndel: minor fixes] Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11Fix dive planner sidebar depth unitsGravatar Linus Torvalds
The dive planner always showed the depth in our internal units, ie millimeter, in the sidebar that showed the plan points. That made little sense in metric mode, and none at all in imperial. The _graph_ showed things in meter and feet. So make the DivePlannerPointsModel always convert things to and from the user units. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09Only define TRUE and FALSE if they aren't defined alreadyGravatar Dirk Hohndel
We did this for some situations but not for all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09Disable unused functionGravatar Dirk Hohndel
I am not removing this but leaving it around as this is useful for a feature that we still need to enable - the ability to filter out which events to display. This existed in 3.1 but is missing in the Qt version. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Fix some signedness issuesGravatar Dirk Hohndel
I always worry if these are worth following up on - but these seem pretty clear and obvious to me. As far as the planner is concerned, depth is unsigned. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Next round of code removal and header cleanupGravatar Dirk Hohndel
None of this is used anywhere Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Remove even more code and declarationsGravatar Dirk Hohndel
There's lots more stuff that can go. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Remove info.c/info.hGravatar Dirk Hohndel
The one remaining helper function in there was moved to maintab.cpp (which was the one remaining user). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Remove feature checkingGravatar Dirk Hohndel
We needed this in Gtk version as we were using a system font to show the stars and that was missing on some ancient Windows versions. With the Qt version we actually draw the stars so this has become obsolete. Suggested-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Make Windows cross compile againGravatar Dirk Hohndel
But this is broken as the utf8/utf16 conversions in windows.c are gone without glib. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Delete code and files that are no longer usedGravatar Dirk Hohndel
Most of this is Gtk related, some of it is helpers that we don't need anymore. I love the diffstat. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Trying to switch to Qt translationGravatar Dirk Hohndel
This compiles and looks about right, but it doesn't appear to work, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06First steps towards removing glib dependenciesGravatar Dirk Hohndel
- remove the build flags and libraries from the Makefile / Configure.mk - remove the glib types (gboolean, gchar, gint64, gint) - comment out / hack around gettext - replace the glib file helper functions - replace g_ascii_strtod - replace g_build_filename - use environment variables instead of g_get_home_dir() & g_get_user_name() - comment out GPS string parsing (uses glib utf8 macros) This needs massive cleanup, but it's a snapshot of what I have right now, in case people want to look at it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04Use helper function to find xslt folderGravatar Dirk Hohndel
This seems much better than the different hard coded and semi-hard coded paths we had before. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04Added configuration options for vertical speed units.Gravatar Patrick Valsecchi
Some people (free divers) are loving ft/s or m/s units for vertical speeds. Now they can choose between /min or /s in the configuration (only Qt UI). Signed-off-by: Patrick Valsecchi <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-27Added a ruler which can be dragged along the profileGravatar Maximilian Güntner
This patch adds a ruler QGraphicsItem which can be dragged along the profile. The ruler displays minimum, maximum and average for depth and speed (ascent/descent rate). Also, all used gas will be displayed. This also adds a new attribute to struct plot_data to store the speed (not just as velocity_t). Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-09-19Hook up adding a diveGravatar Dirk Hohndel
This gets things mostly right. It creates a dive and uses the planner widget to create samples which are copied into the dive. It fills in some reasonable defaults (DC model, timestamp), but doesn't allow editing the timestamp (or the temperatures and air pressure). On accept the planner gets reset and the dive appears correctly in the dive list. Cancel still needs to be handled. And I bet there are many subtle bugs lurking here and there. But it's a start. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18Only calculate deco stops in planner modeGravatar Dirk Hohndel
In add dive mode simply bring the diver safely back to the surface (currently with a fixed ascent rate of 30ft/min (or 9m/min)). We should make that rate configurable (for the planner as well as the dive add function). Also, the dive add function should offer to automatically include a safety stop. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-10Change ws_info and tank_info typesGravatar Dirk Hohndel
This is correct C. But debuggers in C++ mode are broken and can't display the global variables. While I hate having to do this change, I hate not being able to debug my software because of broken tools even more. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-09Use the same code for command line and gui for file handling.Gravatar Tomaz Canabrava
The Command line execution of Subsurface happened before the GUI was created, this leaded to various bugs by me(tm) over time. This patch seems to fix all of those, by reusing the same code for GUI interaction and CommandLine interaction. I had to rework how the main.c worked, it used to be C code calling C++ code, and this is non desirable, since C doesn't really understand C++. I Moved all of C-related code to 'subsurfacestartup.c/h' and created a tiny wrapper to call it, so all of the C code is still C code, and the new main.cpp calls the mainwindow->loadFiles and mainWindow->importFiles to get rid of the bugs that happened before. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-05Delte the temporary dive from the divelist after calculating deco.Gravatar Robert C. Helling
This bug manifested itself as too long deco obligation when moving waypoints to later and then back to earlier times as all intermedite versions were created as dives in the divelist (and the saturation of these "previous dives" was taken into account. It is not entirely clear to me how the dive will be permanently added to the divelist once ok is pressed: One could in createDecoStops allocate struct dive from the heap rather than from the stack and return a pointer to it and which is then added to the dive list upon pressing ok. [Dirk Hohndel: add include file to make this compile] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Removes circle in planGravatar Robert Helling
Remove circle in plan by starting the first line at the first point rather than the last. In addition marks all entered points as entered and not just the first and sets line color accordingly. Makes plan_add_segment return the added data point. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-23Perform deco calculation for planGravatar Dirk Hohndel
This uses a bunch of default values that we eventually need to get from the UI, but it's a first step towards a working dive planner. This exhibits some graphical artifacts when running, but other than that appears to be mostly correct. Things go far worse if I enable the changing of the scale once the deco makes the dive longer than the displayed time window. Things quickly spiral out of control. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-23Start hooking in the deco calculationsGravatar Dirk Hohndel
I expanded the DiveHandler to include the actual time / depth of each node on the graph - this way things will stay consistent if we need to rescale the graph. One thing that this makes obvious is that the whole design for the planner so far assumes metric data. We need to make sure this works well with feet instead of meters as well (and that it uses the information in the units settings). With this change we actually create a dive based on the plan input and add the deco stops (if needed) to it - but we don't do anything with the results of those calculations, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Converting the device_info list into a Qt data structureGravatar Dirk Hohndel
This data structure was quite fragile and made 'undo' when editing rather hard to implement. So instead I decided to turn this into a QMultiMap which seemed like the ideal data structure for it. This map holds all the dive computer related data indexed by the model. As QMultiMap it allows multiple entries per key (model string) and disambiguates between them with the deviceId. This commit turned out much larger than I wanted. But I didn't manage to find a clean way to break it up and make the pieces make sense. So this brings back the Ok / Cancel button for the dive computer edit dialog. And it makes those two buttons actually do the right thing (which is what started this whole process). For this to work we simply copy the map to a working copy and do all edits on that one - and then copy that over the 'real' map when we accept the changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Connect preferences to the rest of the codeGravatar Dirk Hohndel
The biggest problem here was that bool has different sizes in C and C++ code. So using this in a structure shared between the two sides wasn't a smart idea. Instead I went with 'short', but that caused problems with Qt being to smart for its own good and not doing the right thing when dealing with 'boolean' settings and a short value. This may be something in the way I implemented things (as I doubt that something this fundamental would be broken) but the workaround implemented here (explicitly using 0 or 1 depending on the value of the boolean) seems to work. I also decided to get rid of the confusion of where gflow/gfhigh are floating point (0..1) and when they are integers (0..100). We now use integers anywhere outside of deco.c. I also applied some serious spelling corrections to the preferences dialog's ui file. Finally, this enables the code that selects which partial pressure graph to show. Still to do: font size, metric/imperial logic Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Enable the weightsystem info and move the declarations to dive.hGravatar Dirk Hohndel
Having the tank_info declared in models.cpp seemed unintuitive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Get the math right for cylinder model setData functionGravatar Dirk Hohndel
This is a fun one. We only want to mark the divelist changed if the user actually changed something. So we try really hard to compare what was entered with what was there and only if it is different do we overwrite existing values and record this as a change to the divelist. An additional challenge here is the fact that the user needs to enter a working pressure before they can enter a size (when in cuft mode). That is not really intuitive. We work around this by assuming working pressure is 3000psi if a size is given in cuft - but then if the user changes the working pressure, that changes the volume. Now going back and changing the volume again does the trick. Or enter the working pressure FIRST and then the volume... This also changes the incorrect MAXPRESSURE to WORKINGPRESSURE and uses the text WorkPress in English (Gtk code used MaxPress which was simply wrong - this is just the design pressure or working pressure, not some hard maximum. In fact, people quite commonly "overfill" these tanks. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Actually remove cylinders and weightsystems from the data structuresGravatar Dirk Hohndel
The UI had only stubbed this code out. This adds the implementation of the helpers and calls them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Replace GError handling with a kMessageWidget based approachGravatar Dirk Hohndel
Instead of passing pointers to GError around we pass just pointers to error message texts around and use kMessageWidget to show those. Problem is that right now the close button on that doesn't do a thing - so the error stays around indefinitely. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Remove Gtk crudGravatar Dirk Hohndel
The DEBUGFILE logic isn't needed anymore. Nor are helpers dealing with model / datastructure updates. Nor conditional compiles to use Gtk instead of Qt. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Correctly use the weightsystem_none / cylinder_none helpersGravatar Dirk Hohndel
Plus a couple of minor formatting changes Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Added the code to show the cylinders from a dive.Gravatar Tomaz Canabrava
i Added the code to show the cylinders from a dive, this code also already permits additions from the interface, so the user can click 'add' and insert what he wants there. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17Merge branch 'Qt'Gravatar Dirk Hohndel
After the 3.1 release it is time to shift the focus on the Qt effort - and the best way to do this is to merge the changes in the Qt branch into master. Linus was extremely nice and did a merge for me. I decided to do my own merge instead (which by accident actually based on a different version of the Qt branch) and then used his merge to double check what I was doing. I resolved a few things differently but overall what we did was very much the same (and I say this with pride since Linus is a professional git merger) Here's his merge commit message: This is a rough and tumble merge of the Qt branch into 'master', trying to sort out the conflicts as best as I could. There were two major kinds of conflicts: - the Makefile changes, in particular the split of the single Makefile into Rules.mk and Configure.mk, along with the obvious Qt build changes themselves. Those changes conflicted with some of the updates done in mainline wrt "release" targets and some helper macros ($(NAME) etc). Resolved by largely taking the Qt branch versions, and then editing in the most obvious parts of the Makefile updates from mainline. NOTE! The script/get_version shell script was made to just fail silently on not finding a git repository, which avoided having to take some particularly ugly Makefile changes. - Various random updates in mainline to support things like dive tags. The conflicts were mainly to the gtk GUI parts, which obviously looked different afterwards. I fixed things up to look like the newer code, but since the gtk files themselves are actually dead in the Qt branch, this is largely irrelevant. NOTE! This does *NOT* introduce the equivalent Qt functionality. The fields are there in the code now, but there's no Qt UI for the whole dive tag stuff etc. This seems to compile for me (although I have to force "QMAKE=qmake-qt4" on f19), and results in a Linux binary that seems to work, but it is otherwise largely untested. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14Add tag for deco divesGravatar Dirk Hohndel
Fixes #85 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-11Require libzip, xslt and osm-gps-map in all buildsGravatar Henrik Brautaset Aronsen
Conditional inclusion of libzip, xslt and osm-gps-map just makes testing more cumbersome, since testers might lack Subsurface features without knowing. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06Avoid redefinition of typedef ‘bool’Gravatar Henrik Brautaset Aronsen
The compiler on MacOSX wouldn't build Subsurface when bool was redefined. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02Added code to Select a dive, fixed minor annoyances.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24Split report_dives into UI and logic and move to divelist filesGravatar Dirk Hohndel
Functionality is unchanged, except we now have a nice process_dives function that deals with all the logic and that gets called from report_dives from the Gtk code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-21Simplistic filtering by tagsGravatar Dirk Hohndel
This only allows for a logical "AND" - so only dives that all of the selected tags are displayed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-21Add Gtk dialog to select the dives tags for which dives are shownGravatar Dirk Hohndel
This literally just creates the dialog and does not hook things up with the dive list. The idea is to abstract out the idea behind the invalid dives to allow the user to select / deselect all kinds of dives and then do statistics on the selected ones. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-18Delay Qt ui constructionGravatar Amit Chaudhuri
The Qt ui will need to read the dive_table to populate widgets with dives. Gtk functionality in init_ui is required to parse the dives. Split init_ui to allow parsing to proceed and complete before Qt ui mainwindow constructor is called. Play with qDebug()'s printf style (Thiago!) Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-15Added the code that will load and populate the Tank InfoGravatar Tomaz Canabrava
Added the code that will load and populate the Tank Info ComboBox that`s used by the user to select the Cylinder description. Code curerntly implements more than the GTK version since the GTK version of it was a plain-list, this one is a table based model that can be used in ListViews ( like we use now in the ComboBox ) but also in TableViews ( if there`s a need in the future to see everything that`s catalogued in the Tank Info struct. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10Add four more tagsGravatar Dirk Hohndel
Student (training), Instructor (teaching), Photo and Video Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09Automatically show Freshwater tag (but don't set it)Gravatar Dirk Hohndel
If the salinity is 10000 we show (but do not set) the Freshwater tag. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09Add tags for night and freshwaterGravatar Henrik Brautaset Aronsen
Also trim the redundant "Dive" text from "Lake Dive", "Pool Dive", .... Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09Add lake and river to the list of supported tagsGravatar Pierre-Yves Chibon
[Dirk Hohndel: minor cleanups] Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09Store the tag names instead of an opaque numberGravatar Dirk Hohndel
And as we need the names for that, simplify the way we show the tags in the Dive Info tab (and mark them for translation while we are at it). In the process I renamed the constants to DTAG_ from DTYPE_ (and made their nature as being just bits more obvious). Also mark the box on the Info tab "Dive Tags", not "Dive Type". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>