Commit graph

3828 commits

Author SHA1 Message Date
Thiago Macieira
1b5b562da8 Fix compilation with older libzip
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>
2013-12-12 03:33:34 +01:00
Tomaz Canabrava
5ac29bbe74 Save and reestore scrollbar position on editing the items.
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>
2013-12-12 03:26:39 +01:00
Tomaz Canabrava
9a497b1cb0 Keep track of the minimum Depth / time on the planner.
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>
2013-12-12 03:26:39 +01:00
Tomaz Canabrava
0b0860d24a Copyed the code from Dirk that solved the mac issue on cylinders.
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>
2013-12-12 03:26:39 +01:00
Tomaz Canabrava
0b5f9512ef Fix TableWidget ( equipment ones ) on dark scheme.
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>
2013-12-12 03:26:39 +01:00
Tomaz Canabrava
c5c44e3a82 Kill the use of CSS - Fixes a Lot of issues on dark color schemes.
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>
2013-12-12 03:26:39 +01:00
Dirk Hohndel
b87cfa9666 User manual: complete the language preference section
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12 03:17:34 +01:00
Tim Wootton
4d7e6430e8 User manual: add stub for Language Preferences
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12 03:13:38 +01:00
Tim Wootton
415e8bd877 User manual: Add section about Profile Pane context menu
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12 03:13:37 +01:00
Tim Wootton
0f23e3f04c User manual: correct typo in Uemis Zurich section
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12 03:13:22 +01:00
Anton Lundin
2419e074f4 Fix some whitespace damage
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 22:19:37 +01:00
Anton Lundin
78acf20848 Don't crash on loading tags longer than 127 chars
We didn't enforce a limit on tag length, but we would crash on a tag
longer than 127 chars.
This uses the xml buffer as scratch space. Don't really know if this is
fair, but it looks like it works.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 22:19:15 +01:00
Anton Lundin
160fb321bc Close warning first might be garbage
First might be garbage if get_ranges would be called when
dive_table.nr == 0. This would rather signal that something else is
broken, but at least we shouldn't make it worse.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 22:17:50 +01:00
Anton Lundin
2c689964ab Don't use old pointer after realloc
If realloc moved the memory, we shouldn't try to access it. realloc
copied that memory so access it via the new function instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 22:17:21 +01:00
Lubomir I. Ivanov
05b00742c6 Globe: improve the flag placement and size
We can position our old flag in a PNG with double the size of the
original flag - 48x48px, so that the pin is exactly at the center
of the PNG.

This way when the user clicks on a map location the pin should
be placed exactly there.

Patch also makes the flag bigger.

Fixes #335.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 16:30:40 +01:00
Lubomir I. Ivanov
819bd109e5 downloadfromdivecomputer.h: remove a forward declaration
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>
2013-12-11 16:30:10 +01:00
Lubomir I. Ivanov
fe882ea58e uiemis-downloader.c: fix preceding limit check
next_segment():
The iterator limit check (i < size - 1) should precede
the indexing (buf[i]).

Reported by the program cppcheck.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 16:29:58 +01:00
Lubomir I. Ivanov
fbcad20072 profilepgrahics.cpp: fix preceding limit check
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>
2013-12-11 16:29:39 +01:00
Lubomir I. Ivanov
f09afad5a0 divelist.c: Fix possible NULL pointer deref.
calculate_cns():
The check if prev_dive is NULL should be before calling
prev_dive->when.

