Commit graph

1595 commits

Author SHA1 Message Date
Tomaz Canabrava
250653a67f New profile: DiveRuler compiles / not working yet.
This patch removes the GC macros and change the calling to use the
DiveCartesianAxis.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
52fe9101c8 New profile: add placeholder code for the RulerItem
This patch just creates two files for the rulerItem, a .h and a .cpp.
nothing was done to make it visible on the new profile yet - will do that
on the next commits

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
1695894130 New profile: connect the scale action
Just quick'n dirty glue code so that when the user clicks on the 'scale'
toolbar item, the new profile graphic is scaled.

Lovely thing: Animations for free. <3

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
8c56b2f45e Store zoomed plot in preferences
This patch makes the 'Zoomed Plot' a preference that can be stored and
retrieved, this way if the user sets the plot to be 'zoomed', this
information will persist even if they closed or opened subsurface again.

Also, added the 'Scale' button on the new profile, but didn't did the glue
code yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:35 -08:00
Danilo Cesar Lemes de Paula
5846ff972d Fixing default font on preference window
Default font was hardcoded as 14.
What happen if you change any other preference value is that the
application would start to use fontSize=14.

This commit loads the right value in the QDoubleSpinBox

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 11:51:33 -08:00
Dirk Hohndel
30b25d1212 New profile: create fake DC if we have no samples
This call got lost when creating the new plot_info structures.
dives/test15.xml is a good test case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 11:43:56 -08:00
Danilo Cesar Lemes de Paula
6801c68c2d reseting progress_bar_text for new downloads
if the user tries to redownload something from its dive computer
the interface will be stuck since progress_bar_text won't be empty in
the second run.

Even if I don't really like this idea of that value being changed by
downloadfromdivecomputer.cpp and libdivecomputer.c, that value needs to
be reset by someone.

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 09:00:19 -08:00
Danilo Cesar Lemes de Paula
ed12902746 disable buttons while downloading
Simple patch to enable/disable extra buttons while downloading.
The UI should be blocked during the download.

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 09:00:19 -08:00
Giuseppe 'ferdy' Miceli
69bf64793c Adding a polite "Please" in front of the warning message.
Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 08:02:38 -08:00
Dirk Hohndel
67a1e3f3e0 New profile: try to pick better HR samples for which to print number
This simply tries to pick at least local minima / maxima.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 14:24:09 -08:00
Dirk Hohndel
21ed18816a New profile: fix tooltip display for events
We need to use the transform() of the view, not the tooltip.

Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 13:58:57 -08:00
Dirk Hohndel
eb5cbf64eb New profile: small cleanup of heartrate code
Remove unused variable and correct comment.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 13:30:00 -08:00
Dirk Hohndel
c0e489c1ea New profile: add event info to tooltip
This appears to correctly add the tooltip to the event item, but for some
reason the tooltip isn't displayed for most events.

Still needs more work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 12:27:12 -08:00
Dirk Hohndel
b5a02e50aa New profile: create new class for DiveHeartrateItem
This allows us to give it a different color (red) and make it a smaller
size.

While implementing this I also fixed the size of the temperature text in
the new profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 15:28:31 -08:00
Dirk Hohndel
76393a2f53 New profile: better positioning for the heartrate labels
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 14:36:47 -08:00
Dirk Hohndel
41abab7253 Calculate minimum and maximum heartrate
And setup the axis accordingly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 14:32:25 -08:00
Dirk Hohndel
f5862201a8 Don't try to setup event if it is NULL
This also fixes the whitespace in a function that I instrumented to figure
out what's going on. I restored it to its original state, but I couldn't
leave the whitespace unfixed...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 08:35:06 -08:00
Dirk Hohndel
48db63736b Don't try to set visibility of events before they have been added
Admittedly this code doesn't do anything useful right now, but at least
have it not to anything useful in the right spot.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 08:33:58 -08:00
Robert C. Helling
0474fe70fc New profile: add image pixmaps for image events
For reasons that I don’t understand, the image is only shown if the event
happens to be at the same time as a depth sample. This is, however, not
specific to these image events, it seems to apply to all events.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-22 13:11:40 -08:00
Miika Turkia
78c68518f8 Clear edit mode for manually added dives
Edit mode must be cleared for manually added dives as well when one hits
cancel or save.

