Commit graph

3389 commits

Author SHA1 Message Date
Marcos CARDINOT
70b4c9f2d3 RulerItem2::settingsChanged() - NULL pointer dereference
The current code is dereferencing the null pointer 'profWidget'.
It can cause a segmentation fault.

Signed-off-by: Marcos Cardinot <mcardinot@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-19 15:34:10 -07:00
Marcos CARDINOT
d500f56d6f TableView - improving the column width calculation
Even that most (or all) tables have the remove button at the section 0, the method defaultColumnWidth should not assume that it will always be true.

This patch will consider the title width of each section, instead of using a static width (which cause problems when the language is not en).

Signed-off-by: Marcos Cardinot <mcardinot@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-19 15:33:16 -07:00
Torstein Husebø
6a5279b952 Fix a couple of typos
Signed-off-by: Torstein Husebø <torstein@huseboe.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-19 11:17:39 -07:00
Grace Karanja
8fe738bf64 Consistent variable names in UndoCommands class
Implements a uniform variable naming scheme in the undocommands
class.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-17 09:53:47 -07:00
Lubomir I. Ivanov
d2b8fb31eb simplewidgets.cpp: fix a -Wreorder warning
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-17 09:28:47 -07:00
Robert C. Helling
002cfa0663 Create picture cache directory if needed
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-17 09:23:55 -07:00
Robert C. Helling
e0490f3055 Use QUrl::fromUserInput for image files
... as suggested by Thiago.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16 12:42:37 -07:00
Robert C. Helling
6b3b50cc2f Load remote images
When loading an image by filename and by hash fails, try to interpret
the filename as URL and download the image.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16 12:42:36 -07:00
Dirk Hohndel
f724b7ebf9 Don't overwrite the displayed dive in the middle of editing
Coming back from a dive site edit we must not call refreshDisplay() or
otherwise the edits on the displayed_dive are overwritten.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16 10:53:50 -07:00
Dirk Hohndel
35d6cf8000 Make sure the dive site edit widget is current when switching to it
Otherwise it will show outdated information. If the user edits the
location name and then clicks 'manage' we need to make sure that the
correct site is shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16 10:52:45 -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
Jan Darowski
0d77b921eb Added warning when not all images can be added.
Added label in the ShiftImageTimesDialog which appears when
not all of the selected images have timestamp in the checked range.

Made cancel button in this widget actually work.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-15 15:47:37 -07:00
Jan Darowski
7d37a3f5a6 Refactored image timestamp checking.
Seperated getting image timestamp from picture_load_exif_data() and
ShiftImageTimesDialog::syncCameraClicked() into picture_get_timestamp()
and seperated checking timestamp from dive_create_picture() to
dive_check_picture_time().

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-15 15:47:23 -07:00
Miika Turkia
838b450066 CSV import: average depth name fix
Field name changes should change all the occurrences... We ended up with
field index of -1 for average depth due to mixing field names.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-15 15:43:47 -07:00
Claudiu Olteanu
b3da88478f Change the zoom level on globe if no coordinates are set
As flo269 suggested in bug #507, a full view of Earth would be better
when a dive has no coordinates.

Fixes #507

Reported-by: flo269
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-15 07:32:29 -07:00
Gehad Elrobey
ec202890b7 Make exporting photos with HTML optional
This adds the ability to choose either to export photos or not.
Patch is attached.

--
regards,
Gehad

From 6476e1227b72d8297f9aecc2e6cc6f70d07f87ae Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelrobey@gmail.com>
Date: Fri, 13 Mar 2015 15:31:24 +0200
Subject: [PATCH] Make exporting photos with HTML optional

Add the option to enable/disable exporting photos with the HTML.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:18:08 -07:00
Lubomir I. Ivanov
7e7cddde8a Profile: fix a couple of warnings
profilewidget2.cpp:1398:25: warning: the omitted middle operand in
?: will always be 'true', suggest explicit middle operand [-Wparentheses]

profilewidget2.cpp:1403:39: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:17:43 -07:00
Lubomir I. Ivanov
57374fb9f0 Profile: call clearHandlers() in setAddState()
Points (handles) from the last dive ADD operation remain on
the profile unless we clear them.

fixes #846

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:17:30 -07:00
Lubomir I. Ivanov
da2d5b5ee1 Profile: fix potential mem leak in pointsInserted()
The point graphics are allocated but doens't seem to be
deleted anywhere. We attempt to fix that in clearHandlers().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:17:26 -07:00
Lubomir I. Ivanov
3617928621 Revert 4f9705f3f5
It solves #784, but introduces #846.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:17:22 -07:00
Dirk Hohndel
e9e9996766 Better testing if the first gas is explicit
Given that we might be adding a gas change event at t = 0 we need to check
for both that and t = time_or_first_sample.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11 12:31:00 -07:00
Dirk Hohndel
0739da38c5 Don't allow two gas changes at the same time
t = 0 isn't really special here. We shouldn't allow two gas changes at the
same time, period.

We also can do away with the special handling to mark the dive list
changed and replot things if a gas change gets removed. That's done at the
end of this function either way.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11 11:44:25 -07:00
Dirk Hohndel
e121b4b548 Make sure no gas changes with negative time can be added
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11 11:43:17 -07:00
Dirk Hohndel
74638c5f65 Simplify the code that replaces a gas change event at t=0
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11 11:42:57 -07:00
Yousef Hamza
22eb8e0617 Removing gas change events @0:00 when new one is added
Remove the existing gas change events @0:00 when new
one is added @0:00.

