Commit graph

3500 commits

Author SHA1 Message Date
Tomaz Canabrava
484fdee6fb Fire signals for edit and filtering
Edit will always fire,
Filtering only if the dive site already exists.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:43:53 -07:00
Tomaz Canabrava
6a09062065 Only filter by divesite if the divesite exists
And not when we are adding a new dive site.
Also, remove hide button call.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:43:30 -07:00
Tomaz Canabrava
db333226d9 Reset state: have a correct dive site being displayed
I'm not sure if this is the right approach, but it seems to work: when we
reset the state of the widget, we try to get the current dive site from
the current dive, and set it.

This way it will work for the globe later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:43:07 -07:00
Tomaz Canabrava
3561d34745 Current dive site has nothing to do with enableEdition
It will be set later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:42:40 -07:00
Tomaz Canabrava
9c34f196fa Fix the message buttons in dive_site_edit
Some button management operations where unnecessary.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:42:00 -07:00
Tomaz Canabrava
612b068e33 Different states for edit / add dive site
When we start the dive site edit dialog, either for add or for edit, we
don't save the state, so the reject state didn't know what to do with the
dive site.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:36:42 -07:00
Tomaz Canabrava
4c978eab2e Remove unnecessary calls
All those calls are unnecessary:
The first will be called when the QComboBox in the MainTab changes
its index, and the other two calls shouldn't be called: the only thing
that should change a dive site inside the LocationManagement is the
LocationManagement.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:35:34 -07:00
Tomaz Canabrava
f367414297 centerOnCurrentDive needs to be a slot
I'll connect this in the future with a few methods that will try to
maintain state between dive changes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:35:08 -07:00
Tomaz Canabrava
ad5f1682ee Clear up editDiveGeoPosition for the new approach
We can only enter in editing state by opening the editing dialog, so the
mainwindow check is now invalid. and also we shouldn't set the editingmode
to false, since we will edit until the user clicks close.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:34:27 -07:00
Tomaz Canabrava
34b406556d Use for_each_dive_site to populate the dives in the globe
When we didn't have a proper dive_site_table, the dive sites where
scattered across all dives and so we looped over all dives to find the
dive sites and add them to the tree. Now this is a bit cleaner, a bit
faster.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:33:28 -07:00
Tomaz Canabrava
fa373fd544 Rework the method to pick a dive site via the globe
The globe used to allow the user to pick a dive site if the dive didn't
have coordinates, but this is now wrong since when in dive site editing
mode we can select multiple times new coordinates for it, and it should
only be marked as finished when the user actually finishes it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:32:36 -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
ee9746c622 Remove unused method
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 21:36:36 -07:00
Tomaz Canabrava
9dc32de878 Remove Combobox from LocationManagement
I tought about it a bit, and the combobox of the location management was a
bit overkill - we already have another combobox to select the divesite and
also the plus button to add one.

If the user wanna edit the current divesite, he can go to menu and edit it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 21:35:50 -07:00
Tomaz Canabrava
3d63fc9855 Remove unused buttons on the ui.
We are not going to use the add, edit, remove buttons. Removing will be
automatical, addition will be triggered when clicking on the plus on the
dive site. edit is automatically enabled as soon as you try to edit
anything.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 21:35:06 -07:00
Tomaz Canabrava
a9ba98942c Correctly change the dive_site name
Correctly change and update the dive_site, updating the name on the
combobox or other attached views.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 21:31:16 -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
Tomaz Canabrava
82d3f088a4 Manage Dive Site from the MainMenu
Trigger the ManageDiveSite from the MainMenu.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:14:24 -07:00
Dirk Hohndel
d0b5f355ab Move helper function to the appropriate file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:09:45 -07:00
Dirk Hohndel
0c2457d9dc Cloud storage: only make this available with new enough libgit2
The credential callback doesn't appear to work (at least not the way I
implemented it) with v0.22 and earlier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 09:58:09 -07:00
Dirk Hohndel
5bbcc7f16d Cloud storage: first stab at implementing cloud storage
So far there is no mechanism to actually create a repository on the
server, so this only works with the two test repositories.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 22:35:50 -07:00
Dirk Hohndel
a6b6674780 Cloud storage: rethink the terminology used
Cloud storage makes more sense that remote storage - at least I assume
that more people are used to thinking about "storing things in the cloud".

