subsurface/qt-ui
Salvador Cuñat 44b55bd1a2 Import Datatrak/WLog files
Sequentially parses a file, expected to be a Datatrak/WLog divelog, and
converts the dive info into Subsurface's dive structure.

As my first DC, back in 90s, was an Aladin Air X, the obvious choice of log
software was DTrak (Win version). After using it for some time we moved to WLog
(shareware software more user friendly than Dtrak, printing capable, and still
better, it runs under wine, which, as linux user, was definitive for me). Then,
some years later, my last Aladin died and I moved to an OSTC, forcing me to
look for a software that support this DC.
I found JDivelog which was capable of import Dtrak logs and used it for some
time until discovered Subsurface existence and devoted to it.

The fact was that importing Dtrak dives in JDivelog and then re-importing them
in Subsurface caused a significant data loss (mainly in the profile events and
alarms) and weird location of some other info in the dive notes (mostly tag
items in the original Dtrak software). This situation can't actually be solved
with tools like divelogs.de which causes similar if no greater data loss.

Although this won't be a core feature for Subsurface, I expect it can be useful
for some other divers as has been for me.

Comments and issues:

Datatrak/Wlog files include a lot of diving data which are not directly
supported in Subsurface, in these cases we choose mostly to use "tags".

The lack of some important info in Datatrak archives (e.g. tank's initial
pressure) forces us to do some arbitrary assumptions (e.g. initial pressure =
200 bar).

There might be archives coming directly from old DOS days, as first versions
of Datatrak run on that OS; they were coded CP437 or CP850, while dive logs
coming from Win versions seems to be coded CP1252. Finally, Wlog seems to use a
mixed confusing style. Program directly converts some of the old encoded chars
to iso8859 but is expected there be some issues with non alphabetic chars, e.g.
"ª".

There are two text fields: "Other activities" and "Dive notes", both limited to
256 char size. We have merged them in Subsurface's "Dive Notes" although the
first one could be "tagged", but we're unsure that the user had filled it in
a tag friendly way.

WLog adds some information to the dive and lets the user to write more than
256 chars notes. This is achieved, while keeping compatibility with DTrak
divelogs, by adding a complementary file named equally as the .log file and
with .add extension where all this info is stored.  We have, still, not worked
with this complementary files.

This work is based on the paper referenced in butracker #194 which has some
errors (e.g. beginning of log and beginning of dive are changed) and a lot of
bytes of unknown meaning. Example.log shows, at least, one more byte than those
referred in the paper for the O2 Aladin computer, this could be a byte referred
to the use of SCR but the lack of an OC dive with O2 computer makes impossible
for us to compare.

The only way we have figured out to distinguish a priori between SCR and non
SCR dives with O2 computers is that the dives are tagged with a "rebreather"
tag. Obviously this is not a very trusty way of doing things. In SCR dives,
the O2% in mix means, probably, the maximum O2% in the circuit, not the O2%
of the EAN mix in the tanks, which would be unknown in this case.

The list of DCs related in bug #194 paper seems incomplete, we have added
one or two from WLog and discarded those which are known to exist but whose
model is unknown, grouping them under the imaginative name of "unknown". The
list can easily be increased in the future if we ever know the models
identifiers.
BTW, in Example.log, 0x00 identifier is used for some DC dives and from my own
divelogs is inferred that 0x00 is used for manually entered dives, this could
easily be an error in Example.log coming from a preproduction DC model.

Example.log which is shipped in datatrak package is included in dives
directory for testing pourposes.

