Commit graph

8034 commits

Author SHA1 Message Date
Dirk Hohndel
56d701dfff Merge branch 'custom-print' of https://github.com/neolit123/subsurface 2015-06-19 20:33:54 -07:00
Dirk Hohndel
56b82e0ecf Git storage: change time encoding in directory names
We used to use [[yyyy-]mm-]nn-ddd-hh:mm:ss[~hex] in our git storage format
for directory that contained dives. Problem with the is that on Windows
the colon ':' is an illegal character in a filename. So libgit2 refuses to
clone such a repository on Windows.

So instead we now always write dive directories in git repositories as
[[yyyy-]mm-]nn-ddd-hh=mm=ss[~hex] which replaces the ':' with an '='.

Of course we load / parse both formats so that older formats still work.
The next time they are written all the names change which causes rather
huge commits, but that's the only way I see for cloud storage to work on
Windows.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19 11:45:24 -07:00
Lubomir I. Ivanov
b039e1db8a Printing: amend some texts capitalization wise
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:59 +03:00
Gehad elrobey
554e64c43f Printing: add support for printing on any page size
Make page size and orientation customizable. The user can select
any page size and orientation and then the rendering resolution will
be calculated based on the selected preferences and the printer DPI.
The HTML templates must be responsive, also the font-size must be based
on the viewport width so that we don't lose quality.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:58 +03:00
Gehad elrobey
75263e3d2c Printing: rename the "base" template for consistency
Change the name of the template "base" to "two_dives" as this name
describes it better.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:58 +03:00
Gehad elrobey
6c54781e17 Printing: use selected print preferences while printing
Having a pointer to the printing_options struct, it should be
used to privide the selected options while printing.

Print options used ATM:
- number of dives per page
- template file name
- print in colors

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:58 +03:00
Gehad elrobey
60c5e3cf25 Printing: pass the print_options struct to TemplateLayout and Printer
As the print_options struct is needed by both TemplateLayout and Printer
class, it can be passed to their constructor.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:57 +03:00
Gehad elrobey
42b9d0d047 Printing: add a "one dive per page" template
This is a Grantlee template to show 1 dive per page.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:57 +03:00
Gehad elrobey
17470f6822 Printing: add a "one dive per page" option
Add another printing option to the print dialog.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:57 +03:00
Gehad elrobey
cd30e11672 Printing: render the dive profile on top of QWebView
We render the dive profile over the QWebView to the QPainter. This helps
us not to save the SVG images to disk and then render them again to the
webview.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:56 +03:00
Gehad elrobey
1040f0d4e5 Printing: fix rendering bug for odd number of dives
Odd number of dives needs extra space from the buttom, so that when we
scroll to the last page extra whitespace is shown under the last dive
frame, this is fixed by adding a default footer to the base template.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:56 +03:00
Gehad elrobey
c152314790 Printing: fix "if" condition clause in cmake file
Check for NO_PRINTING instead of checking for NOT NO_PRINTING.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:50 +03:00
Rick Walsh
845030a8ad Enforce planner minimum gas switch duration
Enforce a minimum duration for gas switching in the planner.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19 09:15:51 -07:00
Rick Walsh
4dfdea1e1d Add planner minimum gas switch duration option
Add the option for a minimum gas switch duration to the planner UI.  This is not actually used yet.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19 09:15:09 -07:00
Dirk Hohndel
ab90375c19 Use remote transport parameter instead of comparing strings
We pass it in, we might as well use it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19 07:31:15 -07:00
Dirk Hohndel
c765fb5961 Windows support: correct helper function name
Apparently no one ever tried to build with an old libgit2 on Windows...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 23:37:22 -07:00
Dirk Hohndel
293569cb19 HTML export: before showing the dive list, sort descending by dive number
This way the newest dive gets shown first (which I think makes much more
sense) and the dives are in order as we show them in Subsurface.

I actually think we should toggle trips on by default - but I'm not sure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 22:04:11 -07:00
Dirk Hohndel
f5510892a6 HTML export: cosmetic change to show 20 dives by default
10 just seemed a little... low.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 22:03:13 -07:00
Gehad elrobey
d23e71e99a HTML: Fix spelling mistake
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 21:31:18 -07:00
Dirk Hohndel
89ca3c69c1 Git storage: don't abort if there is no default user/email set
I never ran into this because all of my computers have a global default
set for my name and email address. But if the user never uses git and has
no global settings there will be no such info. Instead of failing we need
to just set up a default ID and then try to get a best guess from the OS
(just as we used to do before libgit2 supported getting the git settings
for authorship).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 14:12:01 -07:00
Dirk Hohndel
bd6e75a49f HTML exporter: don't try to write to NULL file descriptor
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 12:23:58 -07:00
Dirk Hohndel
6ad3453af0 HTML standalone exporter: use Subsurface dive numbers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 12:23:30 -07:00
Dirk Hohndel
d11b3743eb HTML standalone exporter: give up if parsing the input fails
There's no point in trying to export after not being able to read the data
in the first place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 12:23:15 -07:00
Dirk Hohndel
c96ee6159b Fix potential crash if the existing filename is NULL
Should have used same_string() anyway...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-18 08:09:27 -07:00
Dirk Hohndel
b63b656c1f Make sure cylinder related data is filled when dives are read
This is re-run every time we update the dive list model for the UI, but we
should run it a first time right after loading the dives so that this data
is correct even without the UI running - this way the data in headless
standalone applications like the HTML exporter is correct as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 17:58:31 -07:00
Dirk Hohndel
b39e478c57 HTML export: corretly show weird imperial tank sizes
It's not enough to convert the wet volume - you need to multiply in the
working pressure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 17:25:44 -07:00
Dirk Hohndel
9f5207fc0d HTML exports: minor cosmetic improvements
This brings up the satellite view when clicking on GPS coordinates and
sets a slightly better page title.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 17:04:16 -07:00
Anton Lundin
b052d63789 Hide the dive-related controls when showing trips
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 16:38:11 -07:00
Anton Lundin
cfd001702f Make the expand/collapse buttons usefull on trips
There where some issues with trying to access non-existing dom elements
when clicking them when showing trips.

