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>
When switching between metric and imperial, we should also show that the
different units are switching too. This signals the greyed out
radio buttons to switch to the right system.
Fixes#347
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The groupBox-es got renamed, and thus the unit-systems radio-buttons
was enabling/disabling the wrong buttons.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we start to define a gas, we should use that one by default instead
of air.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Silly mistake in commit 93b5c0cd14 ("Finish download from divelogs.de"):
parse_file() doesn't call process_dives() - the caller needs to do that.
Fixes#344
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When removing the selected dives from their trips, it makes no sense to
check if the pointer was actually pointing at a valid dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Windows platform translation/ folder contains Qt translation
files as well. This results in extra languages in preferences.
From now we filter these translations and choose only those matching
^subsurface_*.qm$
Fixes#339
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Show language instead of country, sort the list.
Show country in brackets to avoid ambiguity for locales like
de_DE and de_CH.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Left to do is to remove all the auto-added deco-points, aka the ones
that had entered==FALSE before we created a dive from the plan.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It previously always started with o2 in air, now we start with 0 as its
the same default as in the cylinders too, which fixes a uninitialized
index there too.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the scale is too big or too small, adapt the scale automatically.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
otherwise the previous selected dive is still visible in the profile
view. clicking on edit crashs subsurface: null pointer dereference in
editCurrentDive as it uses 'current_dive' which is null.
Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use proper case and subscripts for gas names on profile legend.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Telling Qt that the "Preferences" menu entry is
QAction::PreferencesRole will make it be moved to the System menu on
Mac, for example.
Fixes#327
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is far from perfect.
Avoid a weird warning when total = -1 is passed into the progress bar.
Enable the Accept button once the download completes.
Merge the downloaded dives into the existing dive list on Apply.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt has a really strange API for directories. when you create a QDir
and set's the currentDir on *that* QDir you created, it's for the
whole application and not just for that variable. Then when the
variable is out of scope, the directory doesn't change back - ugh.
The solution is not to call setCurrentDir on the newly created QDir (which
was quite good since it's also a code cleanup. )
[Dirk Hohndel: modified to undo the far less elegant fix I had made in an
earlier commit]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These complete the ability to select languages from the preferences panel.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a filter option to the Language Chooser.
if you choose filter, only the filtered options will appear.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code that should set the preferences was actually retrieving it,
this will correctly set it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When the user first opens the application the default language is
selected; this can be changed to a hardcoded one by going to system
preferences and choosing the one you want.
Restart required.
Fixes#136
[Dirk Hohndel: whitespace fixes, removed qDebug() call, rephrased the
message displayed prompting the user to restart.]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We do not support rows larger than a single page as the
PrintLayout algorithm will enter an infinite loop,
therefore we put a limit of 15 lines for the location text.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch improves the algorithm when estimating where
to put the new page header in the table and how we move
larger dive rows on a new page. It now performs a couple of
'passes', where the first one processes the table and the
second one is used to compensate for the lost space.
Fixes#326
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
setTitle() works with an enum that can be fed different values,
and other we may have eventually. For example not only "app title",
or "app title: filename", but others, like dates, certain app status
and so on.
Patch fixes an issue where deleting a single dive in the divelist
resets the title to "Subsurface" only. clearUpEmpty() should only
call setTitle(MWTF_DEFAULT) if no file is currently open.
It also adds a safe-guard to revert back to MWTF_DEFAULT if
no file is open but setTitle is called with MWTF_FILENAME.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The whole procedure here is quite confusing.
Once we have our model populated, we need to estimate where
to put page headers (each page has one) and to do that we
store a list of indexes, where a page would begin (pageIndexes).
But since a row can end up being chopped at the end of a page
we move it to a new page and this particular part was lacking
compensation for the moved row's height, when storing the *last*
pageIndex.
For N number of pages we are losing N - 1 dives, or such that
were previously transferred on a new page.
See #326
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a different icon for a Bookmark Event, and it
also cleaned a lot of code. :)
See #300
[Dirk Hohndel: made the two icons slightly bigger]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes a better assumption of the location for the
legend in both View and Print modes. It also fixes a few oddities
that we used to have ( like hardcoded spacing ).
We are taking the scene().sceneRect() now into consideration to
better place it on canvas.
Fixes: #322
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I can't really see any point in passing a local loop variable around,
and copying a uninitialized pointer. Better use local variables there
and let the compiler optimize them away if it feels for doing that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Sets the limit for GF's in the preferences panel to 1<=x<=150 and color
it read if gf > 100. Remove the % in the diveplanner view that was
rejected for the preferences view.
The 150 maximum is needed because QSpinBox defaults to maximum 99.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The separator selector in the CSV import dialog was unused. This passes
the value into the xslt and adds ',' as possible value.
I'm sure this could be done much better (pass the actual character instead
of the index), but I couldn't get that to work and this does seem to do
the trick.
Also added a test dive to test this feature.
Fixes#321
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This backs off a little on what was added in commit c1102a38f3 ("More
gradient on the partial pressure graph.") - the numbers simply got too
busy. I also slightly changed the positioning of the numbers to be a
little more "natural looking".
Fixes#323
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The layout of Subsurface on Gnome 3 had a few flaws, since Qt and Gtk
are not really compatible. This implements a CSS that makes the use
of Gnome 3 more pleasant to the eyes.
Fixes#318
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Hitting apply in the preferences dialog causes a QList assert.
This led to DiveListView::reloadHeaderActions(), where
we have an out of range access.
Patch makes the column count match the header action count.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In the PrintLayout constructor we receive a pointer
of PrintDialog, but the type is incomplete, as we only
forward declare it in the class header. If we decide
to eventually call a method from PrintDialog we also
need to include printdialog.h in printlayout.cpp.
The patch also fixes a similar issue in printdialog.h.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
printTable() now emits a 'signalProgress'
to the PrintDialog's progress bar, but it has 3 stages (loops):
- pupulate a model
- process all rows
- render the table in pages
This requires that we also separate the progress in 3 stages
of 33%.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
estimateTotalDives() is used to calculate the total dives
to be printed, it requires a 'struct dive' pointer
and a couple of 'int' pointers for the iterator 'i' and
'total' return.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The dialog was missing a 'Close' button so we add it.
Also change the mnemonic of the 'Preview' button, as it
was the same as the one for print 'Print'.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
I don't recall why but this dialog ended with a fixed size
(setFixedSize()), so it has to be re-adjusted each time a change
is made in there. We resize it to compensate for the addition
of the progress bar.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We rename our old 'Print' button to 'Preview' (as it did just that),
and add a new one called 'Print' which does the direct printing,
by creating a QPrintDialog instance. Both buttons are located
on top of the dialog for now in a QHBoxLayout.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The entire dialog is 'temporary' and should be replaced,
so we slightly modify the comment about the PrintOptions widget.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This dialog will be eventually replaced by a better one, but
for now we can add a progress bar to it. Next step would be to
add separate Print/Preview buttons and emit progress bar updates
from the PrintLayout class.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We don't want to add the last sample - the dive plan functions want to
figure out the path to the surface by themselves and get confused by this.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch attempts to fix the 'click goes to 0,0' bug on the
globe. it moves a bit of code around and I particulary don't
like the way that we are dealing with 'EditMode', I think I'll
refactor that for 4.1. We are alredy dealing with a bunch
of states, maybe a State Machine will help on removing code-complexity.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Selects the newly added dive after adding it, it uses a
rather ugly hack that forced a unselected dive to be
marked as 'selected' so we can remember what was the
newly added dive, and select it after.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
NDL and TTS doesn't show up in the printed profiles, and it takes
significant time to calculate, so just don't do it.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This implements support for:
* uploading a zip file containing dives - untested
(the zip file must have been prepared elsewhere)
* downloading the dive list and the dive XML files
The networking part is finished, but it's missing the actual import of
the XML files sent by divelogs.de.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
The time out is 30 seconds from the start of the request or from the
last time we got any data from the server.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
QNetworkReply might emit signals after it's been told to go away. We
don't want to change the status after that.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Re-enable buttons that should be enabled by default, disable the others,
set the status to empty, make the progress bar go back to zero.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Just my OCD asserting itself. It looks cleaner this way, if the static
functions aren't interleaved in the middle of the WebServices class.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
One of the rules of using QNetworkAccessManager is to share it among all
users, since sockets and other state can be shared. Looks like Marble
doesn't allow us to set it, though, and it creates multiple instances.
I'll prepare an upstream patch to fix that sometime.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
An addition to the "Move dive notes edit message above the
scrollable widget" commit: Make sure the save/cancel message is
always displayed on top, regardless of which tab is selected.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Removed the "Visible:" header on the column selector. It doesn't
have to be there, and it's not in the similar equipment column selector
- PO2 --> pO₂ (and others)
- Use same initial case in the units selector in preferences
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds legend for the partial gass pressures if the
graphs are active. when enabling / disabling the square
that represents the color of a gas will also appear / disappear.
Fixes: #272
[Dirk Hohndel: minor changes to layout and whitespace]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The "Save" and "Cancel" buttons disappeared when scrolling to the
bottom of the notes widget.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the 'mouseClicked' didn't get any dives at the click-geolocation,
ignore it and do not try to select an empty selection. this was
causing a lot of issues when map-navigation.
Also, good deal of code cleanup.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
commit 3c064d5857 ("Make the message when editing a dive fit better")
kinda fixed the wrong problem. A better solution was suggested - just drop
the instructions regarding Cancel / Safe. It's quite obvious what to do
mow that the buttons are part of the message.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the names that we have in our "default set" we need to store the
English name so Subsurface will "do the right thing" when opening the file
in a different locale.
With manually entered names in a local language there's not much we can
do.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This piece of code didn't need to be on the for-loop, so
let's remove it out of it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old code ( slow++ ) ignored that each new dive-selection
we recreated all information on the profile window, so this
version ( a lot more verbose, I know. ) will ignore all dives
that are being selected and will only send the 'dive was selected'
information in the last line of the algorithm, instead of calling
it for each dive on the list of 'to be selected' dives.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Still trying to fix the same issue that I already tried to address in
commit e0b70b82ca ("Fix translation of weightsystem names") and before
in commit dc03b7e7d6 ("We need the correct context to translate event
names").
I missed the WeightModel. Hopefully this was indeed the real fix.
Fixes#312
(I know, I keep saying that)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should keep the message widget visible without horizontal scroll bar,
even on fairly small screens.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The button box on the bottom of the window made it a bit cluttered
on small screens, this patch uses the window of the MessageWidget
to show the butons - this way less space is used and things are better
spaced on screen.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a context menu to set the dive location
via the globe, being the dive with a coordinate or not.
It also fixes setting the dive location on edit mode.
Fixes: #315
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We add the "maximized" entry for the settings group "MainWindow",
and store it on close, so that the window state is the same on
the next run. But then also, we only store the window size and resize
to that size if not maximized. This attempts to preserve a "restored"
window size.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is very much the same as in commit dc03b7e7d6 ("We need the correct
context to translate event names"). I didn't pay enough attention when
reading the bug report and missed that the weight system names were also
not correctly translated.
Fixes#312
(I hope this time for real)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When editing air or water temperature, you are actually editing the
information in the active divecomputer structure. But the Dive Info shows
the summary data created from the temperature data in all dive computers.
For most people who will only ever have one divecomputer per dive this may
seem like an artificial distinction, but it's very important if you track
more than one computer.
So in order to have an edit reflected in what's shown, we must redo the
"summary creation" for data from the different divecomputers into the
summary fields of the dive.
Fixes#313
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt assumes that all strings are in the context of the class in which you
use them. So when we want to display the translated event names from
within the ProfileGraphicsView we need to make it explicit that these are
strings that come from the C part of the code.
Doing that showed another bug in the code where we foolishly compared the
translated text to a fixed string. Not smart.
Fixes#312
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Subsurface creates a lot of singleton instances on demand, but nothing
ever deleted them. Since they are singletons, these memory allocations
are technically not leaks. However, they clutter the output in valgrind
and other memory analysers, hiding the real issues.
The solution is to delete these items at exit. For the models and for
gettextFromC, the solution is to use a QScopedPointer, which will delete
its payload when it gets destroyed. For the dialogs and other widgets,
we can't do that: they need to be deleted before QApplication exits, so
we just set the parent in all of them to the main window.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>