Commit graph

3199 commits

Author SHA1 Message Date
Dirk Hohndel
ca64f8a782 Clean up the UI when finished editing
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 11:09:25 -07:00
Dirk Hohndel
043ae4af27 Turn the toolbar back on after editing a dive site
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:50:56 -07:00
Dirk Hohndel
4796ee0c39 Don't call enableEdition() every time a change is made
We only need to do this once.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:50:18 -07:00
Dirk Hohndel
2c2adacb90 Don't enter dive site edit mode whenever the coordinates are set in the UI
This function was missing the check if setting that field actually changes
what's already in the data structure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:49:21 -07:00
Dirk Hohndel
1e3700c11f Don't call UI functions from helper code
This may seem much more complicated but actually is much cleaner. Add each
thread we start to the list of future results and add a new UI function
that updates the UI once all of the threads have finished.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:22:34 -07:00
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
Tomaz Canabrava
500c4c2772 Clear after accepting / rejecting the LocationEdit
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:30 -07:00
Tomaz Canabrava
986b6c509a Change color / mark widget as changed correctly on LocationEdit
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:21 -07:00
Tomaz Canabrava
30c5a027ca Clone a bit of code to mark the Location Widget changed
This code is the same that is used on the MainTab, but
since they are different objects, I can't just call it.
so I'm duplicating them for the time being.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:05 -07:00
Tomaz Canabrava
6fbf5b33cc Remove redundant code
Another snippet that shouldn't exist.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:00 -07:00
Tomaz Canabrava
a5448ef729 Remove dead code.
This code used to trigger the edit mode a long time ago
since now I'm re-reading the code to implement the
same stuff on the Location edit mode, I realized that
this is not needed anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:46:50 -07:00
Tomaz Canabrava
53d20f5b8a Do not show the Edit mode message when entering location management screen
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:46:30 -07:00
Joakim Bygdell
20a82e2b21 Improve gas accounting in the panner
When using gasmixes where the difference is less than 2% the planner can't
caclulate casconsumptions correctly. This sets the minimum gasdifference
to 1%.