Signed-off-by: Yousef Hamza <jo.adam.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11 11:06:13 -07:00
Lubomir I. Ivanov
1e81dff946 Planner: disable mouse interaction when zoomed in
When zoomed in, things like moving planner points is not possible,
but if the user attempts that, replan() -> plotDive() is called
and the zoomLevel should be reset to the default value (we don't
really want that), but instead it's lost for some reason
(as the user reports: "Somes times, it changes to 100% which is ok").

If moving points becomes possible eventually while zoomed in,
we need to figure a way to replot without resetting the zoom level
in plotDive().

Fixes #851

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11 07:38:46 -07:00
Miika Turkia
76ce2b095b Trim CSV lines on import
In practice this will sanitize Windows line terminations (discard the
carriage return);

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 14:27:43 -07:00
Joakim Bygdell
55582cf5d4 Allow removal of manually added unused cylinders
Fixes #832

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 11:41:52 -07:00
Dirk Hohndel
b81647bd8a Change the diveSiteMessage to show close or accept/reject
This gives us consistent behavior and allows closing the dive site
management screen without editing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 11:35:05 -07:00
Dirk Hohndel
ca64f8a782 Clean up the UI when finished editing
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 11:09:25 -07:00
Dirk Hohndel
043ae4af27 Turn the toolbar back on after editing a dive site
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:50:56 -07:00
Dirk Hohndel
4796ee0c39 Don't call enableEdition() every time a change is made
We only need to do this once.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:50:18 -07:00
Dirk Hohndel
2c2adacb90 Don't enter dive site edit mode whenever the coordinates are set in the UI
This function was missing the check if setting that field actually changes
what's already in the data structure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:49:21 -07:00
Dirk Hohndel
1e3700c11f Don't call UI functions from helper code
This may seem much more complicated but actually is much cleaner. Add each
thread we start to the list of future results and add a new UI function
that updates the UI once all of the threads have finished.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:22:34 -07:00
Salvador Cuñat
44b55bd1a2 Import Datatrak/WLog files
Sequentially parses a file, expected to be a Datatrak/WLog divelog, and
converts the dive info into Subsurface's dive structure.

As my first DC, back in 90s, was an Aladin Air X, the obvious choice of log
software was DTrak (Win version). After using it for some time we moved to WLog
(shareware software more user friendly than Dtrak, printing capable, and still
better, it runs under wine, which, as linux user, was definitive for me). Then,
some years later, my last Aladin died and I moved to an OSTC, forcing me to
look for a software that support this DC.
I found JDivelog which was capable of import Dtrak logs and used it for some
time until discovered Subsurface existence and devoted to it.

The fact was that importing Dtrak dives in JDivelog and then re-importing them
in Subsurface caused a significant data loss (mainly in the profile events and
alarms) and weird location of some other info in the dive notes (mostly tag
items in the original Dtrak software). This situation can't actually be solved
with tools like divelogs.de which causes similar if no greater data loss.

Although this won't be a core feature for Subsurface, I expect it can be useful
for some other divers as has been for me.

Comments and issues:

Datatrak/Wlog files include a lot of diving data which are not directly
supported in Subsurface, in these cases we choose mostly to use "tags".

The lack of some important info in Datatrak archives (e.g. tank's initial
pressure) forces us to do some arbitrary assumptions (e.g. initial pressure =
200 bar).

There might be archives coming directly from old DOS days, as first versions
of Datatrak run on that OS; they were coded CP437 or CP850, while dive logs
coming from Win versions seems to be coded CP1252. Finally, Wlog seems to use a
mixed confusing style. Program directly converts some of the old encoded chars
to iso8859 but is expected there be some issues with non alphabetic chars, e.g.
"ª".

There are two text fields: "Other activities" and "Dive notes", both limited to
256 char size. We have merged them in Subsurface's "Dive Notes" although the
first one could be "tagged", but we're unsure that the user had filled it in
a tag friendly way.

WLog adds some information to the dive and lets the user to write more than
256 chars notes. This is achieved, while keeping compatibility with DTrak
divelogs, by adding a complementary file named equally as the .log file and
with .add extension where all this info is stored.  We have, still, not worked
with this complementary files.

This work is based on the paper referenced in butracker #194 which has some
errors (e.g. beginning of log and beginning of dive are changed) and a lot of
bytes of unknown meaning. Example.log shows, at least, one more byte than those
referred in the paper for the O2 Aladin computer, this could be a byte referred
to the use of SCR but the lack of an OC dive with O2 computer makes impossible
for us to compare.

The only way we have figured out to distinguish a priori between SCR and non
SCR dives with O2 computers is that the dives are tagged with a "rebreather"
tag. Obviously this is not a very trusty way of doing things. In SCR dives,
the O2% in mix means, probably, the maximum O2% in the circuit, not the O2%
of the EAN mix in the tanks, which would be unknown in this case.

The list of DCs related in bug #194 paper seems incomplete, we have added
one or two from WLog and discarded those which are known to exist but whose
model is unknown, grouping them under the imaginative name of "unknown". The
list can easily be increased in the future if we ever know the models
identifiers.
BTW, in Example.log, 0x00 identifier is used for some DC dives and from my own
divelogs is inferred that 0x00 is used for manually entered dives, this could
easily be an error in Example.log coming from a preproduction DC model.

