Commit graph

2597 commits

Author SHA1 Message Date
Dirk Hohndel
c58d136d33 Dive edit: allow the user to explicitly clear a GPS location
If the GPS coordinates for a dive were incorrect for some reason and the
user wanted to clear them in order to then re-download / apply GPS
information from the Subsurface webservice, prior to this patch we would
always match the location name and re-populate the GPS coordinates, making
it impossible to clear a GPS location without also changing the location
name.

This patch fixes this - but if you have multiple dives with the incorrect
name / GPS location pair, the next edit to a dive that had the GPS
coordinates cleared will re-populate the GPS coordinates (at that point
Subsurface can no longer tell that this was intentional).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-16 07:09:11 -06:00
Dirk Hohndel
64c9fff850 Survey: rename "Save" button to "Send"
Fixes #701

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15 21:41:41 -06:00
Dirk Hohndel
e8d430341c TankBar: hook into prefs and make ppGraphs resize accordingly
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15 08:11:14 -06:00
Dirk Hohndel
e71119b40b TankBar: use the itemPos as intended
Which actually makes the code much clearer as now the object is at the
correct spot on the canvas and the positions inside are relative to that.
No more magic gradiants starting at "92"

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15 07:30:31 -06:00
Linus Torvalds
5b14ed16ac Add "download into private trip" dialog checkmark
This adds a checkbox for the divecomputer download dialog that allows you
to tell the download to put the newly downloaded dives into a trip of
their own. That in turn will disable the dive merging with any existing
dives, which means that you will not mix up your newly downloaded dives
with any old dives.

That, in turn, is very convenient of you know that some of the dives were
done by other divers (or from testing that happened during servicing etc),
or the dive dates etc were wrong because the dive computer date had reset
due to battery changes etc.

Once you have all the dives in a private trip of their own, you can then
fix them up (delete dives you don't want to merge etc), and then after all
the data is ok you might want to merge the cleaned-up results with
previous trips etc, and then manually ask subsurface to merge the dives or
whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-14 22:40:14 -06:00
Dirk Hohndel
87ca15c5c3 Add gas text to tank bars
Also restructures the code a bit to make it a little more sane and changes
the colors slightly.

With these changes I think we can claim that this
Fixes #557

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-14 22:39:47 -06:00
Dirk Hohndel
fa3c18d83b Add initial support for a visual tracker of gas used
This shows a color-coded bar at the bottom of the graph that corresponds
with the active gas.

Todo:
- text that explicitly states gas on the left edge of the bar
- better vertical positioning of the bar
- ability to turn this on and off

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-14 18:22:27 -06:00
Robert C. Helling
ecf0408aae Make SAC values in planner settings respect unit settings
So far, the fields for the two SAC rates did not show a unit and were implictly l/min.
Now they respect the settings for volume units. This was harder than I thought for two reasons:

1) Imperial units for SAC are cuft/min but a typical value would be .70. So I made the point
the field prefix and what is entered is actually hundreth of cuft per minute.

2) I had to get the rounding right in order not to get effects like 20l/min become .70 cuft/min (19800 ml/min
internally) which would then become 19l/min when switching back.

While being at it, I gave the gradient factors '%'-signs as units.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-13 21:11:07 -06:00
Joseph W. Joshua
4e99382c96 Improve on error reporting in the ConfigureDiveComputer class
This patch improves on the error reporting for the dive computer
configuration dialog to use config->lastError.

The previous code was using a different argument in each function,
which lacked uniformity.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:15 -07:00
Joseph W. Joshua
24cb0b0496 Hide status message when an error message is present
To avoid confusion, this code update makes the status text empty whenever
there is an error message. This makes the error message more prominent.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:15 -07:00
Joseph W. Joshua
a9b55d7f0d Change Dive Computer Configuration dialog
Changes the layout of the ConfigureDiveComputer dialog to use a
list of supported computers on the left, with a stacked widget
showing the configurable details.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:15 -07:00
Joseph W. Joshua
cc6c385f33 Start Work on Firmware Update
This patch implements the first step towards OSTC 3 firmware update.
Its not much, just file selection, but I will build up on it from there.

Implements a thread to initiate firmware updates. Currently, this is
for the OSTC 3.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:15 -07:00
Joseph W. Joshua
8aa7fddb22 Add read/write support for OSTC 3 SetPoint settings
Implements support for reading, writing and backup/restore of set point
settings for the OSTC 3.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:15 -07:00
Joseph W. Joshua
9c032f20c0 Add reading and writing of OSTC 3 Dil values
Implements reading, writing and backup/restore of OSTC 3 Dil Values
(setting 0x15 to 0x19)

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
a52beebbe9 Implement saving of OSTC3 Gas Settings
Implements writing OSTC3 gas settings to the device.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
8b39d2fc17 Read OSTC3 GasSetting Values
Implements the reading of OSTC3 Gas Settings. These are settings
0x10 to 0x14

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
4f37602836 Move non gui code from qt-ui
Moves non gui classes (configuredivecomputer, configuredivecomputerthreads
and devicedetails) from qt-ui to the top level folder.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
045a6fb6b1 Start working on GAS and DIL tables
Start work for gas1-5 and dil1-5.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
d76881cb01 THIS COMMIT NEEDS A COMMIT MESSAGE
I've moved the .pro file fixes to where it happened, so the rest of the
changes need explanation now. -Thiago

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
5292bcbf21 Add more OSTC 3 settings
I am adding more OSTC 3 settings as I go along. Here, I have
added dive mode and saturation.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
8ccf2e8f1d Change ConfigureDiveComputerDialog to use tabbed interface
Changes the dive computer configuration dialog to use a
tabbed interface. This will make it easier to add new
dive computer models to the interface.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
09ec8a44e5 Add Support for more OSTC 3 Settings
Adds support for more OSTC 3 Settings to the reading, writing,
backup and restore functions. These settings are: last deco,
units, sampling rate, salinity, dive mode colour and compass
gain.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
aad60ef6da Working XML Backup and Restore
The ConfigureDiveComputer class now has functions for complete
XML backup and restore. These dump the loaded settings on a
dive computer to an XML file, and there is an option to
restore them.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
e54d7d9178 Backup basic settings as XML
This patch enables XML backup. We can now save the settings
to an XML file. Currently this backs up just the basic stuff
such as custom text, language and brightness.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
3534e29ae2 Port writing of date and time to new classes
After splitting dive computer configuration classes, the date/time
setting had not been ported. This adds the same to the classes.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:14 -07:00
Joseph W. Joshua
20eb62a98a Polish up on classes
This patch polishes up on all classes added for dive computer
configuration to give a clean workflow. The classes can now
write and read data from the OSTC 3.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-13 10:48:11 -07:00
Anton Lundin
d453d5cb37 Rename dive gas function and defines for clarity
This renames the dive gas functions to not talk about just nitrox, and
to instead talk about gas.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:41:57 -07:00
Anton Lundin
619c1b3ec9 Rename the model column from NITROX to GAS
The column isn't just about NITROX, there might be air and trimix in
there too.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:41:36 -07:00
Anton Lundin
e07d23f806 Rename list column from O2% to Gas
In the dive list, calling the column O2% is kinda wrong, because in
at least my dive list there are both air and trimix showing up, so this
renames that column to Gas.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:40:18 -07:00
Gehad elrobey
3a46657f4c HTML: export Translated strings to JSON files.
First step towards multilingual export. Use the existing translation API
to translate and save words to JSON file.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:21:19 -07:00
Gehad elrobey
108fc892ca HTML: Don't export total statistics value if not chosen
Don't export total row in yearly statistics unless exporting the
statistics is checked

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:21:15 -07:00
Gehad elrobey
10e70336c6 HTML: Remember General Export Settings.
Set Default values and remember user selected general HTML export
settings.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:21:13 -07:00
Gehad elrobey
3ebb62f153 HTML: Add total row to yearly statistics table.
Add new row to the yearly statistics table containing the total. Total
values are calculated to some columns only, it doesn't make any sense to
add the total value to other columns (Temperature cols for example).

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:21:03 -07:00
Gehad elrobey
93a15d471c HTML: Make export statistics optional.
Make exporting statistics to the HTML page optional.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:20:55 -07:00
Joseph W. Joshua
4fc16b1674 Move divecomputer configuration code to different files
This splits the code in configuredivecomputer.cpp into multiple files.
The read and write threads are moved to configuredivecomputerthreads.h/cpp,
and the device details class is moved to devicedetails.h/.cpp

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 12:06:42 -03:00
Joseph W. Joshua
2432350064 Add brightness setting
Adds a setting to control the device's brightness. Currently I
have only the OSTC 3. Will add more afterwards.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 12:01:56 -03:00
Joseph W. Joshua
a7a74ae9a6 Improve writing of device name to dive computers.
Improves the writing of device name to the dive computer. The
code has been updated to use a switch statement.

