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>
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>
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>
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>
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>
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>
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>
[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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
It was ugly to show trip and dive location when no dive
was selected.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is different from a dive site, as it's not a dive site. It's just a
normal string, while a dive site has gps coordinates.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes an invalid dive site selection when
you where typing the name of a dive site for your current
dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This may or may not look intuitive, but it can cause problems with the
zoom seemingly stuck all out (because of the timeouts). So instead stay
where you are. If the current dive site has GPS then its flag will be
bigger and brighter - so there still is visual feedback. But there's less
crazy zooming around.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now it correctly sets the same dive site instead of
creating a new one for each dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
But it will actually create a new dive site, not just rename the existing
one.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
First make sure all the data in displayed dive is correctly recorded,
otherwise things could get overwritten when the filter is removed and we
redisplay the current dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>