Instead of fixing that issue, this actually makes them do something
useful, expanding and collapsing the trips.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 16:38:03 -07:00
Anton Lundin
00db47b19e Remove old timing of function
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 16:37:58 -07:00
Dirk Hohndel
befa8cf32e HTML standalone exporter: don't setup preferences
We don't need them and they can cause the application to crash when called
in a git hook.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 12:39:40 -07:00
Dirk Hohndel
b345db0a64 HTML export: better Google maps link
This way we get an actual place marker

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 12:38:24 -07:00
Dirk Hohndel
243a9e5840 Remove some include files from qthelper.cpp
We keep forgetting to remove include files after modifying the code in
ways that no longer requires them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 11:47:59 -07:00
Dirk Hohndel
c897b857fb We don't really need a long to count the dive sites
At least I hope not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 11:42:15 -07:00
Dirk Hohndel
de586331b2 Add missing package to INSTALL file
This way lupdate is present on Ubuntu

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 11:41:49 -07:00
Dirk Hohndel
a922e52b8f HTML Exporter: make JS work on Firefox as well
It appears the standard way to figure out what type of element is sending
the event is to use .target instead of .toElement - specifically, Firefox
doesn't understand .toElement and so the expansion of dives by clicking on
them didn't work in Firefox.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 10:15:08 -07:00
Dirk Hohndel
3778f94f6f Remove the references to QtPositioning from INSTALL file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 10:12:03 -07:00
Dirk Hohndel
11f457403f Use saved units in the HTML exporter
Also update the exporter to match the latest changes in the Subsurface
code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 09:48:10 -07:00
Dirk Hohndel
ff4b5478b5 Store the user's unit preferences in git storage
Save and load a usually unused copy of the preferences with the units that
were active the last time the dive list was saved to git storage (this
isn't used in XML files); storing the unit preferences in the data file is
usually pointless (that's a setting of the software, not a property of the
data), but it's a great hint of what the user might expect to see when
creating a backend service that visualizes the dive list without
Subsurface running - so this is basically a functionality for the core
library that Subsurface itself doesn't use but that another consumer of
the library (like an HTML exporter) will need.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 09:48:10 -07:00
Dirk Hohndel
7cf3ebc2f7 Git storage: only check git_id if saving to the same remote
If we switch to a different remote (let's say we opened a local git repo
and want to save its content to the cloud storage) then don't check to
make sure that the branch stayed unchanged (because, duh, it's a different
remote, it will have changed).

This fixes the problem where you could open an XML file and store it to
cloud storage just fine, but opening a local git repository and then
storing that to cloud storage failed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 09:45:39 -07:00
Gehad elrobey
5d09244c0f HTML: fix the unclosed <ul> tag.
The <ul> tag must be closed as defined by the html specs.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 09:29:39 -07:00
Rick Walsh
a5a9462820 Re-fix silly typo
The previous Fix silly typo patch didn't quite work.  This one should

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17 05:27:18 -07:00
Linus Torvalds
eff3fd3261 git save: fix crash with no remote
Commit e21cae2d46 ("Cloud storage: sync the remote after save") broke
regular git saving without any remotes: it would never initialize the
"remote" pointer, and then use that uninitialized remote pointer to see
if it was a cloud storage remote that it should try to sync.

Fix it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 21:40:31 -07:00
Robert C. Helling
eca7d998e1 Set up signalling to display notes in planner again.
This got broken in a recent transition to more abstract models.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 20:33:07 -07:00
Rick Walsh
f66ea4cbb0 Show duration before runtime on planner notes table
Switch the column order of the planner notes table so that duration is displayed before runtime.  This is consistent with:
- the verbatim output order, e.g. "Stay at 12.0 m for 3:00 min - runtime 32:48 on EAN50"
- MultiDeco, e.g. http://www.hhssoftware.com/multideco/view_multideco.html
- Planner on the Shearwater Petrel
- How I have been taught to write out my dive plan in my wetnotes

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 20:32:40 -07:00
Dirk Hohndel
d9b39efeb7 Fix silly typo
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 20:30:06 -07:00
Dirk Hohndel
ccc9d80015 Remove all the no longer necessary code that aborts read of first V2 file
This was a poorly implemented hack when we executed the reverse geo lookup
in the main thread and opening a V2 file could take a very long time. We
need to do the "Welcome" message quite differently.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:41:56 -07:00
Dirk Hohndel
bd11988f74 Cloud storage: warn the user if we are not online
This isn't perfect, but at least tells the user if we weren't able to
connect and are working just off the local cache.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:09:37 -07:00
Dirk Hohndel
226e9a7e85 Implement a standalone HTML exporter
This is mostly a proof of concept right now; it shows that it is possible
to create a headless server application that exports a git repository
based data file as html.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:09:21 -07:00
Dirk Hohndel
0692e24036 Separate initializing Qt from initializing the UI
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:05:09 -07:00