Commit graph

7771 commits

Author SHA1 Message Date
Dirk Hohndel
415abeea66 When deleting a cylinder, adapt gas changes
When we delete a cylinder the gas changes in that dive may have to be
adjusted. We didn't do this at all in the past. With this commit we should
be doing this right for a single dive that is being edited.

This does NOT handle multiple dives being edited at the same time (or more
specifically - if you have multiple dives selected and delete a cylinder,
the dives that had the same set of cylinders (other than the displayed
dive) will get that particular cylinder deleted, but won't have their gas
change events (and sensor data in the samples) adapted.

Possibly we should simply prohibit deleting cylinders when more than one
dive are selected.

See #834

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-23 15:27:21 -07:00
Dirk Hohndel
bbfa2b655b Profile context menu: trigger editing of manually added dive
Right now the way to edit the profile of a manually added dive is really
counterintuitive: you have to first make some random change to the dive
information, then the profile switches in to editing mode.

This commit adds a simple context menu entry on the profile that is only
shown when the a manually added dive is displayed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-23 13:56:24 -07:00
Marcos CARDINOT
59f283a4fc ostctools - resource leaks
some resources are not being freed.

Signed-off-by: Marcos CARDINOT <mcardinot@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 13:59:50 -07:00
Dirk Hohndel
6f7e3d04cb Handle XSLT based imports correctly
XSLT conversions create V2 XML files, but we shouldn't abort when we parse
those without having the user informed about the potential slowness - all
XSLT based imports are slow, anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 13:20:27 -07:00
Dirk Hohndel
959077c66b Remove debug output about verbosity
This snuck in on commit f4f791ffbd ("Add verbose debug output to
parse_manual_file").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 11:18:00 -07:00
Dirk Hohndel
ab24c1df87 When editing the location, make sure it gets applied to the dives
Oops, that was embarrassing. Just setting it on displayed_dive doesn't
gain us anything if it isn't transferred to the selected dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 09:35:58 -07:00
Dirk Hohndel
429fcdb344 When remembering the selection, don't try to be too smart with trips
We assumed that a trip was selected when all of its dives were selected
instead of just remembering if the trip itself was selected. I'm sure
there was a reason for that but I cannot think of any. But a side effect
is that if you have a trip with only one dive in it and have that one dive
selected and edit it, after saving your changes you end up on the trip
(which is now also selected) and are no longer on the dive. And that seems
quite wrong.

The new code simply remembers that the trip was selected. And selects it
again if it was.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 08:42:28 -07:00
Dirk Hohndel
31b8dffbb1 Uemis downloader: don't use bogus sensor data from Uemis
Sometimes we get a sensor number of 255 - which gets turned into a tank
index and then causes all kinds of havoc. Simply refuse to use a tank
number larger than the maximum Subsurface has been compiled for.

Oh, and use consistent variables to handle these unsigned 8 bit integers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-21 23:31:03 -07:00
Dirk Hohndel
f33a11bc8a Uemis downloader: adjust the threshold for stopping downloads
A complete batch of divelog and dive data takes about 20% of the available
space (depending on how long those dives are). This is a hack and I can
see this potentially going wrong, but the alternative is to be even more
conservative and that has its own set of problems as it causes us to need
more "unplug, wait, plug in again and restart" cycles.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-21 21:18:43 -07:00
Dirk Hohndel
df9f233eed Uemis downloader: download additional dive data after every batch
This looks like a fairly big change but it mostly just moves a block of
code inside an earlier loop and adjust a few variables around it.

The completely broken and insane Uemis download protocol distributes data
across different "databases" on the dive computer. The "divelogs" are
downloaded in batches of 10 (most of the time), and with this change every
time one of those batches is downloaded we straight away get the matching
"dive" entries.

Hopefully this will avoid having the download abort (for lack of space)
before all components are loaded.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-21 20:29:20 -07:00
Dirk Hohndel
7101386cb6 Uemis downloader: get the right values set before bailing
This caused us to not read the auxiliary information for up to the last
ten dives that were downloaded from the SDA.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-21 19:31:05 -07:00
Dirk Hohndel
164170cfdf cmake: fix finding Marble
Silly bug. A lot of things in cmake are case insensitive. Some care about
case. Stupid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-21 18:19:16 -07:00
Dirk Hohndel
216fa8d543 Don't crash if add_gas_switch_event() gets called with invalid index
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 23:28:51 -07:00
Dirk Hohndel
136282f88a Uemis downloader: even with an empty divelist, check where to start
If the user hits retry from within the download dialog, the dive list
might still be empty but we still have to look for the best point to
restart.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 23:28:44 -07:00
Dirk Hohndel
79f15e913b Uemis downloader: allow continuing download by clicking Retry
When we run out of space in the Uemis filesystem we return an error. The
user could reasonably unplug the SDA, insert it again and then retry to
continue the download (that's what we tell them to do). In that case we
need to make sure we start at the correct dive otherwise the same dives
keep getting downloaded over and over again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 23:28:04 -07:00
Dirk Hohndel
4bccee238c Download dialog: we can accept a partial download after an error
The dialog didn't accept "OK" and store the dives downloaded / selected so
far if there had been an error. Especially with partial downloads from the
Uemis SDA this is something that is quite reasonable to want to do, so
allow exiting the dialog with OK even after an error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 22:11:43 -07:00
Dirk Hohndel
3953800fe6 Uemis downloader: don't discard samples too early
We do a good job in the fixup_dive() code to make sure we don't add long
surface tails to the dives, so don't try too hard to guess the correct
last sample in the Uemis specific code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 21:37:16 -07:00
Dirk Hohndel
3fb5f84e11 Uemis downloader: avoid double free
A well intentioned attempt in commit ff860b3c04 ("uemis-downloader -
resource leaks") to fix resource leaks actually introduced a bug.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 21:35:54 -07:00
Lubomir I. Ivanov
82ff9fc9c8 cmake: more consitent multi-line calls
- don't put anything on the first line after the opening "("
- fix indentation of the closing "("

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:02:32 -07:00
Lubomir I. Ivanov
8fec4ab5e7 cmake: use uppercase for defined macros
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:02:23 -07:00
Lubomir I. Ivanov
8153c1560b cmake: fix message for NO_MARBLE
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:02:07 -07:00
Lubomir I. Ivanov
ea2ffd6c32 cmake: lowercase all built-in calls
e.g.
SET() -> set()
ELSEIF() -> elseif()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:01:36 -07:00
Lubomir I. Ivanov
8c4ef161b2 cmake: generate clean ssrf-version.h
remoevs the extra white sapce in the generated
ssrf-version.h.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:01:14 -07:00
Lubomir I. Ivanov
cdd84bb188 cmake: whitespace cleanup
- indentation
- spaces near comments

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:00:17 -07:00
Lubomir I. Ivanov
ed4fbb92d0 cmake: add LIBGIT2_FROM_PKGCONFIG and LIBDC_FROM_PKGCONFIG
These two new options allow usage of pkg-config to retrieve
libdivecomputer and libgit2.

For some reason the variables *_LIBRARIES have to be set
to blank strings in the process, otherwise "-l" is passed to
the linker.

LIBGIT2_FROM_PKGCONFIG is a rename from PREFER_GIT_FROMSOURCE
for consistency. The IF() check is also fixed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-17 15:25:47 -07:00
Lubomir I. Ivanov
39d0b5533d cmake: add the NO_MARBLE option
If NO_MARBLE is set to ON, the MARBLE package is not seeked.
If set to OFF the package is seeked, but if the find fails
the gcc definition -DNO_MARBLE is set and marble is disabled.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-17 15:25:33 -07:00
Lubomir I. Ivanov
1c71a90826 cmake: add the NO_TESTS NO_DOCS options
NO_TESTS: disable the tests
NO_DOCS: disable the docs

Both are set to OFF by default.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-17 15:24:51 -07:00
Dirk Hohndel
6662f2864f cmake: fix bug when using system libgit2
Simple omission in commit 7596db28b5 ("cmake: allow looking for optional
libraries").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-16 07:25:49 -07:00
Dirk Hohndel
5ecf4650b4 cmake: add extra -lpthread to fix Ubuntu builds
We shouldn't need this. Ubuntu is once again broken. What else is new.
But since this shouldn't hurt any of the sane Linux version, I'll just add
it for any Linux flavor.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-16 07:22:09 -07:00
Dirk Hohndel
1f0bf92a34 build.sh: successfully build an App bundle on the Mac
Some install name magic on two of the libraries we build was necessary for
things to work out correctly.

And I added an install step to the default build that puts Subsurface in the
install_root on other OSs and creates the Subsurface.app under
subsurface/build/Subsurface.app on the Mac.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-15 11:37:30 -07:00
Grace Karanja
193edd9f13 Add ability to undo removing of dives from trips
Add the functionality to undo/redo removing of dives from trips. The
code calling remove_dive_from_trip has moved to the UndoCommands class.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14 10:29:15 -07:00
Tomaz Canabrava
8e32faa866 cmake: remove references to LRELEASE
This is being taken care by Qt5::LinguistTool

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14 10:28:58 -07:00
Gehad elrobey
54453abe49 Show error messages for incorrect edit invocation
Planned dives must be replanned while manually added dives must be edited.
Show error messages to handle wrong user input.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14 10:12:32 -07:00
Dirk Hohndel
12b276d15c cmake: try to find the macdeployqt program
There is no variable for it, but we can abuse the variable that shows us where
moc is located.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-10 13:15:19 -07:00
Dirk Hohndel
6f997274f9 cmake: improve test for variable
CMake still confuses me. When testing if a variable was set it sometimes needs
to want "DEFINED", but sometimes I need to compare it to an empty string. Let's
do both (this seems to fix the problem I ran into) - but this is still weird.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-10 12:10:07 -07:00
Dirk Hohndel
7596db28b5 cmake: allow looking for optional libraries
And use this to look for libusb.
If it's there then libdivecomputer likely was linked against it. If it isn't
then we don't need it, either.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-10 12:08:26 -07:00
Dirk Hohndel
25467aa85a Update the INSTALL file to reflect the switch to cmake
The cross building instructions for Windows are still lacking.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 15:50:11 -07:00
Dirk Hohndel
93559e81e2 Update the mxe based sample script
Working on making the different ways we build things more consistent

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 15:36:20 -07:00
Dirk Hohndel
435ec2cbc2 build.sh: use "install-root" for our local install destination
This seems less confusing then calling it just "install".
Also adjust our cmake/Modules/Find... files accordingly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 15:30:48 -07:00
Joakim Bygdell
68ec73f1b0 Recmode: Fix ascent gas consumption.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 14:36:33 -07:00
Joakim Bygdell
afea30fd8a Recmode: Allow the user to specify gas reserve.
Since most regulators have an intermediate pressure of 10bar
the minimum value is 10 while the max is 99.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 14:36:17 -07:00
Joakim Bygdell
695637dcff Recmode: Take safety stop into account when calculating ascent gas consumption.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 14:35:46 -07:00
Tomaz Canabrava
a8d06b848e Move the translations to it's own subfolder
By adding a new CMakeLists.txt file and configuring
the translations inside of it's folder, the buildsystem
will compile everything on that folder.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 11:57:30 -07:00
Tomaz Canabrava
1a662df648 Use Qt5Translations to deal with translations
And remove the old code that did the same thing in
a very complex way.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 11:16:44 -07:00
Tomaz Canabrava
a56c0f227d We use static library if we find - option was not being used.
Currently we search for a static library and if we don't
find it, we search for a shared library. If one of them
is found, we return success but if none of them is found,
error. So - A static library for libgit and libdivecomputer
is preferred over the shared one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 11:16:30 -07:00
Dirk Hohndel
3a06bb37d4 Update build script to cross build Windows using mxe
The MinGW based script is still there for reference, but that's no
longer how I build the Windows binaries.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-08 14:24:03 -07:00
Dirk Hohndel
5b1d7541dd Update the packaging script to my latest version
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-08 14:15:42 -07:00
Dirk Hohndel
20c1907adb When building from tar file, check .gitversion to get the correct version
Distribution builds on Linux tend to be made from tar files, not from git trees.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-08 14:15:42 -07:00
Dirk Hohndel
dc47003e5b Update the build rules for .deb based builds
With this we also give up on building daily builds on Ubuntu 12.04
The cmake based infrastructure very much assumes Qt5 at this point.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-08 14:15:42 -07:00
Dirk Hohndel
9f532edb67 Update OBS spec file to current version
The old one was
a) outdated and
b) didn't work with cmake so it was rather misleading to have here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-08 13:34:27 -07:00