Don't use PIN or passphrase, call it a password everywhere.

Don't use copy_string() to copy the password - the git credentials routine
asserts that password is not NULL, so make sure we at least have a pointer
to an empty string here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 19:45:05 -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
f28cec7b9e Don't ask for globe-coordinates for a dive
Only ask that for dive_site_management.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:03:37 -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
6d9206150a Organize the dive_sites alphabetically
run std::sort on the dive_site list inside of the model.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:02:35 -07:00
Tomaz Canabrava
8b96179d59 Fix crash when cancelling divesite edit with empty divesite
Only happens if you dont't have any divesites in your list, but either
way, it could happen.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:00:51 -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
266e309962 LocationInformationModel moved to qt-models
I forgot about this one, and we are going to use it
in the mobile version too.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:58:48 -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
abb6773490 Fix border glow on OSX
The border was just too small for the glow.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:58:26 -07:00
Tomaz Canabrava
ec5717aaa1 Move DivePlotDataModel to qt-models
I think with this one I'm finished.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:14:43 -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
33918e6867 Move ProfilePrintModel to qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:32 -07:00
Tomaz Canabrava
60dc9f4ab3 Move TablePrintModel to Qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:12 -07:00
Tomaz Canabrava
85d4bb8a70 Move DiveTripModel to qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:00 -07:00
Tomaz Canabrava
7171d2e1eb Move the YearlyStatisticsModel to qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:12:48 -07:00
Tomaz Canabrava
a56429d31e Move DiveComputerModel to qt-models
Another attempt to make it easyer to create the mobile version of
Subsurface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:11:52 -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
a0f3c9992c Move WeigthSystem Info model to qt-models
This is another effort to make it easyer for the mobile
interface of Subsurface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:10:50 -07:00
Tomaz Canabrava
32b0afa3e7 Move Tankinfomodel to its own file
Another change to make it easier to program the mobile ui. This was a
fairly easy patch: just moved the contents of the file and fixed the
includes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:10:30 -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
Tomaz Canabrava
338c0f22aa Move the models to its own folder
This is an attempt to help share code between the desktop version of
Subsurface and the mobile version.
More code will be moved around and the models will be split in a way that
will help recompile times and also creation of different interfaces for
different form-factors.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:07:54 -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
Dirk Hohndel
61c0d0c73d Remote storage: collect email and PIN in preferences
This allows entering / storing the PIN (aka passphrase) for the ssh key.
The email isn't used, yet - this will be used by the automated backend to
create a unique git repository that will turn into the remote storage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 14:40:06 -07:00
Dirk Hohndel
c90635cef2 Remote storage: add preferences UI
This isn't hooked up at all right now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 14:39:53 -07:00
Dirk Hohndel
20d1d2c385 Remote storage: add preference for the passphrase
While we don't expose it as this to the user, we'll need an ssh key and
potentially a passphrase in order to communicate with the git server in
our infrastructure. This simply sets up a way to store the passphrase.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 14:38:59 -07:00
Anton Lundin
b76a0f0b97 Wire gui for diagnostic logs from dc configuration
This copies peaces from the downloadfromdivecomputer dialog into the
configuredivecomputerdialog and connects them to be able to create a
logfile form the configuration of the divecomputer.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27 15:37:50 -07:00
Dirk Hohndel
a8c013869b Strip the default suffix if saving to git branch
For some reason the file selection dialog box now always adds a default
suffix to the file name we pick - which results in our test for git
storage to fail.

