Commit graph

954 commits

Author SHA1 Message Date
Dirk Hohndel
904c20feef Use the default cylinder if defined
With this every cylinder downloaded from a divecomputer that doesn't
provide cylinder data, and every cylinder manually added anywhere will
default to the default cylinder that is set in the preferences.

For people who most of the time dive with the same equipment (always on
dive boats with AL80, or almost always diving their personal HP119) this
should be a nice improvement.

If you don't like this behavior, simply leave the default cylinder setting
in the preferences empty.

This commit also fixes the incorrect s->value call (should be
s->setValue). I wonder what this did to the default filename before...

Fixes #145

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-23 22:01:11 -08:00
Dirk Hohndel
8e5c222e98 Create a text entry for default cylinder in preferences
We don't do anything with this just yet.
And frankly, a drop down of the cylinders that we know of would be even
better. But hey, it's a start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-23 22:01:11 -08:00
Taiane Ramos
450fd9c7bd Save button on menu calls InfoWidget save
When editing a dive and clicking save button on menu bar, it saved
dive information but didn't mark dive as not being edited anymore.
For closing file, user should always click on the save button on
the bottom of the page and then saving it.
Now when clicking save button on menu bar, it will call the
accept_changes before saving to disk.

Signed-off-by: exhora <exhora.tat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 21:39:20 -08:00
Dirk Hohndel
781266bf18 Work around QPlainTextEdit / QPainter bug on Mac
Actually, it's not so much "work around", it's just "disable our eye candy" for
tags on Mac. This is quite frustrating. When we do anything that has the
QPainter touch the widget from our GroupedLineEdit::paintEvent() path then the
QPlainTextEdit::paintEvent() doesn't render the text of the tags.

Fixes #298

Sort of.
But I guess tag text without eye candy is better than eye candy without tag text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 09:44:28 -08:00
Tomaz Canabrava
a3ddb16d88 Hide everything 'floatable' by default on the globe.
Later we spacifically enable the scale, but Dirk asked me to
use the bare minimum of marble.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:40:56 -08:00
Tomaz Canabrava
abc81fbd01 Disables zooming by double click and context menu on marble.
Marble is a weird piece of Qt software, it seems that it wasn't
thought of being a library when first written. Most of its features
are not achieved by subclassing && overriding one of Qt default methods,
instead we need to eventFilter for almost everything ( which is a pain,
and a bit error prone - see our combo box delegate *puke*. )

This one's ready,  only one thing though - if we want to implement
our own context menu, we will need to use the eventFilter, and not
the contextMenuEvent.

Fixes #291

[Dirk Hohndel: this does not disable the context menu for me...]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:40:32 -08:00
Tomaz Canabrava
6fd0087a27 Show user-hidden widget when choosing Show All
A user could have hiddden and lost any of the four panels
on the interface. Now when he chooses 'show all', if a
part of the interface is hidden, it will be shown again.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:35:10 -08:00
Tomaz Canabrava
7ed2fde778 Small code cleanup on the CylindersModel
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:35:03 -08:00
Tomaz Canabrava
cdac737925 Better positioning of the text on Weightsystems table.
Same as the cylinder, but for weightsystem.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:34:45 -08:00
Tomaz Canabrava
bc461d091c Added a bunch of tooltips where I thought it was sane.
I think we should actually fill the app with tooltips and
whatsthis hints. justsain ;p

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:34:24 -08:00
Tomaz Canabrava
cee021ddd3 Better positioning of the text on the table cells.
Better positioning of the text on the table cells. On KDE systems the
text got too near the line that divided the cells, this way the text is
placed on the middle of the cell.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:33:49 -08:00
Tomaz Canabrava
0f85243cf3 Fixes the correct sizes of the tables when first open.
This patch fixes the correct sizes of the tables when first opened. It was
defaulting to 'resizeToContents', but most of the cases when first opened
we got no content, and this was bad. Now I'm defaulting to 30 when on the
'REMOVE' column and 80 on other columns.

