Commit graph

4849 commits

Author SHA1 Message Date
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
Tomaz Canabrava
fe1df6b1cc Back to profile or empty state when finishing addition.
This patch adds a signal to MainTab, that should be removed from there
when we finish the rework on the edit part, to go to the edit classes,
but in the meantime, let's keep it there.

The signal is connected to the ProfileWidget in a way that the end of the
edit will also trigger the profile to go back to ProfileState (show the
dive, if there's any) or empty Profile (if there's none).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:12:32 +09:00
Tomaz Canabrava
3661f291a4 Enable editing the 'Add dive' from the new profile.
This is highly broken in many ways - but it's the right first step.
I ported two of the most important methods from the old profile and now if
you are in add dive mode, double clicking on the new profile will
correctly add a handler on the planned dive. To see and move the handler
around, however, you need to activate the old planner.

Next step: add the handlers on the new profile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:11:50 +09:00
Tomaz Canabrava
d73fdbc84b Temporary Tab Widget for the planner and the Profile View.
This is a temporary measure to help me port the planner to
the new profile. it will be removed when I finish the port,
but it makes the software still usable, so there's no worris.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:06:41 +09:00
Tomaz Canabrava
f416cdd9e8 Source and dest are created on the constructor, no need to check for them.
The code checked if dest and source existed before trying to call an
method on them, but dest and source are created on the constructor,
and thus, the if is dummy.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:06:16 +09:00
Tomaz Canabrava
119950b6db Move settings of the Ruler to the Ruler.
As with any other graphics object, the settings for the ruler
should be managed by the ruler, clearing up the Profile logic
and making the code easier to read.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:05:30 +09:00
Tomaz Canabrava
6aab69b298 PreferencesChanged -> settingsChanged.
We used both preferencesChanged and settingsChanged in different
methods and classes to mean the same thing, this adds consistency.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:03:51 +09:00
Tomaz Canabrava
3c7a6ab750 Don't replot every time a pref changes, regardless of what preferences.
The list of preferences that should trigger a full repaint are at the top
of this method, *if* this introduces a bug it is because some of the
preferences are not being correctly triaged yet and that needs to be
fixed.  Regardless of that, now the profile will only enable / disable
the *ruler* instead of replotting everything.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 07:31:51 +09:00
Tomaz Canabrava
1988da779f Remove use of QSettings for ruler visibility, use prefs.rulergraph instead.
The QSettings is a bit bloated on its use, so we are trying to narrow
down the amount of calls to it. We have a preferences struct, use that
instead.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 07:31:05 +09:00
Tomaz Canabrava
2a48170fd3 Code Cleanup: Move the Hide/Show ruler to an internal method
By moving the Hide/Show of the ruler to an internal method, we gain a bit
of codecleanuperism by removing a lot of unnecessary calls to their dest
and source drag-handlers.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 07:30:20 +09:00
Tomaz Canabrava
ef4705070f Create a 'remove_event' function that removes an event.
The logic of removing the event was in the UI, and this makes
the code harder to test because we need to take into account
also the events that the interface is receiving, instead of
only relying on the algorithm to test.

so, now it lives in dive.h/.c and a unittest is easyer to make.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 07:28:27 +09:00
Tomaz Canabrava
3750d55665 Fix compilation with CMake.
This changes are only to make CMake compile again after the
addition of the export dialog.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 07:27:47 +09:00
Gehad elrobey
51e5030c06 Shortcuts for the exporting window.
Add the ability to close the exporting window, also Quit Subsurface with
this window in front, for consistency.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21 22:20:48 +09:00
Gehad elrobey
19e22e1bb7 Add ability to export only selected dives in worldmap exporter
This patch adds the ability to export selected dives only in the worldmap
exporter. After Miika added the export dialog in commit 7dc642860d
("Implementing export dialog") and exporting only selected dives became a
choice while exporting.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21 22:18:36 +09:00
Miika Turkia
7dc642860d Implementing export dialog
As our menus are getting many export entries, it is better to create a
single export dialog where user is able to select the export type and
whether to export selected dives or all of them. This should also be
more intuitive than the current way when export from file menu export
all dives and right click menu on divelist exports only selected dives.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21 03:31:43 +09:00
Tomaz Canabrava
0b6cbe0f79 Code Cleanup: use qMin instad of if( min ) setMin else setMax.
silly code cleanup.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 14:48:07 +09:00
Tomaz Canabrava
b34fb70d78 Speed Improvement: Unhide all events by calling event->show()
The old code replotted the whole dive, while what we really wanted was to
show the events. so just ->show() them.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 14:46:12 +09:00
Tomaz Canabrava
97419a0d6a Speed Improvement: hide events instead of replotting everything
The 'Hide Similar Events' function asked the Profile to replot eveything,
only because some events were hidden from the interface. Instead of that
we can simply hide the events since the graph will be the same.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 14:45:08 +09:00
Tomaz Canabrava
4bc3687b21 Only set the state to profile if it's empty, not if it's Add or Plan.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 14:29:24 +09:00
Tomaz Canabrava
b31becd2d9 Remove silly macro to pretend that we were doing things the right way.
That macro was useless, I should have been drunk when I wrote it, and I
don't drink.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 14:27:31 +09:00
Jeremiah Mahler
1e25a7c234 CVS import/export instead of CSV
The ReleaseNotes.txt refer to improved "CVS" import/export.
But there doesn't appear to be any such format.
There is, however, support for "CSV" formats.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 14:24:04 +09:00
Linus Torvalds
7821b87983 Use the last 'diveid' when merging dives for one dive computer
When we merge two dives into the same dive because a divecomputer had
incorrectly considered it two separate dives (due to surface time within
the dive) we should pick the dive ID from the later dive to be the
diveid of the resulting merged dive.  Otherwise we might re-download the
(now merged) partial dive.