This will make it easier to add new devices in the future.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 12:01:56 -03:00
Joseph W. Joshua
ee2403d63c Improve writing of date and time to dive computer
Improves writing of date and time to the dive computer. This
has been tested using the Heinrichs Weikamp OSTC-3.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 12:01:56 -03:00
Joseph W. Joshua
a08d239af5 Change dive computer family detection
Following suggestions on the mailing list, this changes the
method used to detect the dive computer family. Detection is
now done using: dc_device_get_type.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 12:01:56 -03:00
Joseph W. Joshua
3e127a059f Create class to write settings to dive computer
Adds a class to write settings to dive computer, and modifies
the existing ones to integrate it.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 12:01:56 -03:00
Joseph W. Joshua
a7c9b25b05 Read basic details from dive computer
Added classes for reading data from dive computer. This is
at the basic level and I will expand it as I go along.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 12:01:54 -03:00
Joseph W. Joshua
791fbee260 Load vendor list and product list
Using code from 'downloadfromdivecomputer' class, this code
loads the vendors and products to the respective comboboxes.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 11:59:15 -03:00
Joseph W. Joshua
ec02737eda Create Dive Computer configuration dialog
Create a dialog for reading and writing settings to and
from dive computers, with a menu entry in MainWindow to
open the dialog.

I will build up on this dialog and change it as needed.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 11:50:14 -03:00
Dirk Hohndel
827d4740c3 Better User Agent for Subsurface
This one is less verbose and very easy to parse. It's guaranteed to have
five components, separated by ':' with no other ':' in the string:

Subsurface:<version>:<PrettyOSName>:<appCpuArch[/osCpuArch]>:<UILang>

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-08 11:13:05 -07:00
Dirk Hohndel
a9f59c0cb3 Revert "Don't translate components of the version"
This reverts commit 6fdbf2069d.

That was actually the wrong thing to do, now that I think about it.
Instead we should show the translated version on screen and send a
compact, easy to parse variation of this as the User-Agent header.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-08 10:44:06 -07:00
Dirk Hohndel
4a125384ac Fix possible crash attempting network connection
If we didn't get back a JSON encoded string (i.e., if the response
contained no '"') we would access a QList past its boundary.

I'm somewhat hopeful that this is a last second fix for an annoying bug
I've been trying to figure out for a while.

See #514

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-08 10:39:46 -07:00
Dirk Hohndel
6fdbf2069d Don't translate components of the version
When transmitting the Subsurface version string we always want to use the
English terms, not the localized terms.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-08 00:31:18 -07:00
Tomaz Canabrava
44f59b6022 Move the Trash bin to the topRight on the pictures
It was too easy to remove a picture by mistake, not anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-07 13:12:32 -07:00
Dirk Hohndel
ee77398eb8 Reload the dive list after accepting changes
So far we only did it when we added a dive or modified a manually added
dive. But the reality is that an edit of any dive could cause changes that
require the dive list to be reloaded.

Fixes #698

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-07 10:23:08 -07:00
Tomaz Canabrava
68af9f0afb Delete pictures from the Widget by pressing delete
Select the picture, press delete, profit.

[Dirk Hohndel: removed the stray hunk that snuck into this patch]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 18:32:28 -07:00
Dirk Hohndel
b0addb4567 Show the cross hair only when planning or adding a dive
In normal profile mode it's rather redundant and clatters the profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 12:33:36 -07:00
Dirk Hohndel
4c252d8e23 Remove unused static function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 10:59:26 -07:00
Dirk Hohndel
98e374e65a Fix order of initialization warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 10:54:37 -07:00
Linus Torvalds
3aaf8b1f5a Make gas use statistics be coherent and more complete
The gas use logic in the dive statistics page is confused.

The SAC case had a special case for "unknown", but only for
the first gas. Other gases had the normal empty case.

Also, the logic was really odd - if you had gases that weren't used (or
pressures not known) intermixed with gases you *did* have pressure for,
the statistics got really confused.

The list of gases showed all gases that we know about during the dive,
but then the gas use and SAC-rate lists wouldn't necessarily match,
because the loops that computed those stopped after the first gas that
didn't have any pressure change.

To make things worse, the first cylinder was special-cased again, so it
all lined up for the single-cylinder case.

This makes all the cylinders act the same way, leaving unknown gas use
(and thus SAC) just empty for that gas.

It also fixes the SAC calculation case where we don't have real samples,
and the profile is a fake profile - possibly with gas changes in between
the fake points. We now make the SAC calculations match what we show -
which is admittedly not at all necessarily what the dive was, but at
least we're consistent.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 09:14:34 -07:00
Dirk Hohndel
d982096144 Don't make the preferences dialog so huge
Let Qt figure out a good size instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 07:51:12 -07:00
Dirk Hohndel
74e7b8e879 Don't show a SAC of 0.0l/min (or cuft/min)
When we have no data about the gas consumption it makes no sense to show a
SAC of 0. Instead we should show either "unknown" or nothing.

