Commit graph

3943 commits

Author SHA1 Message Date
Dirk Hohndel
cd1884b29c Use neutral color for "no SAC information"
In commit 31d1d1f421 ("Don't change pen color when for zero SAC") Robert
continues to use the last SAC color (which certainly was better than
switching to dark green for "extremely low SAC rate"). But I think it
makes even more sense to mark it as neutral - so I picked a gray.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-25 13:00:58 +09:00
Dirk Hohndel
1ff309c9a1 Fix location edit UI issue on Mac
For some reason the Mac doesn't create an "activated" signal when hitting
enter/return on the drop down. So we simply manually send this and now you can
select the site with enter/return just like on Linux or Windows.

Fixes #953

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-25 12:19:18 +09:00
Robert C. Helling
31d1d1f421 Don't change pen color when for zero SAC
When for individual plot entries the SAC is zero this comes
from gas changes and the SAC calculation needing a bit more
pressure data and not from the diver switching to freediving
mode. So we shold not change the pen color on the pressure
line for that but pretend we are still breathing at the
previous SAC.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2015-10-23 23:50:21 +02:00
Dirk Hohndel
569cfe1bc8 When calculating the offset, both times are localtime
So we don't need to take the relative time zone into account.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-22 07:04:32 +09:00
Dirk Hohndel
c0fb98711b Don't clear out the time stamp we remembered
Otherwise the offset calculation ends up completely wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-22 07:04:32 +09:00
Giorgio Marzano
44bdcffcd4 Display divetime according to dive mode and translation
Many time stats in maintab display also seconds in short freediving

Signed-off-by: Giorgio Marzano <marzano.giorgio@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-18 17:37:49 -07:00
Giorgio Marzano
166d587197 Enable/Disable toolbar element in freedive mode
Signed-off-by: Giorgio Marzano <marzano.giorgio@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-18 17:37:49 -07:00
Lubomir I. Ivanov
ff439396a5 Print: remove the warning about editing bundled templates
Bundled templates can no longer be edited, because
copies are made in the user directory. The TemplateEdit
special case warning is no longer relevant so it can
be removed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-18 17:37:49 -07:00
Lubomir I. Ivanov
894e7d5d39 Print: copy the bundled templates to a safe location
This patch adds couple of helpers to retrieve the template path in
the application bundle (getPrintingTemplatePathBundle())
and the template path in the user directory
(getPrintingTemplatePathUser()).

Once the print dialog is initiated for the first time the contents
of the bundled template path are copied to the user template path
using copyPath(). No overwriting of files will occur.

The PrintOptions and TemplateLayout classes then only use
the user path for retrieving templates.

Fixes an issue where the bundled templates can be locked as read-only
on OSX and Linux.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-18 17:37:49 -07:00
Robert C. Helling
dbd07af59f Mark dive type list for translation
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-14 13:15:40 -07:00
Sergey Starosek
5e93e8c4af Add app icon to statistics window
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-14 05:51:13 -07:00
Dirk Hohndel
7be0e1b1e7 Keep state of reverse geocode button in sync with GPS data
So if the data is removed or invalid, don't allow reverse lookup.
Otherwise do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-13 13:34:16 -07:00
Dirk Hohndel
b7bf5d0fb2 Only allow reverse geo lookup if divesite has GPS data
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-13 13:29:44 -07:00
Lubomir I. Ivanov
acbdd0edc3 usermanual.cpp: use default QWidget theme colors for text selections
The default selection text/background colors (also when seaching)
are black/light-grey in QWebView, for some reason.

To solve the issue we pass a stylesheet that makes use of the
default palette's highlight() and highlightedText() from QWidget.

Fixes #797

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-13 08:18:51 -07:00
Rick Walsh
106a1ff5d1 Planner: add recreational mode tooltip
Recreational mode isn't self-explanatory.  Add a hint for the user.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-12 09:44:56 -07:00
Lubomir I. Ivanov
d0d83d5d7d profilewidget2: fix line width when printing on OSX and Linux
On OSX and Linux only, the cosmetic width of the QPen
on profile axes does not work and is weirdly dependent on the
fact if a printer is installed or not. Possible Qt bugs at hand.

The same is not present on Win32.

To solve the issues we add setPrintMode() in DiveCartesianAxis
and call it for all instances of the class in ProfileWidget2.

This patch also moves gridPen() as a private member function
of PartialGasPressureAxis as it now needs to access member
variables.

Fixes #943

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-11 10:32:11 -07:00
Lubomir I. Ivanov
11e38710e4 profilewidget2: add resetZoom()
resetZoom() is now a new method that is called both
when 'printMode' is updated or when the dive is re-plotted.

Fixes a bug where zooming in on the profile and then
printing the dive has the profile at the wrong zoom level (makes
the profile look smaller).

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-11 10:31:25 -07:00
glerch
67c306b527 Fix main window size, position, and state
Now size, position and state should be preserved correctly.

