Commit graph

4768 commits

Author SHA1 Message Date
Willem Ferguson
b95304f424 Updates to Section 3 of the user manual
Section 3 is quite a long section. Ten of the screen shots are replaced.
Large numbers of typos and inconsistencies are corrected.
A few sentences are included e.g when dealing with the Subsurface Companion.
Section dealing with creating libdivecomputer dump files has been reorganised
slightly.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-25 08:12:54 -07:00
Lubomir I. Ivanov
74ed786d75 Add optional Win32 console allocation
This patch adds the optional --win32console command line option.
It does nothing on OSx and Linux, while is only useable on Win32.

On Win32 if the application was built as GUI (not console),
there is no way to view stdout and stderr. With windows.c's
subsurface_console_init() we are able to either redirect
stdout and stderr to the terminal from which subsurface.exe
was started (always happens; --win32console does nothing in
this case) or if --win32console is explicitly added to
a shortcut, create a dedicated console window and monitor
the output there.

if set, WIN32_CONSOLE_APP is a condition that will make the
subsurface_console_init() and subsurface_console_exit()
functions NOP on Windows. The definition will be created if
the user passes 'CONFIG += console' to qmake.

Fixes #436

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-25 07:57:27 -07:00
Lubomir I. Ivanov
b3f78185a5 Add the WIN32_CONSOLE_APP flag
If the user passes 'CONFIG += console' to qmake, we define
WIN32_CONSOLE_APP that will be used in the source code
to determine if this is a console or a GUI application on Win32.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-25 07:57:25 -07:00
Jan Mulder
fe2ad15603 Redraw profile when manipulating cylinders
Manipulating cylinders, especially changing the exact gas content (o2,
he), changes the pp02, ppHe graphs. This patch simply replots the profile
in case of cylinder change at time of saving.

Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-25 07:53:37 -07:00
Anton Lundin
fc13361079 Don't crash if we try to save a empty plan
Just treat it as a cancel instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-23 17:24:42 -07:00
Anton Lundin
8bc2ad1473 Enable parts of planner based on define
In bf205726 DEPTH/Switch at was disabled by commenting out that code.
This puts it back behind ifdefs

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-23 17:24:40 -07:00
Yosef Hamza
d4a1932276 Divemaster and Buddy fields auto-completion are not saved
The added characters by auto-completion "for the last item"
isn't saved when using Return to save it "works well with
tab"

Fixes #469

Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-23 17:20:03 -07:00
Lubomir I. Ivanov
3b92803667 save-git.c: fix another libgit2 API issue
GIT_CHECKOUT_OPTS_INIT, git_checkout_opts
has changed to:
GIT_CHECKOUT_OPTIONS_INIT, git_checkout_options

Solution-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-23 17:16:57 -07:00
Anton Lundin
9cfc585563 Fix system default font handling
We didn't care about system default fonts and sizes, we just used the Qt
default font.

Due to how QFont is constructed, there was need to split font and font
size.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-21 21:30:39 -07:00
Jan Mulder
41209005c9 Make pp graphs visible at startup according to settings
Changeset a90818671 introduces a small inconvenience. The pp graphs at
startup are not shown according to the visibility settings. Requiring to
toggle the icons to show the desired pp graph.

Trivial fix.

Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-21 21:29:22 -07:00
Gehad
8ca4437624 Add current time and adjusted time to gui when adjusting dive's timestamp
This patch adds the current dive time and the adjusted time to the time
shift window. I added a function to dive.c to get the timestamp of the
first selected dive.

This will view the time of the first selected dive only even when multi
dives are selected but it does change the times for multiple dives
properly.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-21 21:26:09 -07:00
Gehad
cc2369c5f9 Make esc-key discard the new tag selection
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:54:58 -07:00
Jan Mulder
53b5e82411 Do not use default dive filename before setting it
Changeset ee2e43f introduced a small bug. The default dive file as set in
the Prefences is not opened, requiring manual opening.  This patch
reshuffles a little code, allowing first the preferences being set, and
than using it.

Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:53:39 -07:00
Hugle
2ca6009dfa Removed Duplicate Includes
Signed-off-by: Hugle <wulong@comp.nus.edu.sg>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:52:24 -07:00
Tomaz Canabrava
320071ac15 Better handling of keyboard on the inline edition on equipment
The handling of keyboard is broken on Qt inside QComboBoxes.
I'm trying ( and losing ) to make it less broken. This patch makes the
code work reasonably well if you press Key_down or Key_up after having
displayed the filter popup, which is different from the combobox popup for
some reason.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:49:33 -07:00
Tomaz Canabrava
6ee3a6da52 Remove a bit of space from the Axis and its labels.
This should make the layout work better on smaller screens.

Fixes #458

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:49:05 -07:00
Tomaz Canabrava
dfaa302383 Make ruler respect dive depth.
The only place on the code that the y() position didn't accompanied the
dive-depth was this one, so let's see if this patch fixes it.