Fixes #693

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 07:39:19 -07:00
Dirk Hohndel
eb63ccfed5 Don't list gases that weren't used in profile print
If the divecomputer adds additional, unused cylinders to the dive, they
would be listed in the profile based printouts. Given that the field is
named "Gas used" that seems wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 07:08:31 -07:00
Robert C. Helling
71bed5022c Don't zoom the profile when the left button is pressed
This prevents zooming out to more than max in the planner. Using a Mac
MagicMouse it happens at times that the finger slides on the mouse while
dragging a waypoint which can result in zooming out further than max.

Fixes #695

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 06:21:24 -07:00
Dirk Hohndel
d85d08e14f Data validation
Instead of refusing cylinder pressure data let's just mark it as red when
the values don't seem to make sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 21:21:31 -07:00
Dirk Hohndel
ebf1b8f624 Make the cross hair less obnoxious on Mac
While on Linux it was drawn as fine 1px line, on Mac it came out rather
fat and obnoxious by default. With this it's always set to a very thin
line.

This still needs more work, but let's leave it where it is for Beta 5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 15:47:02 -07:00
Tomaz Canabrava
eb4e64d22a Add lines that follow the mouse helping see time and depth.
This was missing from the conversion from the oldPlanner
to the new one, and it also works ok on the profile.

One thing is missing is the Labels on the bottom / left
saying which position it is, but it's already userful.

Fixes #674

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 14:43:18 -07:00
Tomaz Canabrava
f9d38100c4 Hide Depth Column
We were showing everything, always.

Fixes #639

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 14:42:56 -07:00
Lubomir I. Ivanov
cec1ea182e Print: rename the variable 'isHeading' to 'newHeading'
This better describes what the variable (flag) does.
It's used to inform the loop that the last row goes
our of the page limit and that we need to place a new heading
on a new page. In that context 'newHeading' is more meaningful.
The name 'isHeading' is confusing for (i == 0), since it remains
'false' yet the 0 index row is actually a heading.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 12:49:35 -07:00
Lubomir I. Ivanov
81125d190a Print: add a safe guard for row heights in the table print
If a row height is more than the available height on a page
(minus the height of a heading row) we have to skip this row (dive).
The current profile print simply does not support that and it does
not make much sense. For that to happen either the page will have
to be tiny or the user must have entered a very long text for "buddy",
"dive master", "location" or there must be some sort of a
very-large-font-while-printing type of a problem.

Technically, rows spanning on multiple pages is doable, but probably
not worth the effort.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 12:49:16 -07:00
Dirk Hohndel
4583cd8e09 Picture handling: cleaning up the mess
We had pointers to data structures on the stack which we frequently
reallocated. These data structure contain basically a filename and an
offset. We then create a hash of the pointers to those datastructures with
the filename being the key. And then we passed those pointers around
through a Qt model(!!!) only in order to then later look up by filename
what the offset might be.

I am at a loss for words for the lunacy behind this design.

How about we just remember the offsets and pass the integers around?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 12:37:14 -07:00
Dirk Hohndel
3adbff2320 Picture handling: hide the pictures before deleting
Because of the way deleteLater() is implemented, the pictures need to be
hidden, otherwise they might stay around at the wrong time (e.g., when
printing).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 11:42:19 -07:00
Dirk Hohndel
4a76c3b8df Profile: Don't disconnect too many signals
If we disconnect the picture releated signals then in dive add and dive
plan mode the pictures from the last shown dive could appear on the
profile. That's not cool.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 11:34:38 -07:00
Dirk Hohndel
4fd0dfcabb Printing: only give up if no size is available
Checking for available printers appears to sometimes fail, even if there
is a valid PDF or PS printer.

Instead we bail if we can't get a valid size for the printer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 10:01:38 -07:00
Dirk Hohndel
3e00bac552 Don't recalculate plan automatically with low GFHigh
While it's nice to have immediate response to gradient factor changes,
there is an oddity that very low GFHigh values can cause infinite
decompression if the last stop is at 6m.

Robert fixed this and now errors out of deco after 48 hours, but if the
user simply wants to edit their GFHigh from (for example) 75 to 70 and
deletes the '5', we really don't want to trigger a recalculation for
GFHigh of 7...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 08:06:17 -07:00
Lubomir I. Ivanov
4bf0d768f9 Web: use subsurface_fopen() for non-ASCII paths on Win32
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 07:42:51 -07:00
Dirk Hohndel
78fee70450 Correctly remove the Close button from most message widgets
The only time we want the close button is when showing an error at the
bottom of the main window.

In the other cases (maintab, globe) we need to explicitly hide it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 22:45:17 -07:00
Dirk Hohndel
eca96ee8b7 Revert two incorrect commits
Revert "Don't add a close button to KMessageWidget"
This reverts commit 75c9bcd726.

Revert "Remove unused variable"
This reverts commit 9edee3477a.

I was fixing the wrong problem... instead of removing the handling of the
Close button I should have figured out why the close button was
incorrectly shown in the first place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 22:31:52 -07:00
Dirk Hohndel
3fd8e50044 Don't use tmpfile()
It appears that at least on Win7-64 Windows tries to create the temporary
file in C:\ and fails because of insufficient permissions. How stupid is
that.

Instead we roll our own tempfiles, based on the already existing tempfile
name that is passed in.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 22:15:58 -07:00
Tomaz Canabrava
7295c8c6ec Do not recreate all the dive just because a picture was added.
If we add a picture to the dive, this will not change anything
else, so there's no need to recalculate the profile_plot info.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 10:38:00 -07:00
Gehad elrobey
5076e431d5 HTML: export yearly statistics to JSON files.
Save Yearly statistics as JSON data to the stats_files.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 10:03:12 -07:00
Tomaz Canabrava
0416a09a1e Fix the layout on the Print Dialog
The layout was a hardcoded position without layouts, that
would only work on english language since other languages can
have bigger strings than the current ones.

Also removed the 'setFixedSize' stuff and let the widget
find it's best size for itself.

Fixes #656
Fixes #396

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 09:50:55 -07:00
Tomaz Canabrava
116608201d Fix unresizable DiveList
The issue with the dive list was actually the Planner Settings widget
that was in the same space as the dive list but hidden, but since it
had a minimum width we couldn't resize the dive list to be below the
planner settings minimum.

Fixed by inserting the contents of the Planner Settings into a QScroll
Area.