Signed-off-by: glerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-09 12:36:44 -07:00
Miika Turkia
c0ac73a478 Fix a crash when editing manually added dive
I have manually added dives from an ancient version of Subsurface.
Trying to edit these caused Subsurface to crash due to comparison of
string of dc.model that did not exist (to a static string). And further
down the execution path we were crashing as there were no samples
associated with the dive.

See #941

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 16:42:27 -07:00
Lubomir I. Ivanov
4ed418dcc2 Fix font issue on Windows 10 in the weight widget
Column headers were drawin in a smaller font. This fixes it for no
apparent reason.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 11:52:37 +01:00
Dirk Hohndel
f24ab1dfa2 Refresh the screen even if started with no valid files
If no command line argument is given and no default file is set we didn't
call refreshDisplay() and so the information widget stayed enabled even
though no dive was shown which looked really weird and was inconsistent
with what we showed when the user closed an already open file.

This makes the behavior more consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 07:40:29 +01:00
Dirk Hohndel
37445df0b9 Clear date and time when no dive is shown
So far we showed bogus date and time - whatever time it might be in UTC at
midnight 2000-1-1 in your timezone. Instead we now show a discrete little
"-" in both fields.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 07:38:26 +01:00
Tomaz Canabrava
ef2765d0c4 Update UI on dive site widget when retrieving taxonomy
[Dirk Hohndel: slightly refactored this commit and the previous one to
               make the code actually work and make the split across the
               two commits more reasonable]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 06:28:45 +01:00
Tomaz Canabrava
2eed9c0b9b Move the algorithm to divesite.cpp file
This shouldn't be on the maintab.cpp, this file is already too convoluted.

[Dirk Hohndel: slightly refactored this commit and the next one to make
               the code actually work and make the split across the two
               commits more reasonable]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 06:27:38 +01:00
Tomaz Canabrava
ebf2407db6 Add the labels for taxonomy in dive site widget
Nothing to see here - just added the widgets on the .ui files

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 06:17:40 +01:00
Tomaz Canabrava
7bf398549b Passwords fields should have echoMode Password
so nobody can see what's being written.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 18:45:00 +01:00
Dirk Hohndel
f8279249b1 Add missing tooltip for the reverse geo location lookup
This sadly adds another string for tranlsations

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 18:42:21 +01:00
Lubomir I. Ivanov
afed054d82 modeldelegates.cpp: add custom highlight drawing in location items
There is a problem in LocationFilterDelegate::paint(), which
can manifest as very light background with white text in the
combo box from which the user selects a location - a
Windows 7 test case.

The main offenders are the drawControl() call which draws the
selected item background very bright and the fact that
the highlightText() is returning white.

It seems as if the combination of these is just wrong, theme
wise.

e5fa424a and 44762c42 fix that by branching Windows by version,
but do not cover the case where the user can use a custom theme -
e.g. dark selection highlight on Windows 7.

This patch skips drawControl() and draws the highlighted item
background manually. It makes it look similar to the small
tag highlights in TagWidget.

The patch adjust slightly the X offset of the drawn text.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 18:35:37 +01:00
pestophagous
e522dd1a68 Preserve profile toggle-button state zoomed_plot across sessions.
Fixes #912

Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 08:34:47 +01:00
pestophagous
4f287b6f80 Bugfix for checkboxes in DC download window GUI repaint delay.
Bug was due to incorrect use of QAbstractItemModel::index.
The arguments should be in (row, col) sequence but we were
mistakenly passing in (col, row).

Fixes #820

Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 08:34:37 +01:00
Tomaz Canabrava
4b3a117401 Ask the Preferences Widget to show and be visible
The 'show' call only makes the dialog visible, but if it's
covered by any other window that's not from *this* program
it could still be hidden in some OSes. the call to raise()
asks the window manager to make the widget to be on top of the
widget stack.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 07:57:09 +01:00
Tomaz Canabrava
d120755d15 Simplify code
Do not call the setAttributte *everytime* the Preferences
is called, call it once on the constructor.

Also, no need to call the LanguageModel::instance() on the
instance method, it will be already called on the constructor
it seems that it's a leftover from a long while.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 07:56:44 +01:00
Miika Turkia
0db9bbdea7 Fix typo on string formatting option
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 21:22:58 +01:00
Tomaz Canabrava
786f164046 Be way more carefull when copying dive site
I don't know how I was not shot regarding on how broken the
old behavior was.

The new behavior:

1 copy the old_dive_site on top of the current_dive_site
  only if the current_dive_site was actually a new uuid,
  created by that method.

2 if the current_dive_site is an existing one but it doesn't
  have gps coords, copy only the gps coords.

