Commit graph

4651 commits

Author SHA1 Message Date
Yosef Hamza
3027701a14 Correctly edit air/water temp in dive struct
When changing the values of air/water temp after the first time and save,
it will be reset the intial value.
This is fixed by removing the "select_dc" (which makes the change to the
dive struct instead).

Fixes #457

Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 17:51:22 -07:00
Tomaz Canabrava
55d010bad8 Moved code around to make possible to compile the C part alone.
The C code should be compilable without the need to compile the Gui part,
too. This is expecially good for unit testing as we can test all the
algorithms without a window appearing out of nowhere.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 08:46:29 -07:00
Tomaz Canabrava
9598462830 Removed the globals 'userid' and 'save_userid_local' variables
This is a preferences setting, it should belong to the preferences
structure.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 08:37:31 -07:00
Tomaz Canabrava
f14c14c383 Mark a lot of TODO's where I think it should be moved to C code.
This marks a lot of todo's where I think there's core stuff being mangled
on the interface - we should remove this from the interface to make
testing and maintenability easier.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 08:33:51 -07:00
Dirk Hohndel
1a1cbc296b Quick whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 08:06:11 -07:00
Robert Helling
9ddef367b5 Improvement for various bits of the planner
Rewrite of the actual planner logic. Now ascend to the next potential stop
depth. There the state is cached and we try to ascend to the next stop
depth. If we hit the ceiling while doing that we go back to the cached
state and wait there for a minute. Then we try again. Then loop.

Converted all depth related variables from unsigned int to int. During
planning, in a time step the current depth can temporarily be negative and
comparisons of a negative int with an unsigned it have not the result I
expected ( (int) -2 < (unsigned int) 3 turns out to be false). And we
don’t really need the 32nd bit that unsigned buys us for depths.

Deco stops are now shown in the same table as manually entered stops in
boldface (I removed the second table to save screen estate).

The gas shown in the table is still misleading as it means the gas used on
the segment leading up to that event.

The update of the profile only works partially upon changes in the list of
available gases.

Treatment of various gases is basically there but needs some more love.

The ascent velocity is now provided by a function that takes the current
depth as argument. Currently it always returns 10m/min but that will later
be variable (and hopefully user configurable).

The profile is not redrawn while deco is computed (avoiding an infinite
recursion).

The table got a new column for the duration of a segment while the old
“duration” column was renamed “Runtime” to reflect what it actually shows.
Currently, only the run time but not the duration are editable.

All deco gases are used from the depth where their pO2 is 1.4bar. This
should become more flexible.

Calculation of the pressure drop in cylinders without configured volumes
is suppressed. This solves a problem with the planner crashing when saving
a dive where not all cylinders had been manually given a volume.

[Short rant break: Treating 0/0 as air bites back at so many places. E.g.
Cylinder data is initialized with memsetting the whole structures to 0.
Then later suddenly this totally unconfigured cylinder is being treated as
it would contain air. Maybe at some point this was a feature. But it lead
to a naughty bug which took me over an hour to resolve. We should
seriously reconsider this choice and better move to 209/0 being air if
changing this everywhere is not too much trouble]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 07:29:44 -07:00
Gehad Elrobey
8380f09619 Renaming the prefs struct members to be consistent with the QSettings.
-Renaming prefs members for consistency.
-Changing references of QSettings to the prefs structure instead.
-Removing unused functions in pref.h were left over from an old version.
-Changing the data-type of bool members to short for consistency with other members.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16 13:09:55 -07:00
Andrey Zhdanov
4bd4c01108 UI adjustments in Print Dialog Window
- move buttons to the bottom of the window
- use QDialogButtonBox that allows to follow platform-dependent button layout
- enlarge window size to not to crop content
- change "Close" button action from "accept" to "reject"