Fixes #189

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:32:53 -08:00
Anton Lundin
891892cde4 Cleanup and bugfix gaschange event printing
When a gaschange to air happened, the code did
name += name=+ tr("air") which probably was due to the block being just
confusing with all the ?:
Unrolls to proper if statements, and fixes the bug.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:34 -08:00
Anton Lundin
26656310ab Add optional support for stopdepth import from csv
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:28 -08:00
Anton Lundin
5eccd73a30 Add optional support for cns import from csv files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:21 -08:00
Anton Lundin
8dde12fa35 Add optional support for po2 import from csv files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:16 -08:00
Anton Lundin
8e60f3bb44 Give room for more options in csv dialog
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:00 -08:00
Anton Lundin
cf06f78892 Make temperature optional in csv import
This adds a checkbox to be able to import csv files without temperature.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:53:54 -08:00
Anton Lundin
1a0adea0cc Rework csvimportdialog to make room for features
This rewires things a bit to make room for new features coming.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:53:49 -08:00
Dirk Hohndel
60a5d1d070 Fix a couple of warnings
Removing unused variables.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:50:56 -08:00
Patrick Valsecchi
fe2eabf375 Added a configuration option to have gf_low apply at max depth instead of at deepest ceiling.
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Patrick Valsecchi
4c4a7a6d96 Refactoring of the configuration handling.
Before, when clicking the OK button on the preferences GUI, we were
updating in-memory preferences from the GUI, saving them to the
configuration file from the GUI, reloading from the file to the
in-memory preferences. Then, to add to the ducplication, when the
application was exiting, some fields were saved again.
Basically the first step and the last step were useless appart from
the fact the the other steps where missing a few fields here and there.

This patch removes the first step and fixes the missing fields.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
ACKed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Henrik Brautaset Aronsen
e0b376622c Fix typo
All hail the groub!

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Dirk Hohndel
a24eb8ac12 Hack to make tank selection work on Mac
This is an ugly hack as it partially breaks the ability to abort a selection
(so if you click outside of the combobox, the last value you hovered over is
selected). But this seems much better than not being able to select a different
tank at all.

Fixes #275

(and by 'Fixes' I mean "hacks to sort of make work"... but the trac automation
is rather inflexible in which words it understands...)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:08:04 -08:00
Dirk Hohndel
58088d5897 Complete add bookmark for the profile context menu
This (together with the commits fixing the QMessageBox title) should
finally close all the issues in bug 250.

Fixes #250

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 05:13:18 -08:00
Dirk Hohndel
995192c5fb Work around QMessageBox not showing its title on Mac
This is a bit hacky and simply adds the title to the message text when
compiling on a Mac, but hopefully this will be enough.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 04:23:10 -08:00
Anton Lundin
8aadd4d372 Quiet down warning about return in non-void
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 03:35:02 -08:00
Anton Lundin
27d6b2be6e Quiet down warning about duplicate name
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 03:34:46 -08:00
Dirk Hohndel
9c5e037a61 Trigger redraw of the Dive Info pane on preferences change
If we change the units we need to redraw the info on this pane.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 23:08:20 -08:00
Dirk Hohndel
0ca12c3601 Collect per tank SAC rate
This is a bit painful, but we basically walk the samples and pick the
valid tank from the events. And then we do a simple discrete integration
to figure out the mean depth per tank and duration per tank. And then we
assemble all that into per tank statistics.

Strangely the value calculated here seems slightly higher than one would
expect from the overall SAC rate. This inconsistency should be
investigated a bit further, but my guess it it's based on the assumption
that the DC provided mean depth is possibly more accurate than what we can
calculate from the profile.

Fixes #284

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 23:07:04 -08:00
Dirk Hohndel
36cb50fb37 Add gas change event from profile context menu
This allows to add missing gas change events to the currently shown dive
computer. Only gases defined in the Equipment section are offered.

Fixes: #250

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 20:35:15 -08:00
Dirk Hohndel
28ad26e878 Use the correct dive to create the gas list
If we are adding a dive, it's the stagingDive, otherwise it's the
current_dive that we need to look at.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:23:14 -08:00
Dirk Hohndel
c1f936f288 Hiding events doesn't change the dive_table
So let's not mark it as changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:22:40 -08:00
Dirk Hohndel
0d512b2dd9 Small whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:17:50 -08:00
Tomaz Canabrava
df6a80fb37 Hooked up 'Hide Events'
With this commit one can hide all events of the selected type through a
context menu on the profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:17:41 -08:00
Tomaz Canabrava
e8d1f14c90 Enable the 'Remove Event' callback.
Based on the code in the Gtk branch.

