Commit graph

5082 commits

Author SHA1 Message Date
Tomaz Canabrava
58d5d5ca41 Remove uneeded call.
The disableDcShortcuts is called inside of the ProfileGraphics
( I actually think that this method should be moved to there )

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:31 -07:00
Tomaz Canabrava
777f047247 Small code cleanup.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:22 -07:00
Tomaz Canabrava
dcd8381764 Planner: Move method down below to easy comparisson with another.
Planner and add states are driving me nuts.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:12 -07:00
Tomaz Canabrava
c4d022356e Planner: states Add and Plan have a similar behavior
So, the code is equal.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:00 -07:00
Tomaz Canabrava
feff22c222 Planner: Re-enable using the new profile.
This correctly enables the planner on the new profile,
but it doesn't triggers the correct paint on the canvas.

[Dirk Hohndel: remove other remnants of the disabled planner as well]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:17:32 -07:00
Dirk Hohndel
a61c04bb58 Merge branch 'atdotde'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

Conflicts:
	qt-ui/diveplanner.cpp
2014-05-26 09:59:08 -07:00
Robert C. Helling
1093d6235b Reenabled copying the diveplan to dive notes.
Gas consumption calculation fixed. Pressure difference still needs cylinder size to be set.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 09:58:23 -07:00
Dirk Hohndel
cfe865dd0c Merge branch 'atdotde'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

Conflicts:
	qt-ui/diveplanner.cpp
	qt-ui/models.cpp
2014-05-26 08:23:22 -07:00
Robert C. Helling
04b6b6aaf9 Use get_o2() and get_he() instead of accessing permilles directly
This gets rid of problems with air.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 08:12:32 -07:00
Anton Lundin
d14a531510 Rework slot to quiet down Qt5 warning
Qt5 got confused about this slot. This does the same as previously but
gets Qt5 happy.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 06:25:00 -07:00
Anton Lundin
f0f60e1f84 Use gas_mod and fix fpe
When removing o2 from a gas, eg setting it to "", air, this code would
raise a nice fpe. Fix that by using gas_mod instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 15:42:51 -07:00
Dirk Hohndel
d1366257f0 Dive list: make saving / restoring column widths actually work
It's a testament to how much I mess around with things that I hadn't
noticed that saving the column width doesn't actually work. Or actually,
saving them worked, loading them back failed as it was done too early and
the setColumnWidth() calls had no effect - and so the next time we quit
subsurface, the default width of 100 was written over all the saved
values.

This seems like an incredible hack but it has the advantage of actually
working. I look forward to someone with better insides into the inner
workings of Qt to properly fix this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 07:30:50 -07:00
Dirk Hohndel
c29109744e Dive list: don't reset column width when reloading
We set the column width in the dive list widget when we create that
widget, based on what is in the settings. And we save the current column
width back to the settings when we destroy that widget (so if Subsurface
is shut down correctly and Qt actually gets to run the destructor but not
when someone kills the program).

That means that if we recreate the dive list at any point while Subsurface
is running (and we do that a lot when you manipulate your dive list in any
way shape or form), any changes to the column widths are lost.
DiveListView::reload() explicitly calls setupUi() which reads the column
widths back from the settings - but changes made to the columns aren't
saved to the settings until we destroy the widget...

I see no reason why reload() should call setupUi(), so I'm removing that
call. Let's hope this doesn't break anything else.

Fixes #518

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 07:03:38 -07:00
Anton Lundin
ff966f2c1a Move mod calculations to a separate helper
We use mod calculations on multiple places, so make a separate helper
from it with proper types.

The "clumsiness" of defining a local variable to pass into the function
and out from it comes from the discrepancies in how c and c++ handles
initializations of variables in a struct.

Thanks goes to Tiago and Linus for pointing me in the right direction.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 06:20:52 -07:00
Dirk Hohndel
a85023a661 Dive list: remember the current sort colum
Silly bug. We never actually remembered our current sort column when
changing the sort order.

