The existing code (and templates) looked up dives by number and then used
that as index into the dive table. This worked exactly in one case: if all
dives were numbered consecutively starting with 1. While that is not an
entirely unreasonable case, it's of course not an acceptable assumption to
make.
This commit adds the necessary changes to instead look up dives by their
unique id. That's what it's there fore, after all.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is based on the Subusrface logo colors, keeping the hue and modifying
the saturation and value in order to get what to me looks like a fairly
pleasant color setup.
This is an attempt to come up with a good default. By all means, this is
supposed to be a starting point to make it better, not a decision on what
the colors should be. I would however claim that they are better than the
previously available options :-)
I like the idea of basing this on our existing colors - but even that is
up for modification if someone has a better proposal.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old code trusted in Windows new lines with length of 3. The new code
strips out spaces and line ending chars resulting in empty line being
of length 0.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This validates Seabear import from H3 and T1 dive computers that use new
CSV format to store the logs. The fields wary depending on the dive
mode, thus we need to parse the field configuration during import.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This file contains imported dives from Seabear H3 and T1 dive computers.
It is used for validating Seaber import from new file format.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These are test dives for Seabear H3 and T1 dive computers received from
Seabear Diving Technology.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is easier to have user friendly names for the bundled
templates.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
When importing a template, make it the user currently selected template.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
If user selected template is not found, we choose the first template as
a default choice.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Print dives successively and fit as many as we can in the smallest
number of pages. Some dives may be broken between pages.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Implement 'import/export' features, so it's easier to share
customized printing templates. Also support deleting existing templates.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Use the button group to import, export or delete a template from the
printing_templates directory.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
"Table" print is now a template, so remove the radio button.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
As I am using the same old QSettings group name, some variables may not
be correctly initialized, so we need to check for incorrect values
before we start.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We save the selected template name on closing the printDialog, We also
load the last selected template from QSettings when initializing the
dialog.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We use templates from the grantlee templates list created and
dynamically. So we don't need static templates anymore.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We don't need static template names anymore.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We need to dynamically look up for all the existing templates in the
template directory. A grantlee template can be named any name but we
ignore files ending with '~'.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
When we calculate the number of pages to print we need to check if the
template doesn't define the number of dives per one page, then render as
much dives as we can fit in one page. A dive can be broken into many
pages.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The "Table" template shows a simple table of user dives. The fields
shown are:
Dive number, Date, Time, Depth, Duration, Master and Location.
Other fields can be added by the user.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
If we try to set up a message before the window has been instantiated we
should ignore the message, not crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't give sensation that OSTCTools is a H&W software, which it isn't.
Little adds on supported DCs and other considerations.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we are running Subsurface in verbose mode, print the xsltproc command
line to test the XSLT manually.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Include the DC's hardware name if it was given as parameter on CSV
import.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The purpose of parts of the planner code is not not always obvious. This is
especially true of the conditional statements in the add_plan_to_notes function.
Annotate the code with comments to explain the logic.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit 156ad42a3c ("snprintf is happier if it has an explicit string
literal format argument") I got a little too aggressive making sure there
are string literal format strings...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If display transitions in deco isn't selected, then we shouldn't show the
transition segment between two deco stops, even if there is a gas change. We
should still show the ascent segment up to the first deco stop. The
(gaschange_after && !isascent) condition is necessary to pick up backgas breaks.
An example plan is shown below.
Previously:
depth duration runtime gas
40m 1min 1min air
40m 34min 35min
21m 2min 37min <--meaningful ascent segment
21m 1min 38min EAN50
18m 1min 39min
15m 3min 42min
12m 4min 46min
9m 5min 51min
6m 0min 51min <--unnecessary ascent segment
6m 13min 64min oxygen
6m 6min 70min air
6m 2min 72min oxygen
0m 1min 73min
depth duration runtime gas
40m 1min 1min air
40m 34min 35min
21m 2min 37min <--meaningful ascent segment
21m 1min 38min EAN50
18m 1min 39min
15m 3min 42min
12m 4min 46min
9m 5min 51min
6m 13min 64min oxygen
6m 6min 70min air
6m 2min 72min oxygen
0m 1min 73min
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>