Fixes #437

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-20 09:22:43 -08:00
Tomaz Canabrava
508cbc82b8 Implement the rest of the heartbeat.
The only thing that was missing was the size of the vertical axis. I'm
setting a small line on the bottom of the temperature axis, since both
have blue color, this will not make people think one is the other.

TODO: change the color to red.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 20:58:48 -08:00
Dirk Hohndel
fd1a62568b New profile: partial addition of heartrate
This was done during an IRC hacking session with Tomaz.
It compiles, it shows something but not the right graph.
Committed here so Tomaz and I can continue to work on it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 17:19:57 -08:00
Dirk Hohndel
08490785b2 Only recalculate the tooltip if time has changed
Small optimization, but seems to make sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 16:06:16 -08:00
Anton Lundin
43997d3b36 Convert more TRUE/FALSE to stdbools true/false
In Qt5, Qt doesn't define TRUE/FALSE anymore, so we need to stick to
stdbools to have Qt5 builds working.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 07:13:56 -08:00
Dirk Hohndel
48c4c21b9f Implement the '...' search button for Uemis dive computers
Right now the search button isn't connected for any device (clearly an
oversight). At least for the Uemis I think I have a sane implementation of
what that should do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-18 17:20:35 -08:00
Thiago Macieira
756abc0341 Add an assertion to prevent MainWindow from being recreated
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-18 16:49:04 -08:00
Robert C. Helling
226b55893d Make lastUsedImageDir static to prevent a crash
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-18 15:30:59 -08:00
Miika Turkia
28454889d9 Use DateTimeOriginal on image import
Some digital cameras do not set the DateTime exif field bat use
DateTimeOriginal. If the first option is not found, use the second one
to try to detect the moment when the image was shot.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-18 08:46:22 -08:00
Miika Turkia
1328b44d44 Fix compile error
I get compile errors from these lines. Removing the class name from the
calls allow me to compile the current master.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-18 08:46:08 -08:00
Dirk Hohndel
240e269f19 Code cleanup
We called the helper functions way too often.
Whitespace / coding style adjustments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17 20:34:09 -08:00
Tomaz Canabrava
31ee4dac65 Make part of the context menu work (gas change event)
The code of the context menu and the gas change event callback is mostly
the same as the old profile, with minimum modifications, as this changes
the order of the code on the callback to make it a bit saner (declare
variables first, call code later).

This also fixes a bug on the model that was not cleaning itself in the
correct way after a call to clear.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17 14:50:14 -08:00
Dirk Hohndel
d81223b3f4 Missing initializer
This was causing us to access uninitialized memory at times.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17 14:40:10 -08:00
Robert C. Helling
bbb071f1e8 Compute dive computer/camera time offset from sample picture
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17 10:59:30 -08:00
Robert C. Helling
fe2a264db3 Store camera time offset in preferences
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17 10:56:43 -08:00
Dirk Hohndel
16e03ff86e New profile: some more slight rearrangements
This is just an attempt to not have the time markers and dive computer
name printed right on top of each other.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-16 14:16:39 -08:00
Dirk Hohndel
21ca39ab0a Fine tune positioning of temperature and tank pressure lines
Maybe not yet perfect, but better.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-16 11:17:29 -08:00
Dirk Hohndel
582fb693a0 New profile: improve mean depth line
Show decimal depth and make the line length more appropriate for the dive
profile shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-16 10:57:11 -08:00
Dirk Hohndel
e0f8ec7144 Clean up some warnings
Unused variables, more initialization order complaints.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-16 10:44:23 -08:00
Tomaz Canabrava
4525fbb147 Fix z-value of the PartialPressure gas graph over the timeAxis
Fiz zvalue of the partialPressure Gas Graph over the TimeAxis, and also
corrects the position of the PartialPressure gas graph. It now no longer
appears to 'float' over the TimeAxis, now it's on the very top of it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:30:25 -08:00
Tomaz Canabrava
44a72b805c Make it possible to hide some of the grid lines.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:30:25 -08:00
Tomaz Canabrava
4699363a9e Better setup of the defaults for the grid.
This patch creates better defaults for the grid lines, size, position and
z-level.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:30:25 -08:00
Tomaz Canabrava
883b25cea3 Create the grids.
Create the grids, and the way that they move is fabulous <3

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:30:25 -08:00
Tomaz Canabrava
38e25458ee Change the axis update method to move the lines.
Change the axis update method to move the lines alongside the texts.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:30:21 -08:00
Tomaz Canabrava
0c5fd7db8e New template-based-function: remove the uneeded items on a QList.
This function is for non-duplication of code for different QLists, since I
now have Texts and Lines, I needed to make the code in a way that it
worked without dupplication.

