Commit graph

428 commits

Author SHA1 Message Date
Dirk Hohndel
3b018204f2 When done reverse geocoding, hide the notification
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 12:30:02 -07:00
Gehad elrobey
d88da53586 Fix building with NO_MARBLE issue
We can't build with -DNO_MARBLE after some previous commit broke
globe.cpp

- centerOnCurrentDive() is still existing in the code while removed from
header in 6b81fb49d0.

- Some referenced to MainWindow::instance()->globe() even if we are
building with no marble.

- include stdint.h

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 11:22:41 -07:00
Tomaz Canabrava
d9801b67b4 Select the correct dive in EditAddedDive mode
If we added two dives, and then tried to edit
the first added one, the current 'added dive'
set on main_tab would be the second one, so when
we got to the accept() part of the call, it would
reselect the last added_dive that we had.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
6b81fb49d0 Always send the UUID of the coordinates to the globe
We were relying in the current_dive to display the
globe coordinates correctly - but this is not always
the case: you can be inserting a new dive site and it
isn't yet inside of the dive until the user presses
accept. So always pass the uuid of the dive site that
we want to display.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:32 -07:00
Tomaz Canabrava
d29d2a43ec Connect the signals
Connect the signals and slots so we can use the stuff I programmed.

Sorry for the noise on the patch - most of this is whitespace
fixes done by the QtCreator.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:48:09 -07:00
Tomaz Canabrava
ddc7717ab8 Remove broken method
This method was written a long time ago, now we need to use the new
versions of it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:46:50 -07:00
Tomaz Canabrava
7507c96dcd Do not trigger a dive site change when setting a dive
When setting a dive, we fire the dive site change a few times after the
index of the QComboBox is changed; we don't need that - fire just once.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:31:51 -07:00
Tomaz Canabrava
a0c396f5cf Don't clear the underline model of the combobox
Clear was the right method to call when we used a line edit, and the line
edit didn't had a model to provide data. Calling clear() on a QComboBox
will delete all itens inside of it, and what we wanted was to choose an
invalid index - and that's -1

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:31:10 -07:00
Tomaz Canabrava
744ab4bc48 Remove commented out code
This code was commented out when I started to port the locations to new
code, and it's harmless to remove it now.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:30:12 -07:00
Tomaz Canabrava
1ee96f4ad6 Don't rely on current_dive to get the dive site id
Since we are modifying the dive site inside of the dive, we can't ask the
dive for the new one, and we also can't use the name of the dive site, as
there's the possibility that two or more could have the same name, so rely
only on the index of it to get the uuid. The index is variable since we
will sort the dive_site_table alphabetically, but this doesn't matter
since we are using it only temporarely to get the uuid, and this one never
changes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:28:04 -07:00
Tomaz Canabrava
ef10490e03 Update KMessageWidget to KF5
The KMessageWidget that we used was from an ancient version of KDE4, KF5
is out for quite a while, so it's good that we also update our software
that uses parts of KDE.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:26:31 -07:00
Tomaz Canabrava
6cd85d9b73 Simplify model handling and crashes fixes
So, there's only one crash left (that I put a big TODO: on the maintab.cpp
about) and I'll fix it tomorrow as it's quite late here and I'm almost
sleeping at the keyboard.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 21:36:48 -07:00
Tomaz Canabrava
b8092c07a4 Create a new DiveSite when user clicks on add
Also reorganized a bit of the code, and renamed a few misleading methods.

[Dirk Hohndel: remove some C++11 code]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:24:37 -07:00
Dirk Hohndel
96cffe88e7 Fix crash
With no dive sites we dereference a NULL pointer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:12:56 -07:00
Tomaz Canabrava
ad9d1a81a2 Don't ask for a GeoCoordinate when editing a dive
This should be asked when we are in dive_site_edit mode.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:03:07 -07:00
Tomaz Canabrava
636aac83f8 We are not using a completer for location anymore
So, remove it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:00:16 -07:00
Tomaz Canabrava
80fe3f88f9 Correctly set the dive site id on the dive
When changing the index of the combobox we were discarting the
dive_site_id. This fixes it.