See #455

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:48:34 -07:00
Tomaz Canabrava
5b497b5655 Don't create then set, do both at the same time.
When we create, then set the value of a variable, we are wasting cycles
and making the code more verbose.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:48:19 -07:00
Tomaz Canabrava
ec2ea7ec3a QString starts empty, do not set "" as empty string.
Let's not be evil by creating "" as empty strings inside of the code,
really.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:48:10 -07:00
Tomaz Canabrava
30770f5d85 Do not copy strings when you don't need it.
This patch removed the use of copy-constructors on the QString to use the
const-references. Even knowing that the QString is a refcounted class,
let's not get that bad habit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:47:57 -07:00
Tomaz Canabrava
3d83c48c49 Code Cleanup
The offending code is line-by-line equal to the completion highlited
method, so why make it duplicated? Call that method instead.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:47:43 -07:00
Anton Lundin
519f45416f Enable posibility to add dives to trip below
When I'm on a dive trip i usually download dives multiple times to start
logging them while i still remember them. When i have already created a
trip and downloads new dives they needs to be able to be added to the
already existing trip, without relying on autogroup.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:40:28 -07:00
Linus Torvalds
a29c4ddba3 git object store: make it possible to work with checked-out git branches
This makes the git object save logic also check out the changes in the
working tree and index if the branch we save to is checked out.  It used
to be that we would just update the object store (and the branch ref, of
course), but leave any checked-out state untouched.

Note that if the working directory is dirty (ie you have made changes by
hand and not committed them), the checkout will skip any dirty files and
report it as a warning to the user.  However, the save still succeeds
(since the _real_ save goes to the backing store).

NOTE NOTE NOTE! Both loading and saving very fundamentally work on the
git object store level, and if you are working with a checked-out branch
and make modifications to the working tree, saving will not touch those
dirty files (so that you can try to recover your edits manually in the
working tree), but it's worth pointing out that subsufrace loading state
will totally ignore the working tree.

So the only way to make subsurface *see* your changes is to commit them.
Having edited state checked out in the working tree will only confuse
you when subsurface first ignores it on reading, and then refuses to
touch the checked-out state on writing.

Put another way: working with a checked-out branch is now _possible_,
but you need to be aware of the limitations.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-19 14:32:27 -07:00
Lubomir I. Ivanov
ee2e43f11a Main: separate the QApplication and UI creation
When some arguments like --help and --version are passed to the
executable, we don't need to create the UI at all.

This patch separates the QApplication creation which is at first
only needed to parse the arguments and then if exit() is not
called from subsurfacestartup.c, we can call some of the
"init" methods such as setup_system_prefs(), fill_profile_color()
etc.

At this point init_ui() can be called which no longer needs
to accept the command line argument list.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-19 09:37:49 -07:00
Lubomir I. Ivanov
71f2fd91b5 Profile2: fix widths on some lines for Qt5
Qt5 uses different widths for some of the poly. lines
in the profile. Setting an explicit value fixes that.

Tested-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-19 09:37:12 -07:00
Gehad
fdf6f3cd4e Make Up/Down arrows work with tags
When using Up/Down arrows to scroll the tag list it always selected the
first item in the list and doesn't scroll.

Fixes #468

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-19 09:33:59 -07:00
Gehad
f2238300ef Saving edits requires to move focus first
After editing values in cylinders or weights hitting save will not save
the changes to save the edit one must move the focus to a different
field first this is fixed by losing the focus before saving the changes

Fixes #412

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-19 09:27:04 -07:00
Anton Lundin
1768b08dc0 Link to marbledata when building out of tree
When building and running subsurface out of tree, marbledata was
inaccessible to subsurface.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18 11:58:29 -07:00
Lubomir I. Ivanov
6d6721dc9b Profile2: use unsigned int for the divecomputer number
display.h: dc_number is unsigned int, thus a couple of warnings
may pop-out.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18 11:56:06 -07:00
Hugle
a908186716 Clear PN2 PO2 PHE GasItem
After the dive log has been closed, the ProfileWidget2 does not clear
the pn2 po2 and ph2 gas line.

This patch cleared the three lines after dive log closed.

Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Hugle <wulong@comp.nus.edu.sg>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18 11:49:57 -07:00
Dirk Hohndel
cb53049b74 Don't devide by 0 if fO2 is 100%
Fixes #465

Initial-patch-by: Anton Lundin <glance@acc.umu.se>
Better-idea-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 20:41:16 -07:00
Anton Lundin
17a675367d Translate using tr() to be Qt5-compatible
There are no utf8 in those strings, and we can translate them as
everything else with tr() instead.
QApplication::UnicodeUTF8-part is deprecated and removed in Qt5.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 20:37:41 -07:00
Anton Lundin
f8d30ae528 Make dc_number defined when using it
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 20:37:38 -07:00
Anton Lundin
0a762334e2 Add forward declaration of QSettings
Its needed for Qt5

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 20:37:33 -07:00
Willem Ferguson
f7709ec4a3 User manual: Changes to sections 1 and 2
The text for these two sections has been corrected and updated
in order to be ready for the release of V4.1. The very first
paragraph of the manual is expanded substantially.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 10:54:08 -07:00
Linus Torvalds
37794e2e23 Be more careful about dive computer selection
The selection logic was a bit random: some places would return NULL if
the dive computer index was out of range, others would return the
primary dive computer, and actually moving between dive computers would
just blindly increment and decrement the number.