So if the filename looks like "<path>[branch].ssrf" then remove the suffix
that was added.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27 11:14:26 -07:00
Dirk Hohndel
17b7bdfd2e Fix crash when rejecting dive site changes
Emitting the stopFilterDiveSite signal caused us to clean up the UI which
reset currentDs to NULL if this was a new dive site...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27 07:53:14 -07:00
Dirk Hohndel
d6e32b02f6 Start editing new site regardless what the user does first
It doesn't matter if we first enter coordinates, name, description or
notes. If there is no currentDs we need to handle that gracefully.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27 06:36:19 -07:00
Dirk Hohndel
bfee0a13f0 Dive site management: make sure currentDs is valid
When double clicking on the globe on a dive with no dive site we did
almost the right thing - except that we didn't create a dive site.

Not 100% sure this is the right place to do this, but it seems to work and
prevents the crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27 06:31:34 -07:00
Tomaz Canabrava
c6783739c9 Expand trips that are filtered on dive_site_manage
While filtering we would have trips that were collapsed, but this doesn't
really make much sense while managing dive_sites.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:49:19 -07:00
Tomaz Canabrava
ffffccee93 Filter out the dives that are not at dive_site.
Untested code to filter out dives that are not at the active dive_site.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:48:45 -07:00
Tomaz Canabrava
ee7e511372 Create signals/slots for filtering the dive_site,
The dive site management requires that we filter all the dives that are on
the current dive_site, this is the preparatory work for that.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:48:22 -07:00
Tomaz Canabrava
785051c9dd Only repopulate model when needed.
The old way we set the location and *then* updated the model, so the very
first location that we tried to show was empty.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:47:55 -07:00
Tomaz Canabrava
b7ec57bdef Show the correct dive_site on the manage combobox
When triggering the dive_site management, we need to get the uuid that was
send to us and set it as the current dive_site on the combobox, the dialog
can fill all required info for us.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:47:21 -07:00
Tomaz Canabrava
609688b489 Do not create a new dive site when curr is invalid
We will however create a new dive site when the user clicks on the add
button - creating it here would led to strange behavior.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:47:02 -07:00
Tomaz Canabrava
562ee7410c Don't setLocationId when accept/reject changes
setLocationId will filter the dives, so ignore the visual changes when
accepting / rejecting, it will only be triggered again when we are showing
this dialog again.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:46:29 -07:00
Tomaz Canabrava
46aa97bfc4 Do not set the dive_site when changing dives
We should only set the dive_site on the dive site management widget when
we are going to use that information, this is because the dive_site
management widget will filter all dives on the dive list.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26 21:45:54 -07:00
Dirk Hohndel
ed57442bf7 Layout issues: Fix rating/visibility vs suit
The suit field should take up all the remaining space and the stars should
be vertically centered with the text.

This looks much better

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:45:15 -07:00
Tomaz Canabrava
8f2f9164fc Layout issues: Fix the Profile/Toolbar
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:45:15 -07:00
Tomaz Canabrava
adb61b38ea Do not connect null to a signal
The parent here should have been the mainwindow, but we create this dialog
on the stack instead of the heap and because of that we don't set the
parent to prevent a double free.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:45:13 -07:00
Tomaz Canabrava
f17f4ec9a0 Layout issues: Fix planner layout
Layout was wrong.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:45:13 -07:00
Tomaz Canabrava
0f7061b93e Layout issues: Fix DownloadFromDiveComputer
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:45:13 -07:00
Tomaz Canabrava
4a52f44ae3 Layout issues: Fix DiveShare export dialog
One more.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:45:13 -07:00
Tomaz Canabrava
307ad174ae Layout issues: Fix the DiveImportDialog
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:45:11 -07:00
Tomaz Canabrava
42acaa40f5 Layout issues: Fix the export dialog
This patch makes the export dialog more consistent with the rest of
Subsurface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:43:21 -07:00
Tomaz Canabrava
946615b8d7 Layout issues: Major rework on the MainTab
This seems almost perfect now.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:43:14 -07:00
Tomaz Canabrava
d5013a7883 Layout issues: Fix spacing for the filter dialog
This is the single filter dialog - the spacing is much better, but when
activated it seems cluttered, this is because the outer layout (the one
that encapsulates everything) has the wrong layouting - I need to find and
fix that. I'll actually change that to a splitter, it will provide a more
flexible resize of the widgets.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:43:08 -07:00
Tomaz Canabrava
a46cc691dc Layout issues: Fix issues in other places of the MainTab
Also, added tooltips to the Tab Texts.
I need to fix the layout issues of the Equipments, but that's not inside
the UI. Things are much more sane now.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:42:55 -07:00
Tomaz Canabrava
d801bd622a Layout issues: Fix the layout ugliness on Mac & Linux
I seem to have found a sane way to create layouts:
If it's the 'outer' layout, the one that encapsulates everything:
- Horizontal Spacing: 5
- Vertical Spacing: 5

