We appear to be missing the correct dll. I'm out of time trying to track
this down, so I just switched Subsurface to access divelogs.de via http on
Windwos.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previously we would overwrite the gasmix as well as start and end
pressure even when editing multiple dives, which clearly is wrong.
Fixes#364
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This gets the behavior close to what we really want.
- scroll wheel no longer enters edit mode when over the tabWidget
- scroll wheel doesn't modify dateTimeEdit, nor does it enter edit mode
- scroll wheel still scrolls both the notes and the full widget
The only oddity is that when clicking on either the dateTimeEdit or the
tabWidget we don't immediately turn on the 'being edited' warning (as we
do for all the other widgets). For those two widgets the user has to press
a key before edit mode starts.
I think this Fixes#176
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Ideas-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When toggling autogroup in the menu we ended up setting the NO_TRIP flag
for dives that were removed from a trip that was created by autogroup. So
toggling things on and off and on again meant no more auto grouping.
Fixes#337
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user had never set up the language selection they could end up
getting the "language changed, restart required" warning even if they
didn't touch the language setting at all.
This fixes that issue by assuming that UseSystemLanguage is true if the
setting is undefined and only comparing the selected language if that
selection actually matters (i.e., UseSystemLanguage is false).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The open call will tell us what we need to know. Obviously we can't open
a file that doesn't exist. This saves us one stat() or Windows
equivalent.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Casting a pointer to a size_t variable to a pointer to int is wrong on
big endian machines. Not that I expect anyone to compile Subsurface 4
for Mac on PowerPC 64-bit, but just in case... Who knows, we may have
some Solaris-on-UltraSPARC or AIX-on-POWER6 users.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't need to get it for every file, since it's the same. This also
avoids leaking temporary files and memory if the stylesheet cannot be
found.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No need to allocate memory for something that will show in debugging
only. Besides, qDebug() of a QString adds quotes around it, which we
can do without.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Older libzip lack zip_get_num_entries. Thanks to Lubomir for spotting
the version macro.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Save and restore scrollbar position on editing the dives.
I think this is not the best place for it, but I'll leave
it here for a while untill I find a better place.
Fixes: #343
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes sure that the minimum time / depth is
correctly set on the profile planner.
Fixes: #358
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the same code that Dirk used on the Mac to fix the
bad-behavior of Cylinder Selection, this time applyed to
Weigthsystem selection.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch uses the class created by the previous patch
to get rid of the CSS and be really desktop native. it
fixes a lot of stuff in non-blue-styles and throws
a lot of code away. <3
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The css was done by me in the first days of subsurface for Qt, and it
was a code that I was never proud of. Mostly because I tougth at the
time that it was better to write it into CSS than to create a new class
just to take care of the size of the default cell height on a tree view.
Now I see that it was a biased approach since it created issues on
dark color schemes and it also didn't make a 'native' experience on
Gnome or OSX, only on KDE.
This fixes that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The forward declaration of 'struct device_data_t' is not
needed as it already comes from '../libdivecomputer.h'.
Reported by the program cppcheck.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
ProfileGraphicsView::plot_depth_profile():
The iterator limit check (i < 7) should precede the indexing
(increments[i]).
Reported by the program cppcheck.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Introduce some harness in ProfileGraphicsView::plot_one_event, so we
detect bad stuff and bail, instead of dereferencing undef pointers.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
prepare_dives_for_divelogs() did a silly thing, which I was
responsible for. When populating 'tempfile' we benefit
from QString, but then return a pointer to a local variable
(char *) without alocating it on the heap. This resulted
in undefined behavior, as we don't know the lifespan of that
local memory on the stack.
Patch fixes that by using strdup() and freeing the memory
when/if needed.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When trying to remember a newly manually created dive across the
sort_table() call I abused the dive->selected flag and didn't clear it out
afterwards (most likely thinking "hey, I'm calling selectDive() on this
anyway").
This caused the UI code to correctly mark the dive as selected, but when
it called down to the C code to keep the internal data structures in sync,
that code didn't update amount_selected as it thought this dive had
already been selected. And that caused other parts of the code to get
confused, which manifested for example in the failed upload to
divelogs.de.
So this clears out the flag after abusing it to remember a dive. Maybe we
should add a 'remembered' flag instead, but for now this fixes the issue.
Fixes#351
Initial-fix-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We use the same dialog for both the Subsurface WS and for the
divelogs.de one. Instead of the old title (which suggests download)
we can use a more generic one - "Webservice Connection"
This makes it easy for us to maintain a dialog that can both
upload and download data, while the dialog title is descriptive
enough.
Fixes#352
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If rowCount() is 0 we get an assert:
ASSERT: "last >= first" in file kernel/qabstractitemmodel.cpp...
To solve that we wrap the beginRemoveRows() call in a bnrach:
if (rowCount() > 0) {
...
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clang yelled about it, and it looks prettier. It also felt kinda strange
to explicit initialize the first element to zero and the rest to zero
implicit.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Initialize diveplan.dp to NULL, so we know that we will bail in
drawProfile, when the initial settingsChanged is fired.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Give user the possibility to re-enter username and password
after unsuccessful upload due to wrong credentials.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Initialize stagingDive to NULL, so we know that we will bail in
createTemporaryPlan, when the initial settingsChanged is fired.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
At least username and password have to follow each other.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Post downloading we have an 'Apply' button that can be clicked
to apply/merge the downloaded dives. When uploading we
rename the button to 'Done' and enable the button if the
upload was successful. The 'Cancel' button on the other hand
becomes disabled.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use qDebug() instead of fprintf(stderr, ...) in
prepare_dives_for_divelogs().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The correct way to stop the upload/download is to use
reply->abort(). If the dialog closes, post exec()
we check if the reply 'isOpen' and abort and delete it.
Without this modification the program seems to crash
as the connection is still in action and it attempts
to read an already deleted file.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We store the user/pass for 'Apply' when downloading, but
we also want to store these values for 'Upload'.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Only show a filename in the error report if such was previsly
set. We also add a string for translation, that is shown
in the main window.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The 'Content-Disposition' header, requires that we pass
'name' but also a 'filename' field.
Suggested-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
prepare_dives_for_divelogs() is based on GTK / C code
where we used GLib methods to generate a temp zip file.
Qt has QTemporaryFile, but it seems there is some sort
of a problem when using with with zip_open
(ZIP_CREATE considered) or at least in this particular case.
To workaround that, we generate a random name ourself with qrand()
and simply pass it to zip_open (with ZIP_CREATE) and then return
the filename.
Also (!), there is memory corruption when trying to return
'tempfile'. This wasn't the case with the C compiler,
to my knowledge. Regardless of this fact the generated
zip does not look corrupt.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
prepare_dives_for_divelogs() comes from the GTK version, originally.
The upload seems to fail at this point with an error.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This patch adds commands to the dialog buttons, to apply
(and possibly show an error if 'parse_file' fails',
reject, or show help - which is a link to the 'divelogs.de'
website.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This is so we can default to the GF's from the preferences. We need the
bail handler in createTemporaryPlan, because its triggered when we
change GF's, and if we don't have a stagingDive there, we will access a
NULL-pointer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When got auto-rescaling of the depth scale, always reset the depth scale
to what the profile would suggest. This introduces a concept of user
requested minimum witch we will update and not scale down to lower than.
Reported-by: Henrik Brautaset Aronsen <henrik@synth.no>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>