Fixes #679

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 09:49:51 -07:00
Tomaz Canabrava
e95fa6c6dc Disable the Toolbox when in edit mode.
Some of the toolbox icons will trigger a recalculation of the dive,
triggering then a replot, that will copy the dive to the displayed_dive
again, but in the case of a edit this would discard the edition (
that would still be shown on the UI ) leaving the dive in an
unconsistent state.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 09:48:35 -07:00
Lubomir I. Ivanov
69676b08fb Print: display an error message if no printers are found
When pressing Print or Preview from the PrintDialog, we need
to first check if there are printers installed. If not
we abort and show an error message.

This is needed because if no printers are installed,
things like the reported page height could be zero and
the profile and table print code in PrintLayout will
break.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 09:47:18 -07:00
Lubomir I. Ivanov
6ebbc3d74e Print: enable the vector table print only for Qt5.0 and newer
In #671 a user reported that the table print outputs a blank page if there
are dives for one page or less to be printed.
This doesn't really makes any sense.

A possible bug in Qt4's QPicture is suspected, so we only enable the
vector print for Qt 5.0 and newer versions.

See #671

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 07:43:42 -07:00
Dirk Hohndel
825eb019ab Planner: show mean depth
Almost invisible, mostly looking like an odd bug in the profile code,
there was a tiny red line at depth 0 in the planned profile. Turns out
that was the missing mean depth. We didn't populate enough data in the
dive computer of the dive we generated from the plan (and the length of
the depth line was incorrectly determined by the duration of the dive
instead of the duration stored in the dive computer).

Fixes #570

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 07:36:07 -07:00
Robert C. Helling
a3fe1c560f Update altitude properly when changing unit systems
We need to change the displayed numeric value of the altitutde and not just the
unit suffix when changing unit systems.

Fixes #681

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-03 13:44:39 -07:00
Miika Turkia
2b100c8c17 Try to fix divelogs upload on Windows
zip_open needs correct directory separators. QFile::encodeName does not
do this conversion, so we must call it explicitly.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-03 13:04:38 -07:00
Robert C. Helling
1508f95775 Update pictures when entering/exiting planner
This fixes the problem I pointed out im my comment to #667 and hopefully also
the original problem although I cannot confirm since i cannot reproduce the
problem in the first place.

See #677

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02 15:13:51 -07:00
Robert C. Helling
89622b0b51 Enforce end pressures to be not above starting pressures.
We don't blow into our cylinders under water.

Negative pressures should be allowed as they might arise from dive planning
without taking care of gas consumption.

fixes #644

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02 15:12:42 -07:00
Robert C. Helling
a7eb316b1f In recent files use native directory separators
Qt internally always uses / as directory separator. #651 shows that in the recent
files menu, under windows we can have double entries with both versions of the
separator. This patch should normalize the menu entires to use the native separator
(i.e. \ on Windows). (Untested due to lack of Windows computer).

See #651

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02 15:11:43 -07:00
Dirk Hohndel
13d922aef7 Keep edited profile after editing a manually added dive
This is yet another unintended side effect of the UI restructure changes.
I stared at this code for so long - I can't believe I kept missing this.

Fixes #668

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-31 14:41:30 -07:00
Dirk Hohndel
526ba82b53 Give Subsurface a distinct User Agent string
When accessing websites (divelogs.de, subsurface website) we shouldn't
pretend to be Mozilla 5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-31 11:20:11 -07:00
Dirk Hohndel
ebdeddb9b9 When exporting to XML and no extension given, default to .ssrf
See #646

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-31 10:38:36 -07:00
Dirk Hohndel
055ac2a1a2 Mark divelist changed after removing a picture
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 14:19:34 -07:00
Tomaz Canabrava
7bf63c5b0b Add a new 'show' Animation, and use it on the close button.
The error with 'ungrabMouse' warning that we got was because
we were removing an item that had the mouse grab instead of
waiting a few milisseconds so it won't be the mouse grabber
anymore.

So I'v used the Animations::hide() to get rid of it, and
since it worked well, I'v also added a Animations::show()
method to display it in a good fade-in way.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 14:15:09 -07:00
Tomaz Canabrava
3b9bceacb6 Implement the functionality of remove_picture.
Added the remove_picture functionality, with code
shamelessy stolen from remove_event, and hoock it
up with the interface.

Fixes #650

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 12:52:31 -07:00
Tomaz Canabrava
1e6986d870 Instead of holding the index, hold the URL.
Since the idea is to remove the picture in the future, we need
to not hold the row on the model, as when we delete one, the
other pictures will change the row. but the QUrl is unique.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 12:34:43 -07:00
Tomaz Canabrava
75aafdc715 Added a button to hide a picture from the dive.
This patch hides a picture from the dive, it should actually
remove it, but because I didn't found a quick way to remove
a picture from the dive yet, it just hides it.

To remove a picture from the dive, the DivePictureItem has to
remember the QUrl of the original file, to remove that from the
model, and currently it only has the QPixmap.

this can be for 4.2.1 or we can postpone 4.2 a tiny bit since this
is a important feature.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 12:34:39 -07:00
Dirk Hohndel
74d89fc818 Planner / Add dive: hide handler after removing it
Otherwise users can still interact with it.

Fixes #648

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 09:31:22 -07:00
Dirk Hohndel
1a978a0345 Maintab: fix trip location / notes editing
Reusing the displayed_dive for this caused all kind of odd problems that
were hard to reproduce, because the behavior depended on what was in the
corresponding fields of the current_dive. Worse: the GPS location handling
prevented us from reliably removing the location of a trip.

The solution isn't ideal and certainly isn't elegant. Maybe we simply
shouldn't reuse the widget here. But I think what I have now works - I
tried hard to make it break again and couldn't.

Fixes #659

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 08:52:11 -07:00
Tomaz Canabrava
fcbe6bfc13 Do not show the heartrate info unconditionally.
use the preferences instead.

Fixes #664

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 15:44:37 -07:00
Tomaz Canabrava
f0f8b91c00 Make the Axis set the changed flag when a new line is set
This was preventing the recalculation of the ticks, making the
line static when we enabled or disabled the PP graphs.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 15:33:00 -07:00
Tomaz Canabrava
078332bae1 Change the Ruler text values when metric system changes.
"ups", as I did this in Metric system I forgot to update
to imperial when the user selected it.

Fixes #665

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 13:06:19 -07:00
Dirk Hohndel
936f057ddc Retain the start time when creating plan from dive
We need to make sure that the start time is set before we start adding
points.

Fixes #661

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 13:02:01 -07:00
Dirk Hohndel
d262886a2d Fix time zone conversions
I know I tested this - no idea how I missed this.
Anyway, this was of course utterly bogus. Whenever we get a time from a
time_t into a Qt Date or Time datastructure, we need to adjust it by the
timezone offset as otherwise Qt will assume it's in local time and
helpfully change it to the wrong values for us.