[Dirk Hohndel: some small cleanups, merged with latest master, support
               divesites, remove the pointless memset() before free() calls
	       add to cmake build]

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:03:08 -07:00
..
css Fix TableWidget ( equipment ones ) on dark scheme. 2013-12-12 03:26:39 +01:00
marble Resync included header with upstream 2014-01-15 15:49:50 +07:00
profile Change the references to ShowError to the new notification object. 2015-02-27 06:31:10 +01:00
statistics Implement the modelDataChanged to repopulate the widget on Statistics 2014-08-25 14:00:38 -07:00
about.cpp add and use a version.c / version.h pair 2015-02-15 13:26:51 -08:00
about.h Headers cleanup. 2014-06-26 15:47:02 -07:00
about.ui SubsurfaceAbout class cleanup. 2014-02-08 08:00:27 -08:00
completionmodels.cpp Update completion model for dive site names 2015-02-12 11:19:27 -08:00
completionmodels.h Put include guard to every header 2014-02-11 12:37:01 -08:00
configuredivecomputerdialog.cpp Remove the ProfileWidget from mainwindow.ui 2015-02-10 10:45:45 -08:00
configuredivecomputerdialog.h Whitespace cleanup 2014-12-28 21:02:28 -08:00
configuredivecomputerdialog.ui Use a progressbar in the configure dc dialog 2015-01-21 17:03:18 +12:00
divecomponentselection.ui Switch components for cut/paste dive to dive site logic 2015-02-12 21:11:51 -08:00
divecomputermanagementdialog.cpp Remove the DiveList from the mainwindow.ui 2015-02-10 10:45:45 -08:00
divecomputermanagementdialog.h Massive automated whitespace cleanup 2014-02-27 20:09:57 -08:00
divecomputermanagementdialog.ui divecomputermanagementdilog capitalisation consitency 2014-07-10 16:26:20 -07:00
divelistview.cpp Add option to undo deleted dives 2015-02-11 08:07:23 -08:00
divelistview.h Move the Facebook send profile button 2014-12-29 09:05:08 -08:00
divelogexportdialog.cpp Show translated String. 2015-02-27 06:31:12 +01:00
divelogexportdialog.h Revert "Update Qt4 patch" 2015-02-22 08:30:34 -08:00
divelogexportdialog.ui Enable and disable unit selection 2014-12-31 12:12:59 -08:00
divelogimportdialog.cpp Revert "Update Qt4 patch" 2015-02-22 08:30:34 -08:00
divelogimportdialog.h CSV import: make predefined imports work again 2015-01-07 17:02:42 -08:00
divelogimportdialog.ui CVS import UI: better message if some columns were matched 2015-01-07 12:41:06 -08:00
divepicturewidget.cpp Add hashes to images 2015-02-27 06:29:44 +01:00
divepicturewidget.h Add hashes to images 2015-02-27 06:29:44 +01:00
diveplanner.cpp Improve gas accounting in the panner 2015-03-09 10:39:50 -07:00
diveplanner.h Move the Profile out of the mainwindow.ui 2015-02-10 10:45:46 -08:00
diveplanner.ui Support different salinity in planner 2014-11-12 14:42:15 -08:00
diveshareexportdialog.cpp Move helper functions around 2015-02-23 09:31:08 -08:00
diveshareexportdialog.h Export to DiveShare 2014-10-14 20:33:46 +02:00
diveshareexportdialog.ui Two small fixes regarding translation texts 2014-11-10 13:10:50 -08:00
downloadfromdivecomputer.cpp Revert "Update Qt4 patch" 2015-02-22 08:30:34 -08:00
downloadfromdivecomputer.h Dive d/l selection UI: clear table when retrying 2015-01-11 07:46:21 -08:00
downloadfromdivecomputer.ui Typos, punctuation and capitalisation. 2015-01-26 07:25:37 -08:00
filtermodels.cpp Make filters work with dive sites 2015-02-12 22:45:47 -08:00
filtermodels.h Remove unused DivesFilteredOut variable 2014-11-16 18:39:29 +00:00
filterwidget.ui Add better icons for the filter dialog 2014-12-31 23:53:28 -08:00
globe.cpp Allow editing of dive sites 2015-02-13 14:27:35 -08:00
globe.h Add the first call to registerApplicationState 2015-02-10 10:45:44 -08:00
graphicsview-common.cpp CCR option: display o2 sensor data 2015-01-21 17:00:18 +12:00
graphicsview-common.h CCR option: display o2 sensor data 2015-01-21 17:00:18 +12:00
groupedlineedit.cpp Clean up the header files 2015-01-18 21:25:59 +12:00
groupedlineedit.h Massive automated whitespace cleanup 2014-02-27 20:09:57 -08:00
kmessagewidget.cpp Clean up the header files 2015-01-18 21:25:59 +12:00
kmessagewidget.h 727 fixed 2014-11-17 06:02:21 +00:00
listfilter.ui Revert "Remove unused strings from ui files" 2014-12-24 10:06:41 -08:00
locationInformation.ui Create simple class to hold the location management. 2015-02-11 16:34:02 -08:00
maintab.cpp Remove redundant code 2015-03-10 07:47:00 -07:00
maintab.h When updating the dive site name, show this on the maintab 2015-02-13 23:50:31 -08:00
maintab.ui Rename the tab "Dive info" to "Info", and "Dive notes" to "Notes" 2015-02-14 11:18:53 -08:00
mainwindow.cpp Import Datatrak/WLog files 2015-03-10 10:03:08 -07:00
mainwindow.h Change the references to ShowError to the new notification object. 2015-02-27 06:31:10 +01:00
mainwindow.ui Creating a Notification widget in the Main Window. 2015-02-27 06:31:06 +01:00
metrics.cpp Unify icon metrics 2014-10-18 15:16:15 -07:00
metrics.h Unify icon metrics 2014-10-18 15:16:15 -07:00
modeldelegates.cpp Finish the cleanup of mainwindow.ui 2015-02-10 10:45:46 -08:00
modeldelegates.h Turn of replotting while the cylinder type combo box is active 2014-12-17 21:33:55 -08:00
models.cpp Use unused cylinders in planner if they are displayed 2015-02-15 06:00:06 -08:00
models.h Add the ability to modify the cylinder use in the UI 2014-11-17 14:03:37 +00:00
notificationwidget.cpp Creating a Notification widget in the Main Window. 2015-02-27 06:31:06 +01:00
notificationwidget.h Creating a Notification widget in the Main Window. 2015-02-27 06:31:06 +01:00
plannerDetails.ui Add the PlannerDetails class 2015-02-10 10:45:45 -08:00
plannerSettings.ui Revert "Update Qt4 patch" 2015-02-22 08:30:34 -08:00
preferences.cpp Remove the DiveList from the mainwindow.ui 2015-02-10 10:45:45 -08:00
preferences.h Ignore QWebView in Android 2015-01-14 07:49:24 +13:00
preferences.ui Try to make the Facebook interaction be more pleasant 2015-01-30 22:36:49 -08:00
printdialog.cpp Clean up the header files 2015-01-18 21:25:59 +12:00
printdialog.h Print: add the support to store margins and printer options 2014-11-13 15:05:11 -08:00
printlayout.cpp Get location from dive site for printing 2015-02-12 22:45:47 -08:00
printlayout.h Print: add the support to store margins and printer options 2014-11-13 15:05:11 -08:00
printoptions.cpp Clean up the header files 2015-01-18 21:25:59 +12:00
printoptions.h Print: add the support to store margins and printer options 2014-11-13 15:05:11 -08:00
printoptions.ui Fix the layout on the Print Dialog 2014-08-04 09:50:55 -07:00
renumber.ui Make some dialogs modal to MainWindow 2014-03-12 10:14:17 -07:00
searchbar.ui Add a horizontal spacer to make the searchbar layout better 2014-07-11 17:00:23 -07:00
setpoint.ui A widget to add a set-point change 2014-12-01 14:19:03 -08:00
shiftimagetimes.ui shifimmagetimes capitalisation consitency and title 2014-07-11 07:05:10 -07:00
shifttimes.ui shiftimes capitalisation consitency and title 2014-07-11 07:05:17 -07:00
simplewidgets.cpp Clear after accepting / rejecting the LocationEdit 2015-03-10 07:47:30 -07:00
simplewidgets.h Clear after accepting / rejecting the LocationEdit 2015-03-10 07:47:30 -07:00
socialnetworks.cpp Get location for Facebook from dive site 2015-02-12 22:45:47 -08:00
socialnetworks.h Facebook integration: Album name is required 2014-12-29 11:59:21 -08:00
socialnetworksdialog.ui Facebook integration: improve dialog layout 2014-12-29 11:58:38 -08:00
starwidget.cpp Clean up the header files 2015-01-18 21:25:59 +12:00
starwidget.h Unify icon metrics 2014-10-18 15:16:15 -07:00
subsurfacewebservices.cpp Change the references to ShowError to the new notification object. 2015-02-27 06:31:10 +01:00
subsurfacewebservices.h Give Subsurface a distinct User Agent string 2014-07-31 11:20:11 -07:00
tableview.cpp Clean up the header files 2015-01-18 21:25:59 +12:00
tableview.h Fix plus icon position based on the theme 2014-10-18 15:18:38 -07:00
tableview.ui Revert "Remove unused strings from ui files" 2014-12-24 10:06:41 -08:00
tagwidget.cpp Remove information panel from mainwindow.ui 2015-02-10 10:45:45 -08:00
tagwidget.h 727 fixed 2014-11-17 06:02:21 +00:00
undocommands.cpp Add ability to undo renumbering of dives 2015-02-28 12:44:14 +01:00
undocommands.h Add ability to undo renumbering of dives 2015-02-28 12:44:14 +01:00
updatemanager.cpp Move helper functions around 2015-02-23 09:31:08 -08:00
updatemanager.h Add unique but random UUID to server queries 2015-01-25 12:02:13 -08:00
usermanual.cpp Make search and close shortcut for user manual work on Mac 2015-01-28 14:30:19 -08:00
usermanual.h Make search and close shortcut for user manual work on Mac 2015-01-28 14:30:19 -08:00
usersurvey.cpp Move helper functions around 2015-02-23 09:31:08 -08:00
usersurvey.h Move helper functions around 2015-02-23 09:31:08 -08:00
usersurvey.ui Include iPhone companion app to user survey 2015-01-30 22:48:08 -08:00
webservices.ui webservice capitalisation consitency 2014-07-11 07:05:38 -07:00