It's a pretty standard use of templates, I think that even the C guys will
not be offended by it. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:16:15 -08:00
Tomaz Canabrava
fc55b2abfe Remove the class 'CartesianPlane'
This class was pratically a re-do of the axis, I'll do the axis to plot
the lines when it feels like it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:16:02 -08:00
Tomaz Canabrava
87d5289920 Move the events when a partial pressure graph is enabled / disabled
The events were static on the canvas even if the profile changed its size
because of a toggle of the partial pressure gas. This patch makes events
move on the canvas to their correct place.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:15:14 -08:00
Tomaz Canabrava
6c67f90858 If the depth is zero, dont show it.
The first depth label of its axis is always zero, do not show it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:15:03 -08:00
Tomaz Canabrava
021d799ff9 Fix crash opening testdive0.xml
That particular dive didn't have a temperature, and thus we got a crash
while accessing the last temperature text.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:14:49 -08:00
Dirk Hohndel
191a3064a7 Removed unused setup function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 11:17:23 -08:00
Dirk Hohndel
6be62c1d90 Make font label scale a per axis property
This way the partial pressure graph can have smaller pressure labels than
all the other labels on the profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 11:15:57 -08:00
Dirk Hohndel
980737221d New Profile: make axis labels smaller
Previously all text in the new profile was deawn in the same font. With
this change the labels on all axes are smaller.
It might be even better to allow per-axis configuration of the label size
as along the time axis the bigger size looked better. But especially for
partial pressures this looks much better.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 07:06:09 -08:00
Miika Turkia
cb5ab4bc8e Add unit support for CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 06:33:33 -08:00
Dirk Hohndel
31aa93857a Initialize device_data_t data
If the user never clicks on the log and dump checkboxes (and that's what
we expect to be the case by default), then the log / dump flags (and
filenames) were never initialized.

I am reasonably certain this will close the following three bugs, that all
show the same symptom: they behave as if libdivecomputer dump was set,
even if it wasn't.

Fixes: #426
Fixes: #431
Fixes: #435

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 06:31:50 -08:00
Tomaz Canabrava
e49bd86f5e Align Right side of Cylinder Pressure Text to the Left.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-14 21:50:05 -08:00
Tomaz Canabrava
822ed20625 Left-Align the last Temperature Text.
The last temperature text used to have the same align flags
as all the other texts: Right. this makes it much more appealing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-14 21:50:05 -08:00
Tomaz Canabrava
bd5cc109f0 Show the last temperature on the graph.
The code shamelessy copied from the old profile introduced
a bug where the old temperature was not correctly shown.
I'v added a new member to the class that will store the
last valid temperature, and use that to calculate if there's
a reason or not to display it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-14 21:50:05 -08:00
Tomaz Canabrava
bf4144a012 Removed the 'Unused Tanks' from the toolbar.
Just removed the unused tanks from the toolbar,
since it's just a removal of something on the ui
related code, it's good to see how much verbose
the xml to generate the UI is.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-14 21:50:05 -08:00
Dirk Hohndel
f26896da1b Automated whitespace / coding style correction
First attempt to use the tools on one of our source files.
So far so good. Not perfect, but a HUGE improvement.