Now I need to understand what's happening to the globe.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:59:47 -07:00
Tomaz Canabrava
b0d7d0f3b9 Fix the connections for the Location Edit
The LocationEdit now correctly connects to the QComboBox signals, not the
QLineEdit signals.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:59:30 -07:00
Tomaz Canabrava
ac6a7ab24e Update DiveLocationModel when thread finishes
This patch updates the DiveLocationModel when the
GeoLoockupInformationThread finishes, and also selects
the correct index for the displayed dive.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:59:11 -07:00
Tomaz Canabrava
88549d1874 Change the Location from a LineEdit to a ComboBox
And hook up every method that was changed.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:58:38 -07:00
Tomaz Canabrava
ffc0c8ee99 Move DivePictureModel to qt-models
This class will surely be used on the mobile version, and it was very
tangled inside divepicturewidget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:14:27 -07:00
Tomaz Canabrava
37bd82f623 Fewer rebuilds triggered by changes in models.h
Models.h now is quite minimal, I'll keep it like that for now, until it
grows huge again. I've also cleaned a bit the headers that are using it so
only the ones that actually need the stuff that I've left behind will
actually include this file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:44 -07:00
Tomaz Canabrava
257f8063c4 Move ExtraDataModel to qt-models
Another attempt to make it easyer to create the mobile version.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:11:26 -07:00
Tomaz Canabrava
d84ffa8fc3 Move WeightModel to qt-models
One more step to make it easyer to port the app to Mobile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:11:12 -07:00
Tomaz Canabrava
f432b764e7 Move DivePlannerModel and CylinderModel to qt-models
Still trying to make it easier for the Mobile Port:
This patch is a bit bigger than I hopped, but it was the smallest that I
could get.

A lot of TODO items where added where I broke the code because the current
implementation would break the QML implementtion on the designer. I'll
most probably fix those myself when I finish the transition to the models
to the new folder.

I only moved both models at once because there's an interdependency
between them (seems inevitable, tough, but I'll take a better look at it
later).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:09:13 -07:00
Salvador Cuñat
64ba7f8683 Correctly save dive rating after changing it
Corrects typo in ebaa7d1fd which impeded that changes in dive rating
were saved after editing.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 16:12:37 -07:00
Paul-Erik Törrönen
cfa5403192 Fix typo
Loockup -> Lookup

Signed-off-by: Paul-Erik Törrönen <poltsi@777-team.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-21 16:05:09 -07:00
Tomaz Canabrava
253d9ff300 Use the QtWaitingSpinner instead of blocking the MainTab
We shouldn't allow the user to change the location when we are probing
the web for the correct places if we are updating an old file from
Subsurface. This makes use of a pleasant spinner that works beautifully.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 15:02:57 -07:00
Tomaz Canabrava
c2f77353ee Better name for the disable/enable geolocation edit
'enable' and 'disable' is too generic, and we are only
blocking the geolocation edit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 15:00:45 -07:00
Tomaz Canabrava
96850b9931 Don't enable the widgets before finishing the thread
The maintab should be disabled when the geolocation thread is
running - but if you changed the dive, it would reenabled it.
(actually this should be only on the location widget, I'll send
another path later)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:42:53 -07:00
Tomaz Canabrava
2b99ae5781 Fix signal connections
I don't know what happened to me, I connected to some signals that didn't
exist at all.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:42:09 -07:00
Dirk Hohndel
ebaa7d1fd0 Multi dive edit: treat buddy and divemaster as tag lists
So just like tags do "differential editing". Figure out what (or in this
case, who) was added / removed from the displayed dive and do the same for
all other selected dives.

This does seem a bit over top for divemaster, but this is more consistent
and therefore should make more sense to the user - assuming we ever have
one who runs into this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-11 10:40:20 -07:00
Dirk Hohndel
4c588c1f00 Improve multi dive tag list edits
The old behavior was kind of crude. Just smack the tags that were on the
displayed dive on all selected dives.

This seems to make more sense. We figure out which tags were added to the
displayed dive and add them to all selected dives. And we remove all tags
that were removed from the displayed dive from all selected dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-02 12:18:12 -07:00
Dirk Hohndel
415abeea66 When deleting a cylinder, adapt gas changes
When we delete a cylinder the gas changes in that dive may have to be
adjusted. We didn't do this at all in the past. With this commit we should
be doing this right for a single dive that is being edited.