If it's a vertical inner layout that is grouping items like label +
control:
- Spacing: 0
This way the label will be 'touching' the item, without empty space, so
you know that the label refers to that widget.

If it's an horizontal inner layout:
- Spacing: 5
Different from the Vertical Layout, we don't want to make horizontal items
touch each other, a bit of space is fundamental to the eyes.

If it's a Grid Layout:
- Vertical Space: 0
- Horizontal Space: 5

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:42:49 -07:00
Tomaz Canabrava
7d1df992fa Layout issues: Remove auto layout management from mainwindow.cpp
While this worked for a bit, it was very error prone as it relied in
layout having specific names, and layouts in the .ui files are treated as
substandard items. Every time a 'break layout' command is issues (and it's
issued quite a lot when trying to reorganize the items on the widget) all
layout items are removed and new ones are added later, without any of the
names.

Since the new layout can be different the old names are not usefull
anymore - and a clean compilation won't trigger a single warning either:
the name resolution is done at runtime and not at compile time, so it
would just fail silently.

Instead of brute-forcing each layout to have 0,0 or 5,5 margins, we should
put the correct values on the .ui files.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:42:35 -07:00
Tomaz Canabrava
dbed94f12c Remove support for Qt4 (part 6)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-24 09:37:23 -07:00
Tomaz Canabrava
4eeecf7315 Remove support for Qt4 (part 5)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-24 09:37:23 -07:00
Tomaz Canabrava
f88fb74b5b Remove support for Qt4 (part 4)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-24 09:37:23 -07:00
Tomaz Canabrava
bd73156e2b Remove support for Qt4 (part 1)
I`m now clearing the code for all use of Qt < 5, since Qt 5 was released
for quite a while and making two versions of Qt to work together is a bit
painfull.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-24 09:37:18 -07:00
Dirk Hohndel
e201f0f2b1 Location management: reflect changes to a location's name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22 12:29:47 -07:00
Dirk Hohndel
d4b5854f82 Location management: reflect changes to the coordinates on the map
This is a bit aggressive as it changes the globe with every single
character that's entered, but it's better than what we had before.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22 12:29:39 -07:00
Dirk Hohndel
b342730ec9 Location management: actually parse the GPS coordinates
We still don't respond correctly to a user changing them (i.e., the map
doesn't change), but at least once they change the dive to a different
dive and back to this one things get done correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22 11:56:03 -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
Dirk Hohndel
00b1469658 Merge branch 'v4.4-branch' into newmaster
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-21 13:45:25 -07:00
Robert C. Helling
187f7dab9f Add option to display GPS coordinates as decimals
This adds a field to the units preferences to have GPS coordinates
show as decimals (as for example Google maps does it).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-20 10:34:10 -07:00
Robert C. Helling
6730405624 Ask user about merging dives more than 30m apart
...and remember the answer.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-18 13:53:18 -07:00
Robert C. Helling
043bd3afb7 Make gaschange from contex menu act as a gaschange
so it affect no longer the previous leg but all the following ones
with the same gas (i.e. until the next gaschange).

This makes the add dive/planner behaviour more consistent
with the rest of the program regarding gas changes.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 15:07:06 -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
b59084dc1f Add a new class, QtWaitingSpinner, MIT Licensed.
from https://github.com/snowwlex/QtWaitingSpinner

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 15:00:25 -07:00
Dirk Hohndel
c11bbe4f38 Fix easily reproduced crash
Open dive file. Click Location-manage. Pick a site. Click close. Click
Location-manage again. BOOM.
This seems to make sense, but since not a lot of the code is hooked up
yet, I'm not sure this is what we want in the end. But for now it prevents
an easily reproduced crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 14:05:24 -07:00
Tomaz Canabrava
10a0a252c8 Update the dive location when showing the dialog
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:54:08 -07:00
Tomaz Canabrava
0c33d585ea Implement the row count for location information
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:52:23 -07:00
Tomaz Canabrava
3235dd842e Implement the data method for location information
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:52:23 -07:00
Tomaz Canabrava
8115855428 Start the model for location information.
And implement the reset method.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:52:19 -07:00
Tomaz Canabrava
5eb572b9c6 Move Locationinformation to its own file.
The SimpleWidgets file was getting too big, and location information will
also need a new model - a good way to do not mix everything is to put
things in a new file.

[Dirk Hohndel: added missing include of stdint.h]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:51:13 -07:00
Tomaz Canabrava
d9ad829173 Change the Locationinformation to handle location editing
Add a few interface items to handle location editiing, a combobox to show
everything, and three buttons: add, edit, delete.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:45:46 -07:00
Tomaz Canabrava
c95998e4bd Fix the layout of the geo management
The layout was just plain ugly; this fixes that and also adds the
possibility to insert new controls that will be userfull for managing the
Locations.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:45:12 -07:00
Tomaz Canabrava
e61e127715 Remove extra ; at the end of lines.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:44:51 -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
Robert C. Helling
05552c7339 Show seconds in duration for free dives
For free dives (corresponding to dive mode or duration shorter than
15min), the display format for duration is changed to display minutes
and seconds.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:40:11 -07:00
Dirk Hohndel
2dd5781afe Make sure that the save file dialog actually is marked as such
While this worked on Linux, on the Mac we didn't have an input field to
enter the file name. With this we explicitly declare that this is a file
save dialog and that the user can specify a non-existing file name.

Fixes #872

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-11 15:26:56 -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
Robert C. Helling
698b2b133f Only add disclaimer and runtime table if we added deco to replanne dive
As a side effect this changes the signature of plan(): Before it
returned an int that was supposed to be possibly an error but
we never bothered to check it. So now it's bool indicating if the
planner did add stops.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-11 07:57:09 -07:00
Linus Torvalds
3edec7c97d Fix initial scrolling problem
The initial selection change signal seems to potentially be sent
before the listview is even visible when we do the first "scrollTo()"
to the currently selected dive.

That, in turn, seems to result in that when the listview is actually
shown, it will be scroll the trip description off the visible area,
and force the current dive to be shown at the very top of the
divelist. Which is not very nice: we do want to scroll to the current
dive, but we don't want to hide the current trip in the process.

Ignoring the selection change if the listview isn't even visible seems
to fix things for me.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-11 07:33:31 -07:00
Tomaz Canabrava
9523132b6d Only show Collapse all when its needed
This makes Collapse All only visible when its needed, and it
also fixes a crash when invocking collapse all when there was
nothing to collapse.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-11 07:30:52 -07:00
Tomaz Canabrava
d6f45ec74d Only show expand all and collapse all options if there`s a need
This patch unclutter the menu by hidding collapse all
when all dives are collapsed, and expand all when all
dives are expanded.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-11 07:27:55 -07:00
Tomaz Canabrava
627de38c01 Get the location information in a separate thread
This makes Subsurface usable faster for those without a good internet
connection when they are opening an older data file.