Reported by the program cppcheck.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 16:29:02 +01:00
Tim Wootton
ea895fbecc User manual: Fixes one broken italics
Italics marker needed to come after the 's to work properly

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 16:27:52 +01:00
Tim Wootton
17e53b4d8e User manual: added troughs to peaks in profile description
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 16:27:41 +01:00
Tim Wootton
a16a245e58 User manual: remove ter from below Stats Tab section
Found the word "ter" below this para, assume it's not
supposed to be there.

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 16:27:29 +01:00
Anton Lundin
022e2d0d9d Guard against dereferencing undef
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>
2013-12-11 03:13:30 +01:00
Anton Lundin
82b86fe924 Fix potential null pointer dereference
If createTemporaryPlan was called on a empty diveplan.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
0812d2def2 Add some sanity checks
If first sample is not a DC_SAMPLE_TIME, we would have bin dereferencing
a null pointer.
This might actually never happen, unless we talk to a really weird dc,
but this makes the static analyzer happier.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
5b61409358 Use delete instead of free() in c++
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
1e92a8e648 Remove extra local variable declaration
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
9f7102f9da Remove redundant readfile() in parse_csv_file
try_to_xslt_open_csv will read the file, so we don't need to do it
before that and leak that memory.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
c46ae27c3b Match sizeof with pointer type
More to get clang-scan to quiet down that for the unlikely event that
unsigned int and int is different sizes.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
6c0865c532 Initialize tissue_tolerance
So we can't return garbage.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
25c3eb26dc Remove some dead code
last_pressure is updated a couple of lines later, so no need to do it
here.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
511f8b8885 Plug potential memory leak in try_to_xslt_open_csv
Free temp buffer if realloc fails.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
ef3a51f6ee Plug potential memory leak in process_raw_buffer
Free temporary buffer before returning.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
d0c7b3bf7d Plug memory leak in duration()
Strdup should be followed by a free()...

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
01fdd2876a Plug memory leaks in compare_samples
Free temporary buffer before returning.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Tim Wootton
edfa3ba810 User manual: use charge rather than load when referring to battery
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 22:39:41 +01:00
Tim Wootton
aa34ca814d User manual: remove imperative not to save
It's ok to save as you go, just not required.

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 22:38:46 +01:00
Lubomir I. Ivanov
643f404036 Divelogs.de: prevent undefined behaviour
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>
2013-12-10 22:35:13 +01:00
Dirk Hohndel
5ebcc2d237 Latest translation updates
Amazing progress. Bulgarian, Chinese (Taiwan), Slovak got completed - many
other translations added the hand full of new strings that showed up over
the last few days.

Thanks to all the translators.

I only pull these, authorship is tracked at Transifex.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 21:26:02 +01:00
Willem Ferguson
52a168d7ff Manual update
Replaced graphics for Import from Divelogs.de to reflect latest UI schanges.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 14:38:58 +01:00
Sergey Starosek
12981030a5 Fix asciidoc CSS path
Both JS and CSS resources need to be embedded into HTML

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 14:38:45 +01:00
Willem Ferguson
9545745c90 Usermanual update
- Print divelog added
- Typos corrected.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 10:15:30 +01:00
Dirk Hohndel
0e3a24c3c0 Reset libdivecomuter import canceled state
Once the process got cancelled once we never reset the flag.

Fixes #82

Initial-fix-by: Jef Driesen
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 08:09:42 +01:00
Anton Lundin
0d4fb44c18 Remove some safety stop code in plan()
Some code in plan() left from the gtk days introduced a safety stop in the
plan. It created a un-editable diveplanpoint.

Fixes #349

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 08:00:52 +01:00
Dirk Hohndel
13c9d2ad38 Don't rely on current path when searching for support files
The notion of current path changes as we open files in the file system.
What we really want is the directory from where Subsurface was started.
That covers both the case of Windows and running Subsurface from the
install directory.

This worked before because all support files were opened before the first
user interaction. But opening the manual showed the flaw in the previous
logic.

Fixes #348

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 07:29:06 +01:00
Dirk Hohndel
5e1cfd96fd Pulled latest translations
As always, I didn't author these, just did the pull from Transifex.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 06:28:41 +01:00
Dirk Hohndel
e5561d7668 Fix selection tracking bug
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>
2013-12-10 06:25:30 +01:00
Dirk Hohndel
eaa3160082 Add the new string introduced in the previous commit
It gets lost in the noise with all the line number changes, but this
introduces only a single new string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 06:16:14 +01:00
Lubomir I. Ivanov
c8eae30c6f Webservices: make the dialog title more generic
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>
2013-12-10 05:52:26 +01:00
Lubomir I. Ivanov
cf9748278f Planner: fix potential assert in clear()
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>
2013-12-10 05:22:01 +01:00