Commit graph

5541 commits

Author SHA1 Message Date
Tomaz Canabrava
30499fdb30 Fixed memleak
The model was not being deleted when the table was, and thus we
recreated it for every print.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:27 -07:00
Tomaz Canabrava
426b640d2f No need to delete a QPointer
QPointer is a smart pointer, it will delete itself when the
refcount == 0.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:27 -07:00
Tomaz Canabrava
d3c0a723b8 Save / Restore the QPainter before operations.
I don't know if this fixes anything, but it is asked of us to
do that by the Qt docs.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:27 -07:00
Tomaz Canabrava
774a785a99 Added a HTML Displayable Delegate
Added a HTML delegate to show rendered HTML on print.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:27 -07:00
Anton Lundin
345b01750a Use get_gas_at_time in active_o2
active_o2 is now just a wrapper to return the o2 part of the active gas at
a certain time.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:27 -07:00
Anton Lundin
7806dbbd9e Convert get_gas_from_events to get_gas_at_time
This converts the get_gas_from_events to a get_gas_at_time function that
actually maps our events to what cylinder and thus gas we are breathing
at that time.

[Dirk Hohndel: fixed to actually use the gas that was looked up
               (and make things compile)]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:13:52 -07:00
Anton Lundin
9eeeba468a Use more of our propper types in the planner
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:02:11 -07:00
Anton Lundin
8e5eb71e0b Correct usage of current_dive to displayed_dive
current_dive is the selected dive, and displayed_dive is the one we are
currently drawing. They are quite often the same one, but not in the
case of adding a dive for example.

This fixes potential null pointer dereferences in the case of a blank
divelist, and makes sure we use the correct data in the case of adding
and planning dives.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:09:42 -07:00
Henrik Brautaset Aronsen
606bf377c5 Use "6m" and "20ft" instead of "6m/20ft".
Get rid of unit type shortcut in planner.  Also use "to" instead of "-" in ascent rate intervals.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:09:04 -07:00
Anton Lundin
950638ec1c Replace cylinder_is_used with is_cylinder_used
is_cylinder_used uses get_cylinder_index as underlaying function that
does the right thing with with respect on how to find the closest
matching cylinder, and handles both types of gaschange events correctly.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 08:28:21 -07:00
Anton Lundin
810880ea1d Rename is_gas_used to is_gas_used
This function operates on cylinder ids, so its actually about cylinders
not gases.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 08:27:40 -07:00
Dirk Hohndel
3cdd4df8e8 Statistics: change our notion of "bogus SAC rate"
With a pSCR it is entirely possible to have a SAC rate below 2.8l/min.
Since we still don't want to include SAC rates of 0 let's change the
cutoff to 0.1l/min.

Fixes #624

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 08:16:15 -07:00
Robert C. Helling
9bf6100aa7 Accept negative pressure readings
Sometimes the planner can produce negative pressures (i.e. when the
cylinders are not properly configured) or when the usser ignored
gas management (for whatever reason). When such a dive gets saved and
reread we should not display a further "Strange pressure reading"
warning on the command line.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 08:10:42 -07:00
Dirk Hohndel
24472a3b23 Planner: correctly deal with units in Ascent/descent rates
This adds two changes
a) it uses rint() to make sure we don't truncate the displayed values
b) it moves the update of the displayed values into a helper function that
   is also called whenever the settings change

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 08:06:15 -07:00
Robert C. Helling
13b8680b0c Planner: Ascent/descent rates are stored in mm/s not in m/min
So should be defaults.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 07:47:04 -07:00
Salvador Cuñat
8fae0b6af8 Update spanish translation for user-manual.txt to 82fc95d
[Dirk Hohndel: added the html.git file]

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 07:26:28 -07:00
Anton Lundin
3b99b03133 Hide gachange events in the first 30 seconds
Back in 4.0 we hide all gaschange events during the first 30 seconds,
not just gaschange events on second 0. Eg, the OSTC3 emits its gaschange
event on the first sample, which can be 2, 10 or 30 seconds into the
dive.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 00:04:44 -07:00
Anton Lundin
6f8dc22e08 Use get_cylinder_index instead of get_gasidx
Replace get_gasmix_from_event and get_gasidx with get_cylinder_index.