While parsing, we are only feeding an vector of locations, after the
parsing is done, we traverse the vector searching for the information on
the web.

I need to also add a way to stop if there`s no internet connection - but
this will be another patch.

Also, fixed two small memory leaks from the old imp.

[Dirk Hohndel: cleaned up the whitespace mess]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-10 11:14:20 -07:00
Robert C. Helling
412844c02b Keep old notes when saving as new dive in replan
... but discard an old disclaimer and runtime table if present.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-09 06:54:03 -07:00
Robert C. Helling
e538347424 Change menu entry for "replan"
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-09 06:53:43 -07:00
Robert C. Helling
70c64eaa66 Only print gasname for a segment in planner if it differs from the previous one
This is to avoid visual clutter when replanning logged dives.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-08 10:04:22 -07:00
Robert C. Helling
9d8eb10421 Only warn when trying to replan a logged dive
If there are more than 100 samples, average some of them so we end up with no more than 100.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-08 10:02:45 -07:00
Dirk Hohndel
02ed0ccabb 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 17:02:21 -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
5810aedeac Uemis downloader: clean up the path for Windows mount point
Oops, we left the (UEMISSDA) in the path. This can never have worked
without the user manually correcting it to just show the drive letter.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-30 16:35:46 -07:00
Dirk Hohndel
8bbb3dfe42 Uemis downloader: allow continuing download by clicking Retry
When we run out of space in the Uemis filesystem we return an error. The
user could reasonably unplug the SDA, insert it again and then retry to
continue the download (that's what we tell them to do). In that case we
need to make sure we start at the correct dive otherwise the same dives
keep getting downloaded over and over again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-30 07:42:42 -07:00
Dirk Hohndel
e9ba8f0ff6 Download dialog: we can accept a partial download after an error
The dialog didn't accept "OK" and store the dives downloaded / selected so
far if there had been an error. Especially with partial downloads from the
Uemis SDA this is something that is quite reasonable to want to do, so
allow exiting the dialog with OK even after an error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-30 07:41:41 -07:00
Robert C. Helling
a4c35f1d63 Rename menu entry for image hashing
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-29 14:01:24 -07:00
Robert C. Helling
66ac97d7ad Display a notification while image hashing is ongoing.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-29 14:01:14 -07:00
Dirk Hohndel
5fe8919424 Small design fix to make labels on Info tab look aligned
By wrapping the Location label in a layout as well they now all look
aligned again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-29 12:43:11 -07:00
Dirk Hohndel
3a715c2299 Simplify creation of the upload file for Divelogs.de
Instead of writing each dive out to a file and reading that file back in,
let's just use the internal helper function that places the dive as XML
into a membuffer.

So much simpler, so much faster.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-28 11:28:53 -07:00
Dirk Hohndel
3043114446 Show error if creation of the Divelogs.de upload file fails
Previously we simply failed silently without showing the user any
indication that something went wrong. That seems wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-28 10:42:54 -07:00
Robert C. Helling
e19d38193d Disable planner UI elements without function
This disables planner UI elements in recreational mode that have no function
in that mode.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-26 16:54:29 -07:00
willem ferguson
a8656759bb Modify wording of dive list context menu
Dive context menu:
After the addition of the item "Add image(s) from web" the item
immediately above is "Add images". It is proper to specify now:
"Add image(s) from file(s)" to make the distinction clear. I also
change "Shift times" to "Shift dive times".

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-26 10:31:52 -07:00
Robert C. Helling
757c4aab20 Allow images to be added via the web
This adds a new divelist context menu entry which asks for a URL. The file
is retrieved and if it is an image it is added to the cache and the url
is associated to dives as with local files.

NB this currently only works with URLs pointing directly to images. But it
should not be too hard to add the possibility to add a direction via an html
file and its image tags.

To test: open dives/test43.xml and delete the image and then add the URL
http://euve10195.vserver.de/~robert/wreck.jpg

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 09:36:21 -07:00
Robert C. Helling
a0a3c6ec15 Cleaning up variable names in image loading
Use more explicit variabel names and make the get timestamp function actually
return the timestamp rather than getting a pointer argument

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 09:35:35 -07:00
Miika Turkia
c80d1879b7 Add suit field for CSV import
Fixes #853

[Dirk Hohndel: fixed test compile]

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 06:50:50 -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
bbfa2b655b Profile context menu: trigger editing of manually added dive
Right now the way to edit the profile of a manually added dive is really
counterintuitive: you have to first make some random change to the dive
information, then the profile switches in to editing mode.

This commit adds a simple context menu entry on the profile that is only
shown when the a manually added dive is displayed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-23 13:56:24 -07:00
Dirk Hohndel
6f7e3d04cb Handle XSLT based imports correctly
XSLT conversions create V2 XML files, but we shouldn't abort when we parse
those without having the user informed about the potential slowness - all
XSLT based imports are slow, anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 13:20:27 -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
Dirk Hohndel
429fcdb344 When remembering the selection, don't try to be too smart with trips
We assumed that a trip was selected when all of its dives were selected
instead of just remembering if the trip itself was selected. I'm sure
there was a reason for that but I cannot think of any. But a side effect
is that if you have a trip with only one dive in it and have that one dive
selected and edit it, after saving your changes you end up on the trip
(which is now also selected) and are no longer on the dive. And that seems
quite wrong.

The new code simply remembers that the trip was selected. And selects it
again if it was.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22 08:42:28 -07:00
Dirk Hohndel
79f15e913b Uemis downloader: allow continuing download by clicking Retry
When we run out of space in the Uemis filesystem we return an error. The
user could reasonably unplug the SDA, insert it again and then retry to
continue the download (that's what we tell them to do). In that case we
need to make sure we start at the correct dive otherwise the same dives
keep getting downloaded over and over again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 23:28:04 -07:00
Dirk Hohndel
4bccee238c Download dialog: we can accept a partial download after an error
The dialog didn't accept "OK" and store the dives downloaded / selected so
far if there had been an error. Especially with partial downloads from the
Uemis SDA this is something that is quite reasonable to want to do, so
allow exiting the dialog with OK even after an error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-20 22:11:43 -07:00
Grace Karanja
193edd9f13 Add ability to undo removing of dives from trips
Add the functionality to undo/redo removing of dives from trips. The
code calling remove_dive_from_trip has moved to the UndoCommands class.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14 10:29:15 -07:00
Gehad elrobey
54453abe49 Show error messages for incorrect edit invocation
Planned dives must be replanned while manually added dives must be edited.
Show error messages to handle wrong user input.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14 10:12:32 -07:00
Joakim Bygdell
afea30fd8a Recmode: Allow the user to specify gas reserve.
Since most regulators have an intermediate pressure of 10bar
the minimum value is 10 while the max is 99.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 14:36:17 -07:00
Joakim Bygdell
f8a808bcaf Shorten the first leg of the planner.
With the addition of gas reserves in recreational mode
we need to make sure that the first leg is short enough
that we have more gas left than the specified reserve
even when using small cylinders like LP72.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-05 07:40:33 -07:00
Salvador Cuñat
3ca4e14d5c OSTCTools-Add support to import .dive files
OSTCTools is a windows based software by Robert Angeymar which performs
configuration upgrade, memory analysis and download tasks for H&W OSTC
devices.

Downloaded dives are stored in files (one archive each) with the raw
binary data heavily padded at the begining of the file, and some other
data not included in H&W dive header protocol as the device's serial
number.

The import function simply takes the raw data part of the file and lets
libdivecomputer do the parseing.

Then adds some additional info as OSTC reported dive number and serial
device number.

Please note that OSTCTools is *not* a real logging software, it simply
gets the DC raw data, so there isn't any information about dive site,
equipment and so.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 10:33:49 -07:00
Robert C. Helling
cc8d601422 Checkbox and preference for safety stop
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-02 09:46:10 -07:00
Robert C. Helling
8571dcf967 Introduce recreational planner mode
This adopts the planner to the needs of the recreational diver. Rather than immediately
starting to ascent doing deco stops this mode, this mode stays at the last manually
entered depth for the maximal time before mandantory stops appear (NDL). It does not
change gas but keeps using the last used cylinder.

TODO: * Grey out unused UI elements of the planner in this mode
      * Start ascent before gas runs out (or into reserve)
      * Do a 3min @ 5m safety stop.

Fixes #840

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-02 09:45:50 -07:00