See #655

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 13:01:46 -07:00
Dirk Hohndel
9edee3477a Remove unused variable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 10:32:13 -07:00
Sergey Starosek
d9e16ecd2d Another string to translate
[Dirk Hohndel: took only one of the two parts and adjusted commit message
               accordingly]

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 09:38:47 -07:00
Tomaz Canabrava
357f5c19da C++ Correctness and code cleanup.
Use const-reference where we can gain a bit of speed from that
and clear an else { if {}} by using else if.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 09:38:10 -07:00
Dirk Hohndel
edea301252 Don't mess with the selection when closing a file
Our core structures are kept consistent by calling delete_single_dive()
and there is no reason at all to even touch the UI selection as this all
goes away with cleanUpEmpty()

Fixes #660

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 09:11:42 -07:00
Dirk Hohndel
1863452a25 Add dive: initialize start time of dive
commit f29f41ae9e ("Planner: fix start time handling") broke the start
time handling for Add dive. While in actual planner mode we set the start
time for the plan, we did not do this when simply adding a dive. The
moment the time / date was changed (which admittedly in real life a user
would most likely do) all was well, but if the user just accepted the
"now + 1h" default, things went badly wrong.

Fixes #658
See #655

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-26 07:30:09 -07:00
Lubomir I. Ivanov
050b1b71ff PrintLayout: fix a potential bug in the recent table print update
There is a weird QPicture dependency; we need to offset a page
by headingRowHeightD2, which is half the heading height.
The same doesn't make sense if we are rendering the table widget
directly to the printer-painter.
Moving the offset inside 'pageIndexes' is less desirable.

The bug itself manifests when a top margin is set on Win32,
while on Linux it's more obvious.
On new page start, a fixed height from the last dive on the
previous page becomes visible even if the math seems correct.
Offsetting both the page index and the vertical position at
which the QPicture is placed fixes that.

If 'table.render(&painter...)' is used the bug also goes away
and our 'pageIndexes' start to make sense again, but we want
to use QPicture so that the table is in vector. I don't have a good
explanation why this happens!

Tested on Ubuntu 12.04 and Win7.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-25 07:23:39 -07:00
Lubomir I. Ivanov
cccf05ee7b PrintDialog: make "print only selected" the default option
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-25 07:07:50 -07:00
Lubomir I. Ivanov
0a53449e76 PrintLayout: vectorize the table print
Use QPicture to do that.

QPainter::drawPicture() requires offsetting the target QPoint's
Y value by two times the headingRow height.
This can be improved the hardcodding the offset when the
'pageIndexes' are calculated, but is a bit complicated.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:10:44 -07:00
Lubomir I. Ivanov
50b4617cd4 PrintLayout: reduce the scope of 'pic' and 'picPainter'
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:10:30 -07:00
Lubomir I. Ivanov
c51d4ce0b0 PrintLayout: modify the profile font size based on the #dives per page
For the profile print, the number of dives per page is:
divesPerRow * divesPerColumn

If we have more 3, 0.6 seems optimal, while for less we can
pretty much use the default scale of 1.0.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:10:06 -07:00
Lubomir I. Ivanov
e3dbbfe9f2 PrintLayout: draw the profile to a QImage only on Linux
The QImage fix for the recently reported
"huge-vector-lines-in-PDF-printouts" bug is only needed on Linux.

For Win32 and OSx we can render to vector.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:06:49 -07:00
Lubomir I. Ivanov
3af7db71c8 PrintLayout: fix the ProfilePrintModel font
Fixing the font size is required, because we don't really support
a dynamic row height, as the row height is set in the class
constructor.

7 seems optimal for all print modes.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:06:42 -07:00
Lubomir I. Ivanov
feda96cec5 PrintLayout: disable the QPainter scaling
This is wrong because we don't really need to scale. We already
have the estimated page dimentions in pixels, so taking the
quotient of the printer DPI and screen DPI and then scaling
(probably up) our rendered widgets via the QPainter introduces
blur (due to the oversampling), and a performance penalty.

By rendering at the exact dimensions we ensure that the widgets
are crisp at a 100% printout.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:06:19 -07:00
Lubomir I. Ivanov
5e8f4c8560 PrintLayout: a whitespace fix
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:06:05 -07:00
Lubomir I. Ivanov
21585403db Printing: add 1 dive per page option
With this option there is an exception, which makes the notes section of
the profile table occupy half the page. This way dive plans can reasonably
be printed.

Fixes #636

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 11:33:28 -07:00
Dirk Hohndel
f29f41ae9e Planner: fix start time handling
We setup the startTime for the dive plan in too many places... but never
actually copied it into the planned dive.

Fixes #640

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 09:03:56 -07:00
Dirk Hohndel
95466cb245 Sort dive table after adding a dive
The dive might not be the newest dive in the dive list.

Fixes #637

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 08:20:34 -07:00
Sergey Starosek
6d5905419e Translate progressbar text
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 07:29:42 -07:00
Sergey Starosek
458b234920 Align progressbar text to center of the widget
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 07:29:30 -07:00
Dirk Hohndel
c87f6081a5 Update strings for translations
Including a tiny change for one of the new strings to be consistent with
the capitalization rules we recently established.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 07:15:05 -07:00
Lubomir I. Ivanov
028568555f Planner: fix an enduring assert on startup
qt 5.3, win7 64bit.

beginRemoveRows() asserts in removeSelectedPoints()
because rowCount() - 1, becomes less than firstRow.

This needs a check in removeSelectedPoints() if the number
of passed rows is zero.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 08:19:45 -07:00
Tomaz Canabrava
f6f2c4e929 Only repopulate the dive info once ( we were repopulating 4 times )
This makes the screen repopulate itself after a dive change only
one time instead of the old 4. we were repopulateing when we
removed the actual selection to reset the old selection previously
stored, sigh.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 08:10:10 -07:00
Tomaz Canabrava
99922722d2 Only use HTML if the text has a <table>
The text we generate for the diveplan has a table inside, and
we must use HTML only for the dive plan. so I treat all text
as HTML, look for a table item, if it doesn't have, I treat
it as Simple text and set it on the notes. Works and makes
linus loves me again.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 08:09:58 -07:00
Tomaz Canabrava
607d450cd6 Code cleanup: HeartRate item was doing insane things
This simplifies so much of the code that we were using to control
the visibility of the HeartRate. now things are much saner.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:51:22 -07:00
Tomaz Canabrava
65eefe7b59 Animation speed is a value, not a boolean
This breaks compatibility with old preferences, but it's a single
key and not that very important so I don't think it's a bigger issue
I've renamed prefs.animation to prefs.animation_speed to denote
that it's a value, and not a state.

