git access: allow arbitrary revision specifiers on reading

Commit 13e2210d75bb ("Allow remote branch names when reading a git
object tree") made it possible to read (but not write) remote branches,
which is very convenient when you just want to look at somebody elses
dives in a shared repository.

However, it was really quite stupidly done - both overly complicated,
and overly restrictive.

It's much better and simpler to just allow general git revision
specifications, which includes branches (both remote and local) as a
simple case, but also allows general git revision expressions.  So you
can tag things, and use a tag-name instead.  Or you can say that you
want to look at the previous save, by using the "branchname^" syntax.

Or, you can use the git reflog, and do things like

   subsurface ~/scuba/[linus@{two.days.ago}]

to see the dives that your repository contained two days ago.

Obviously, you will not be able to save to this kind of ref-spec (and I
really will have to make error handling work better), but for browsing
state it's quite useful.

And in git terms, this is actually simpler than the "lets try to first
see if we have a local branch of that name, and then if we have a remote
one", as shown by the fact that this removes more lines than it adds.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
error handling: return errors for save functions

Note! This just returns the error (and uses "report_error()" to generate
a string that is currently printed to stderr).  Nothing actually *uses*
that error return yet, and we don't show the error string in the GUI.

Baby steps.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
propagate save errors further, don't mark divelist unchanged

This at least avoids marking the dive list as unchanged on a failed
write, and propagates the error further up the stack.

We still don't show the error string in the GUI, though.  I'll start
doing that next, I think.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
show the error string in the GUI rather than stderr

This makes the error string just be an internal "membuffer", which the
GUI can fetch and show when errors occur.  The error string keeps
accumulating until somebody retrieves it with "get_error_string()".

This should make any write errors actually show up to the user.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Convert other users of showError() to the new world order

The "report_error()" interface is a lot simpler, although some of the
C++ code uses QStrings which make them a bit annoying, especially for
the varargs model.  Still, even with the explicit conversion to UTF8 and
"char *", the report_error() model is much nicer.

This also just makes refreshDisplay() do the error reporting in the UI
automatically, so a number of error paths don't even have to worry.  And
the multi-line model of error reporting means that it all automatically
does the right thing, and reports errors for each file rather than just
for the last file that failed to open.

So this removes closer to a hundred lines of cruft, while being a
simpler interface and doing better error reporting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Revision of Profile part of manual

The last figures in the manual using the Unity desktop have been replaced
with equivalent figures using Gnome 3. There should now be no figures
remaining from Unity.

This is a revision of the profile part of the manual in the light of the
changes for V4.1. Text has been moved around, some new text added or
rewritten. Graphics has been replaced to reflect the UI for V4.1,
including Tomaz's button bar and Louisa's new buttons for that bar.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make "save changes" dialog modal

This definitely seems to be a good candidate for a modal dialog.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If saving to a git repository fails, don't create oddly named XML file

Before this change when the user gave a git style filename, say
/tmp/mydives[myname], if Subsurface couldn't create a repository with that
branch, it instead saved an XML file to this exact name, with '[' and ']'.
That clearly is not the desired behavior, so report an error instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>