Most importantly it effortlessly fixed the Allman style braces introduced
in commit 51220f26ef ("Add recent files to main menu.").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-13 22:12:17 -08:00
Boris Barbulovski
51220f26ef Add recent files to main menu.
Add(up to four) recent files to File main menu.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-13 22:05:05 -08:00
Dirk Hohndel
730e0295c9 Ensure the correct parent is used in the dialog
This way the dialog is centered and the main window gets dimmed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 13:25:23 -08:00
Dirk Hohndel
af5ad2033d Don't redeclare variables of the same name
This isn't broken, but it's confusing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 13:24:40 -08:00
Boris Barbulovski
c86822c2f4 Replace mainWindow() with MainWindow::instance()
C++ style of accessing single instance class object.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 11:42:59 -08:00
Tomaz Canabrava
cc37d2e94a Make the mean depth line follow the size of the axis.
When we move, shrink or expand the depth axis, the
meandepth should also change it's position. this
patch adds that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 10:33:14 -08:00
Tomaz Canabrava
0333de426f Hide the extra axis labels on release mode, show on debug mode.
The extra axis labels on the Temperature and Cylinder Pressure
graphs are not wanted in release mode as they create a lot of visual
clutter, but they are useful to have in debug mode since we can then
better understand what went wrong.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 10:31:24 -08:00
Tomaz Canabrava
8041a2ed85 Added cylinder pressure shrinking on show/hide partial pressure.
Same as the last commit, but for cylinder pressure. Another bug
was spotted, where the mean depth line does not move to the correct
location after a axis-size-changed - fixing that on next commit.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 10:30:45 -08:00
Tomaz Canabrava
49642cacbc Shrink temperature axis when partial pressures are shown.
This patch adds shrinking of the Temperature axis when partial
pressures are shown. This adds an unwanted side effect however,
the axis started showing it's values - and we didn't do that on
the gtk version or on the old profile. While this is good for
debugging, it's not wanted for the software if it's on release
mode. I'll fix that in due time.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 10:29:57 -08:00
Tomaz Canabrava
b08c38da33 Animate transition between show / hide partial pressure graphs
When the user checked the option to show or hide the partial
presure graph the size of the profile graph was kept the same;
usually I do those changes on the objects themselves, on the
settingsChanged method, but since the calculation of the
size of the profile was done on the ProfileView class for
consistency with the other objects, I had to change it there
too.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 10:08:46 -08:00
Dirk Hohndel
5ca13b0024 Correctly track parent of print dialog
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 06:26:25 -08:00
Dirk Hohndel
6332976c3d Whitespace and dead code cleanup
The coding style for switch isn't the prettiest, but let's at least keep
things consistent.

Also, those ugly break statements never got reached, anyway.

And there was no need to re-declare and re-generate currentString.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 06:22:10 -08:00
Dirk Hohndel
9c9867dec5 More variable scope confusions
Don't have nested loops with the same loop variable. Really. Even if it is
legal C++.
And don't declare local variables more than once. This will only cause
issues later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 06:07:32 -08:00
Dirk Hohndel
6bff18e56a Make sure the about dialog is correctly centered
Otherwise, why pass in the parent to begin with?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 06:06:13 -08:00
Dirk Hohndel
4f522d79d8 Don't shadow object members like this
If you need to use this->error to distinguish the local variable from the
object membe that should be a hint that maybe you didn't pick the best
name for the local variable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 05:51:25 -08:00
Dirk Hohndel
11559f1704 Don't reuse a variable name with a different type inside the same function
Since the variable was inside of an inner scope this was technically legal,
but it's just too annoying for words.
(The diff in the commit doesn't make this obvious, but outside the for
loop in the same function there is a divedatapoint *dp, so we had a
pointer to divedatapoint and a divedatapoint with the same name...)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 05:43:31 -08:00
Dirk Hohndel
ffc61e1357 Don't use current_dive instead of the argument to the function
I could have gone either way - the other alternative would have been to
remove the argument to the function. But since current_dive is a macro
and since the semantic of the function make sense with the argument being
passed in, it seemed better to just not use current_dive in the function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 05:37:18 -08:00
Dirk Hohndel
48e9257de4 Fix variable scope issue
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 14:08:17 -08:00
Linus Torvalds
e58f54cac1 Fix ATM-vs-bar confusion
SAC should be calculated in relationship to surface pressure, not "1 bar".

I also realize that we have a few other cases where we do the same
mistake: the partial pressure calculations do things like

    po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive);

which is wrong as well - the partial pressure is also relative to
standard atmospheric pressures.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 14:05:54 -08:00
Dirk Hohndel
92bbed3304 Take the on-canvas position into account for DiveCartesianAxis::valueAt()
We did this right for posAtValue(), but not for the inverse.

Fixes #438

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:37:09 -08:00
Boris Barbulovski
ccb1c33d02 Put include guard to every header
* ensure include guard to every header
* comment endif guard block

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:37:01 -08:00
Boris Barbulovski
a3d82bf9b1 Update #include statement for QStringListModel
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:36:53 -08:00
Boris Barbulovski
507a929a27 Migrate MainTab models(QStringListModel)
Migrate MainTab models
  from static xxxCompletioModel::instance()
  to private MainTab variable members.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:36:45 -08:00
