Some flags like printMode and isGrayscale are missing yet needed.
The flag printMode is required so that we know *when* to hide
certain elements such as the ruler and tool tip (e.g. not needed
while printing).
isGrayscale should be passed to all getColor() calls, so that
the greyscale color table is respected.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Changeset a90818671 introduces a small inconvenience. The pp graphs at
startup are not shown according to the visibility settings. Requiring to
toggle the icons to show the desired pp graph.
Trivial fix.
Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should make the layout work better on smaller screens.
Fixes#458
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
display.h: dc_number is unsigned int, thus a couple of warnings
may pop-out.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After the dive log has been closed, the ProfileWidget2 does not clear
the pn2 po2 and ph2 gas line.
This patch cleared the three lines after dive log closed.
Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Hugle <wulong@comp.nus.edu.sg>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The selection logic was a bit random: some places would return NULL if
the dive computer index was out of range, others would return the
primary dive computer, and actually moving between dive computers would
just blindly increment and decrement the number.
This always selects the primary computer if the index is out of bounds,
and makes sure we stay in bound when switching beteen dive computers
(but switching between dives can then turn an in-bound number into an
out-of-bounds one)
Fixes#464
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I had intended to amend the previous commit with this before pushing it
out. This changes the comment that pointed out the bug that the previous
commit fixed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Turns out we unconditionally set all events as visible when redrawing the
dive - even with a comment that this should take into account if the event
is visible. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This got lost when we switched to the new profile.
Remove event works. Hide events does call hide() on the DiveEventItem but
for some reason it stays visible. I'll hope for one of the more
experienced Qt people to fix that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
By simply storing the coordinates based on the scene (instead of trying to
map them to real coordinates) the overlay position is correctly restored.
Also remove the redundant positioning before readPos is called.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The topmost Z order of items in the profile should be:
- background (poster / logo)
- toolTipItem
- rulerItem
...
This mostly fixes the ruler being under other elements.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The animation appeared when the user started subsurface with a default
file, wich was a little annoying since it didn't had a 'from' position
to go and it was also increasing it's size on some window managers
that do subtle windows animations when a program starts. This patch
treats the first dive opened when the program loads with a divelog pa
rameter differently as the following ones storing the velocity value
on a temporary, and reassigning it later.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Once the poster is displayed when there are no dives in the list,
we may also want to disable the QToolButtons (PO2, SAC, etc..),
until a new dive is loaded and the profile is redrawn.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user has zoomed in but then changes to a new dive,
we may want to reset the scale back to the original value (1.0)
based on the current zoomLevel, so that the profile is not stuck
in zoomed mode.
This patch adds a snippet that resets the QGraphicsView scale,
zoomLevel variable and also the toolTip position.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a new image resource named poster.png which,
is shown instead of the 3 posters. The main reason for that
is due to the poster text not being visible. This new image
is pretty much the Subsurface logo only.
It also removes the grid lines, while the poster is visible.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Such can be disabled with -Wno-reorder and are clearly
more of a nuisance, but C++98 12.6.2.5 says the order should be
the same as in the class declaration.
On theory this would only speed the compile times a tiny amount.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We had all in place, all that was missing was to actually load
the position stored on the settings for the tooltips.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code cleanup fixes the two issues that I raised on
my last e-mail. hurrah.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch partially removes the code for the old profile from
Subsurface. It removes the use of the old profile on the mainwindow,
but keeping the code in the tree for now.
A bit of code-cleanup also entered this commit because I had to change
every instance of the code that used the old profile.
Now to the real code-cleanup
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The ruler is a weird beast - it has two child objects that access the
parent to call another function, that call the child functions.
When I updated the plot_info I didn't take that into consideration, what
happened is that when I set the parent's plot_info, the children's
plot_info are still invalid, but the update method is called anyhow.
This patch updates all plot_info's before calling anything else.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes the ruler work again, the problem is that the fonts are
*terribly* big, I'll fix that on the next commit.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch toggles on / off the ruler via QSettings.
When the user clicks on the toolbar, this sets the settings to true /
false, in a way that if the user turns Subsurface on/ off, we still get
the last choosed option.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the RulerItem inside of the new profile, and already takes
settings into consideration.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>