Signed-off-by: Andrey Zhdanov <andrjufka@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16 12:17:49 -07:00
Willem Ferguson
1b6d4f55df Use Luisa's new icons
Move the heart rate graph icon up in the toolbox with the cluster of
buttons that control graphs

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16 12:10:41 -07:00
Luisa Pires
a8aa3a2f00 New icons
- Replace the current text-based heart rate icon
- Replace the DC-reported ceiling icon

Signed-off-by: Luisa Pires <luisapiresdesign@gmail.com>
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16 12:10:28 -07:00
Lakshman
c6295b77fa Test cases for unit conversion
Added more test cases for unit conversion

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16 08:36:38 -07:00
Miika Turkia
54af66bdb3 Information on writing test cases
This information is mainly from Tomaz on IRC with references added to Qt
documentation on the subject.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-15 11:03:38 -07:00
Lakshman
2e80d79396 Corrections to unit tests
Make the initial unit tests actually pass

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-15 09:57:28 -07:00
Dirk Hohndel
f7a327077b Simplify code
This seems like a rather obvious optimization...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 23:21:09 -07:00
Dirk Hohndel
e5967dd193 Make red ceiling work
The existing code for toggling the DC reported ceiling in red or "surface
color" clearly had never been tested.

This seems to create a reasonably attractive implementation - not exactly
what we had in the past, but good enough.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 22:52:22 -07:00
Linus Torvalds
a3aacfc6c2 git-save: improve commit authorship data
We used to always just commit as "subsurface@hohndel.org" because
libgit-19 doesn't have the interfaces to do user name lookup.  This does
better if you have libgit-20, using "git_signature_default()" to get the
actual user that does the saving.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 16:07:59 -07:00
Tomaz Canabrava
7e1d8724c5 Add the option to specify the LIBDCDEVEL path.
Use cmake .. -DLIBDCDEVEL="../your/library" to specify
where the libdc is, or leave it blank if you have it
installed on the system. you can change the location later
by running ccmake.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 14:49:45 -07:00
Tomaz Canabrava
7b60f96734 Use a list of files instead of filtering for *.c
While filtering for *.c / *.cpp is much smaller, it has the
disvantage of getting garbage on some computers as the devs
tends to create test files around.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 14:35:38 -07:00
Tomaz Canabrava
bce0b43449 Add a Readme.testing file with explanations on how to use the tests.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 11:49:49 -07:00
Tomaz Canabrava
019edd065f First test case implemented.
This is just a stub test case to show how a test case should be
implemented. every 'private slot' on the test classes will be
automatically executed when you run 'make test' on the terminal,
and a report will be generated with a failure / success.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 11:49:49 -07:00
Tomaz Canabrava
907d8b8fbb Add a CMake based buildsystem for the tests.
This commit adds a CMake based buildsystem for the tests,
it separated the subsurface sources in small libraries to
make testing easyer ( subsurface core, subsurface ui,
subsurface profile, etc. )

There's no test yet, this however produces a compiled
and executable binary *on linux*. This file shouldn't
be needed on any other platform as this is not the main
build system, but the test build system.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 11:49:49 -07:00
Venkatesh Shukla
3abcde9a2a Add option to save userid in data files
The userid of Subsurface Webservice can be included in locally saved xml
files and git repository.
For xml files, it is stored in userid tag. For git repo, it is stored
in 00-Subsurface file present in the repo.
Preference dialog and webservice dialog modified to include option
for saving userid locally.

In case of difference in default userid and userid in local file,
some semantics are followed. These can be referred to here:
http://lists.hohndel.org/pipermail/subsurface/2014-April/011422.html

Fixes #473

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 09:40:30 -07:00
Yosef Hamza
ad9eb73d73 Mark Air/Water temp field red for wrong input.
As a warining for the user mark the field red.
If the user inputs invalid input that will be ignored
while parsing.
But with adding a one character error margin to prevent it from toggling
between Red and Yellow while editing existing values, for example "After
Deleting unit and last number after '.'"