Patrick Majewski
936ac958ed Handle cancel in PreferencesDialog::on_chooseFile_clicked
If I click in the Preferences Dialog on the 3 dots to choose a default
file to load and cancel the opening FileDialog an empty string is returned
and set to the coresponding QLineEdit.

The new behavior (and mostly expected) is to update the QLineEdit only
if there is a filename returned from QFileDialog.

Signed-off-by: Patrick Majewski <dive@patrick-majewski.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:36:28 -08:00
Dirk Hohndel
b839cd4cb0 More renaming
I don't even know what a partial gas might be...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:36:11 -08:00
Dirk Hohndel
9bd77b51f5 Give the widget for the new profile a better name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:36:03 -08:00
Dirk Hohndel
d1c4bcf570 New profile: enable switching between dive computers
This was mostly in place, just needed to be hooked up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:35:54 -08:00
Dirk Hohndel
73d6057424 Minor cleanup
Remove obsolete header and unused variable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:35:47 -08:00
Dirk Hohndel
6ea6a4305c Use our macro for FP comparisons
I think that catches all the ones we missed (thanks clang -Wfloat-equal).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:35:40 -08:00
Dirk Hohndel
2bd2df0349 Fix bug in logic expression
Yes, the old code made perfect sense when you read it - except the C++
compiler turned it into something quite different from what was intended.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:34:42 -08:00
Dirk Hohndel
d49acdb3c0 Clean up include files
They should have a newline at the end.
Forward declarations of classes should be 'class'.
Function / method definitions don't end on a ';'
Remove obsolete QStateMachine forward reference.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:34:34 -08:00
Dirk Hohndel
829473ddc6 Don't repopulate the model if the dive didn't change
plotDives takes a list of dives (for future use) but currently only looks
at the first dive in this list. With that semantic in mind we can save
ourselves some work if we first check if this is the same dive we are
already showing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 16:32:10 -08:00
Dirk Hohndel
ba6713f0d8 Clean up the setDive function
* This should never be called with a NULL dive.
* The dc variable was set then never used.
* We now have a unique id for each dive, but we can't simply not
  repopulate the model in setDive as the old comment might make you
  consider, as otherwise the dataModel will reference already freed data
  in pInfo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 16:27:05 -08:00
Dirk Hohndel
74c75938bf Set up the dive that was passed in as first dive
We carefully extracted the first dive passed in with the QList, but then
always used current_dive. That's silly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 15:12:01 -08:00
Lubomir I. Ivanov
4b21e2f9a3 Profile2: Prevent another crash if no dives are present
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 14:33:44 -08:00
Tomaz Canabrava
691fbabb7a Do not add the items to the scene twice.
Those items have parent(), which means that when the parent has a scene,
they are automatically added and removed from the scene.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 09:58:42 -08:00
Tomaz Canabrava
bb71707321 Fixed item visibility on emptyState after being on profileState.
Background was not correctly back to it's original position
and a few other items kept their visibility when it shouldn't.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 09:57:45 -08:00
Tomaz Canabrava
cafc7e4b13 Clear the data when the model resets.
This patch does a few things:
1 - reset the model when user closes the dive file
2 - connects the 'rowsAboutToBeRemoved' in a way that the graphics can
    remove their polygons too
3 - adds a 'clear' virtual method so items that don't follow the rules can
    clean themseves up.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 09:57:04 -08:00
Dirk Hohndel
2f2c9e371c Don't ignore the return values from readfile and EXIF parser
If readfile fails it already frees its buffer.
If the parsing failed we shouldn't use the data in the structure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 08:20:53 -08:00
Danilo Cesar Lemes de Paula
31c45b8c4c Enable the dive planning under a compile flag
Allow subsurface to show the dive planner in case a compile flag is given.

qmake CONFIG+=planner

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 08:08:20 -08:00
Boris Barbulovski
e7eb06d78c Improve sanity check for DivePlotDataModel::data()
Adds DivePlotDataModel row upper-boundary check (isValid method already
checks for negative values).

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 07:55:55 -08:00
Boris Barbulovski
0e3852e625 memory leak fix(that I created in some previous commits).
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 07:51:52 -08:00
Sergey Starosek
16e80bf6af Close search panel by button click
Connect Close button (X) to panel's hide() method.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 07:12:35 -08:00