This fixes existing dive sites copying notes and coordinates
from the old_dive_site.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 21:17:03 +01:00
Tomaz Canabrava
20f8c89d64 Remove unused code
This was needed when maintab had to thinker every little aspect
of the dive site selection, which has not been necessary for quite
a while.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 21:15:51 +01:00
Dirk Hohndel
9d8b0addf9 Correctly copy preferences
When just assigning one structure to the other we copy the string
pointers. If we then modify those strings in the copy, we happily free
the strings of the original. And then resetting the preferences equally
happily reused those strings, pointing to long since freed memory.

I think what I did now is excessive for the current use case in that it
copies a ton of strings that are unset in the default_prefs. But I figured
this is a rarely used function and I might as well do it correctly.

Also, once we implement multi user support with per user preferences we
will be copying completely populated preferences around (at least that's
my guess).

Fixes #940

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 10:19:43 +01:00
Dirk Hohndel
2e6afb8e89 Correctly handle the webservice userid in preferences
Because of the way that the webservice userid can be saved both in the
preferences and in a data file it was treated differently than other
preferences settings - which prevented the reset of the preferences from
actually clearing it.

This patch makes sure that if the preferences are reset the preferences UI
reflects that. To make this work the data file loading functions can no
longer be allowed to just simply clear out the userid preference value
just in case they might load a new one.

Fixes #939

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 08:53:54 +01:00
Dirk Hohndel
e5fa424a67 Only check Windows version when building on Windows
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 00:23:22 +01:00
Dirk Hohndel
d567859e87 Show error messages during start up as soon as the main window is shown
When the user has setup cloud storage as their default file but didn't
store the cloud storage password an error is created but not shown until
another error happens - that's very confusing for the user.

This patch fixes that.

Fixes #938

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 00:01:30 +01:00
Dirk Hohndel
5861da0bce Remove unused part of the geocoding preferences
And always turn on geocoding. The user needs to trigger this manually
anyway, so there's no point in having the extra option in the preferences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 00:01:30 +01:00
Tomaz Canabrava
44762c4252 Do not use White font on newer Windows versions
It isn't readable with the very light background.
Which Windows versions this should be used on is a guess right now.
So far Windows 7 or newer, but that may need adjustment.

Fixes #935

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 00:01:30 +01:00
Tomaz Canabrava
437469e8ff Do not incorrectly use the UUID as the dive name
for some reason sometimes activating the dive via tab
or enter gave us the wrong column, so simply select the
right one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 00:01:30 +01:00
Dirk Hohndel
f0a176149a Don't use the numerus version of tr()
It looks like our tools create a .ts stance that transifex can't deal
with.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-05 16:35:09 +01:00
Dirk Hohndel
021af81443 With no filename set pick reasonable directory for Save as
If the user has no default filename set and starts Subsurface without a
filename, the directory that is opened with Save as ends up being the
current working directory of the executable, which might be its
installation directory - which in general is not a good place to save data
files to.

With this change we pick the directory which is usually used for the
default file, which should give us reasonable places on all OSs.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-05 16:35:08 +01:00
Dirk Hohndel
f8e9c975b7 Use copy_string() to avoid potential crash
If the trip has no location or notes calling strdup on NULL is just a bad
idea.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-03 07:19:55 -04:00
Dirk Hohndel
6b9aea1b96 Remove unused member
This isn't the bug that Coverity showed, but it was found by looking at
CID 1307969

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-02 17:30:21 -04:00
Dirk Hohndel
6b0d9adb61 Avoid potential uninitialized access
I don't think this could ever happen but hey, let's be sure.

Coverity CID 1307985

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-02 15:42:43 -04:00
Dirk Hohndel
dde82a6ba4 Avoid potentially uninitialized member
Coverity CID 1325281

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-02 15:22:55 -04:00
Dirk Hohndel
a94c84d598 Undo/redo of dive deletion needs to handle trips as well
If we delete dives that were part of a trip, that trip may get deleted as
well. So if we undo that operation we need to bring back the trip, too.

This also deals with a bug in the original code that did the delete both
in calling code (in divelistview.cpp) and in the redo function. Because of
the nature of the delete this didn't really matter but it is of course
wrong and with the new code it would in fact cause an issue.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-02 14:50:12 -04:00
Linus Torvalds
7c427dcc02 Add support to "split" a dive with surface time in the middle
Right now this requires that

 (a) the dive have only one divecomputer associated with it.

     Trying to split a dive with multiple dive computers would be *much*
     harder to do, since you'd have to try to line up the surface
     interval between computers etc.  So just don't do it after
     downloading multiple dive computers for the same dive.

 (b) there must be at least one minute between the sample that came up
     to the surface and the sample that goes down again.

     If you just peeked your head above the surface, don't try to split
     things into two dives.  Maybe we can relax this for freediving or
     something.

also note that the split dive will only get new numbering if the dive
that was split was the very last dive in the divelist.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-01 22:29:43 -04:00