This is a rather unusual special case, but it actually hit me with the
Uemis on my last dive in Palau: Chandelier Cave has multiple surface
points where you can spend time admiring the cave above water, and the
Uemis (but not my Suunto's) decided that the dive was actually four
short dives back-to-back.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 14:16:00 +09:00
Anton Lundin
176d49c591 Add math.h because of usage of rint()
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 11:51:46 +09:00
Anton Lundin
0f0ddf86fe Use get_o2 instead of local version
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 11:51:46 +09:00
Anton Lundin
05d9cc409c Migrate code to for_each_dive and for_each_dc
[Dirk Hohndel: this overlapped with my commit 09e7c61fee ("Consistently
	       use for_each_dive (and use it correctly)") so I took the
	       pieces that I had missed]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 11:51:40 +09:00
Anton Lundin
91c20357f5 Fix building with NO_MARBLE prepareForGetDiveCoordinates
Commit fb82da58a2 ("Globe: assume that we are looking at the
current_dive") changed the prototype for
GlobeGPS::prepareForGetDiveCoordinates. This patches the dummy in
NO_MARBLE.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 11:36:57 +09:00
Anton Lundin
1c64a986ee Fix building with NO_MARBLE, centerOnCurrentDive
Commit 2bc76beb65 ("Globe: we always center on the current dive") changed
GlobeGPS::centerOn to GlobeGPS::centerOnCurrentDive. This patches the
dummy in NO_MARBLE, too.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 11:36:18 +09:00
Dirk Hohndel
09e7c61fee Consistently use for_each_dive (and use it correctly)
The way the macro is written there is no need to test the dive against
NULL before dereferencing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 06:37:19 +09:00
Dirk Hohndel
b303f217a9 Dive list: add context menu function to renumber dive(s)
No attempt is made to ensure that what the user does is sane. So this can
result in duplicate numbers, non-consecutive numbers, non-monotonous
numbers, whatever floats the users boat.

You can renumber a single dive or all selected dives (with a starting
number given that is applied to the oldest selected dive and then for each
newer selected dive that number is incremented by one).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 06:11:32 +09:00
Dirk Hohndel
4d14059d7c Remove unused variables
These were leftover in commit 90638180d2 ("Use the used flag on
cylinders in get_dive_gas").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19 20:12:59 +09:00
Dirk Hohndel
a117428ff4 Add ability to make a dive computer the first dive computer of a dive
If a dive has multiple dive computers we enable a special context menu
when the user right-clicks on the dive computer name AND is not already
showing the first dive computer. In that case we offer to make the
currently shown dive computer the first one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19 20:12:59 +09:00
Dirk Hohndel
419434f494 Show the dive computer number (if a dive has more than one)
For most users this is no change at all. For the few who download from
multiple dive computers this now shows them which of them is the primary
dive computer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19 20:12:59 +09:00
Dirk Hohndel
eaa4e5948a Make the code easier to read
This uses the new helper function from commit fc4f133f19d0 ("Add new
helper function that looks up the index of a dive by its uniq ID") to make
the logic implemented in commit 122593a63a46 ("Fix selection after
downloading dives from the dive computer") much saner to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19 20:12:59 +09:00
Dirk Hohndel
4059180ef2 Add new helper function that looks up the index of a dive by its uniq ID
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19 20:12:59 +09:00