Fixes #795

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-09 10:39:50 -07:00
Anton Lundin
237043d6ba Fix building with NO_PRINTING for Android
Back in 4867ee8ad8 ("Move the Profile out
of the mainwindow.ui") the way to access the PlannerDetails object
changed.

This does the corresponding change to the NO_PRINTING block, making it
build on Android again.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-09 09:44:00 -07:00
Miika Turkia
724772ef68 Include upper case extensions on import dialog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-08 12:55:47 -07:00
Grace Karanja
182fe790c9 Add ability to undo renumbering of dives
Expand the undo feature by storing a list of renumbered dives' ids
and numbers so that the original numbers can be restored if needed.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-28 12:44:14 +01:00
Gehad elrobey
100f4ee1a4 Show notification message while logs are converted from v2
This is another long operation that needs showing a notification about
importing the old format log files

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-28 12:42:50 +01:00
Gehad elrobey
90d68ead31 Show translated String.
Translated notifications are always better.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:31:12 +01:00
Gehad elrobey
f61b59d961 Change the references to ShowError to the new notification object.
Showing an Error message is better called from the Notification Object,
So for consistency old references to showError is replaced by calling
the notification object.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:31:10 +01:00
Gehad elrobey
59ab849854 Creating a Notification widget in the Main Window.
The main error message bar can be used to show exporting information and
other notification.

So a new Notification handler object is created in the main window
<NotificationWidget> that inherits <KMessageWidget> that shows different
type of notifications, ex. (Warning, Error and information)

Also this class contains a QFutureWatcher object that is set to handle
the QFuture variable returned from the exporting thread. this will allow
the UI to be updated when the thread finishes execution.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:31:06 +01:00
Robert C. Helling
e6482bbdc8 UI to learn hashes of local image files
This addes a menu entry for the user to select a directory that is recursively
traversed to look for image files and compute the hashes of those images (for
those images to be available to be displayed in dives according to their hash values).

This traversal and hash computation happens in and independend thread and so far
the only feedback to the user is that upon completion the dispayed images are updated.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:30:49 +01:00
Robert C. Helling
b02bf002a6 Add hashes to images
Upon successfull reading an image file, this computes a SHA1 hash of the
image and saves it with the picture tag in the log file. When a file is
not successfully loaded (for example because the log was created on a
different computer) we look up the hash in a dictionary that maps hashes
to local file names.

That dictionary (actually two for both directions), is loaded on startup
and saved upon destruction of the main window.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:29:44 +01:00
Dirk Hohndel
0ed4356fc2 Display slowness warning before opening a V2 file
This is somewhat invasive as aborting the XML file read requires us to
report things up the recursive parsing chain.

What we really need to do here is to ask the user how they want to use the
data from reverse geo lookup. But for now we only warn about the fact that
this can take a while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-25 10:05:37 +01:00
Dirk Hohndel
ddc01e39e7 Move helper functions around
We had a ton of helper functions in qt-gui.cpp which really didn't make
much sense. So I moved them all into qthelper.cpp.

Also moved the UserAgent helper that didn't belong in the UpdateHandler to
begin with - that's a generic helper used in many places...

With this we can successfully build using cmake again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-23 09:31:08 -08:00
Dirk Hohndel
2866a604b4 Revert "Update Qt4 patch"
This reverts commit 762315e7ee.

Oops, this was supposed to update the patch, not update and apply it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-22 08:30:34 -08:00
Dirk Hohndel
762315e7ee Update Qt4 patch
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-19 21:52:41 -08:00
Lubomir I. Ivanov
aa7f2eeb8a subsurfacewebservices.cpp: add QDebug include
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 14:08:44 -08:00
Lubomir I. Ivanov
8053a61442 simplewidgets.cpp: QLineEdit::setClearButtonEnabled() is from Qt5.2
This could cause problems if the user tries to compile with
Qt versions between 5.0 and 5.2.

Reported-by: Michele Fabi <fabiemme@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 14:08:36 -08:00
Tomaz Canabrava
2e6fcfc969 Fix profile toolbar
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-16 20:37:52 -08:00
Lubomir I. Ivanov
071b9ff50c downloadfromdivecomputer.cpp: fix initializer list order warning
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 13:29:49 -08:00
Lubomir I. Ivanov
c45768a09f add and use a version.c / version.h pair
version.c is now object code which is recompiled each time
ssrf-version.h changes, while the interface file version.h
remains that same at all times and files which include it
will not need to be recompiled.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 13:26:51 -08:00
Thiago Macieira
39ffb0fced Fix Subsurface build with Qt 5.4.1 and later
The intention had been all along to use the 5.4 QSysInfo API, but due to
a silly mistake in the QT_VERSION check, it never got enabled for 5.4.0.
On 5.4.1 it does get enabled and, unfortunately, causes compilation
errors because the API changed between the time we backported to
Subsurface and the final version.

This commit backports the final QSysInfo API from Qt 5.4 into
Subsurface, which includes the renaming of a few functions. Since the
prettyOsName function no longer exists in the Qt API in that form, I've
reimplemented it using the API that does exist.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 06:00:52 -08:00
Robert C. Helling
ea143e9668 Use unused cylinders in planner if they are displayed
This makes prefs.display_unused_tanks also relevant for the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 06:00:06 -08:00
Gehad elrobey
9470be0a77 HTML: Fix Null values in yearly statistics export.
Null values should be handeled nicely instead of showing NULL or Nan.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 05:56:01 -08:00
Gehad elrobey
d2990aea6f HTML: Fix exporting themes in multilingual environment
Don't compare to static english string, must translate first.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 05:55:42 -08:00
Miika Turkia
2bd019817c Add ssrf as dive log extension on import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 22:38:17 -08:00
Grace Karanja
87ee8e8aef Add ability to undo shifting of dive time
Adds the ability to undo shifting of dive times. The change is captured
at simplewidgets.cpp and an undo command is created.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 15:46:37 -08:00
Dirk Hohndel
cf07e3a79b When cleaning up the empty screen, also clean up dive sites
Otherwise we are using stale pointers in the displayed_dive_site global.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 11:56:33 -08:00
Henrik Brautaset Aronsen
961bac9233 Rename the tab "Dive info" to "Info", and "Dive notes" to "Notes"
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 11:18:53 -08:00
Lubomir I. Ivanov
cbff3f89c9 mainwindow.cpp: don't close a file if a dive site is being edited
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 11:18:32 -08:00
Dirk Hohndel
f81e2c111d When updating the dive site name, show this on the maintab
If we accept a change on the dive site management screen, it needs to be
reflected on the Dive notes tab right away.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 23:50:31 -08:00
Dirk Hohndel
ca72ab5749 When closing a dive, delete all the dive sites
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 23:11:36 -08:00
Dirk Hohndel
3ea2e15bd2 Don't add empty dive sites
It makes no sense to keep them around, it makes no sense to have dives
refer to them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 23:08:33 -08:00
Dirk Hohndel
cd77e2e700 Make sure there is a dive site if you try to edit it
If the user clicks on manage (or double clicks on the globe) and the
displayed_dive doesn't actually have a dive site associated with it (e.g.
because we are adding a dive or because it was imported or downloaded
without dive site information, then we need to make sure that there is an
empty dive site that we can make changes to.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 22:45:31 -08:00
Dirk Hohndel
e32459d313 When adding / planning a dive, reset the dive site manage screen
Otherwise old data is still shown if the user clicks manage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 22:42:57 -08:00
Dirk Hohndel
b60b4ef69d Fix crash when adding a dive
If a dive has no dive_site_uuid we would dereference a NULL pointer and
crash. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 22:08:08 -08:00
Dirk Hohndel
2607fea2de Fix compile time warning
No idea why designer sometimes adds these zorder items.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:45:31 -08:00
Dirk Hohndel
32ad046f56 Allow editing of dive sites
And hook things up when double clicking the globe.

The user experience isn't consistent with what we do on the main tab
(i.e., no coloring of fields that are changed), but it seems to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:35 -08:00
Dirk Hohndel
6708e06872 Adapt GPS coordinate download from our companion app to dive sites
This is a bit awkward now. We are downloading what looks like fake dives
in the v2 format. So we create a dive site for every single fix.

After we merge those new dive sites into the existing dives we need to
throw away all the dive sites that weren't used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:34 -08:00
Dirk Hohndel
be1b6c67c1 maintab change for get_dive_site_uuid_by_name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:34 -08:00