Also, fixed the places that were treating it as a state (on/off)
to treat it like a correct value.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:50:03 -07:00
Tomaz Canabrava
82bcb1767c Don't plot pictures in Print mode
The pictures were being plotted in print mode, the main
reason for this was that when we entered print mode and
had already a picture plotted, the method would return
before removing them from the screen. This fixes it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:48:22 -07:00
Tomaz Canabrava
5da2e667d0 Set visibility in a saner way
for some reason we did a if(true) setValue(true) else serValue(false)
now we just use the value to set the value. =p

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:47:27 -07:00
Tomaz Canabrava
efa05bc0c9 Break really long line.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:47:23 -07:00
Tomaz Canabrava
5e7f40115f Whitespace fixes.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:47:15 -07:00
Anton Lundin
60c4587be6 De-duplicate planner default settings
All other default settings we get from subsurfacestartup.c's
initialization of the prefs struct. The planner had its defaults there
and in the retrieve of the settings from QSettings.

This changes so the defaults for planner settings will be read from the
defaults prefs struct as all other settings.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-19 10:24:07 -07:00
Dirk Hohndel
17bcd1bc60 get_gas_at_time needs to always give us a valid gas
Before this function was changed it was really supposed to just change a
gas that was passed in in case there was an event that changed the mix -
but with the new name the caller will assume that they get a valid gasmix.
And promptly we had one caller that didn't initialize gas to be based on
the first cylinder before calling get_gas_at_time().

Instead of adding yet one more spot that knows about the oddity of the old
API I simply changed get_gas_at_time() to do what it name appears to imply
and fixed the other callers not to bother to initialize the gasmix.

Fixes #647

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 18:46:51 -07:00
Sergey Starosek
88a0dc1bb2 Add missing application icon
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:21:42 -07:00
Lubomir I. Ivanov
21a1fc2a4f Print: remove the options for height from display.h's 'struct options'
Not supported. Also the profile in "6 dives per page" doesn't really
allow much variations because it looks bad if we scale it down further
on A4.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:20:11 -07:00
Lubomir I. Ivanov
6e4ebe3c54 Print: remove the height sliders from the PrintOptions class
These were hidden and we don't really support them because
our print layouting is not that flexible in Qt!

Note: printoptions.ui is now converted to UNIX line breaks.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:20:00 -07:00
Tomaz Canabrava
571755cc64 Do not plot text twice for information.
Well, the information was bad, it was being printed twice
if the text is HTML, print only once.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:57 -07:00
Tomaz Canabrava
94bcd2622a Bypass the PDF bug by painting on a QImage and paint the image to pdf
well... we have a good and working printing system now. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:48 -07:00
Tomaz Canabrava
10ed5da325 Close the print dialog after a sucessfull print
I think it's intuitive to do not warn if everything was according to the
plan, and keep the dialog open after a print was due is something that I
find it strange.

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
7a70f15f9b Add the HTML Delegate to printing.
This patch just adds the HTML Delegate to print the text.

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
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
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
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
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
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
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
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
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
32a76671ed Fix SearchBar growing vertically on window resize
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:11:14 -07:00
Sergey Starosek
b2a3e46184 Fix layout for User Survey
- apply vertical layout to top-level dialog. This solves label clipping
- call adjustSize() on dialog to fit all labels (translated text could
  be longer than original)

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:11:04 -07:00
Salvador Cuñat
7eb422d988 Change in logic while aplying gps fixes to dives
We were actually searching dives which match the dowloaded position
fixes. So we're also trying to take into account if the fix is automatic
or no based on a limited amount of predefined strings (bad idea, as the
user can change in companion app settings the predefined string).
This way, in actual implementation, if program concludes that a fix has
been manually got or, simply, the user is unlucky enough to have all the
position fixes out of the dive time, find_dive_n_near() function will
pair fix and dive in an ordered way (1st fix -> 1st dive; 2nd fix -> 2nd
dive ...) which is probably erroneous, except for manual position fixes.

BTW actual implementation can't pair the same gps position with more
than one dive, which would be the case, e.g. in repetitive dives while at
anchor in the same point.

The patch changes the logic:

- Search positions for defined dives (instead of dives for defined
positions) without care if position has manually or  automatically been
set.
- Only take care of those dives that don't have a position yet.
- It makes two assumptions:
   a.- If the position fix has been taken during the dive time, is