See #518

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 06:19:05 -07:00
Miika Turkia
54592fdcfa Localize worldmap export
Call the translation functions for text strings when exporting the
worldmap to allow localized exports.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 05:39:39 -07:00
Miika Turkia
ae5c947460 Use user preferred units on worldmap export
We should use the temperature units preferred by the user when exporting
dive info on Worldmap.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 05:39:16 -07:00
Miika Turkia
8f17caeedc Location must be quoted on worldmap export
User supplied text fields must be quoted on worldmap export. Without
quoting the HTML is broken e.g. with location "Angel's Window"

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 05:39:04 -07:00
Tomaz Canabrava
b88e6dc5fa Remove leftovers from the planner.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 21:11:55 -07:00
Tomaz Canabrava
2359bd3c2c Reenables the air edition and deletion of handlers on the planner/add
Only a tiny bit of poke around the contextMenuEvent - the events
of the planner are dealt by the QGraphicsItem, and this makes the
logic pretty easy to follow. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 21:11:30 -07:00
Tomaz Canabrava
2d41c4da09 Reenamble 'Delete Dive Point' on the planer / add
Just removed an #if 0

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 21:11:21 -07:00
Rick Walsh
b27e56da0a Add location and max depth to world map export
From fdf157bb4db042e63f215607b284663f606bd98c Mon Sep 17 00:00:00 2001
From: Rick Walsh <rickmwalsh@gmail.com>
Date: Sun, 25 May 2014 14:57:36 +1200
Subject: [PATCH] Add location and max depth to world map export

Adds location name and maximum depth to the exported world map html file.
Minor formatting changes to exported text for consistency and clarity.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>

From fdf157bb4db042e63f215607b284663f606bd98c Mon Sep 17 00:00:00 2001
From: Rick Walsh <rickmwalsh@gmail.com>
Date: Sun, 25 May 2014 14:57:36 +1200
Subject: [PATCH] Add location and max depth to world map export

Adds location name and maximum depth to the exported world map html file.
Minor formatting changes to exported text for consistency and clarity.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 21:10:57 -07:00
Tomaz Canabrava
81c84d02ed Speed up the multi dive selection
Dirk's code in commit a3d300ca91 ("Correctly implement multi dive
selection") had a major flaw - it kept redrawing the selected dives
one after another. Not what we need. So this fixes this up so that it
doesn't take more than a sec to select all the dives that are on the same
part of the click on the globe. I've achieved this by creating a boolean '
dontEmitDiveChanged and sending the signal only if this flag is false.

The reason that we can't simply remove the emit from the selectionChanged
is because the selectionChanged is what we have when we click on the
diveList, if we removed this from there, nothing will happen upon
selection.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 21:09:11 -07:00
Dirk Hohndel
a3d300ca91 Correctly implement multi dive selection
The old code had several issues. It broke the synchronization between
dive->select and Qt selected status and worse, it would partially unselect
previously selected dives when called.

This patch, however, causes the selection via the map to be glacially slow
because it forces a redraw of every single selected profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 21:03:53 -07:00
Gehad
6009d770b2 Rename the export dialog
Give the export dialog a better name than just dialog.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 15:06:44 -07:00
Dirk Hohndel
e4b8cf89a1 Dive list: move trip merging logic into divelist.c
This also fixes a couple of issues with the existing code:
- removes a memory leak
- treats null and "" the same

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 14:03:36 -07:00
Dirk Hohndel
10e5675151 Dive list: work around odd problem with selections
According to the documentation clearSelection() should emit
selectionChanged() - but I can verify in the debugger that sometimes this
doesn't appear to happen - consequently our notion of what's selected gets
confused.

To work around this, after calling clearSelection() we simply manuall
deselect all dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 13:58:13 -07:00
Dirk Hohndel
dbb86374e0 Dive list: move trip selection / deselection logic to divelist.c
This is core logic, not UI code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 13:19:05 -07:00
Dirk Hohndel
032ea24191 Dive list: more consistent handling of "add to trip"
When multiple dives are selected, we need to be smarter about when to show
"add to trip immediately above" or "... below". This code is quite
readable, I think, and does the trick.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 10:28:11 -07:00
Tomaz Canabrava
bc047238d4 Port the KeyPress actions to the new profile.
[Dirk Hohndel: combined two commits into one and cleaned up some
               whitespace issues]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 09:07:34 -07:00
Dirk Hohndel
ba1c4fcec1 Add some helper functions
First step towards getting the "add to trip" logic in the divelist context
menu to be consistent and correct.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 08:27:42 -07:00
Dirk Hohndel
2a88a72f1a Remove export and save as from dive list context menu
The context menu is getting way too big and confusing. This is now much
more cleanly done from the File->Export dialog.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:52:16 -07:00
Tomaz Canabrava
d2569c6688 Remove a ton of code.
The code removed was already ported to the New Profile.
We managed to clean quite a bit. huhhy

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:36:44 -07:00
Tomaz Canabrava
93f35971c6 Remove the depth / time increase and decrease functions.
The new profile code handles the resizing of the profile area in order to
accomodate the depth and time of the dive much more intuitively - the old
manual buttons to do so are no longer needed.