[Dirk Hohndel: whitespace cleanup and changed the message text]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 17:58:18 -08:00
Tomaz Canabrava
4c2e6c4658 Adds half of the support for the menu on the profile.
This adds the menu, it just doesn't do anything, yet.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 17:04:25 -08:00
Anton Lundin
eb027f2a4b Do per cylinder statistics
This shows how much gas form each cylinder was used. I would like to add
SAC to that list too but it became a mess trying to calculate average
depth per cylinder.

Design based on idea in #284

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:46:19 -08:00
Tomaz Canabrava
732f7a69b0 Better handle the mouse movements on the Add Dive profile
Better handle the mouse movements on the add dive profile,
when outside of the canvas boundaries. It had bugged me for
quite a while, but this is so much better.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:43:12 -08:00
Tomaz Canabrava
82ac9ef9c6 Enable gas selection through a context menu
This patch re-enables gas selection through in the add dive profile.
Good thing ( and I really didn't think of that before ) is that
it is less than half of the code of the other implementation.
:D

Fixes #265

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:41:34 -08:00
Tomaz Canabrava
25a52056c6 Fixes positioning the first Gas Label on the add dive profile.
We didn't take into account that last == first when checking for
the first item on the list. Now the gas is correctly placed on screen.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:41:11 -08:00
Tomaz Canabrava
f5be24609a Removed obsolete Code ( gaslist on text click )
This commit removes obsolete code, there was a
gaslist selection when user clicked on the buttons, but
this shouldn't be anymore, since the next commit will
add a menu to select the gas for that particular point.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:38:58 -08:00
Anton Lundin
c7941f66b4 Print bailout on separate row from SP change
It looked kinda weird without a separator between the SP change and the
bailout.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:34:40 -08:00
Dirk Hohndel
6acff53735 Fix trip summary line in dive list
Two errors fixed.

- With no location set, the summary line would start with a ','.
- When auto creating a trip for a manually added dive or when editing the
  dates of dives in a trip, the timestamp for the trip was not updated
  after editing the dive.

Fixes #293

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 14:20:18 -08:00
Dirk Hohndel
33f7c6bb28 Clear selected trips after restoring selection
The rememberSelection() / restoreSelection() functions ONLY handle
selected dives, not selected trips. This is a bit of a misfeature, but
because of that we need to make sure we clear our notion of selected trips
when we use restoreSelection()

Fixes #285

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 06:05:43 -08:00
Dirk Hohndel
1a876a85b9 Hook up MOD in the preferences dialog
For some reason this was never connected. Oops.

Fixes #267

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 05:32:24 -08:00
Dirk Hohndel
1a5e94006c Sanity check on gas percentages
O2 + He + N2 = 100%
(well, there are some other gases, but this is close enough)

Since N2 can't be negative that means we should refuse any change where
O2 + He > 100% (or o2.permille + he.permille > 1000).

Fixes #280

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 05:02:08 -08:00
Dirk Hohndel
4619bfd9ca Immediately update the dive flag label when editing location text
This seems like a much nicer user experience. Editing a location's name is
immediately reflected on the globe label, the moment it happens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:32:24 -08:00
Dirk Hohndel
e8a4420c59 Immediately show new locations on globe widget
When modifying or adding a dive location on the globe widget while in dive
edit or dive add mode, we now show the modified / new location right away
on the globe (assuming a location name has been given). This makes it much
easier to manually reposition a dive location.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:28:15 -08:00
Dirk Hohndel
7886719443 Handle double clicks on globe during dive edit mode
When we are editing or adding a dive, the globe widget needs to act
differently. Instead of directly changing the lat/lon of selected dives,
it needs populate the coordinate text field as if this information was
entered by the user (effectively all it is is a way to more conveniently
enter coordinates).

As a side effect, this also allows us to change the location once it has
been added (you just need to go into dive edit mode to do so).

There is one weird issue that occasionally (and I can't quite reproduce
this) I get lat/lon very close to 0/0 (as if the globe widget was centered
on 0/0 and not on whatever it is actually showing). That still needs to be
addressed.

Fixes #239
Fixes #131

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:12:31 -08:00