This always selects the primary computer if the index is out of bounds,
and makes sure we stay in bound when switching beteen dive computers
(but switching between dives can then turn an in-bound number into an
out-of-bounds one)

Fixes #464

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 10:53:49 -07:00
Dirk Hohndel
60ceb8ebc1 Silly change to a comment
I had intended to amend the previous commit with this before pushing it
out. This changes the comment that pointed out the bug that the previous
commit fixed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 10:53:12 -07:00
Dirk Hohndel
33b1b0ed9d New profile: fix event hiding logic
Turns out we unconditionally set all events as visible when redrawing the
dive - even with a comment that this should take into account if the event
is visible. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-16 15:11:35 -07:00
Willem Ferguson
0f7dfcee26 User manual: Update sections 4 and 5
A new figure is included to reflect the actions of the new profile buttons
on the calculated ceilings.

A number of small edits on sections 4 and 5 of the user manual are done.
These sections are now finalised for the new release.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 22:17:59 -07:00
Dirk Hohndel
401aa210ff New profile: add event manipulation to context menu
This got lost when we switched to the new profile.
Remove event works. Hide events does call hide() on the DiveEventItem but
for some reason it stays visible. I'll hope for one of the more
experienced Qt people to fix that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 21:12:34 -07:00
Dirk Hohndel
cb41f34826 Don't put cylinder widget in edit mode if deletion of cylinder failed
If the user tries to delete a cylinder that is in use and that action is
rejected, the cylinder widget (and the whole dive) should not be put into
edit mode. After all, nothing changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 15:38:10 -07:00
Jan Mulder
a636e4f2c1 Add test dive to show erroneous pp graphs
Add simple test dive to show the erroneous pp graph in case of
multiple periods of high p02. See commit aa0cd792bb for the fix.

Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 15:01:08 -07:00
Dirk Hohndel
36ba353450 Correctly check if tank is in use
We always checked if the tank was in use by the planner / dive editor -
even if we were not in dive edit mode.

With this patch, when not in dive edit mode, we check our cylinder "used"
flag instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 14:56:32 -07:00
Dirk Hohndel
4a1b9312f3 Don't check for tank size information only on first tank
commit d681bdcb63 ("Only use default cylinder for first one") has a
stupid bug in that it only calls get_tanksize for the first tank. That's
of course completely bogus.

Thanks to Linus for catching this.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 13:46:35 -07:00
Dirk Hohndel
d681bdcb63 Only use default cylinder for first one
When downloading from a divecomputer it makes little sense to assume that
all tanks are the default cylinder.

There's a good case to be made for having a default first cylinder (you
always dive with your own cylinder, or you are always on a dive boat with
AL80 tanks), but in multi-cylinder situations this is much more likely to
cause unintended harm; for example for those dive computers that always
report their maximum number of cylinders, even if some of them aren't
used.  Here setting a default cylinder turns those entries from obviously
empty into something that appears to have meaning (i.e., cylinder type is
filled in) even though this was just a default added by Subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 13:16:03 -07:00
Dirk Hohndel
6ba140571e Only use a default cylinder if it is explicitly set
We used to fall back to an AL80 default cylinder, but that meant that a
user who doesn't want a default cylinder at all had no way to indicate
that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 13:09:36 -07:00
Jan Mulder
aa0cd792bb Bugfix: generalize pp graphs to allow for multi over-threshold periods
Especially in O2 decompression parts of a dive, the pp02 is typically very
close to the threshold value (normally 1.60 bar). The old implementation
of the pp profile graphs assumes that there is exacty 1 consecutive set of
samples that needs to be in the "warning color". This results in an
erroneous display of the mentioned graphs, connecting multiple episodes of
too high pp with bogus lines in between.

This fix generalizes the pp graph logic to allow for multiple segments of
high pp, each to been drawn seperately in the "warning color".

Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 12:07:34 -07:00
Willem Ferguson
ce6f2cdda4 User manual: Add the missing icons
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 09:48:49 -07:00
Dirk Hohndel
781b2e35d4 Revert "If saving to a git repository fails, don't create oddly named XML file"
This reverts commit e70bbb637e

Linus' solution in commit 27c36ec4cf ("Improved handling of git syntax
names with no git repository") is much better and makes my hack
unnecessary.
2014-03-14 21:01:13 -07:00
Linus Torvalds
27c36ec4cf Improved handling of git syntax names with no git repository
This makes "is_git_repository()" return non-NULL for all file names that
match the git name pattern, even if we don't find an actual git
repository there.  That way, we won't fall back to writing out an XML
file with an odd filename.

If there is no actual git repository, we return a special invalid dummy
pointer, and then the git reading and writing routines will catch it and
return the appropriate error.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14 20:54:20 -07:00