Example.log which is shipped in datatrak package is included in dives
directory for testing pourposes.

[Dirk Hohndel: some small cleanups, merged with latest master, support
               divesites, remove the pointless memset() before free() calls
	       add to cmake build]

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:03:08 -07:00
Tomaz Canabrava
500c4c2772 Clear after accepting / rejecting the LocationEdit
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:30 -07:00
Tomaz Canabrava
986b6c509a Change color / mark widget as changed correctly on LocationEdit
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:21 -07:00
Tomaz Canabrava
30c5a027ca Clone a bit of code to mark the Location Widget changed
This code is the same that is used on the MainTab, but
since they are different objects, I can't just call it.
so I'm duplicating them for the time being.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:47:05 -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
Tomaz Canabrava
53d20f5b8a Do not show the Edit mode message when entering location management screen
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 07:46:30 -07:00
Joakim Bygdell
20a82e2b21 Improve gas accounting in the panner
When using gasmixes where the difference is less than 2% the planner can't
caclulate casconsumptions correctly. This sets the minimum gasdifference
to 1%.

Fixes #795

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-09 10:39:50 -07:00
Anton Lundin
237043d6ba Fix building with NO_PRINTING for Android
Back in 4867ee8ad8 ("Move the Profile out
of the mainwindow.ui") the way to access the PlannerDetails object
changed.

This does the corresponding change to the NO_PRINTING block, making it
build on Android again.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-09 09:44:00 -07:00
Miika Turkia
724772ef68 Include upper case extensions on import dialog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-08 12:55:47 -07:00
Grace Karanja
182fe790c9 Add ability to undo renumbering of dives
Expand the undo feature by storing a list of renumbered dives' ids
and numbers so that the original numbers can be restored if needed.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-28 12:44:14 +01:00
Gehad elrobey
100f4ee1a4 Show notification message while logs are converted from v2
This is another long operation that needs showing a notification about
importing the old format log files

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-28 12:42:50 +01:00
Gehad elrobey
90d68ead31 Show translated String.
Translated notifications are always better.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:31:12 +01:00
Gehad elrobey
f61b59d961 Change the references to ShowError to the new notification object.
Showing an Error message is better called from the Notification Object,
So for consistency old references to showError is replaced by calling
the notification object.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:31:10 +01:00
Gehad elrobey
59ab849854 Creating a Notification widget in the Main Window.
The main error message bar can be used to show exporting information and
other notification.

So a new Notification handler object is created in the main window
<NotificationWidget> that inherits <KMessageWidget> that shows different
type of notifications, ex. (Warning, Error and information)

Also this class contains a QFutureWatcher object that is set to handle
the QFuture variable returned from the exporting thread. this will allow
the UI to be updated when the thread finishes execution.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:31:06 +01:00
Robert C. Helling
e6482bbdc8 UI to learn hashes of local image files
This addes a menu entry for the user to select a directory that is recursively
traversed to look for image files and compute the hashes of those images (for
those images to be available to be displayed in dives according to their hash values).

This traversal and hash computation happens in and independend thread and so far
the only feedback to the user is that upon completion the dispayed images are updated.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:30:49 +01:00
Robert C. Helling
b02bf002a6 Add hashes to images
Upon successfull reading an image file, this computes a SHA1 hash of the
image and saves it with the picture tag in the log file. When a file is
not successfully loaded (for example because the log was created on a
different computer) we look up the hash in a dictionary that maps hashes
to local file names.

That dictionary (actually two for both directions), is loaded on startup
and saved upon destruction of the main window.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:29:44 +01:00
Dirk Hohndel
0ed4356fc2 Display slowness warning before opening a V2 file
This is somewhat invasive as aborting the XML file read requires us to
report things up the recursive parsing chain.

What we really need to do here is to ask the user how they want to use the
data from reverse geo lookup. But for now we only warn about the fact that
this can take a while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-25 10:05:37 +01:00
Dirk Hohndel
ddc01e39e7 Move helper functions around
We had a ton of helper functions in qt-gui.cpp which really didn't make
much sense. So I moved them all into qthelper.cpp.

Also moved the UserAgent helper that didn't belong in the UpdateHandler to
begin with - that's a generic helper used in many places...

With this we can successfully build using cmake again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-23 09:31:08 -08:00
Dirk Hohndel
2866a604b4 Revert "Update Qt4 patch"
This reverts commit 762315e7ee.

Oops, this was supposed to update the patch, not update and apply it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-22 08:30:34 -08:00
Dirk Hohndel
762315e7ee Update Qt4 patch
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-19 21:52:41 -08:00
Lubomir I. Ivanov
aa7f2eeb8a subsurfacewebservices.cpp: add QDebug include
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 14:08:44 -08:00
Lubomir I. Ivanov
8053a61442 simplewidgets.cpp: QLineEdit::setClearButtonEnabled() is from Qt5.2
This could cause problems if the user tries to compile with
Qt versions between 5.0 and 5.2.

Reported-by: Michele Fabi <fabiemme@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 14:08:36 -08:00
Gehad elrobey
98d1dbef11 HTML: Fix Null values in yearly statistics export.
Null values should be handeled nicely instead of showing NULL or Nan.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 08:52:21 -08:00
Gehad elrobey
043ab5b02c HTML: Fix exporting themes in multilingual environment
Don't compare to static english string, must translate first.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 08:52:16 -08:00
Miika Turkia
9e92d27bd0 Add ssrf as dive log extension on import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 08:52:11 -08:00
Robert C. Helling
b60a3d71d3 Use unused cylinders in planner if they are displayed
This makes prefs.display_unused_tanks also relevant for the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 08:51:05 -08:00
Lubomir I. Ivanov
d6d0fb09f9 subsurfacewebservices.cpp: add QDebug include
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 08:49:34 -08:00
Lubomir I. Ivanov
0cf2f90507 simplewidgets.cpp: QLineEdit::setClearButtonEnabled() is from Qt5.2
This could cause problems if the user tries to compile with
Qt versions between 5.0 and 5.2.

Reported-by: Michele Fabi <fabiemme@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 08:49:26 -08:00
Tomaz Canabrava
2e6fcfc969 Fix profile toolbar
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-16 20:37:52 -08:00
Lubomir I. Ivanov
071b9ff50c downloadfromdivecomputer.cpp: fix initializer list order warning
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 13:29:49 -08:00
Lubomir I. Ivanov
c45768a09f add and use a version.c / version.h pair
version.c is now object code which is recompiled each time
ssrf-version.h changes, while the interface file version.h
remains that same at all times and files which include it
will not need to be recompiled.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 13:26:51 -08:00
Thiago Macieira
39ffb0fced Fix Subsurface build with Qt 5.4.1 and later
The intention had been all along to use the 5.4 QSysInfo API, but due to
a silly mistake in the QT_VERSION check, it never got enabled for 5.4.0.
On 5.4.1 it does get enabled and, unfortunately, causes compilation
errors because the API changed between the time we backported to
Subsurface and the final version.

This commit backports the final QSysInfo API from Qt 5.4 into
Subsurface, which includes the renaming of a few functions. Since the
prettyOsName function no longer exists in the Qt API in that form, I've
reimplemented it using the API that does exist.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 06:00:52 -08:00
Robert C. Helling
ea143e9668 Use unused cylinders in planner if they are displayed
This makes prefs.display_unused_tanks also relevant for the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 06:00:06 -08:00
Gehad elrobey
9470be0a77 HTML: Fix Null values in yearly statistics export.
Null values should be handeled nicely instead of showing NULL or Nan.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 05:56:01 -08:00
Gehad elrobey
d2990aea6f HTML: Fix exporting themes in multilingual environment
Don't compare to static english string, must translate first.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 05:55:42 -08:00
Miika Turkia
2bd019817c Add ssrf as dive log extension on import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 22:38:17 -08:00
Grace Karanja
87ee8e8aef Add ability to undo shifting of dive time
Adds the ability to undo shifting of dive times. The change is captured
at simplewidgets.cpp and an undo command is created.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 15:46:37 -08:00
Dirk Hohndel
cf07e3a79b When cleaning up the empty screen, also clean up dive sites
Otherwise we are using stale pointers in the displayed_dive_site global.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 11:56:33 -08: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
Lubomir I. Ivanov
cbff3f89c9 mainwindow.cpp: don't close a file if a dive site is being edited
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 11:18:32 -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
ca72ab5749 When closing a dive, delete all the dive sites
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 23:11:36 -08:00
Dirk Hohndel
3ea2e15bd2 Don't add empty dive sites
It makes no sense to keep them around, it makes no sense to have dives
refer to them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 23:08:33 -08:00
Dirk Hohndel
cd77e2e700 Make sure there is a dive site if you try to edit it
If the user clicks on manage (or double clicks on the globe) and the
displayed_dive doesn't actually have a dive site associated with it (e.g.
because we are adding a dive or because it was imported or downloaded
without dive site information, then we need to make sure that there is an
empty dive site that we can make changes to.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 22:45:31 -08:00
Dirk Hohndel
e32459d313 When adding / planning a dive, reset the dive site manage screen
Otherwise old data is still shown if the user clicks manage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 22:42:57 -08:00
Dirk Hohndel
b60b4ef69d Fix crash when adding a dive
If a dive has no dive_site_uuid we would dereference a NULL pointer and
crash. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 22:08:08 -08:00
Dirk Hohndel
2607fea2de Fix compile time warning
No idea why designer sometimes adds these zorder items.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:45:31 -08:00
Dirk Hohndel
32ad046f56 Allow editing of dive sites
And hook things up when double clicking the globe.

The user experience isn't consistent with what we do on the main tab
(i.e., no coloring of fields that are changed), but it seems to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:35 -08:00
Dirk Hohndel
6708e06872 Adapt GPS coordinate download from our companion app to dive sites
This is a bit awkward now. We are downloading what looks like fake dives
in the v2 format. So we create a dive site for every single fix.

After we merge those new dive sites into the existing dives we need to
throw away all the dive sites that weren't used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:34 -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
b2f0d21d43 Get location for Facebook from dive site
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 22:45:47 -08:00
Dirk Hohndel
253a137cc7 Get location from dive site for printing
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 22:45:47 -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
616cb18b29 Make filters work with dive sites
This simply tracks the names - if we have multiple dives sites with the
same name but different other data (e.g. different GPS), we could easily
get this right (well, somewhat easily, it's a UI question), but for that
we'd have to filter for dive site uuid instead of for dive location name.

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
8bea7cbdc7 Show dive site name in dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 12:54:20 -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
f8b63e1bb6 Update completion model for dive site names
This way the drop down works again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 11:19:27 -08:00
Dirk Hohndel
d488c37cc1 Show dive coordinates on map based on 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
Dirk Hohndel
9edb7811ef Remove redundant function
We had two functions doing exactly the same thing. Let's drop the one with
the highly confusing name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 16:34:02 -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
Tomaz Canabrava
d769c6016f Copy the name and the coords when entering the EditDiveSite state
Name and coords of the current dive are copied to the edit dive site
screen.

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
Tomaz Canabrava
68691c9d6d Accept / Cancel location edit
Make it possible to cancel or accept the location edit and
get back to the mainwindow default state.

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
Tomaz Canabrava
7d66dcd12d Enable the location edit widget on mainwindow
Clicking on the 'Manage' button now brings you to the widget to manage it.
Nothing has been added on it yet.

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
Tomaz Canabrava
e3d800885f Create a new state for the MainWindow: EditDiveSite
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
Tomaz Canabrava
3516ff2ab2 Create simple class to hold the location management.
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
Tomaz Canabrava
63e998b4bd More meaningfull names for the ui elements.
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
Tomaz Canabrava
c173fc567d Add the ui file for the location information
Just the xml file for the Ui location information.

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
Lubomir I. Ivanov
fd1a33d935 mainwindow.cpp: don't use ui.globePane
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 16:18:25 -08:00
Grace Karanja
60a7404ed4 Add option to undo deleted dives
Add ability to undo deleted dives by storing a list of the
deleted dives in a QUndoCommand.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 08:07:23 -08:00
Grace Karanja
6d996a7874 Add a structure to hold undo commands
Add the undocommands.cpp / undocommands.h files, which will hold a
collection of classes that will hold undo commands.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 08:05:53 -08:00
Grace Karanja
ef14798d6d Add undo stack
Add an instance of QUndoStack in the mainwindow, and add undo/redo
actions in the edit menu. The QUndoStack will have a collection
of QUndoCommands to process the undo and redo events.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 08:00:39 -08:00
Grace Karanja
013da6b0af Reverse undo buffer
Reverse all the code using the UndoBuffer class so that we can
use the QUndoStack and QUndoCommand classes. These are Qt's own
inbuild undo framework classes, offering a better undo/redo
process.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 07:59:46 -08:00
Dirk Hohndel
d449ac3208 Only update tags in the selected dives if they were changed
If current_dive and displayed_dive still have the same tags then we
shouldn't touch the tags of other selected dives.

Fixes #826

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 15:04:29 -08:00
Miika Turkia
01199728fb Select the known import for APD automatically
If the filename has extension of .apd, then set the known import
automatically.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 15:03:28 -08:00
Miika Turkia
c104ff67e4 Add the .apd file extension to be treated as CSV file
Adding support for importing .apd files (APD Log Viewer). They are CSV
files and already supported in CSV import, but the file extension .apd
is added here.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 15:03:28 -08:00
Dirk Hohndel
2dab00f5dc Change the tooltip for bailout
While this text makes sense if this is a CCR dive and the diver does bail
out, the more neutral text "Manual switch to OC" works in all use cases
for this event, e.g. at the beginning of a dive when we manually set this
dive to be OC.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 15:02:53 -08:00
Dirk Hohndel
e0ad44c1b3 Don't show a setpoint switch event at t=0
When using that to indicate the dive type at the start of the dive, it's
visually strange to have an event marker.

See #826

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 15:02:53 -08:00
Tomaz Canabrava
e44deed734 Fix a regression on selection caused by the new interface code
In the designer we set the selection type to extendedSelection
but since I removed the widget from the designer, I also had
to set it in the code.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 13:45:06 -08:00
Tomaz Canabrava
81ba72b219 Add a new button on the MainTab to handle management of geo locations
Just a button on the UI.
This moves the layouts around, in an attempt to make them less
obtuse.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 12:49:03 -08:00
Tomaz Canabrava
bb9398d08f Fix build without marble
If we have an null widget, we hide the stack.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 12:47:55 -08:00
Tomaz Canabrava
d53723fade Remove unused enums
Thuis is garbage from the old code.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:47 -08:00
Dirk Hohndel
3296089953 Change the order of the quadrants
At least to me it seems more natural to enumerate them row by row instead
of column by column, so now we do

1 2     instead of    1 3
3 4                   2 4

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:47 -08:00
Dirk Hohndel
ca154a65da Rename the widget to better reflect what it does
This widget defines what's in each quadrant of the main window.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:47 -08:00
Tomaz Canabrava
9b62d36757 Fix broken connection
The old way of creating the mainwindow made things a bit
dependent of the order of initialization, and we don't
assume that anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:46 -08:00
Tomaz Canabrava
9b547e6c71 Remove the flicker issue and the resize issue.
The flicker was caused by removing all widgets (and thus setting
the size of the splitter to zero) and then re-adding them.
I've added four QStackedWdigets that have a consistent size and
the only thing I do now is to set the corresponding widget to visible
without removing / readding anything, and thus, not messing with
the sizes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:46 -08:00
Tomaz Canabrava
7b46a8fddf Don't set the state if it's the same
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:46 -08:00
Tomaz Canabrava
3912adfe5b Save the size of the widgets to restore it later.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:46 -08:00
Tomaz Canabrava
194dd8bd97 Finish the cleanup of mainwindow.ui
This is the last patch in the series of clearing up the
mainwindo.ui. Now to bugfixing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:46 -08:00
Tomaz Canabrava
4867ee8ad8 Move the Profile out of the mainwindow.ui
And place it in mainwindow.cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:46 -08:00
Tomaz Canabrava
6b038c2a9a Remove the ProfileWidget from mainwindow.ui
It is now in mainwindo.cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
2992d78f83 Remove the PlannerWidget from mainwindow.ui
Now it uses the states on the mainwindow.cpp and it's finally
starting to be worth the hassle of reworking the UI.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
238c0573da Remove information panel from mainwindow.ui
Now it's created in the mainwindow.cpp as part of the new
way to configure the interface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
c30aee1ae5 Remove the Globe from the mainwindow.ui
Now it's started from mainwindo.cpp and it's part of the
new states

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
cf4d55c470 Remove the DiveList from the mainwindow.ui
It's now set up from the mainwindow.cpp file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
c69aab04f4 Correctly set up the Planner state
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
57e938d040 Create the method that changes the state of the application
Not used yet. The idea is to call 'setApplicationState("plan");'
and all widgegts for plan will be magically setup because we
added the plan state with registerApplicationState.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
93198a8098 Change splitter names to something more meaningfull
listGlobe and infoProfileSplitters weren't good names as
now we will be able to create more types of widgets there

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
486226be18 Add the PlannerDetails class
This is the last of the current dialogs to be ported to the
new widgets system. now we need to clean the mainwindow of the
old code.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
5098e8672e Add a new file, plannerDetails.ui
This new file is the interface for the Details of the planned dive
removed from the mainwindow.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
727e397aa5 Add the modes for ADD and PLAN
The Plan mode still misses a widget that was done directly inside
the mainwindow. I'll extract it from there and create a proper
class in the next commit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
7d48c1fc26 Add the first call to registerApplicationState
This will be used to set the 'default' state. The other
two possible states right now are plan and add; those will
be created right next.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:44 -08:00
Tomaz Canabrava
9e3bff6b7c Simplify a bit of code
two #ifdef NO_PRINTING one over the other, merged them together.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:44 -08:00
Tomaz Canabrava
38aab70555 Implement the registerApplicationState function
This function registers the different widget layouts
that we will have in subsurface. Currently we have three layouts
(default, plan, add) and a few more are comming (for instance
location) and the code is scattered around. It was making me
unconfortable.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:44 -08:00
Tomaz Canabrava
aa56797b0b Add a new struct that will hold the widgets for each corner
The combination of the map / struct will change based on the
state of the application. Currently a lot of different
widgets change what is shown on the main window, and it's very
messy.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:44 -08:00
Dirk Hohndel
585d6a004b Only update tags in the selected dives if they were changed
If current_dive and displayed_dive still have the same tags then we
shouldn't touch the tags of other selected dives.

Fixes #826

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 06:31:37 -08:00
Grace Karanja
d60a620193 Add ability to undo deleted dives
Before the dive is deleted, a copy is made and passed to the
undo buffer. When edit->undo is clicked, this dive is restored
to the dive list.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-09 21:02:19 -08:00
Grace Karanja
8d1e4557a9 Add UndoCommand class
Add a class to handle all undo/redo events. Whenever a user
action affects a dive, an undo command will be created. A list of
these commands will be stored in the UndoBuffer, to allow for
moving forwards/backwards in the list.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-09 21:02:16 -08:00
Grace Karanja
c5138b2090 Add menu entries for undo/redo
Add an edit menu with undo and redo submenus, and connect them to
the UndoBuffer class. The submenus are only enabled when needed.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-09 21:02:13 -08:00
Grace Karanja
853dfa6673 Create UndoBuffer class
Add an empty UndoBuffer class. This will be built up on to
implement a working undo/redo mechanism.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-09 21:02:07 -08:00
Miika Turkia
0e26487208 Select the known import for APD automatically
If the filename has extension of .apd, then set the known import
automatically.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-07 08:56:27 -08:00
Miika Turkia
936fc2dae7 Add the .apd file extension to be treated as CSV file
Adding support for importing .apd files (APD Log Viewer). They are CSV
files and already supported in CSV import, but the file extension .apd
is added here.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-07 08:56:23 -08:00
Dirk Hohndel
bd994c1722 Change the tooltip for bailout
While this text makes sense if this is a CCR dive and the diver does bail
out, the more neutral text "Manual switch to OC" works in all use cases
for this event, e.g. at the beginning of a dive when we manually set this
dive to be OC.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-07 08:52:05 -08:00
Dirk Hohndel
d276f9cb08 Don't show a setpoint switch event at t=0
When using that to indicate the dive type at the start of the dive, it's
visually strange to have an event marker.

See #826

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-07 08:51:54 -08:00
Grace Karanja
88fa627258 Delete dives using delete key
Allow users to delete dives using the delete key.

[Dirk Hohndel: small whitespace fix; removed an unnecessary
               include file]

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-06 07:22:50 -08:00
willem ferguson
802bf1d7c8 CCR gas composition and gas pressure labels on dive profile: revisited
This patch cleans up code for achieving the above with respect to
CCR dives. The code is simplified and shortened. The display of
gas lables on the profile is made consistent with the cylinder
pressure closest to the graph and the gas composition above/below
the cylinder pressure. The patch significantly improves the
maintainability of this code.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-05 07:31:52 -08:00
Tomaz Canabrava
cc9c24d46a Do not set default bg to white on the models
The user may have a different theme, as i did, and it
looked very wrong.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-03 15:14:09 -08:00
Tomaz Canabrava
3671c991e8 Don't allow the Cylinder option be edited in PLAN / ADD mode
This sets the combobox to disabled if the profile is in
any mode besides PROFILE.

Fixes #824

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-03 15:13:05 -08:00
Miika Turkia
4f9705f3f5 Fix crash when removing an out-of-profile divepoints
We can end up having a divepoint that is outside the dive profile. In
this case, we used to crash, but this hack prevents the index out of
range issue.

Fixes #784

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-03 11:27:41 -08:00
Miika Turkia
6f795a0059 Fix crash when moving divepoints rigorously
I have no idea how the index ends up outside the range, but at least
this prevents a crash in this case.

See #784

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-03 11:27:35 -08:00
Dirk Hohndel
d34965135a Disable dive component copy/paste shortcuts when no profile show
Instead of inventing another way to do this (and inevitably forgetting a
path where this should be re-enabled) I renamed the DcShortcup related
function and made them enable/disable the copy and paste shortcuts as
well.

Of course there now is one exception (isn't there always?): in "ADD" state
we don't want to be able to switch DCs, but we do want to be able to
paste.

Fixes #825

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-03 07:36:09 -08:00
Dirk Hohndel
baa4b4d7c5 Don't show the plot_info table in every debug build
Instead add a new define SHOW_PLOT_INFO_TABLE that triggers if this
debugging aid is shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-02 13:14:04 -08:00
Patrick Valsecchi
7e0ff8c1e4 Fixed CMakeLists.txt to work with Qt5
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-02 08:00:49 -08:00
Miika Turkia
414b9807e6 Do not go to edit mode if nothing changed
Fixes #804

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-02 07:06:56 -08:00
Miika Turkia
e1db5f21b1 Fix Ubuntu glitch with completer popup
On Ubuntu, the completer often prevents applying/discarding the changes
on the dive info pane and disrupts editing of other fields as well. This
patch prevents the completer popup from appearing when not in edit mode
(apply or discard is pressed) or when the string is still empty.

Fixes #818

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-01 13:50:35 -08:00
Dirk Hohndel
62bc751bd9 Facebook integration: recognize when user didn't allow us to post
Why someone would log in but then not allow us to post I don't know... but
it seems useful to at least handle it...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-01 10:52:28 -08:00
Dirk Hohndel
f30ff4fde7 Facebook integration: only set the URL once
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-01 10:47:31 -08:00
Dirk Hohndel
1e4a13d3ba Clean up all the debug messages from Facebook integration
Even for a beta this was a bit too verbose for my liking.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-01 07:24:48 -08:00
Dirk Hohndel
5343b909fa Get ready for Beta 3
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-01 07:08:11 -08:00
Miika Turkia
2dc1a42b29 Fix crash if one selects incorrectly Seabear CSV
Fixes #814

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-01 07:06:12 -08:00
Robert C. Helling
1e45858ee6 Update ceiling when changing dive mode
Without this patch, the user effectively cannot change the dive mode as
any change is overwritten by replot copying current_dive over
displayed_dive. The way out is not to call replot but only update the deco
ceiling directly.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 14:09:50 -08:00
Robert C. Helling
c70ba77199 Don't call replot when exiting cylinder combo box
Commit b72c32da7 turned off replotting while the cylinder
combo box was active to speed up editing. After leaving
the combo box, replotting was enabled again and a replot
was called.

This replot is too agressive, as it overwrites the displayed
dive with the current dive and thereby resets the cyinder
change. This eliminates the replot call.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 14:07:52 -08:00
Dirk Hohndel
eeb0c6a756 Don't store the Facebook credentials between multiple runs of Subsurface
They stay valid while Subsurface is running, but once you quit, the
credentials are gone.

This way no one can steal them from our settings.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 12:01:36 -08:00
Dirk Hohndel
646fa22c01 Correctly quote a double quote in the message
Otherwise the message on Facebook will end at the first double quote.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 10:57:15 -08:00
Dirk Hohndel
fd33d6aa3f Hide tooltip when posting a profile to Facebook
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 10:32:02 -08:00
Gehad elrobey
ad60ca84ee Export the XSLT based exports in a new thread.
The XSLT based exports can consume long time while applying the xml format.
This time can make the GUI unresponsive. Simply call the export functions
in a new Thread.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 10:15:12 -08:00
Miika Turkia
b01f14efab Fix maximum depth on CSV import
Commit d329420d55 changed the name of the
header from "Max depth" to "Max. depth", so we need to use that in the
code as well. (The dive profile is not drawn if we do not have max
depth.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 10:14:48 -08:00
Lubomir I. Ivanov
8eb25f6700 DiveMeanDepthItem: fix bad translated depth units
probably just a typo; taking the value of a (char *) will return
the first char (or byte).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31 10:13:36 -08:00
Miika Turkia
bc6569f10f Include iPhone companion app to user survey
We should mention the iPhone companion app either alongside the Android
app or at its own line if more precise information is wanted. I suppose
this text change should be enough as we should get more precise
statistics of usage of these apps from the server logs.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 22:48:08 -08:00
Dirk Hohndel
39e68c795c Try to make the Facebook interaction be more pleasant
Show either the login screen or the disconnect button, plus some text that
explains what the user is expected to do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 22:36:49 -08:00
Dirk Hohndel
13e2be5889 Use the 'popup' style Facebook login window
This fits much better in the preferences dialog.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 22:09:50 -08:00
Dirk Hohndel
cb6bda4e0c Compile Facebook support when building with Qt5
Now that Facebook approved our use of the API, we can build this by
default.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 22:08:50 -08:00
Dirk Hohndel
d8e5e1922f Minor whitespace change - this line was getting long
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 22:07:36 -08:00
Dirk Hohndel
86c25b7157 Fix update message popping up when there is no new version
I was just missing one key phrase to check for. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 17:23:59 -08:00
Gehad elrobey
f16f4e2f6e Don't go to edit mode if the dive notes field didn't change.
The maintab view should be consistent; some fields just go to edit mode
whenever they acquire focus and most of them wait till their values are
changed.

Change the dive notes field to be consistent with the other fields and
only enter edit mode if its value is changed.

[Dirk Hohndel: changed to use same_string()]

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 17:03:03 -08:00
Anton Lundin
e9558d848c Prevent crash on shutdown
We always call reply->deleteLater(), so we where actually calling delete
on a stale pointer, that caused subsurface to crash on shutdown.

Reported-by: Sergey Starosek <sergey-starosek@yandex.ru>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-30 07:16:12 -08:00
Dirk Hohndel
07e94c67e0 Make sure the index is valid
There are reports that the replace calls can cause the application to
crash. This doesn't seem to make sense, looking at the code - this change
shouldn't make any difference. But it makes it even more clear that there
shouldn't be any possible scenario in which we call replace with an index
that's out of range.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-29 15:26:24 -08:00
Dirk Hohndel
cd992bd14a Don't reimplement the clear() method
Much easier and clearer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-29 14:00:19 -08:00
Dirk Hohndel
4e40872fc0 Prevent potential access to uninitialized variable
If we have a dive with no data (e.g. from a failed import), we might never
assign a value otherwise.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-29 13:37:32 -08:00
Tomaz Canabrava
5649086d61 Make search and close shortcut for user manual work on Mac
When the help dialog appears, remove the shortcuts for filter and close from
the main window so that the identical keys for the help window work. This is
not necessary on other platforms, but on Mac it appears to be required.

[Dirk Hohndel: Tomaz had a slightly different approach of removing the actions,
               instead I changed this to just modify the shortcuts]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28 14:30:19 -08:00
Dirk Hohndel
eaec0bc842 Small changes to the mean depth text
Add a tiny bit of white space to the left and display the unit as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28 13:35:49 -08:00
Tomaz Canabrava
7f1373ea6d Implement the mean depth text
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28 13:35:43 -08:00
Tomaz Canabrava
343b82708e Remove dead code
We changed this MeanDepthLine to the MeanDepthCurve (or something),
no need to keep old code around.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28 12:29:47 -08:00
Tomaz Canabrava
ee4f9494f2 Hide ruler when in ADD or PLAN mode.
This ruler shouldn't appear in ADD or PLAN mode, it's a bug
and may crash things.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28 12:29:33 -08:00
Anton Lundin
991531d847 Let notes expand to full with fbsupport off
This hides the whole QWidget with the share-to-fb button in it. This
lets the Notes field expand to the full width.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28 07:36:34 -08:00
willem ferguson
bc7d233365 User manual: Tying up loose ends
As the heading above says.
1) Place user manual option in main menu at the bottom of the Help submenu.
   It is more easily seen in that position.
2) Replace two images. I forgot one of the images that had been changed to F20 format.
3) A few small changes, including in the systematic description of the main menu.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-27 22:58:38 -08:00
Dirk Hohndel
6a161b532e Fix UI issues and warning
Commit e219bc70f8 ("Refactor dctype -> divemode") introduced a few issues.
For one thing it causes a warning about incorrect use of zorder - I don't see
why this would be needed here, so I simply removed it.

Secondly, it adds a new, automatically named layout element that therefore gets
handled by our "consistent margin" code which creates a messy layout for the
Dive Notes tab. This patch gives that horizontal layout a useful name and adds
it to the list of "zero margin" layouts.  Signed-off-by: Dirk Hohndel
<dirk@hohndel.org>

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-27 20:19:21 -08:00
Lubomir I. Ivanov
66fdb2b89d diveplotdatamodel.cpp: use space before sensor index
the manual uses "Sensor 1:", not sure if it breaks anything.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-27 07:21:49 -08:00
Lubomir I. Ivanov
dee91a96aa divelogimportdialog.cpp: remove extra line at EOF
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-27 07:21:27 -08:00
Lubomir I. Ivanov
96575b2366 divelogimportdialog.cpp: more capitalization of acronyms
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-27 07:21:17 -08:00
Miika Turkia
6edc458e83 Fix crash when no dives were selected for downloading
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-26 21:33:09 -08:00