This patch adds couple of helpers to retrieve the template path in
the application bundle (getPrintingTemplatePathBundle())
and the template path in the user directory
(getPrintingTemplatePathUser()).
Once the print dialog is initiated for the first time the contents
of the bundled template path are copied to the user template path
using copyPath(). No overwriting of files will occur.
The PrintOptions and TemplateLayout classes then only use
the user path for retrieving templates.
Fixes an issue where the bundled templates can be locked as read-only
on OSX and Linux.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The new statistics code, enable the editing of colors, font, and other
template options.
This patch enables the UI elements for these features.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Show the existing templates based on the print type selected
by the user.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Disable all the UI elements for "dive list print", disable
all the template settings as well, Template Edit button
will be enabled after statistics print supports color palettes.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@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>
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>
"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>
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>
This is the main area to edit the templates inside Subsurface.
Whenever the user edits a template the edited template is saved in
custom.html and custom.html is considered the selected printing
template.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
-Remove unneeded parameter to member variable
-Check if template_options struct is valid
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add:
-custom.html template
-custom template to print_options struct
-options to the options dialog
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The template_options struct holds the settings variables in the code.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Edit button should open TemplateEdit dialog.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
Move print_options struct to printoptions.h, its more relevant to be
placed here.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove obsolete code and add new customizable print code to the options
dialog.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Lots and lots and lots of header files were being included without being
needed. This attempts to clean some of that crud up.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All the print options will be stored after the user closes
or "cancels" the print dialog.
There seems to be no good way to store the last
selected page size, because print dialogs are different and
some just list them as strings - A4, A3, etc.
The patch also applies the following changes:
- renames display.h's 'struct options' to 'struct print_options'
as these were really just for the print dialog
- the print_options dialog now stores more options as 'bool'
- demote PrintDialog's 'printOptions' to 'private'
Fixes#653
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this option there is an exception, which makes the notes section of
the profile table occupy half the page. This way dive plans can reasonably
be printed.
Fixes#636
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These were hidden and we don't really support them because
our print layouting is not that flexible in Qt!
Note: printoptions.ui is now converted to UNIX line breaks.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Hide the sizeing sliders from PrintOptions. we don't really
support any of those in PrintLayout and these are not that
useful and easy to implement, until some sort
of layouting/templating system is in place.
- Move the 'Print' button on top as a workaround, since if
it's bellow the print options it stays bellow an empty area
where the now hidden sizing sliders are.
- Resize the dialog to a smaller size
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This means we don't have to new/delete them, which is a waste of
overhead.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This means we can also remove the forward declarations.
This is the first step in removing the memory allocation for the ui
sub-classes. Without the second step, this commit is just making the
compilation time increase for no good reason :-)
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't really need includes of display.h and dive.h in
printoptions.h and printlayout.h or forward declartions
of 'struct dive' and 'struct options' in there.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
PrintLayout is a class that will handle the layouting part
of dive profiles, text, tables depending on the settings
of a QPrinter and the PrinterDialog and PrintOptions
instances.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
By connecting to slots we always modify values at a previously
set 'struct options' pointer.
Also have the setup of slots and pre-set values in a
separate setup(struct options *) function.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The PrintOptions widget has value labels next to the
horizontal sliders. Add slots to update these labels
when a slider moves.
Patch also makes a modification so that the PrintOptions
constructor requires a 'struct options' pointer. If
an options struct is not received we do not set predefined
values and do not connect signals to slots, where
options will be updated immediately.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
PrintOptions is a QWidget class to be used as an
addition to a future print dialog (possibly based on
QPrintDialog). Currently only contains a couple of
radio buttons.
PrintDialog (printdialog.cpp/h) which is a basic QDialog
is currently added for testing only and it holds
an instance of PrintOptions.
Calling File->Print opens this test dialog for now.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>