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: #426Fixes: #431Fixes: #435
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
C++ style of accessing single instance class object.
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
But in general we should not show the profile of a dive that
was recently removed from the list - e.g. via File->Close.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The profile info was generated using nasty string concatenation that the
membuffers are much better at anyway. And membuffers don't need those
arbitrarily sized fixed buffers (500 bytes? Why 500 bytes?).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>