correct. If there are more than one inside the dive time, takes the
first one (closest to the DC's reported time).
   b.- If not during diving time, the correct one is the nearest fix
before the dive begins (also the usual case if manually fixed from the
smartphone just before jump into the water). But will work too if there
is only one fix *in SAME_GROUP range* after the dive (another usual
case).
- Finally, as copy_gps_location() in dive.h is used only here, let it
take care of naming the dive if user hasn't named it yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 07:38:31 -07:00
Dirk Hohndel
10e66823b0 Improve handling of cylinders with identical gasmix
In reality we have no concept for handling those, yet. But the UI doesn't
prevent the user from entering multiple cylinders with the same gasmix, so
we need to help the user to get rid of them as well.

If the user attempts to remove a cylinder we check if there's a second
cylinder with the same gas. If that's the case then we can proceed and
remove the cylinder the user wants to get rid of without losing that gas
for the dive. The only tricky issue is that we need to make sure that if
we remove the first cylinder that one is actually replaced with one with
the same gas.

Fixes #622

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 20:36:49 -07:00
Dirk Hohndel
0cf55d7e39 Correctly track the 'changed' status of the equipment widgets
updateDive() cannot reset the changed status - this is called while the
dive is edited. Instead this status is reset when the user either accepts
or rejects the changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 20:36:25 -07:00
Dirk Hohndel
327ea3aca4 Dive equipment edit - fix logic for applying changes
We keep getting this wrong. First you check all selected dives that are
not the current dive, make sure the equipment was the same before the edit
and then apply the changes. Then, when you are done with ALL of them, then
you change the current dive. Otherwise you cannot compare to the 'before'
state anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 20:29:14 -07:00
Dirk Hohndel
5440d0c39f Don't ignore equipment just because the dive list is empty
This was a fun little bug. Tomaz pointed me in the right direction. The UI
restructure with the displayed_dive had another unintended side effect
here. It is not valid not to set up the widgets just because the dive_list
is empty. The displayed_dive isn't on the dive_list until it is saved - so
while the user is adding or planning a dive, we still need to show the
equipment widgets.

Fixes #614
Fixes #601

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 19:52:05 -07:00
Dirk Hohndel
3860c3eaa1 Planner: limit altitude and pressure
Oh boy, this should allow for altitude in 'ft' as well.
I set an arbitrary cutoff at 3000m (and switched things to increments of
10m for the altitude).

Fixes #629

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:19:49 -07:00
Tomaz Canabrava
4c8e9615e4 Remove uneeded function
This method was being unused, rip it off.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:46 -07:00
Tomaz Canabrava
e38595f684 Use QObject::tr instead of OurClasses::tr for functions
This will make more easy to move code around in the future.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:46 -07:00
Tomaz Canabrava
887f9e63c3 Save and restore Dive Planner Settings
This patch adds the code that saves and restores the dive planner
settings.

Fixes #608

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:38 -07:00
Tomaz Canabrava
a502958a66 Selects the delegate text on Cylinder edition
The text selection was not being set, bummer.

See #628

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:30 -07:00
Tomaz Canabrava
d993684fec Do not create a backup for Q_FOREACH container
Q_FOREACH will expand and already creates a copy of the
contained container, so this is just a waste of cpu cycles
and also increases a tiny bit the memory consumption.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 16:55:10 -07:00
Dirk Hohndel
dff92f188a Planner: don't allow the user to remove the last point
This causes all kinds of assumptions to go wrong - and it makes no sense.
Move the point to where you want it or cancel the plan.

Fixes #623

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 03:33:48 -07:00
Dirk Hohndel
133e104393 Planner: when adding new waypoint at the end, use previous gas
In commit b0da8c2707 ("When adding a waypoint, use the gasmix of the
_next_ waypoint.") we default to air when adding a waypoint at the end of
the plan by double-clicking. That seems silly since we could instead
continue using the last gas.

I wasn't able to reproduce the "gas list disappears" problem in bug #623,
but I did get a silly air segment added which was equally wrong. Maybe I'm
lucky and this fixes the problem that Henrik sees as well...

See #623

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 03:20:23 -07:00
Dirk Hohndel
95dbfc22ac Try to avoid inconsistent selection state after divecomputer download
I cannot reproduce the problem, but adding one more call to
unselectDives() should ensure that all dives are marked as not selected
before selecting the last dive that was downloaded.

See #620

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 21:44:57 -07:00
Lakshman Anumolu
74bfa1b170 Shrink YAxis when heart rate is on display
This patch makes sure that YAxis is not expanded to cover heart rate
when it is displayed on profile panel.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 21:38:34 -07:00
Gehad elrobey
6f05194b02 HTML: Add dive photos to the detailed view
Dive photos are copied to the photos directory on export. The photos
section appears only if photos exist.

C++ helper functions are added to copy images to the photos directory,
Additionally the photos directory must be passed as a parameter to the
write_one_dive function to save photos to it. Some options structure may
be needed instead of passing many arguments.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 21:38:22 -07:00
Dirk Hohndel
6a5dcb4859 Remove warning about undeclared menuFilter
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 18:43:42 -07:00
Anton Lundin
4cea594655 usersurvey: Add : for consistency
All the other statements there had : in them.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 18:42:10 -07:00
Anton Lundin
0fbfccd31a profile2: remove unused varable diveComputer
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 18:33:57 -07:00
Anton Lundin
64d7c5c042 Remove unused menu "Filter"
The filter menu wasn't connected to anything other than a debug print.
This removes that menu.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 18:33:54 -07:00
Miika Turkia
9775750cf5 Change default export tab to "General export"
I prefer that we show the first tab by default. Everyone should remember
that Qt Creator changes the currently shown tab as default on save.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-13 21:39:33 -07:00
Miika Turkia
4986853113 Typo fix Ave. => Avg.
Fixes #619

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-13 21:39:25 -07:00
Miika Turkia
ebdc8744fc Add tooltip for toggle pictures
Fixes #618

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-13 21:39:18 -07:00
Dirk Hohndel
74616cdddf Rename event: correctly replace event with new one
I don't like that the event structure includes the variable length array.
That really makes it a pain to change the name of an event (on the flip
side, freeing events is easier I guess).

Anyway, to correctly rename an event we need to actually remove the event
from the correct dc and then add a new event with the new name. The
previous code was insane (it only worked if the new name was of smaller or
equal length, otherwise it had a beautiful buffer overflow).

And of course we need to do this both for the current_dive and the
displayed_dive.

Fixes #616

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 12:56:03 -07:00
Miika Turkia
79015e17f8 Fix inserting gaschange events
Use a macro that works to get the current DC.

Fixes #613

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 08:04:42 -07:00
Anton Lundin
b55218c2f4 Lower CCR setpoint min value in planner to 0
We signal a bailout to OC via setting the setpoint to zero. A setpoint
between 0.2 and 0 would be really wierd, but i couldn't figure out any
better way to keep the bailout deco planning.

Note:
The gas consumption of CCR dives are plain wrong, but this atleast lets
you plan your deco for a CCR bailout plan.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 08:03:46 -07:00
Anton Lundin
c4981f28a6 Add step size in our SpinBox delegates
For the Set point spinbox, it was kinda hard just stepping by the
default 1.0, so setting it to step by 0.1 makes much more sense.

The int SpinBox got a step size parameter for consistency.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 08:03:34 -07:00
Anton Lundin
6008d08557 Use doubles in DoubleSpinBoxDelegate
The previous code used qreals, but it feels clearer to use doubles when
the name of the class contains the word double. The performance loss of
using doubles instead of floats on arm is non-existent in this case.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 08:03:16 -07:00
Anton Lundin
dcb580ed46 Don't round range for DoubleSpinBoxDelegate to int
This fixes simple copy-paste error that the DoubleSpinBoxDelegate range
was stored as int, thus rounding min value from 0.2 to 0.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 08:02:58 -07:00
Miika Turkia
7ce9eb28ee Mark divelist changed when adding bookmark
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 22:50:09 -07:00
Dirk Hohndel
e1ae7ebab2 Printing: print depth unit in table
When adding the method that includes the depth unit to the DiveItem class
I realized that this was yet another implementation of our depth unit
conversion. We should just call the existing helper instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:59:21 -07:00
Dirk Hohndel
236ff5c89d Printing: make table more useful
Tweak font size and column widths.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:51:44 -07:00
Dirk Hohndel
0d9a1946fa Printing: change the header to show depth / duration
At least for my dives there wasn't enough space for depth and duration in
the header, most likely because I made the last two columns smaller to
create more space for tags and suit.

With this commit the depth and doration in the header now spans two
columns and easily fits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:40:22 -07:00
Dirk Hohndel
6699dab952 Printing: print tags instead of max CNS
And re-order / re-size the fields so more useful information is actually
shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:39:44 -07:00
Dirk Hohndel
2552b027ae Printing: use more appropriate font sizes
2-up and 6-up need different fonts.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:30:40 -07:00
Tomaz Canabrava
ece93107d9 Better default font for printing.
use setPointSize instead of setPixelSize to make it device independent,
also reduced a bit the size of the font.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:02:24 -07:00
Tomaz Canabrava
8cd4a5f3d1 Render the table print in curves.
We can use QPicture to record the painting done by a QPainter and it will
be saved in vector format, then we can simply paint that.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:01:59 -07:00
Tomaz Canabrava
e18f4dfdee Code cleanup: removed bogus animation functions
All animations are now on the Animations namespace, which resulted in a
bit of code cleanup, which is nice.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:01:12 -07:00
Tomaz Canabrava
2171b981ac Correctly disable all animations
This seems to be needed for the correct print of the profile,
What was happening on the print code was that the profile even in print
mode was doing animations, and we were getting a frame of it and trying to
print it.

Also, a bit of code cleanup.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:00:40 -07:00
Tomaz Canabrava
3fa908b242 Add a horizontal spacer to make the searchbar layout better
Just a horizontal spacer added to the .ui

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:00:23 -07:00
Tomaz Canabrava
bd993a4135 Use a layout to lay down the search and the help
The old layout tried to add the search on top of the help view, which
didn't really work because of the way that the QWebView rendered: we got
garbage after a scroll with the find opened. So now I'v created a QWidget
and layed down the QWebView and the search bar vertically.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 16:59:14 -07:00
Tomaz Canabrava
af9d62bac3 Fixed input in the DivePlanner table
Based on Glance's idea on rewritting the Delegates, but
we don't need to redo the wheel as Qt already gives us
the correct Delegate, we just need to set some boundaries
on it before returning.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 16:58:42 -07:00
Tim Wootton
44a554d53a Makes profile button tool-tips consistent
Toggle seems to fit all these scenarios ok.

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 16:58:02 -07:00
Tim Wootton
d69d1cdfcd web service not web-service
web service not web-service to match the others

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 16:55:53 -07:00
Tim Wootton
745c9a130c "non-used" just didn't sound right to me.
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:44:49 -07:00
Tim Wootton
9b5048034f profile capitalisation
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:44:41 -07:00
Tim Wootton
38c402d9ad dive list context menu capitalisation
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:44:35 -07:00
Tim Wootton
9dd484b63f Misc UI capitalisation consitencies and other text changes
Capitalisation consitencies
A typo correction
A readability improvement (IMHO)

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:44:09 -07:00
Dirk Hohndel
fbd00c6b0d Planner: add event that explains when planner turns red
I don't know why the plot_info was walked backwards - for our purposes
walking forward needs to make a lot more sense. And the event nicely goes
away when the diveplan gets modified and the displayed_dive gets reset.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:26:22 -07:00
Dirk Hohndel
6c9aaf406a Planner: fix calculation when it is safe to surface
We were comparing with a negative depth which apparently confused the
algorithm.

Fixes #611

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:10:15 -07:00
Tomaz Canabrava
9661926131 It's safe to delete NULL pointers
Small code cleanup, it's safe to delete null pointers.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 09:58:55 -07:00
Tomaz Canabrava
040e172d33 Read the preferences upon initialization for the show/hide pictures
Forgot to add this one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 09:57:27 -07:00
Tim Wootton
3a16a64616 misc capitalisation and spelling
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:06:26 -07:00
Tim Wootton
402198871b divelistview capitalisation consitency
affects mainly capitalisation on the dive list context menu

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:05:59 -07:00
Tim Wootton
fbb01e37d3 webservice capitalisation consitency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:05:38 -07:00
Tim Wootton
da51b1b3ac shiftimes capitalisation consitency and title
Makse capitalisation consistent.
Makes title more specific

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:05:17 -07:00
Tim Wootton
9b6d72e8b4 shifimmagetimes capitalisation consitency and title
Makse capitalisation consistent.
Makes title more specific

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:05:10 -07:00
Gehad elrobey
e5c5ee74f0 HTML: fix profile labels
Fix labels view in dive profile.
Add Jqplot css file to the exports.
The css files fix the view and enahnce the plot.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 06:59:00 -07:00
Tomaz Canabrava
b9d04c0cf4 Show/Hide pictures working.
This code hoocks the pictures with the preferences change.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:54 -07:00
Tomaz Canabrava
a00d8101c5 Fix memory leak on the Export Dialog
The export dialog was being created but never free'd.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:45 -07:00
Tomaz Canabrava
31e0ec8696 Macro to simplify the creation of toggle buttons on the Profile
The new macro hides all 5 lines of code from the old code to just one,
since we already have 15 buttons and more are comming, and *every*
code is just the same, it's a logical change that will make us reduce
now 75 lines of code to just 15, in the future this can be bigger.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:39 -07:00
Tomaz Canabrava
dd94831d90 Correctly sets the 'enabled' flag on the picture button
Forgot to add this one, oops.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:27 -07:00
Tomaz Canabrava
503a150af0 Added the toggle picture button and hoocked it up
This patch adds the toggle picture button and hoocks
it up with the rest of the code. I'v also changed a call
from ProfileWidget because it caused errors on the ui
generated code, where it would try to call an still-to-be
instantiated object.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:23 -07:00
Tim Wootton
8940f29ead Prefer "temp." vs "temp" and sometimes "temperature"
For consitency in the UI
There are plenty more of these to find, and once in a while
"Temperature" looks more apropriate, like in a title, but most
of the time "temp." works best.

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:30:56 -07:00
Tim Wootton
25114a4e84 preferences capitalisation consistency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:30:39 -07:00
Tim Wootton
70bec60983 plannersettings capitalisation consitency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:30:14 -07:00
Tim Wootton
5538fd4baa mainwindow capitalisation consistency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:30:05 -07:00
Tim Wootton
e418f7d871 downloadfromdivecomputer capitalisation consitency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:29:24 -07:00
Tim Wootton
7680863c0e diverplanner capitalisation consitency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:29:01 -07:00
Tim Wootton
91ead05dbf divelogimportdialog capitalisation consitency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:27:50 -07:00
Tim Wootton
2db9c97530 Add diveloexportdialog explaination strings for translation
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:26:54 -07:00
Tim Wootton
8e7b7fafda divelogexportdialog capitalisation consistency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:26:41 -07:00
Tim Wootton
5c5168cf17 maintab capitalisation consistency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:26:30 -07:00
Tim Wootton
85a98636c1 divecomputermanagementdilog capitalisation consitency
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:26:20 -07:00
Tim Wootton
d2d6b7937e Implements consistent capitalisation and minor tweaks to survey text
Makes capitalisation consistent
Replaces Tech diver with Technical diver
Adds title to survey dialog (was "dialog")

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:24:55 -07:00
Henrik Brautaset Aronsen
a99349814c Use gasmix getters in diveplanner.cpp as well
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:19:06 -07:00
Dirk Hohndel
9b8c1e195a Avoid duplicate name warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 12:44:00 -07:00
Anton Lundin
dd924a21ed Add quirks for Seabear CSV settings for pressure
This adds the settings quirk workaround for the pressure import from the
Seabear CSV file.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 12:40:41 -07:00
Anton Lundin
89d74888b3 Add support for importing pressure from CSV files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 12:40:25 -07:00