Signed-off-by: Yousef Hamza <jo.adam.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 05:16:31 -07:00
Gehad
f46e2803eb Remove some unneeded explicit paths in includes
The include path is set up correctly so we don't need these explicit paths
in includes.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-11 07:21:21 -07:00
Gehad elrobey
cdf83f5ef6 Change some references of QSettings to the pref struct.
After adding the animation member in the preference struct, it is
very resonable to change these references of QSettings to the
preference structure instead.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-11 07:21:15 -07:00
Lakshman
6a8d929876 Feature to show or hide heart rate graph
Adds new push button "HR" to the button bar on the dive profile to
toggle display of heart rate.

TODO: New icon for the heart rate button is needed.

Fixes #485

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-10 09:21:43 -07:00
Willem Ferguson
20bde81023 Small updates to user manual
These updates reflect the discussion and small changes that were made to the
Preferences section and the Export-to-Worldmap features over the last week.

1) A few small changes made to the text of the Preferences section.
2) Two images replaced in the Preferences section.
3) Expansion of description of Export to Worldmap option of the menu system.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-10 09:15:28 -07:00
Miika Turkia
07fabc03fd No negative depth on divelogs.de export
Crafting depth samples produced a negative depth for the last sample.
This patch checks that negative last sample is ignored. (This occurred
when last manual sample is not full minutes.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-10 09:11:00 -07:00
Miika Turkia
27fa775c7c Create synthetic depth samples for manual dives
This patch creates artificial depth samples for manually entered dives
every 60 seconds. This is used for export to divelogs.de.

Fixes #486

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-10 09:10:59 -07:00
Dirk Hohndel
0107fa817d Add test dive that shows heart rate
This is adapted from a real dive file, anonymized and massively shortened.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-07 14:20:01 -07:00
Willem Ferguson
4c627ddb30 Change position of heart rate labels on y-axis
The lettering of the heart rate numbers on the lefthand exis "fall off"
the left hand of the profile panel when the panel is a bit narrow. This
minute change moves the letters a bit closer to the Y-axis so that their
left-hand extreme is more or less in line with those of the depth-labels
on the Y-axis. This is a partial response to Ticket # 484.

See #484

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-07 13:24:08 -07:00
Gehad
3125e0e695 Fix incorrect behavior in preference window
When doing some changes in the preference window and clicking "Apply", the
'Close without saving' button is supposed to restore the previous values.
However some fields were not restored correctly.

- The Animations Slider was never restored to its initial value.
  (A new member in the pref struct was added - pref.animation)

- The 'Font' and 'Font size' were restored correctly to the previous
  values but their effects weren't restored to the UI and that required to
  open the prefrences window again and press ok.

Fixes #481

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-07 13:06:15 -07:00
Anton Lundin
0bf79e216f Use the ENABLE_PLANNER macro in the manual too
This introduces ifdef control structures in the manual too, so we can
continue to develop both the planner and its manual, until its ready for
release.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-07 10:17:45 -07:00
Willem Ferguson
57bfa7e353 Update to bring user manual in line for the release of V4.1.
1. New section added on IrDA and communicating with the Uwatec Galileo dive computers.
2. Sections 7 to 9 of manual updated to reflect current version. Three figures updated.
3. New section added to reflect the dive planner. This is only a skeleton
awaiting better description when the dive planner is more mature. Added
2 figures within this new section.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-07 10:16:54 -07:00
Willem Ferguson
dcee5d4c0a Preferences: Change of text for unused cylinders.
The present text for configuring the display of unused cylinders simply reads:
"unused cylinders". This is now changed to "Show non-used cylinders in
Equipment Tab". The latter wording is much clearer to the average user.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-07 10:07:24 -07:00
Miika Turkia
1b6b2b78c8 Fix HTML errors
- There needs to be a space between HTML attributes.
- Ampersand must be encoded on URL addresses
- Div element is non-void, so it cannot be self closed

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-06 14:17:09 -07:00
Anton Lundin
63943371bd Rely on ENABLE_PLANNER to enable the planner
The removal of the planner menu entry was erroneously commented out.
Other parts of the code rely on ENABLE_PLANNER to know if the planner is
enabled or not so rely on it here to.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 16:12:17 -07:00
Dirk Hohndel
5b3cab94a1 Add test dive that has an unused cylinder
This way one can test that the corresponding preferences option works
correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 16:12:16 -07:00
Gehad
cb3436b42e Use helper function to write decimal numbers
Never ever use '%f' to write floating point data to a file. The stupid
locale handling creates useless comma-infested output in some locales.
Instead use one of our clever helper functions to do the right thing.

Original patch by Gehad, modified by Linus to be a little more generic.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 16:10:11 -07:00
Venkatesh Shukla
62e4c4069b Fix divelogs.de upload error
The order of arguments to fread was incorrect.
In case of arguments "streamsize, 1" the returning value is 1, and
hence due to membuf[streamsize] = 0; line, membuf ends up being one
character long.
Fixed it by exchanging arguments to "1, streamsize". This way,
streamsize has the correct value.

Fixes #483

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 13:30:16 -07:00
Lakshman
ecc8c1d995 Remove check option to show units in text label
Currently the feature to show temperature units while adding dive is
provided through checkbox in preferences->units section. This patch
disables this checkbox and always enables this feature.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 13:27:53 -07:00
Gehad
d6af09b269 Set the world-map HTML charset to UTF-8
The exported HTML was missing the UTF-8 encoding, so non ascii
characters weren't displayed correctly, This patch makes the exporter
support all the unicode characters.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 07:46:45 -07:00
Gehad
a6fcd4f99f Javascript exported code throws errors when dives are missing
The world map exported Javascript sometimes fail because dives with
no coarinates are neglected during exporting which leaves some array
indexes missing and corrupt the javascript.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-04 08:23:26 -07:00
Dirk Hohndel
9a0e40b456 Random small whitespace cleanups
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03 12:52:05 -07:00
Yosef Hamza
0f5664e584 Edit name option for bookmarks
Add the option to edit the name of a bookmark to be more meaningful for
the user they prefer.
It works just as simple bookmarks and can be removed and hidden.
It won't accept names longer than 22 characters because longer names will
display as garbage text.
Also changed the code from displaying flag depending on event name to
depending on event type.

Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03 12:49:22 -07:00
Gehad
c268b757df Fixing dive notes escape characters in worldmap exporter
Replacing the newlines in the string with <br> and changing the
single quote to its HTML number.

Also minor coding style updates to previous commit.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03 12:12:56 -07:00
Dirk Hohndel
3485c6c260 Correctly handle dive selection after editing dives
It's a tricky problem as we need to remember this across a divelist sort
(as the user might have edited the date / time). The old code made not one
but two incorrect assumptions.
a) it assumed that the added or edited (but previously manually added)
dive was the last one in the dive list (clearly wrong when adding a dive
that has an earlier date)
b) it ignored the fact that refreshDisplay() would select the top dive in
the list if no dive was selected

This patch addresses both of them and makes the code easier to understand.

Fixes #480

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03 10:26:48 -07:00
Jan Mulder
141433c3df Reefnet Sensus dataloggers report in mbar (CSV import)
Sensus dataloggers report depth in (absolute) millibar. This simple
fix corrects the CSV import. The depth is now computed correctly.

Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03 10:26:38 -07:00
Gehad
71afa05b84 Adding shortcut key sequence to the worldmap exporter
Adding Shortcut (Ctrl+H) to the worldmap exporter for consistency with
the other commands in the file menu

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-02 19:05:57 -07:00
Lubomir I. Ivanov
e372e819e7 windows.c: prevent an unused warning
When building with WIN32_CONSOLE_APP (or CONFIG += console)
we need to fake-use console_desc or a warning will pop out.

__attribute__((unused)) is available, but is GCC only.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-02 19:05:00 -07:00