This also removes a few other unused methods.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:34:32 -07:00
Tomaz Canabrava
f67693b2e0 Make mouse dragging work as it should.
This patch makes mouse dragging work as it should, a tiny
bit different than the old version, but I think it's a better
way. What's missing: Keyboard actions.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:32:23 -07:00
Tomaz Canabrava
8a1e4b04db Remove unused code.
This code is not ported to the new profile, but from what I
can understand from it, it doesn't need to be. The purpose
of this code was to setup the correct colors and strings
for the current mouse position, we already do this on the
Profile in a different way, on the Notification Area.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:32:01 -07:00
Tomaz Canabrava
e6c294f718 Remove code already ported to the new profile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:31:27 -07:00
Tomaz Canabrava
963178d3d4 Fixe movement of DiveHandlers when moving the NotificationArea
The QGraphicsView system moves every selected item when the user
clicks and drags one. This patch makes a cache of all selected
items and removes the selection on them. When the user stops dragging
the Notification, the selection is restored.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:30:36 -07:00
Tomaz Canabrava
ea4d4ac020 Make the planner actually work.
This commit makes the planner actually work. There ar still
a few edges, but oh, joy - the new Profile gave a very unexpected
and nice addition to it - Grab the last handler of the initial
dive, and move it to the right, or get any handler, and move it
to the bottom to see what I mean.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:28:39 -07:00
Tomaz Canabrava
e1dcd8eac3 Change how the handler handlers itself.
This patch adds a itemChange method, that emits a 'changed'
signal when the handler is moved. I'll use that signal on
the profile to call the correct method.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:26:53 -07:00
Dirk Hohndel
3a2ceed33d Add Subsurface XML export to Export dialog
Also be consistent about the default folder we use when opening the file
dialog.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:12:03 -07:00
Dirk Hohndel
18fa359b48 Rework the Export dialog
The UI design looked too tight in my screen.
The explanation texts were a bit inconsistent (and in one case simply
wrong).
The explanation for the initial selection wasn't shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 06:42:10 -07:00
Gehad
2b2e2f52c0 Add descriptions for different formats in the export dialog
When choosing a format from the export dialog a two line description of
the format appears. This is helpful and prevents confusion.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 06:41:49 -07:00
Dirk Hohndel
5ba573240f Gratuitous whitespace changes
I keep trying to get to consistenct.
Completely hopeless.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 11:40:22 -07:00
Dirk Hohndel
c7e7cebed6 Small tweaks to our whitespace handling
This is still not (and likely will never be) intended to just be blindly
run and mechanically applied to all files. It tries to implement our rules
but it is not perfect and more importantly, we have parts of the code
where we intentionally break our rules for various reasons of readability
in that particular situation.

But running this against the sources files you touch often will point out
things that are wrong and should be fixed.

This fixes the indentation for continuation lines and the handling of the
for each style loops (clang 3.5 should have this built in - I'll play with
the current development version of this later).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 11:20:04 -07:00
Tomaz Canabrava
f24f0f3936 Good code cleanup on the old DivePlanner code.
All code that was removed already is working on the New Profile,
The code that's behind #if 0 means that it still needs to be ported and
because of some removal, it was not possible to keep it compiling (mostly
the removal of the Ruler class, that is the Axis, on the new profile).

The rest of the code that's untouched - most probably will keep that way.
The DivePlannerPointsModel is correct and well done, no need to change
that, only the Graphics part.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:41:37 +09:00
Tomaz Canabrava
f99ccc8ac2 Profile now correctly displays the planned dive.
But it doesn't move the handlers yet, and when you confirm it you also
must click on the dive to select it or the profile will show garbage.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:41:26 +09:00
Tomaz Canabrava
c6ad04d076 Code Cleanup: connections can be made between signals.
A signal can connect to another signal, so I removed a slot that had the
sole purpose to call another signal and replaced that with a direct call.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:32:26 +09:00
Tomaz Canabrava
e249fe8703 Disconnect temporary connections on the Profile.
This code adds the disconnections of temporaries. A temporary connection
is a connection that should be active only on a certain state, and we need
to clean that for the new state that will enter after.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:31:37 +09:00
Tomaz Canabrava
27afb33806 Move two necessary functions for the Planner behavior to the Profile code.
Those two functions are important and necessary for the Planner, they
create and remove the little balls that act as handlers so the profile
can be edited with the mouse.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:28:54 +09:00