The macro BEHAVIOR expanded to "QList<int>()". This was used to
generate temporary QList<int>s with constructs such as
BEHAVIOR << COLLAPSED << EXPANDED
Instead, simply use initializer lists such as
{COLLAPSED, EXPANDED}
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There was no reason to do this in a macro. Let the compiler decide
if it wants to inline or not. Note that for consistency with the
Qt functions, collapsAble was replaced by collabsIble.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When importing a dive (using import from logfile) and it is a
ssrf/xml file that contains the autogroup setting, the autogroup
is effectuated in the dive list. Not sure that I like this
behavior, but thats the way it currently is. Simply wrong
is that in this case the menu item toggle is not adapted
so we end up with a dive list that is autogrouped, but
the menu toggle is off.
This can be solved by setting the UI toggle in a more central
location.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
A very simple commit to start 2018. When hitting new logbook from
a currently open logbook, and the current dive has tags filled in,
they stayed around in the UI. Just clear them. Further, delete
an unused variable.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
If the BT dialog hasn't been shown, the device name was taken from
the text field, which contained a formatted string. The device open
would then fail.
Fixes#1002
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This fixes a bug reported by Willem that removing waypoints
using the right click context menu makes the cylinder
pressure lines partly disappear.
The reason was that clicking a dive handler disables the
pressure interpolation (and other things, controlled by
shouldCalculateMaxdepth). This is turned on again upon
the mouse release event. This event is not triggered when
selecting in item from the context menu (like remove
waypoint or gas selection) so we need to send it manually.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
See also commit c032006d91. Compare functions passed
to sort functions need to compare for less-than and not
less-or-equal.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
In MainWindow::on_actionCloudstorageopen_triggered(),
getNotificationWidget()->hideNotification() was called, thus hiding
any error message produced by the cloud code. Notably, the information
"Cannot sync with cloud server, working with offline copy" was
not shown.
Therefore, remove this call. Note that on cloud save messages were
not hidden.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
DiveLocationFilterProxyModel::lessThan() used less-or-equal instead
of less-than comparison. This can lead to subtle bugs if two elements
compare as equal.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Introduce toggle buttons which mean "filter all dives except
those fulfilling the selected criteria".
The old code used to check for rowCount() == 0. This should never happen,
because there is always a row "empty field". This check was moved into
the preamble of the functions to seperate it from the actual logic.
Fixes#435
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Let the menu introduced in commit 5e86442bab
pop up on right-click instead of button-click.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since these classes do not possess any signals/slots,
these macro are unnecessary.
Likewise, the friend declaration in TagFilter is useless,
since the corresponding fields are in the base class.
Fallout of commit 1a4e7ad0dd.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We aren't really consistent. And I don't do this often enough. But based
on a few things that I saw in a recent commit, I wanted to at least fix
those. And then of course fixed everything in those two files.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
To every filter list add a menu button that allows selection of all,
selection of none or inversion of selection.
Implements #435.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The TagFilter, BuddyFilter, SuitFilter and LocationFilter classes
all did essentially the same thing. Therefore, factor out common
code / objects into a base class FilterBase.
The new base class stores a pointer to the filter model. It was
felt that this is simpler than introducing virtual methods.
The only thing the *Filter classes now do is setting a label and
in one case a tooltip. Thus, in principle, they could be removed
completely, but let's keep them for now.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The more complex handling is no longer needed because:
- Keyboard tracking for gfhigh/low UI fields was switched off here:
030c094854
- GFhigh was limited to 40 here:
53fffe0ce3
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
And why this one? Well, while this include is renamed in Qt 5.10
and gives deprecated compile warnings. And as it unused anyway, just
remove it.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Besides being the right thing to do (code reflects reality), it
silences a compiler warning.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This implements different zoom levels for the dive photos tab as
suggested by Stefan Fuchs <sfuchs@gmx.de> in #898.
The zoom level can be changed using a slider or CTRL+mousewheel.
Zoom levels range from a third of the standard thumbnail size to
thrice the standard thumbnail size.
Thumbnails are cached in maximum resolution and scaled down on
the fly. Because the profile widget took its pictures from the
photo list model, an extra picture copy with a fixed size had
to be introduced.
The UI is still a bit crude.
Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Internal floating point (FP) calculations should be performed using double
unless there is a very good reason. This avoids headaches with conversions.
Indeed, the vast majority of FP calculations were already done using double.
This patch adapts most remaining calculations. Not converted where things
that were based on binary representations and variables which weren't used
anyway.
An analysis of all instances follows:
core/plannernotes.c, l.404:
This was a comparison between two floats. On the left side, first an integer
was cast to float then multiplied with and integer and divided by a constant
double. The right hand side was an integer cast to a float. Simply divide by
1000.0 first to convert to double and continue with calculations. On the right
hand side, remove the cast, because the integer will be implicitely cast to
double for comparison. This conversion actually emits less instructions,
because no conversion to double and back is performed.
core/planner.c, l.613:
Same analysis as previous case.
subsurface-desktop-main.cpp, l.155:
A local variable representing the version OpenGL version. Turn this into
integer logic. Not only does this avoid dreaded FP rounding issues, it also
works correctly for minor version > 10 (not that such a thing is to be
expected anytime soon).
abstractpreferenceswidget.[h/cpp]:
A widget where the position is described as a float. Turn into double.
desktop-widgets/divelogexportdialog.cpp, l.313:
total_weight is described as float. Use double arithmetics instead. This
instance fixes a truncation warning emitted by gcc.
The MainWindow::setTitle() function was passed an enum, which depended
on whether existing_file is set or not. The check can be (and was!) done
directly in setTitle(). Therefore, remove the whole enum.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Before, we did not look at the path of the filename to export
to but we should write the images there and not in pwd.
Fixes#931
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Title is self explanatory.
[Dirk Hohndel: small edits to remove typo / improve readability]
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
ATM we were giving preference to a gps fix taken during dive time over
another taken before dive start time (proven both in predefined
SAME_GROUP 6 hours range).
While this logic is right for a static boat or a shore dive - as it
ensures a correct position - will fail for drift dives or dives where
boat changes its position during dive time.
Instead, will choose the gps fix closer to the dive start time.
fixes issue #666
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't change into a directory just to see if it exists.
Remove unnecessary braces of one of the changed if statements.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This fixes an actual bug, where the current image dir would only be
remembered on closing the program.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The progressbar was not hidden on failed save to cloud. In return
remove an unnecessary variable on loading from cloud.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Calculating variations when in recreational mode doesn't make sense, and can
prevent variations from being calculated when switching back to Buhlmann or
VPM-B modes.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
This reenables the computation of plan variations but now in a separate
thread. Once finieshed, a signal is sent to update the notes.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Small change to allow the dive pictures list to use the available
space if one resizes the window or switches to different mainwindow
view.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>