Commit graph

31 commits

Author SHA1 Message Date
Dirk Hohndel
54b50392f2 Printing: minor fixes as suggested by Lubomir
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-16 21:32:22 -07:00
Gehad elrobey
f800c602d6 Printing: Remove braces around single lines in if/then
Remove useless braces around single line if/then.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-16 21:18:00 -07:00
Gehad elrobey
bdedc97036 Printing: make statistics template editable
Now inplace edit is supported, so enable editing the "Default"
statistics template, Also show warning when editing this template.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-16 21:17:41 -07:00
Gehad elrobey
d3c75f2c72 Printing: show warning message when editing bundled templates
When editing a bundled template show warning message.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-16 21:17:35 -07:00
Gehad elrobey
27bec9bc7b Printing: support in-place editing for templates
Edit the templates into the same file, which is more intuitive as
Custom.html is a bit confusing.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-16 21:17:22 -07:00
Gehad elrobey
f45fdc8660 Printing: disable template editing for statistics templates
Editing statistics templates is not supported now, as there is no
custom template for statistics printing, so disable the template
edit area.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:37:48 +03:00
Gehad elrobey
90852e114c Printing: fix typo in template name
Template names was capitalized, so change the file name to
"Custom.html" instead of "custom.html"

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:32:28 +03:00
Gehad elrobey
1dbe10fe27 Printing: add another color in color palettes
Add another color 'Table cells 2' to the color palette, make all the
backgrounds solid white by default.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:30 +03:00
Gehad elrobey
1d22bdc08c Printing: fix TemplateEdit color selection bug
When choosing a color from the QColorDialog, the TemplateEdit trigger to
change the current selected template to be custom, and then changes the
selected color. When the selected template is changed old template
values are copied to the current template which results in incorrect
behaviour.

This is fixed by checking for the current editting state before setting
the saved palettes as the current used palette.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:04 +03:00
Gehad elrobey
dd7bae378e Printing: fix wrong custom palette index
The custom palette index is defined by the CUSTOM directive, and it
should be used.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:01 +03:00
Gehad elrobey
55f09f0106 Printing: don't save invalid colors
When QColorDialog is closed with 'Cancel' button, it returns invalid color
that must be discarded. So check if color is valid to prevent replacing
the current color with black.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:01:58 +03:00
Dirk Hohndel
be47ce6241 Printing: add new default color scheme
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>
2015-07-28 10:48:29 -07:00
Gehad elrobey
ed5afc510e Printing: don't name color templates with confusing numbers
Use the color_palette enum instead.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-28 11:39:25 +03:00
Gehad elrobey
d41d79b549 Printing: add the "Shades of blue" color theme
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-28 11:39:19 +03:00
Gehad elrobey
2b2c506cb7 Printing: use grantlee templates from the current existing template list
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>
2015-07-28 11:37:30 +03:00
Gehad elrobey
1ae1a11c22 Printing: add default case to switch
Add default case to fix switch warning.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:45 +03:00
Gehad elrobey
7575bb169b Printing: change 'Discard' to 'Cancel' button
Cancel button is more relevant to the dialog message.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:42 +03:00
Gehad elrobey
f8f6453988 Printing: add custom color palette
We can use custom color palette to edit current color palette.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:40 +03:00
Gehad elrobey
e1dda8df63 Printing: implement edit buttons in color tab
Add button group and attached edit buttons to it.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:23 +03:00
Gehad elrobey
ad531c25fb Printing: show colors in edit tab
- Add default color struct
- Init the color struct with default colors
- Show color text in labels
- Preview colors

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:20 +03:00
Gehad elrobey
18282aa30e Printing: update preview on field changes
- Trigger re-rendering on the QPixmap if fields changed.
- Change template selection to custom if template text changed.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:15 +03:00
Gehad elrobey
d705cb34bb Printing: update preview on apply settings
On update call Printer to render on the QPixmap.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:12 +03:00
Gehad elrobey
f1615e725c Printing: add apply button to TemplateEdit class
Add apply button to the dialog, Update the preview after applying
the new settings.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:10 +03:00
Gehad elrobey
7ca311ae85 Printing: save only if data is changed in template_options
Check if data is changed before saving the new settings.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:07 +03:00
Gehad elrobey
d4382c7c4b Printing: add preview to TemplateEdit dialog
Show QPixmap in QLabel, Use Printer class to render the Preview on
the QPixmap.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:03 +03:00
Gehad elrobey
c90d5b891d Printing: show confirmation message before overwriting the template
Before overwriting the new template show confirmation message.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:27:23 +03:00
Gehad elrobey
cc53dc7acf Printing: implement QPlainTextEdit in TemplateEdit
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>
2015-07-05 21:03:12 +03:00
Gehad elrobey
c44496e23d Printing: move template_options to print_options.h
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 21:03:04 +03:00
Gehad elrobey
71561e720d Printing: add QSettings for TemplateEdit class
TemplateOptions struct must be saved to QSettings after the window
is closed, also it must be recalled when initializing the window.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 21:00:28 +03:00
Gehad elrobey
a600ea5201 Printing: add template_options struct that contains template
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>
2015-07-05 21:00:25 +03:00
Gehad elrobey
963e09ad7b Printing: add TemplateEdit form to source tree
The TemplateEdit class works to customize the tempalate before printing,
User can select the font-size, font-type, color-palette, linespacing
and editing the template HTML code.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 20:59:55 +03:00