This does NOT handle multiple dives being edited at the same time (or more
specifically - if you have multiple dives selected and delete a cylinder,
the dives that had the same set of cylinders (other than the displayed
dive) will get that particular cylinder deleted, but won't have their gas
change events (and sensor data in the samples) adapted.

Possibly we should simply prohibit deleting cylinders when more than one
dive are selected.

See #834

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-23 15:27:21 -07:00
Dirk Hohndel
ab24c1df87 When editing the location, make sure it gets applied to the dives
Oops, that was embarrassing. Just setting it on displayed_dive doesn't
gain us anything if it isn't transferred to the selected dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 09:35:58 -07:00
Lubomir I. Ivanov
bc44dd8db1 maintab.cpp: fix editing dive profiles from trips
Once a manually added dive is part of a trip and this trip
is edited, applying the modifications leaves the dive profile
in edit mode (e.g. points can be dragged and gas swapping can
be applied).

The issue can be viewed from another angle. Why enable
profile edits of a manually added dive which is in a trip,
while the trip is being edited in the first place?

If there are more than one manually added dives in said trip
we are enabled to edit one of the dive but probably
it's not intended to modify all manually added dives after the
changes are applied for the trip.

This patch disables the functionality in question and it also...

Fixes #864

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-30 12:54:36 -07:00
Dirk Hohndel
84aab5ffed Correctly create a dive site with the name entered on the Notes tab
The char pointer was out of scope by the time we created the dive site.
Also remove the misleading comment above - it really makes sense to do
nothing in that function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16 10:51:41 -07:00
Tomaz Canabrava
6fbf5b33cc Remove redundant code
Another snippet that shouldn't exist.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:00 -07:00
Tomaz Canabrava
a5448ef729 Remove dead code.
This code used to trigger the edit mode a long time ago
since now I'm re-reading the code to implement the
same stuff on the Location edit mode, I realized that
this is not needed anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:46:50 -07:00
Henrik Brautaset Aronsen
961bac9233 Rename the tab "Dive info" to "Info", and "Dive notes" to "Notes"
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 11:18:53 -08:00
Dirk Hohndel
f81e2c111d When updating the dive site name, show this on the maintab
If we accept a change on the dive site management screen, it needs to be
reflected on the Dive notes tab right away.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 23:50:31 -08:00
Dirk Hohndel
be1b6c67c1 maintab change for get_dive_site_uuid_by_name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:34 -08:00
Dirk Hohndel
4e95beabc2 Remove coordinates from main tab
It seems to make sense to only have them on the dive site screen. For the
main UI they were redundant (we have the map) and not all that useful. The
only time people would want them is if they wanted to manually add GPS
coordinates for a dive, but that should now be done via the dive site UI.

There are a couple of FIXMEs in the code and a few code blocks that have
been commented out as they will be needed in one form or another once this
GPS handling is done on the dive site UI, which right now it is NOT.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 22:45:47 -08:00
Dirk Hohndel
32da12664d Switch components for cut/paste dive to dive site logic
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 21:11:51 -08:00
Dirk Hohndel
0e6345f65b Correctly connect the maintab to dive site management
We now have a working uuid - use it. And populate the fields accordingly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 11:19:27 -08:00
Dirk Hohndel
5c4d266060 Make editing a location work with dive sites
Not sure if this is the final implementation, but at least for simple
cases it works now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 11:19:27 -08:00
Dirk Hohndel
ccf833b45c Clear the location if we have no dive site
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 11:19:27 -08:00
Dirk Hohndel
9ef81d3ed3 Show GPS coordinates based on dive site on MainTab
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 11:19:27 -08:00
Dirk Hohndel
6a812c6b6d Show location based on dive site on MainTab
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 11:19:27 -08:00
Tomaz Canabrava
42afb4972a Pass a fake dive site UUID to the callback.
This is the start of the preparations to edit the dive site,
passing a uuid so we can retrieve it later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 16:34:02 -08:00