get_cylinder_index actually knows about both types of gaschange events
and the difference between them.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 00:04:32 -07:00
Anton Lundin
b4679c819f Add missing struct keyword in DivePlotDataModel
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 00:04:24 -07:00
Anton Lundin
6d7a9b9466 Use plot_data cylinderindex instead of event data
For the info box, we can't use the event data, because its not 1:1
mapped to whats in the cylinder and what we actually switched to. Use
the plot_data here we already calculated what we are switching to.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 00:01:42 -07:00
Gaetan Bisson
e69bb1879e Store drop_stone_mode, bottomsac, decosac in prefs
The values for drop_stone_mode, bottomsac, and decosac are typically the
kind of personal data specific to a diver that is unlikely to change
from one dive plan to the next.

This patch stores/restores them to/from the preferences file. For this,
it adds bottomsac and decosac to the prefs structure; drop_stone_mode
was already there, though not stored/restored.

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 23:09:56 -07:00
Dirk Hohndel
d73d98c032 User manual: add latest html files to git tree
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 23:09:01 -07:00
Willem Ferguson
82fc95d693 User manual: Updated text
This patch contains some updates to the user manual to reflect the new
images that were submitted previously. The updates include:
1) Moving the "Load Photos" section to the section daling with the input
   of dive information (photos qualify as additional dive information).
2) Changing the wording around the new button in the tool bar.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 23:08:50 -07:00
Dirk Hohndel
912560f928 Planner: don't track cylinder pressure if working pressure is 0
The pressure graph will go from 0 to negative - one could make a weak
argument that this would at least tell you how much pressure you'd need in
the cylinder to start with, but that's kinda lame.

Fixes #615

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 23:04:30 -07:00
Sergey Starosek
387553f0b3 Translate velocity units in planner settings
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 22:54:52 -07:00
Dirk Hohndel
b3e662a895 Pick the correct timezoneoffset for the day in question
Calculating the timezoneoffset for the current date really makes no sense
whatsoever when displaying a time that isn't "now".

Fixes #605

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 20:24:56 -07:00
Tomaz Canabrava
bebcbfe92a Desselects the trip before dive add / plan, and reselects it on cancel
When we had a trip selected, we ignored that and simply called
the DiveAdd functions, but the mainTab code that deal with selections
to show one or more dives or trips asked how many trips were selected
to the DiveList, and since a trip was selected things go kabum.

Fixes #606

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:08:22 -07:00
Tomaz Canabrava
9d4b8c8218 Force replot of selected_dive when canceling plan
The profile was still the planner one, so we need to force
a replot.

Fixes #621

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:07:31 -07:00
Tomaz Canabrava
c34ee894ab Use 'this' instead of ::instance() when iside of same class.
Do not use MainWindow::instance() inside of a non-static
mainWindow method, that's just bogus.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:07:01 -07:00
Tomaz Canabrava
e5b06bf6c8 Fixed creating recursion on the connections
Ugh. Each time you wanted to change a cylinder, a new connection was
being created on this object, delaying the correctly setup of the item.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:53:55 -07:00
Tomaz Canabrava
b66f679d64 Complete the name of the first Cylinder on edit
When you entered part of the name of a cylinder this was
being treated as a new cylinder, and not selecting the first
one.

Fixes #628

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:53:21 -07:00
Tomaz Canabrava
1b6144350d Added a 'use default file' button on preferences.
Added a 'Use default file' button on preferences in a way
that doesn't clutters the interface.

Fixes #630

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:52:29 -07:00
Tomaz Canabrava
bf7fc97b50 Fix saving and storing the dive plan notes when there's html on it
We save an HTML table-based plan, so we need to get the text as html,
not plaintext.

