Commit graph

152 commits

Author SHA1 Message Date
Tomaz Canabrava
b0374047dd code to show profile again
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-14 08:18:26 -03:00
Henrik Brautaset Aronsen
5868b37e6b Fix inaccurate weight and temperature display in dive list
A nonexisting temperature (mkelvin==0) was displayed as -273°C.
Weight was always displayed with an extra 500 grams/0.5 lbs.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14 05:33:58 -04:00
Henrik Brautaset Aronsen
f9598f062c Clean up some typos
Cosmetic commit to clean up some of the annoying typos in qt-ui

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14 05:24:28 -04:00
Tomaz Canabrava
5d75b4b41b removed a unused debug.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13 21:47:35 -05:00
Tomaz Canabrava
009e6a6fa7 shift-key + shift-click + key corner cases covered.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13 21:47:14 -05:00
Tomaz Canabrava
6f74618d9c Speed fixes
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13 21:45:06 -05:00
Tomaz Canabrava
ee7f579242 Trying to make the DiveList selection behave correctly
And rip out all the code that Dirk put there to do that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13 21:37:08 -05:00
Tomaz Canabrava
a6d9f27445 Change setText(QString()) to clear()
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13 21:32:03 -05:00
Tomaz Canabrava
61373eaccf Fix segfault on mouseOver at the Profile with an invalid dive selected ( trip )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-13 15:28:17 -03:00
Dirk Hohndel
605f42daa4 Merge branch 'Qt-selection' into Qt 2013-05-12 07:04:05 -07:00
Dirk Hohndel
c729ae92ed Allow walking the dive list with the cursor keys
Figure out what is our first selected element (in case we start out from a
multiple selection) and then move to the next logical element. So the code
traverses an expanded tree (from a trip 'down' to its first dive or 'up'
to the last dive of the previous trip - and similar from a first dive in a
trip 'up' to its trip and from a last dive in a trip 'down' to the next
trip.

This does not take 'shift-cursor-up/down' into account (i.e. manual
selection extension). Instead with just cursor up and down a single dive
(or single trip) is selected.

My guess is that the code will make someone's eyes bleed. Be warned.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-12 06:58:56 -07:00
Dirk Hohndel
a180af3879 Modify selection changed slot to deal with trips correctly
If a user clicks on a trip, all the dives in a trip should be selected.
But if a user selects a range of dives that happens to have a trip header
in it, then only the range of dives should be selected (the trip header is
marked as 'selected' for visual consistency, even though not all dives in
this trip are selected).

This also changes the code to scrollTo the first selected dive instead of
just expanding the parent. This seems to give us a more pleasant visual
appearance (trying to keep the selected dive centered in the dive list)
and as a side effect no longer hides the first dive trip at program start
(before this change the first dive in the first trip would be the top
entry in the dive list, with its trip just out of sight above).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-12 06:53:57 -07:00
Dirk Hohndel
32941cb84f Don't print temperatures that are below 200K
That threshold is of course ridiculous and arbitrary - but it seems like a
good assumption to make that anything below that is DEFINITELY not valid
data.

Because of the way the scene grows automatically in Qt, printing these
texts would squish the profile into one thin line.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-12 06:36:55 -07:00
Dirk Hohndel
d62d1124cf Fix crash if we have no divecomputer information
The string we print is lame, but it keeps things consistent (and prevents
us from dereferencing functions in uninitialized objects).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-12 06:36:41 -07:00
Amit Chaudhuri
5105d6a333 Fix crash in DiveTripModel.
A left click in the treeview header leads to a call to createIndex which
results in a null pointer dereference.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-11 06:51:19 -07:00
Dirk Hohndel
06d296a17d Improve the text labels in the profile
Only 1 decimal, please.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 21:07:49 -07:00
Amit Chaudhuri
97a044d41f Tweaks to maintab
Align statistics tab labels as per infotab.

Amend helper function to show degree symbol for temp measurements.

Change order of member initialisation list to match order of decl
(ProfileGraphicsView::ProfileGraphicsView)

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 16:01:17 -07:00
Dirk Hohndel
1245c232db Merge branch 'fixCrash' of https://github.com/tcanabrava/subsurface into Qt 2013-05-10 11:59:17 -07:00
Tomaz Canabrava
ad8f96cd6e Crash fixed on clicking on the canvas while no dive is loaded.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10 15:52:06 -03:00
Dirk Hohndel
e69dbebf21 Make nextDC and previousDC work and assign shortcuts
Cursor right and left now work again to switch between divecomputers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 10:49:00 -07:00
Tomaz Canabrava
56c4cced53 Fixed loading the first dive via command line on the profile.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10 10:49:00 -07:00
Tomaz Canabrava
1fec7d849c Fixed Zoom and Positioning of the Ruler Items
The items are still being placed far from each other when
zooming in - I need a bit of help with the math for that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 10:48:37 -07:00
Dirk Hohndel
c129902793 Fix some compiler warnings
Passing the alignment as int instead of float or double was actually a bug
as CENTER is defined as (-0.5) ...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 10:47:37 -07:00
Tomaz Canabrava
b3b1b3f58f Change the plot text so it receives a QPointF instead of x,y, and a Parent
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10 13:03:16 -03:00
Dirk Hohndel
bfef1d0219 Fix some compiler warnings
Passing the alignment as int instead of float or double was actually a bug
as CENTER is defined as (-0.5) ...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 08:59:09 -07:00
Tomaz Canabrava
9a40333067 Fix showing the stuff on the canvas in the right positions.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10 08:19:38 -07:00
Tomaz Canabrava
ea5353025f Only drag the tooltip panel when not zooming.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 08:16:00 -07:00
Tomaz Canabrava
2052e44ba1 Fix Tooltip Positions, code cleanup
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10 11:07:44 -03:00
Tomaz Canabrava
93d3af768b Uses the correct rectangle to englobe the profile grid.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10 10:30:24 -03:00
Dirk Hohndel
ed6a54f506 Enable defautl_filename in settings
We don't have a UI to set it, yet, so you have to manually set it in the
config file, but once you do that it works...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 21:37:21 -07:00
Tomaz Canabrava
acdb5d97eb The Zoom is working just like the GTK Version.
This code enables Zoom in / Out with the Wheel,
and it also enables panning by moving the mouse around.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
9cc089f9f6 Removed unused code that I'm sure it's safe to delete.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
5978afbcd8 Use a Default pen to make the configuration easier.
Created a default pen that has 'cosmetic' enabled,
A cosmetic line doesn't change it's width no matter
what zoom level we apply.

Also , changed everything that used a line to have
that as default pen instead.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
cb8198b524 Plot the vertical ruler on the left of the profile.
Plot the numbers on the left of the profile.
It seems that everythign is being plotted -
But I can see that there are coordinate-errors on the
code. ( the GTK one plots some curves below of the
dive, but the Qt one is overlapping - probably the
way that I'm using the gc information)

Need to investigate a bit.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
b794c23099 Plot pp Text
This patch plots the PP text, but when I plotted I realized
that the gc.pi.mapp is being calculated wrong, probably
something went wrong on the calculations - it's comming
zered always. So, only one line & text is plotted.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
25d65ab97d Plotting deco text.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
e62eb58ab5 Plotting cylinder pressure text.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
d6d1a10195 Plotting depth text.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
c62e8e5baa Plotting temperature text.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Tomaz Canabrava
17c6db6a5b Shows the correct color for the CylinderPressure
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 17:50:06 -07:00
Amit Chaudhuri
7f9fbd2295 Horizontally align labels on info widget page.
Left aligning text values looked wrong.

Use Qobject cast to filter labels from any other qobjects around and
set alignment. Doing this via Qt Designer would be tedious.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 12:10:34 -07:00
Amit Chaudhuri
4f4d40925b Remove 2 keyboard short cuts.
Ctrl-C & Shift-Ctrl-C were used for next & prev DC which was considered
to be poor style.

Disable for now. Maybe replace with something else?

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 10:28:15 -07:00
Tomaz Canabrava
9554cb5767 Plot of the Cylinder Pressure over time.
a few code was moved around, a macro that contained
the form of x ? : y; had to be rewritten to x ? x : y
since c++ doesn't allow ternarys without the middle operator.

The color-choosing for the Cylinder Pressure broke
on the Qt port - but it's a small issue.
I'm painting everyone as 'dark green' now, will
fix that later.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09 00:24:03 -03:00
Dirk Hohndel
d120fed211 Add bounding box to profile
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 16:53:00 -07:00
Dirk Hohndel
880870b46c Show the dive computer name in the profile window
And clean up some obsolete Gtk related stuff that is no longer relevant
for the Qt port.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 16:30:38 -07:00
Dirk Hohndel
656b58f205 Add tooltip data and cleanup size calculations
Tomaz' code had a fixed height per tooltip item and some rather suspicious
logic how to position them (and how to size the surrounding box), based on
a fixed height in pixels per item - which of course fails if you use
larger fonts or multi line items.

This uses the bounding rects to correctly calculate the sizes and populates
the tooltip with the other dive data that we already had in a helper
function.

This also fixes a small formatting issue for gas change events.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 15:46:16 -07:00
Dirk Hohndel
6f06c31d0b Stop passing around gc and pi
Make the graphics_context part of the ProfileGraphicsView and remember
that the plot info is already a part of the graphics_context (we kept
passing around both of them in the Gtk code... pointless but a leftover
from before adding the pi to the gc...)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 15:01:49 -07:00
Tomaz Canabrava
688276b6f2 Fix moving the ToolTip box with the mouse.
When I changed the way that the tooltip box behaved,
I accidentaly 'ate' the mouseMoveEvent, it was being
used only to show tooltips instead of everything
that it should have. this simple patch fixes it.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08 14:20:15 -07:00
Tomaz Canabrava
ef7ace9926 Plot the temperature Graph
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 14:19:10 -07:00
Tomaz Canabrava
ce8d30b938 Make tooltips works
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08 14:18:27 -07:00