Fixes #634

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:51:13 -07:00
Dirk Hohndel
a5c9bc1ef2 Pull latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 14:24:27 -07:00
Sergey Starosek
14cc59898a Date picker l10n for profile and planner
- set application-wide locale from preferences
- use custom date format for display

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:58:06 -07:00
Tomaz Canabrava
0dd40b7a51 Rely on QNetworkReply finished() signal instead of AccessManager one
The access manager is only one, while we can make requests from
different parts of the application, so relying on the manager
finished() signal to see if something was done or not was a
not very good move.

The QNetworkReply is created when a get() is invocked on the
AccessManager and that's unique. connect it's finished()
signal instead.

bonus: code cleanup.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:56:46 -07:00
Dirk Hohndel
bbbb4ced24 More source string updates for translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:28:03 -07:00
Sergey Starosek
dcca755343 More strings to translate for statistics tab
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:26:41 -07:00
Henrik Brautaset Aronsen
f0e17e6fff pN2 » pN₂, pO2 » pO₂
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:17:09 -07:00
Dirk Hohndel
a0a0bb5247 Add latest text strings for translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:59:18 -07:00
Dirk Hohndel
789a04bd70 Translations: get hemisphere letters translated again
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:56:46 -07:00
Dirk Hohndel
598102c351 Convert ternary "?:" into if for translation tools to work
It seems the translation tools don't like the ?: in the argument - can't
blame them. So use an explicit if clause instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:35:48 -07:00
Dirk Hohndel
138da489c8 Run convert -strip against all .png files
Just in case...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:30:43 -07:00
Sergey Starosek
9d35864eab Fix libpng warning about unrecognized profile
During Subsurface startup there are several warnings reported:
libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
The reason is explained at https://wiki.archlinux.org/index.php/Libpng_errors

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:26:11 -07:00
Miika Turkia
cd4dc503fc Set proper gas type on UDDF import
Use type 25 on UDDF import when the gas mix contains some helium.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:22:33 -07:00
Willem Ferguson
004b9d72c5 Replacement figures for user manual
Replacement figures for user manual

     Here are 12 replacement figures for the user manual to bring the
figures
     in line with the current UI. This relates to the updated profile
toolbar
     and manual dive profile entry. I did not change any text of the manual.
     That will happen tomorrow evening.

     Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>

From 85413b967c02738d47f0b7779613f33cc7898c17 Mon Sep 17 00:00:00 2001
From: Willem Ferguson <willemferguson@zoology.up.ac.za>
Date: Wed, 16 Jul 2014 07:26:43 +0200
Subject: [PATCH 4/4] Replacement figures for user manual

Here are 12 replacement figures for the user manual to bring the figures
in line with the current UI. This relates to the updated profile toolbar
and manual dive profile entry. I did not change any text of the manual.
That will happen tomorrow evening.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:22:02 -07:00
Miika Turkia
796df27273 Index used cylinder properly on divelogs.de export
The wrong O2 percentage was due to not referring to the correct cylinder
but grabbing any o2 value in any cylinder. While fixing this, I noticed
that also end pressure was missing the cylinder selection, so fixing
that as well.

Fixes #626

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:21:01 -07:00
Dirk Hohndel
45acec0e25 Small update to CodingStyle document
Mention variable declarations (they should be at the beginning of code
blocks).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:16:47 -07:00
Sergey Starosek
42e8e6406b Disable DC shortcuts on closing data file
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:14:39 -07:00
Sergey Starosek
b87a602265 Suppress XML preamble in CSV export
To obey <xsl:output omit-xml-declaration="yes"/> element
one should rely on libxslt to do its job instead of writing
document himself.

Discussion on this subject can be found at
http://comments.gmane.org/gmane.comp.gnome.lib.xslt/3839

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:14:27 -07:00