Merge branch 'RefactorPrint'

- Modifies printing model to be similar to glabels-3.x.
   - Allow simple projects to print by-the-page (#51)
   - Added collated vs uncollated document merges
- Added ability to separate merge groups by page
- Updated man pages
- Updated misc developer documentation
This commit is contained in:
Jim Evins
2020-01-01 14:19:11 -05:00
parent af607ca4af
commit aebcda43cb
23 changed files with 1184 additions and 380 deletions
+5 -2
View File
@@ -9,11 +9,14 @@ Acknowledgments
gLabels includes contributions from
* [Chris Morgan](https://github.com/chmorgan)
* [hochwasser](https://github.com/hochwasser)
* [Mario Blättermann](https://github.com/mariobl)
* [probonopd](https://github.com/probonopd) - travis-ci setup, appImage
* [gitlost](https://github.com/gitlost)
* [Yuri Chornoivan](https://github.com/yurchor)
* [nblock](https://github.com/nblock)
* [hochwasser](https://github.com/hochwasser)
* [Chris Morgan](https://github.com/chmorgan)
* [Brian K. White](https://github.com/aljex)
Translations
+107 -96
View File
@@ -20,10 +20,6 @@ Assumptions/caveats
A sheet contains only one size of label or card (if a sheet contains more than one size of item,
it can be split into multiple templates for multiple pass printing).
Distances can be expressed in units of *pt*, *in*, *mm*, *cm*, or *pc*. For example:
`"1.0in"` or `"2.54cm"`. If no units are specified, computer points (*pt*) will
be assumed (1 *pt* = 1/72 *in* = 0.352778 *mm*).
Template Files
--------------
@@ -57,22 +53,37 @@ An example template file containing a single *Template* node:
</Glabels-templates>
```
*Distance* Attributes
---------------------
A distance attribute is expressed as a number followed by a unit identifier.
Valid unit identifiers are *pt*, *in*, *mm*, *cm*, or *pc*. These are a subset of
the SVG absolute length units. Examples:
```xml
<Label-round radius="1.0in" >
<Label-round radius="2.54cm">
```
If no units are specified, computer points (*pt*) will be assumed (1 *pt* = 1/72 *in* = 0.352778 *mm*).
*Template* Node
---------------
A *Template* node describes a single stationery product. It must contain exactly one instance of
a label node, either *Label-rectangle*, *Label-round*, *Label-ellipse* or *Label-cd*.
Property | Description
---------------|------------
*brand* | Brand or manufacturer of stationery product. E.g. "Avery".
*part* | Part number or name of stationery product. E.g. "8160".
*size* | Paper size. Must match an ID defined in *paper-sizes.xml*, "roll" or "other". E.g. "A4".
*description* | Description of stationery product. E.g, "Mailing Labels".
*_description* | Translatable description of stationery product. Used in predefined labels instead of description.
*width* | Page width. Only valid if `size="other"` or `size="roll"`.
*height* | Page height. Only valid if `size="other"`. Value is ignored if `size="roll"`.
*equiv* | Equivalent part number. If this property is present, the template is a clone of another template of the same brand. The template will inherit all properties, except brand and name from the other template. This equiv property must refer to a previously defined template - *gLabels* does not currently support forward references.
Property | Type | Description
---------------|----------|------------
*brand* | string | Brand or manufacturer of stationery product. E.g. "Avery".
*part* | string | Part number or name of stationery product. E.g. "8160".
*size* | string | Paper size. Must match an ID defined in *paper-sizes.xml*, "roll" or "other". E.g. "A4".
*description* | string | Description of stationery product. E.g, "Mailing Labels".
*_description* | string | Translatable description of stationery product. Used in predefined labels instead of description.
*width* | distance | Page width. Only valid if `size="other"` or `size="roll"`.
*height* | distance | Page height. Only valid if `size="other"`. Value is ignored if `size="roll"`.
*equiv* | string | Equivalent part number. If this property is present, the template is a clone of another template of the same brand. The template will inherit all properties, except brand and name from the other template. This equiv property must refer to a previously defined template - *gLabels* does not currently support forward references.
### Guidelines for Creating Product Descriptions
@@ -90,10 +101,10 @@ If creating templates to be distributed with *gLabels*, please use the following
A *Meta* node contains some additional information about the template. A *Template* node may contain zero
or more *Meta* nodes. Only one property should be defined per *Meta* node.
Property | Description
--------------|------------
*category* | A category for the template. A template can belong to multiple categories by simply adding multiple *Meta* nodes to the parent *Template* node. The category must match an existing ID defined in categories.xml. E.g. `category="media"`
*product_url* | A URL pointing to the vendor's webpage for the specific product, if available.
Property | Type | Description
---------------|----------|------------
*category* | string | A category for the template. A template can belong to multiple categories by simply adding multiple *Meta* nodes to the parent *Template* node. The category must match an existing ID defined in categories.xml. E.g. `category="media"`
*product_url* | string | A URL pointing to the vendor's webpage for the specific product, if available.
*Label-rectangle* Node
@@ -102,14 +113,14 @@ Property | Description
A *Label-rectangle* node describes the dimensions of a single label or business card that is rectangular
in shape (may have rounded edges).
Property | Description
--------------|------------
*id* | Reserved for future use. Should always be 0.
*width* | Width of label or card. E.g. `width="29mm"`
*height* | Height of label or card. E.g. `height="100mm"`
*round* | Radius of corners. For items with square edges (business cards), the radius should be 0.
*x_waste* | Amount of horizontal waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
*y_waste* | Amount of vertical waste (over-print) to allow.
Property | Type | Description
---------------|----------|------------
*id* | integer | Reserved for future use. Should always be 0.
*width* | distance | Width of label or card. E.g. `width="29mm"`
*height* | distance | Height of label or card. E.g. `height="100mm"`
*round* | distance | Radius of corners. For items with square edges (business cards), the radius should be 0.
*x_waste* | distance | Amount of horizontal waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
*y_waste* | distance | Amount of vertical waste (over-print) to allow.
![Label-rectangle properties](images/glabels-template-rect-label.png)
@@ -120,12 +131,12 @@ Property | Description
A *Label-ellipse* node describes the dimensions of a single label or business card that is elliptical
in shape.
Property | Description
--------------|------------
*id* | Reserved for future use. Should always be 0.
*width* | Width of label or card. E.g. `width="29mm"`
*height* | Height of label or card. E.g. `height="100mm"`
*waste* | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
Property | Type | Description
---------------|----------|------------
*id* | integer | Reserved for future use. Should always be 0.
*width* | distance | Width of label or card. E.g. `width="29mm"`
*height* | distance | Height of label or card. E.g. `height="100mm"`
*waste* | distance | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
![Label-ellipse properties](images/glabels-template-ellipse-label.png)
@@ -135,11 +146,11 @@ Property | Description
A *Label-round* node describes the dimensions of a simple round label (not a CD).
Property | Description
--------------|------------
*id* | Reserved for future use. Should always be 0.
*radius* | Radius (1/2 diameter) of label or card. E.g. `radius="14.5mm"`
*waste* | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
Property | Type | Description
---------------|----------|------------
*id* | integer | Reserved for future use. Should always be 0.
*radius* | distance | Radius (1/2 diameter) of label or card. E.g. `radius="14.5mm"`
*waste* | distance | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
![Label-round properties](images/glabels-template-round-label.png)
@@ -149,14 +160,14 @@ Property | Description
A *Label-cd* node describes the dimensions of a CD, DVD, or business card CD.
Property | Description
--------------|------------
*id* | Reserved for future use. Should always be 0.
*radius* | Outer radius (1/2 diameter) of label. E.g. `radius="58.5mm"`
*hole* | Radius (1/2 diameter) of concentric hole. E.g. `hole="18mm"`
*width* | If present, the label is clipped to the given Width. (For use with business card CDs.)
*height* | If present, the label is clipped to the given height. (For use with business card CDs.)
*waste* | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
Property | Type | Description
---------------|----------|------------
*id* | integer | Reserved for future use. Should always be 0.
*radius* | distance | Outer radius (1/2 diameter) of label. E.g. `radius="58.5mm"`
*hole* | distance | Radius (1/2 diameter) of concentric hole. E.g. `hole="18mm"`
*width* | distance | If present, the label is clipped to the given Width. (For use with business card CDs.)
*height* | distance | If present, the label is clipped to the given height. (For use with business card CDs.)
*waste* | distance | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
![Label-cd properties](images/glabels-template-cd-label.png)
@@ -165,13 +176,13 @@ Property | Description
A *Label-continuous* node describes the dimensions of a single section of a continuous label tape.
Property | Description
--------------|------------
*id* | Reserved for future use. Should always be 0.
*width* | Width of label or card. E.g. `width="29mm"`
*min_height* | Minimum user defined height or length of label.
*max_height* | Maximum user defined height or length of label.
*derault_height* | Default user defined height or length of label.
Property | Type | Description
-----------------|----------|------------
*id* | integer | Reserved for future use. Should always be 0.
*width* | distance | Width of label or card. E.g. `width="29mm"`
*min_height* | distance | Minimum user defined height or length of label.
*max_height* | distance | Maximum user defined height or length of label.
*default_height* | distance | Default user defined height or length of label.
*Label-path* Node
@@ -179,13 +190,13 @@ Property | Description
A *Label-path* node describes the dimensions of a label with an outline defined by an arbitrary path.
Property | Description
--------------|------------
*id* | Reserved for future use. Should always be 0.
*d_units* | Units used in path definition. (default = `"pt"`)
*d* | Path definition. This is a subset of of the SVG path "d" attribute. Commands include "M/m", "L/l", "H/h", "V/v", and "Z/z". Commands and data must be delimited by white space."
*x_waste* | Amount of horizontal waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
*y_waste* | Amount of vertical waste (over-print) to allow.
Property | Type | Description
---------------|----------|------------
*id* | integer | Reserved for future use. Should always be 0.
*d_units* | string | Units used in path definition. Must be a supported distance unit identifier. (default = `"pt"`)
*d* | string | Path definition. This is a subset of of the SVG path "d" attribute. Commands include "M/m", "L/l", "H/h", "V/v", and "Z/z". Commands and data must be delimited by white space."
*x_waste* | distance | Amount of horizontal waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images).
*y_waste* | distance | Amount of vertical waste (over-print) to allow.
*Markup* Nodes
@@ -201,59 +212,59 @@ special areas, or other helpful hints to the user of a template.
A *Markup-margin* describes a margin along all edges of a label.
Property | Description
--------------|------------
*size* | Size of the margin. I.e. the distance of the margin line from the edge of the card/label.
*x_size* | Size of the margin in x dimension. I.e. the distance of the margin line from the edge of the card/label.
*y_size* | Size of the margin in y dimension. I.e. the distance of the margin line from the edge of the card/label.
Property | Type | Description
---------------|----------|------------
*size* | distance | Size of the margin. I.e. the distance of the margin line from the edge of the card/label.
*x_size* | distance | Size of the margin in x dimension. I.e. the distance of the margin line from the edge of the card/label.
*y_size* | distance | Size of the margin in y dimension. I.e. the distance of the margin line from the edge of the card/label.
### *Markup-line* Node
A *Markup-line* node describes a markup line.
Property | Description
--------------|------------
*x1* | X coordinate of 1st endpoint of the line segment.
*y1* | Y coordinate of 1st endpoint of the line segment.
*x2* | X coordinate of 2nd endpoint of the line segment.
*y2* | Y coordinate of 2nd endpoint of the line segment.
Property | Type | Description
---------------|----------|------------
*x1* | distance | X coordinate of 1st endpoint of the line segment.
*y1* | distance | Y coordinate of 1st endpoint of the line segment.
*x2* | distance | X coordinate of 2nd endpoint of the line segment.
*y2* | distance | Y coordinate of 2nd endpoint of the line segment.
### *Markup-circle* Node
A *Markup-circle* describes a markup circle.
Property | Description
--------------|------------
*x0* | X coordinate of circle origin (center).
*y0* | Y coordinate of circle origin (center).
*radius* | Radius of circle.
Property | Type | Description
---------------|----------|------------
*x0* | distance | X coordinate of circle origin (center).
*y0* | distance | Y coordinate of circle origin (center).
*radius* | distance | Radius of circle.
### *Markup-rect* Node
A *Markup-rect* describes a markup rectangle.
Property | Description
--------------|------------
*x1* | X coordinate of upper left corner of rectangle.
*y1* | Y coordinate of upper left corner of rectangle.
*w* | Width of rectangle.
*h* | Height of rectangle.
*r* | Radius of rounded corners of rectangle.
Property | Type | Description
---------------|----------|------------
*x1* | distance | X coordinate of upper left corner of rectangle.
*y1* | distance | Y coordinate of upper left corner of rectangle.
*w* | distance | Width of rectangle.
*h* | distance | Height of rectangle.
*r* | distance | Radius of rounded corners of rectangle.
### *Markup-ellipse* Node
A *Markup-ellipse* describes a markup ellipse.
Property | Description
--------------|------------
*x1* | X coordinate of upper left corner of ellipse bounding box.
*y1* | Y coordinate of upper left corner of ellipse bounding box.
*w* | Width of ellipse.
*h* | Height of ellipse.
Property | Type | Description
---------------|----------|------------
*x1* | distance | X coordinate of upper left corner of ellipse bounding box.
*y1* | distance | Y coordinate of upper left corner of ellipse bounding box.
*w* | distance | Width of ellipse.
*h* | distance | Height of ellipse.
*Layout* Node
@@ -282,13 +293,13 @@ with unique coordinates for the top left corner of that label.
> A single label can always be treated as a grid of one.
Property | Description
--------------|------------
*nx* | Number of labels/cards in the grid in the X direction (horizontal).
*ny* | Number of labels/cards in the grid in the Y direction (vertical).
*x0* | Distance from left edge of sheet to the left edge of the left column of cards/labels in the layout.
*y0* | Distance from the top edge of sheet to the top edge of the top row of labels/cards in the layout.
*dx* | Horizontal pitch of grid.
*dy* | Vertical pitch of grid.
Property | Type | Description
---------------|----------|------------
*nx* | integer | Number of labels/cards in the grid in the X direction (horizontal).
*ny* | integer | Number of labels/cards in the grid in the Y direction (vertical).
*x0* | distance | Distance from left edge of sheet to the left edge of the left column of cards/labels in the layout.
*y0* | distance | Distance from the top edge of sheet to the top edge of the top row of labels/cards in the layout.
*dx* | distance | Horizontal pitch of grid.
*dy* | distance | Vertical pitch of grid.
![Layout example](images/glabels-template-layout.png)
+2 -1
View File
@@ -1,4 +1,5 @@
Developer Documentation Directory
=================================
This directory contains developer documentation. For user documentation, see [user-docs/](../user-docs).
This directory contains developer and installation documentation primarily for developers, packagers and other contributors.
For user documentation, see [user-docs/](../user-docs/_build).
+55 -61
View File
@@ -1,80 +1,74 @@
To Do List for gLabels 4.0 -- 2019-10-07
========================================
Expose user variables to glabels-batch
--------------------------------------
There should be a way to set initial values of user variables from the glabels-batch
command line. Possibly even create them on the fly.
- [x] Expose user variables to glabels-batch
Add programmable margin to text objects
---------------------------------------
The current built-in fixed margin seems to confuse people when dealing with
different horizontal and vertical alignments.
There should be a way to set initial values of user variables from the glabels-batch
command line. Possibly even create them on the fly.
Improve print copies UI
-----------------------
As with previous versions of glabels, there should be a way of selecting
the number of sheets to print. Merge printing should be able to be collated
or not, and if printing multiple copies, start on the same first label.
- [x] Improve print copies UI
Printer calibration tool
------------------------
There desperately needs to be a printer calibration tool. At a minimum
the tool should allow adjusting horizontal and vertical offsets. The
adjustments should be unique to each printer.
As with previous versions of glabels, there should be a way of selecting
the number of sheets to print. Merge printing should be able to be collated
or not, and if printing multiple copies, start on the same first label.
I am thinking of a test page with a cross in the center. It would have a
grid around this cross, indicating how much to adjust x & y. The user
would fold the paper in quaters and use this grid to guestimate the offsets.
- [ ] Write help documentation
There should be warnings about how printers may drift from calibration or
even not have repeatable results.
- [x] Add "User Variables" feature
* A more sophisticated tool, could adjust for scaling and skew, but it would
be very difficult to interact with the user on these.
Add page to MainWindow to
- Define variables,
- Set their initial values
- Control how they might increment (per item instance, per item copy, per page)
Save as part of glabels project file
Write help documentation
------------------------
- [x] Add support for arbitrary label shapes
I.e. similar to an SVG path.
Completed List for gLabels 4.0 -- 2018-04-15
============================================
- [x] Add support for "Continuous Roll" labels
Add "User Variables" feature
----------------------------
If product template is for a continuous roll, define a mininum and default length.
This determines h and dy
* Add page to MainWindow to
- Define variables
- Set their initial values
- Control how they might increment (per item instance, per item copy, per page)
* Save as part of glabels project file
Add support for arbitrary label shapes
--------------------------------------
* I.e. similar to an SVG path.
Add support for "Continuous Roll" labels
----------------------------------------
* If product template is for a continuous roll, define a mininum and default length
- This determines h and dy
* Add option to Properties page to adjust this value
Add option to Properties page to adjust this value
To Do List for gLabels 4.1 -- 2019-03-17
========================================
To Do List for post gLabels 4.0 -- 2019-03-17
=============================================
- [ ] Create a "built-in" merge source
As an alternative to external merge sources, let the user edit the merge source
in situ. The user can add fields. The user can add records using those fields.
The user created database will become part of the glabels project file.
For simple databases, such as a small address list, this would be much easier
to deal with than creating it externally.
- [ ] Printer calibration tool
There desperately needs to be a printer calibration tool. At a minimum
the tool should allow adjusting horizontal and vertical offsets. The
adjustments should be unique to each printer.
I am thinking of a test page with a cross in the center. It would have a
grid around this cross, indicating how much to adjust x & y. The user
would fold the paper in quaters and use this grid to guestimate the offsets.
There should be warnings about how printers may drift from calibration or
even not have repeatable results.
A more sophisticated tool, could adjust for scaling and skew, but it would
be very difficult to interact with the user on these.
- [ ] Add programmable margin to text objects
The current built-in fixed margin seems to confuse people when dealing with
different horizontal and vertical alignments.
Create a "built-in" merge source
--------------------------------
As an alternative to external merge sources, let the user edit the merge source
in situ. The user can add fields. The user can add records using those fields.
The user created database will become part of the glabels project file.
For simple databases, such as a small address list, this would be much easier
to deal with than creating it externally.
+57 -4
View File
@@ -31,12 +31,12 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QDebug>
#include <QLibraryInfo>
#include <QLocale>
#include <QPrinter>
#include <QPrinterInfo>
#include <QTranslator>
#include <QtDebug>
namespace
@@ -110,8 +110,14 @@ int main( int argc, char **argv )
QCoreApplication::translate( "main", "Set number of copies to <n>. (Default=1)" ),
"n", "1" },
{{"a","collate"},
QCoreApplication::translate( "main", "Collate merge copies." ) },
{{"g","group"},
QCoreApplication::translate( "main", "Start each merge group on a new page." ) },
{{"f","first"},
QCoreApplication::translate( "main", "Set starting label on 1st page to <n>. (Default=1)" ),
QCoreApplication::translate( "main", "Set starting position to <n>. (Default=1)" ),
"n", "1" },
{{"l","outlines"},
@@ -197,11 +203,58 @@ int main( int argc, char **argv )
}
glabels::model::PageRenderer renderer( model );
renderer.setNCopies( parser.value( "copies" ).toInt() );
renderer.setStartLabel( parser.value( "first" ).toInt() - 1 );
if ( model->merge()->keys().empty() )
{
// Simple project (no merge)
if ( parser.isSet( "sheets" ) )
{
// Full sheets of simple items
renderer.setNCopies( parser.value( "sheets" ).toInt() * model->frame()->nLabels() );
renderer.setStartItem( 0 );
}
else if ( parser.isSet( "copies" ) )
{
// Partial sheet(s) of simple items
renderer.setNCopies( parser.value( "copies" ).toInt() );
renderer.setStartItem( parser.value( "first" ).toInt() - 1 );
}
else
{
// One full sheet of simple items
renderer.setNCopies( model->frame()->nLabels() );
renderer.setStartItem( 0 );
}
}
else
{
// Project with merge
renderer.setNCopies( parser.value( "copies" ).toInt() );
renderer.setStartItem( parser.value( "first" ).toInt() - 1 );
renderer.setIsCollated( parser.isSet( "collate" ) );
renderer.setAreGroupsContiguous( !parser.isSet( "group" ) );
}
renderer.setPrintOutlines( parser.isSet( "outlines" ) );
renderer.setPrintCropMarks( parser.isSet( "crop-marks" ) );
renderer.setPrintReverse( parser.isSet( "reverse" ) );
// Item and page count summary
if ( renderer.nPages() == 1 )
{
if ( renderer.nItems() == 1 )
{
qDebug() << "Printing 1 item on 1 page.";
}
else
{
qDebug() << "Printing" << renderer.nItems() << "items on 1 page.";
}
}
else
{
qDebug() << "Printing" << renderer.nItems() << "items on" << renderer.nPages() << "pages.";
}
// Do it!
renderer.print( &printer );
}
}
+69 -16
View File
@@ -70,10 +70,7 @@ namespace glabels
connect( mModel, SIGNAL(changed()), this, SLOT(onModelChanged()) );
copiesSpin->setRange( 1, 100*mModel->frame()->nLabels() );
copiesStartSpin->setRange( 1, mModel->frame()->nLabels() );
onFormChanged();
onModelChanged();
}
@@ -82,10 +79,15 @@ namespace glabels
///
void PrintView::onModelChanged()
{
copiesSpin->setRange( 1, 100*mModel->frame()->nLabels() );
copiesStartSpin->setRange( 1, mModel->frame()->nLabels() );
printRangeStartPositionSpin->setRange( 1, mModel->frame()->nLabels() );
printRangeLastPositionSpin->setRange( 1, mModel->frame()->nLabels() );
mergeStartPositionSpin->setRange( 1, mModel->frame()->nLabels() );
updateView();
printRangeBox->setVisible( mModel->merge()->keys().empty() );
mergeBox->setVisible( !mModel->merge()->keys().empty() );
mergeOnlyOptions->setVisible( !mModel->merge()->keys().empty() );
onFormChanged();
}
@@ -98,22 +100,24 @@ namespace glabels
{
if ( mRenderer.nItems() == 1 )
{
copiesDescriptionLabel->setText( tr("(Will print a total of 1 item on 1 page.)") );
printDescriptionLabel->setText( tr("(Will print a total of 1 item on 1 page.)") );
}
else
{
copiesDescriptionLabel->setText( tr("(Will print a total of %1 items on 1 page.)")
.arg(mRenderer.nItems()) );
printDescriptionLabel->setText( tr("(Will print a total of %1 items on 1 page.)")
.arg(mRenderer.nItems()) );
}
}
else
{
copiesDescriptionLabel->setText( tr("(Will print a total of %1 items on %2 pages.)")
.arg(mRenderer.nItems()).arg(mRenderer.nPages()) );
printDescriptionLabel->setText( tr("(Will print a total of %1 items on %2 pages.)")
.arg(mRenderer.nItems()).arg(mRenderer.nPages()) );
}
pageSpin->setRange( 1, mRenderer.nPages() );
nPagesLabel->setText( QString::number( mRenderer.nPages() ) );
mRenderer.setIPage( pageSpin->value() - 1 ); // Update preview
}
@@ -126,15 +130,64 @@ namespace glabels
{
mBlocked = true;
mRenderer.setNCopies( copiesSpin->value() );
mRenderer.setStartLabel( copiesStartSpin->value() - 1 );
if ( mModel->merge()->keys().empty() )
{
// Simple project (no merge)
if ( printRangePagesRadio->isChecked() )
{
// Print full sheets of labels
int nItemsPerPage = mModel->frame()->nLabels();
printRangePagesSpin->setEnabled( true );
printRangeStartPositionSpin->setEnabled( false );
printRangeLastPositionSpin->setEnabled( false );
printRangeStartPositionSpin->setMaximum( nItemsPerPage );
printRangeLastPositionSpin->setMinimum( 1 );
printRangeStartPositionSpin->setValue( 1 );
printRangeLastPositionSpin->setValue( nItemsPerPage );
mRenderer.setNCopies( printRangePagesSpin->value()*nItemsPerPage );
mRenderer.setStartItem( 0 );
}
else
{
// Print a partial sheet of labels
int iStart = printRangeStartPositionSpin->value();
int iLast = printRangeLastPositionSpin->value();
printRangePagesSpin->setEnabled( false );
printRangeStartPositionSpin->setEnabled( true );
printRangeLastPositionSpin->setEnabled( true );
printRangeStartPositionSpin->setMaximum( iLast );
printRangeLastPositionSpin->setMinimum( iStart );
mRenderer.setNCopies( iLast - iStart + 1 );
mRenderer.setStartItem( iStart - 1 );
}
}
else
{
// Project with merge
bool isMultipleCopies = mergeCopiesSpin->value() > 1;
mergeCollateCombo->setEnabled ( isMultipleCopies );
mergeGroupCombo->setEnabled ( isMultipleCopies );
mRenderer.setNCopies( mergeCopiesSpin->value() );
mRenderer.setIsCollated( mergeCollateCombo->currentIndex() == 1 );
mRenderer.setAreGroupsContiguous( mergeGroupCombo->currentIndex() == 0 );
mRenderer.setStartItem( mergeStartPositionSpin->value() - 1 );
}
mRenderer.setPrintOutlines( printOutlinesCheck->isChecked() );
mRenderer.setPrintCropMarks( printCropMarksCheck->isChecked() );
mRenderer.setPrintReverse( printReverseCheck->isChecked() );
mRenderer.setIPage( pageSpin->value() - 1 );
updateView();
mBlocked = false;
+1 -1
View File
@@ -473,7 +473,7 @@ namespace glabels
model::PageRenderer renderer( sheet );
renderer.setNCopies( sheet->frame()->nLabels() );
renderer.setStartLabel( 0 );
renderer.setStartItem( 0 );
renderer.setPrintOutlines( true );
QPrinter printer( QPrinter::HighResolution );
+4
View File
@@ -95,13 +95,17 @@
<file>icons/flat/24x24/glabels-valign-text-middle.svg</file>
<file>icons/flat/24x24/glabels-valign-text-top.svg</file>
<file>icons/flat/32x32/glabels-collated.svg</file>
<file>icons/flat/32x32/glabels-file-new.svg</file>
<file>icons/flat/32x32/glabels-file-open.svg</file>
<file>icons/flat/32x32/glabels-file-recent.svg</file>
<file>icons/flat/32x32/glabels-label-orientation-horiz.svg</file>
<file>icons/flat/32x32/glabels-label-orientation-vert.svg</file>
<file>icons/flat/32x32/glabels-merge-group-contiguous.svg</file>
<file>icons/flat/32x32/glabels-merge-group-page.svg</file>
<file>icons/flat/32x32/glabels-print.svg</file>
<file>icons/flat/32x32/glabels-select-product.svg</file>
<file>icons/flat/32x32/glabels-uncollated.svg</file>
<file>icons/apps/32x32/glabels.svg</file>
<file>icons/flat/48x48/glabels-edit.svg</file>
@@ -0,0 +1,23 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32" >
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="4.5" y="2.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="6.5" y="4.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="8.5" y="6.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="4.5" y="17.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="6.5" y="19.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="8.5" y="21.5" rx="1" ry="1" />
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,45 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32" >
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="24" width="18" x="6.5" y="2.5" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="24" width="18" x="8.5" y="4.5" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="11" y="7" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="18" y="7" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="11" y="12" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="18" y="12" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="11" y="17" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="18" y="17" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="11" y="22" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="18" y="22" />
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,30 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32" >
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="24" width="18" x="5.5" y="1.5" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="24" width="18" x="7.5" y="3.5" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="24" width="18" x="9.5" y="5.5" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="12" y="8" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="19" y="8" />
<rect
style="fill:#666666;fill-opacity:1;stroke:none"
height="4" width="6" x="12" y="13" />
</svg>

After

Width:  |  Height:  |  Size: 835 B

@@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32" >
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="2.5" y="7.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="4.5" y="9.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="6.5" y="11.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="8.5" y="13.5" rx="1" ry="1" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
height="8" width="20" x="10.5" y="15.5" rx="1" ry="1" />
</svg>

After

Width:  |  Height:  |  Size: 872 B

+418 -81
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>852</width>
<height>792</height>
<height>796</height>
</rect>
</property>
<property name="sizePolicy">
@@ -22,6 +22,9 @@
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>9</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
@@ -51,7 +54,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="copiesBox">
<widget class="QGroupBox" name="printRangeBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -71,26 +74,29 @@
</size>
</property>
<property name="title">
<string>Copies</string>
<string>Print range</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QRadioButton" name="printRangePagesRadio">
<property name="text">
<string>Copies:</string>
<string>Pages</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QSpinBox" name="copiesSpin">
<widget class="QSpinBox" name="printRangePagesSpin">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::UpDownArrows</enum>
</property>
@@ -101,7 +107,7 @@
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
<number>250</number>
</property>
</widget>
</item>
@@ -121,48 +127,67 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QRadioButton" name="printRangePositionsRadio">
<property name="text">
<string>Start on position:</string>
<string>Positions</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QSpinBox" name="copiesStartSpin">
<widget class="QSpinBox" name="printRangeStartPositionSpin">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="label_4">
<property name="text">
<string>on 1st page</string>
<string>to</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<widget class="QSpinBox" name="printRangeLastPositionSpin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -176,29 +201,114 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mergeBox">
<property name="title">
<string>Merge control</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="copiesDescriptionLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>330</width>
<height>0</height>
</size>
</property>
<widget class="QLabel" name="label">
<property name="text">
<string notr="true">(Will print a total of xxxx items on nnn pages.) </string>
<string>Copies:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="mergeCopiesSpin">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="mergeCollateCombo">
<property name="styleSheet">
<string notr="true">text-align:left; padding:3px;</string>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<item>
<property name="text">
<string>Uncollated (e.g. 1,1,1 2,2,2 3,3,3)</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flat/32x32/glabels-uncollated.svg</normaloff>:/icons/flat/32x32/glabels-uncollated.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Collated (e.g. 1,2,3 1,2,3 1,2,3)</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flat/32x32/glabels-collated.svg</normaloff>:/icons/flat/32x32/glabels-collated.svg</iconset>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="mergeGroupCombo">
<property name="styleSheet">
<string notr="true">text-align:left; padding:3px;</string>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<item>
<property name="text">
<string>Merge groups are contiguous</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flat/32x32/glabels-merge-group-contiguous.svg</normaloff>:/icons/flat/32x32/glabels-merge-group-contiguous.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Merge groups start on a new page</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flat/32x32/glabels-merge-group-page.svg</normaloff>:/icons/flat/32x32/glabels-merge-group-page.svg</iconset>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
@@ -223,10 +333,10 @@
</size>
</property>
<property name="title">
<string>Print options</string>
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="printOutlinesCheck">
@@ -249,11 +359,84 @@
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="mergeOnlyOptions" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Start groups at position:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="mergeStartPositionSpin">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>12</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="printButton">
<property name="sizePolicy">
@@ -266,7 +449,7 @@
<string notr="true">text-align:left; padding:3px;</string>
</property>
<property name="text">
<string>Print</string>
<string>Print...</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
@@ -278,8 +461,63 @@
<height>32</height>
</size>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>2</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="printDescriptionLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>330</width>
<height>0</height>
</size>
</property>
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;(Will print a total of xxxx items on nnn pages.)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>2</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@@ -401,30 +639,14 @@
</resources>
<connections>
<connection>
<sender>copiesStartSpin</sender>
<sender>printRangePagesSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>221</x>
<y>124</y>
</hint>
<hint type="destinationlabel">
<x>4</x>
<y>309</y>
</hint>
</hints>
</connection>
<connection>
<sender>copiesSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>161</x>
<y>84</y>
<x>175</x>
<y>122</y>
</hint>
<hint type="destinationlabel">
<x>2</x>
@@ -439,8 +661,8 @@
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>114</x>
<y>220</y>
<x>182</x>
<y>444</y>
</hint>
<hint type="destinationlabel">
<x>2</x>
@@ -455,8 +677,8 @@
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>84</x>
<y>248</y>
<x>152</x>
<y>475</y>
</hint>
<hint type="destinationlabel">
<x>6</x>
@@ -471,8 +693,8 @@
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>88</x>
<y>276</y>
<x>156</x>
<y>506</y>
</hint>
<hint type="destinationlabel">
<x>6</x>
@@ -487,8 +709,8 @@
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>645</x>
<y>745</y>
<x>641</x>
<y>760</y>
</hint>
<hint type="destinationlabel">
<x>1</x>
@@ -503,8 +725,8 @@
<slot>onPrintButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>249</x>
<y>325</y>
<x>291</x>
<y>589</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
@@ -512,10 +734,125 @@
</hint>
</hints>
</connection>
<connection>
<sender>mergeCopiesSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>159</x>
<y>243</y>
</hint>
<hint type="destinationlabel">
<x>7</x>
<y>218</y>
</hint>
</hints>
</connection>
<connection>
<sender>printRangePagesRadio</sender>
<signal>toggled(bool)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>59</x>
<y>108</y>
</hint>
<hint type="destinationlabel">
<x>6</x>
<y>76</y>
</hint>
</hints>
</connection>
<connection>
<sender>printRangeStartPositionSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>142</x>
<y>149</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
<y>123</y>
</hint>
</hints>
</connection>
<connection>
<sender>printRangeLastPositionSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>226</x>
<y>145</y>
</hint>
<hint type="destinationlabel">
<x>8</x>
<y>155</y>
</hint>
</hints>
</connection>
<connection>
<sender>mergeCollateCombo</sender>
<signal>currentIndexChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>52</x>
<y>261</y>
</hint>
<hint type="destinationlabel">
<x>3</x>
<y>192</y>
</hint>
</hints>
</connection>
<connection>
<sender>mergeGroupCombo</sender>
<signal>currentIndexChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>231</x>
<y>314</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
<y>378</y>
</hint>
</hints>
</connection>
<connection>
<sender>mergeStartPositionSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>PrintView</receiver>
<slot>onFormChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>362</y>
</hint>
<hint type="destinationlabel">
<x>4</x>
<y>309</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>onPrintButtonClicked()</slot>
<slot>onFormChanged()</slot>
<slot>onPrinterPropertiesButtonClicked()</slot>
</slots>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>
+169 -29
View File
@@ -47,9 +47,9 @@ namespace glabels
PageRenderer::PageRenderer( const Model* model )
: mModel(nullptr), mMerge(nullptr), mVariables(nullptr), mNCopies(0), mStartLabel(0), mLastLabel(0),
: mModel(nullptr), mMerge(nullptr), mVariables(nullptr), mNCopies(0), mStartItem(0), mLastItem(0),
mPrintOutlines(false), mPrintCropMarks(false), mPrintReverse(false),
mIPage(0), mIsMerge(false), mNPages(0), mNLabelsPerPage(0)
mIPage(0), mIsMerge(false), mNPages(0), mNItemsPerPage(0)
{
if ( model )
{
@@ -79,7 +79,7 @@ namespace glabels
{
mMerge = mModel->merge();
mOrigins = mModel->frame()->getOrigins();
mNLabelsPerPage = mModel->frame()->nLabels();
mNItemsPerPage = mModel->frame()->nLabels();
mIsMerge = ( dynamic_cast<const merge::None*>(mMerge) == nullptr );
updateNPages();
@@ -96,15 +96,33 @@ namespace glabels
}
void PageRenderer::setStartLabel( int startLabel )
void PageRenderer::setStartItem( int startItem )
{
mStartLabel = startLabel;
mStartItem = startItem;
updateNPages();
emit changed();
}
void PageRenderer::setIsCollated( bool isCollated )
{
mIsCollated = isCollated;
updateNPages();
emit changed();
}
void PageRenderer::setAreGroupsContiguous( bool areGroupsContiguous )
{
mAreGroupsContiguous = areGroupsContiguous;
updateNPages();
emit changed();
}
void PageRenderer::setPrintOutlines( bool printOutlinesFlag )
{
mPrintOutlines = printOutlinesFlag;
@@ -139,7 +157,7 @@ namespace glabels
int PageRenderer::nItems() const
{
return mLastLabel - mStartLabel;
return mNItems;
}
@@ -166,25 +184,49 @@ namespace glabels
{
if ( mModel )
{
if ( mIsMerge )
if ( !mIsMerge )
{
mLastLabel = mStartLabel + mNCopies*mMerge->nSelectedRecords();
// Simple project
mLastItem = mStartItem + mNCopies - 1;
mNItems = mNCopies;
mNGroups = 1;
mNItemsPerGroup = mNItems;
}
else
{
mLastLabel = mStartLabel + mNCopies;
}
mNPages = mLastLabel / mNLabelsPerPage;
if ( mLastLabel % mNLabelsPerPage )
{
mNPages++;
// Merge project
if ( mIsCollated )
{
// Collated Merge project
mNItemsPerGroup = mMerge->nSelectedRecords();
mNGroups = mNCopies;
}
else
{
// Un-Collated Merge project
mNItemsPerGroup = mNCopies;
mNGroups = mMerge->nSelectedRecords();
}
if ( mAreGroupsContiguous )
{
// Merge groups are contiguous
mLastItem = mStartItem + mNGroups*mNItemsPerGroup - 1;
}
else
{
// Merge groups start on new page
mNPagesPerGroup = (mStartItem + mNItemsPerGroup - 1)/mNItemsPerPage + 1;
mLastItem = (mNGroups-1)*mNPagesPerGroup*mNItemsPerPage + mStartItem + mNItemsPerGroup - 1;
}
mNItems = mNGroups*mNItemsPerGroup;
}
}
else
{
mNPages = 0;
}
mNPages = mLastItem/mNItemsPerPage + 1;
}
@@ -233,13 +275,20 @@ namespace glabels
{
if ( mModel )
{
if ( mIsMerge )
if ( !mIsMerge )
{
printMergePage( painter, iPage );
printSimplePage( painter, iPage );
}
else
{
printSimplePage( painter, iPage );
if ( mIsCollated )
{
printCollatedMergePage( painter, iPage );
}
else
{
printUnCollatedMergePage( painter, iPage );
}
}
}
}
@@ -250,7 +299,7 @@ namespace glabels
printCropMarks( painter );
int iCopy = 0;
int iLabel = mStartLabel;
int iItem = mStartItem;
int iCurrentPage = 0;
mVariables->resetVariables();
@@ -258,7 +307,7 @@ namespace glabels
{
if ( iCurrentPage == iPage )
{
int i = iLabel % mNLabelsPerPage;
int i = iItem % mNItemsPerPage;
painter->save();
@@ -276,13 +325,15 @@ namespace glabels
painter->restore(); // From before translation
}
// Next copy
iCopy++;
iLabel++;
iCurrentPage = iLabel / mNLabelsPerPage;
iItem++;
iCurrentPage = iItem / mNItemsPerPage;
// User variable book keeping
mVariables->incrementVariablesOnItem();
mVariables->incrementVariablesOnCopy();
if ( (iLabel % mNLabelsPerPage) == 0 /* starting a new page */ )
if ( (iItem % mNItemsPerPage) == 0 /* starting a new page */ )
{
mVariables->incrementVariablesOnPage();
}
@@ -290,12 +341,12 @@ namespace glabels
}
void PageRenderer::printMergePage( QPainter* painter, int iPage ) const
void PageRenderer::printCollatedMergePage( QPainter* painter, int iPage ) const
{
printCropMarks( painter );
int iCopy = 0;
int iLabel = mStartLabel;
int iItem = mStartItem;
int iCurrentPage = 0;
const QList<merge::Record*> records = mMerge->selectedRecords();
@@ -313,7 +364,7 @@ namespace glabels
{
if ( iCurrentPage == iPage )
{
int i = iLabel % mNLabelsPerPage;
int i = iItem % mNItemsPerPage;
painter->save();
@@ -331,20 +382,109 @@ namespace glabels
painter->restore(); // From before translation
}
// Next record
iRecord = (iRecord + 1) % nRecords;
if ( iRecord == 0 )
{
iCopy++;
if ( mAreGroupsContiguous )
{
iItem++;
}
else
{
iItem = iCopy*mNPagesPerGroup*mNItemsPerPage + mStartItem;
}
}
iLabel++;
iCurrentPage = iLabel / mNLabelsPerPage;
else
{
iItem++;
}
iCurrentPage = iItem / mNItemsPerPage;
// User variable book keeping
mVariables->incrementVariablesOnItem();
if ( iRecord == 0 )
{
mVariables->incrementVariablesOnCopy();
}
if ( (iLabel % mNLabelsPerPage) == 0 /* starting a new page */ )
if ( (iItem % mNItemsPerPage) == 0 /* starting a new page */ )
{
mVariables->incrementVariablesOnPage();
}
}
}
void PageRenderer::printUnCollatedMergePage( QPainter* painter, int iPage ) const
{
printCropMarks( painter );
int iCopy = 0;
int iItem = mStartItem;
int iCurrentPage = 0;
const QList<merge::Record*> records = mMerge->selectedRecords();
int iRecord = 0;
int nRecords = records.size();
if ( nRecords == 0 )
{
return;
}
mVariables->resetVariables();
while ( (iRecord < nRecords) && (iCurrentPage <= iPage) )
{
if ( iCurrentPage == iPage )
{
int i = iItem % mNItemsPerPage;
painter->save();
painter->translate( mOrigins[i].x().pt(), mOrigins[i].y().pt() );
painter->save();
clipLabel( painter );
printLabel( painter, records[iRecord], mVariables );
painter->restore(); // From before clip
printOutline( painter );
painter->restore(); // From before translation
}
// Next copy
iCopy = (iCopy + 1) % mNCopies;
if ( iCopy == 0 )
{
iRecord++;
if ( mAreGroupsContiguous )
{
iItem++;
}
else
{
iItem = iRecord*mNPagesPerGroup*mNItemsPerPage + mStartItem;
}
}
else
{
iItem++;
}
iCurrentPage = iItem / mNItemsPerPage;
// User variable book keeping
mVariables->incrementVariablesOnItem();
mVariables->incrementVariablesOnCopy();
if ( iCopy == 0 )
{
mVariables->resetOnCopyVariables();
}
if ( (iItem % mNItemsPerPage) == 0 /* starting a new page */ )
{
mVariables->incrementVariablesOnPage();
}
+19 -8
View File
@@ -64,7 +64,9 @@ namespace glabels
void setModel( const Model* model );
const Model* model() const;
void setNCopies( int nCopies );
void setStartLabel( int startLabel );
void setStartItem( int startItem );
void setIsCollated( bool isCollated );
void setAreGroupsContiguous( bool areGroupscontiguous );
void setPrintOutlines( bool printOutlinesFlag );
void setPrintCropMarks( bool printCropMarksFlag );
void setPrintReverse( bool printReverseFlag );
@@ -97,7 +99,8 @@ namespace glabels
private:
void updateNPages();
void printSimplePage( QPainter* painter, int iPage ) const;
void printMergePage( QPainter* painter, int iPage ) const;
void printCollatedMergePage( QPainter* painter, int iPage ) const;
void printUnCollatedMergePage( QPainter* painter, int iPage ) const;
void printCropMarks( QPainter* painter ) const;
void printOutline( QPainter* painter ) const;
void clipLabel( QPainter* painter ) const;
@@ -113,16 +116,24 @@ namespace glabels
Variables* mVariables;
int mNCopies;
int mStartLabel;
int mLastLabel;
bool mPrintOutlines;
bool mPrintCropMarks;
bool mPrintReverse;
int mStartItem;
int mLastItem;
int mNGroups;
int mNItemsPerGroup;
int mNPagesPerGroup;
int mIPage;
bool mIsMerge;
int mNItems;
int mNPages;
int mNLabelsPerPage;
int mNItemsPerPage;
bool mIsCollated;
bool mAreGroupsContiguous;
bool mPrintOutlines;
bool mPrintCropMarks;
bool mPrintReverse;
QVector<Point> mOrigins;
};
+15
View File
@@ -118,6 +118,21 @@ namespace glabels
}
///
/// Reset "on copy" variables to their initial values
///
void Variables::resetOnCopyVariables()
{
for ( auto& v : *this )
{
if ( v.increment() == Variable::Increment::PER_COPY )
{
v.resetValue();
}
}
}
///
/// Increment variables on item
///
+1
View File
@@ -66,6 +66,7 @@ namespace glabels
void setVariables( const QMap<QString,QString>& definitions );
void resetVariables();
void resetOnCopyVariables();
void incrementVariablesOnItem();
void incrementVariablesOnCopy();
void incrementVariablesOnPage();
+48 -20
View File
@@ -531,26 +531,10 @@
</context>
<context>
<name>PrintView</name>
<message>
<source>Copies</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copies:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start on position:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>on 1st page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Print options</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>print outlines</source>
<translation type="unfinished"></translation>
@@ -563,10 +547,6 @@
<source>print in reverse (i.e. a mirror image)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Print</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
@@ -579,6 +559,54 @@
<source>nn</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Pages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Print range</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Positions</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>to</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Merge control</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Uncollated (e.g. 1,1,1 2,2,2 3,3,3)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Collated (e.g. 1,2,3 1,2,3 1,2,3)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Merge groups are contiguous</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Merge groups start on a new page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Print...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start groups at position:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PropertiesView</name>
+34 -12
View File
@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "GLABELS-BATCH-QT" "1" "Nov 27, 2019" "" "gLabels"
.TH "GLABELS-BATCH-QT" "1" "Jan 01, 2020" "" "gLabels"
.SH NAME
glabels-batch-qt \- batch creation of labels and business cards
.
@@ -35,9 +35,8 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
\fBglabels\-batch\-qt\fP [\fIoptions\fP] [\fIfilename\fP]
.SH DESCRIPTION
.sp
\fBglabels\-batch\-qt\fP is a utility for printing files previously
prepared with \fBglabels\-qt\fP from the command line. It is suitable
for use with scripts.
\fBglabels\-batch\-qt\fP is a utility for printing a glabels project file
from the command line. It is suitable for use with scripts.
.SH OPTIONS
.INDENT 0.0
.TP
@@ -57,13 +56,15 @@ Send output to <printer>.
.INDENT 0.0
.TP
.B \-o [<filename>], \-\-output [<filename>]
Set output filename to <filename>. Set to "\-" for stdout.
(Default="output.pdf")
.TP
.B Set output filename to <filename>. If filename is "\-", write to standard output.
.TP
.B (Default="output.pdf")
.UNINDENT
.INDENT 0.0
.TP
.B \-s <n>, \-\-sheets <n>
Set number of sheets to <n>. (Default=1)
For simple projects, sets number of full sheets to <n>. (Default=1)
.UNINDENT
.INDENT 0.0
.TP
@@ -72,8 +73,18 @@ Set number of copies to <n>. (Default=1)
.UNINDENT
.INDENT 0.0
.TP
.B \-a, \-\-collate
Collate merge copies.
.UNINDENT
.INDENT 0.0
.TP
.B \-g, \-\-group
Start each merge group on a new page.
.UNINDENT
.INDENT 0.0
.TP
.B \-f <n>, \-\-first <n>
Set starting label on 1st page to <n>. (Default=1)
Set starting position to <n>. (Default=1)
.UNINDENT
.INDENT 0.0
.TP
@@ -113,7 +124,20 @@ templates here!\fP
.B ${HOME}/.glabels/
Directory for manually created product templates.
.UNINDENT
.SH BUGS
.SH KNOWN ISSUES
.sp
On GNU/Linux platforms, \fBglabels\-batch\-qt\fP must be run from within a windowing environment, such as X or Wayland. This is because Qt requires a suitable platform to obtain system font information. A work\-around is to run \fBglabels\-batch\-qt\fP using a virtual X server environment:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
xvfb\-run glabels\-batch\-qt \-o output.pdf myProject.glabels
.ft P
.fi
.UNINDENT
.UNINDENT
.SH REPORTING BUGS
.sp
On GNU/Linux platforms, \fBglabels\-batch\-qt\fP must be run from within a windowing environment, such as X or Wayland. This is because Qt requires a suitable platform to obtain system font information. A work\-around is to run \fBglabels\-batch\-qt\fP using a virtual X server environment:
.INDENT 0.0
@@ -134,9 +158,7 @@ Bugs and feature requests can be reported via the gLabels issue tracking system
\fBglabels\-qt(1)\fP
.sp
The gLabels homepage at <\fI\%http://glabels.org/\fP>.
.SH AUTHOR
Jim Evins
.SH COPYRIGHT
2018, Jim Evins <evins@snaught.com>
2020, Jim Evins <evins@snaught.com>
.\" Generated by docutils manpage writer.
.
+2 -4
View File
@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "GLABELS-QT" "1" "Nov 27, 2019" "" "gLabels"
.TH "GLABELS-QT" "1" "Jan 01, 2020" "" "gLabels"
.SH NAME
glabels-qt \- create labels and business cards
.
@@ -75,9 +75,7 @@ Bugs and feature requests can be reported via the gLabels issue tracking system
\fBglabels\-batch\-qt(1)\fP
.sp
The gLabels homepage at <\fI\%http://glabels.org/\fP>.
.SH AUTHOR
Jim Evins
.SH COPYRIGHT
2018, Jim Evins <evins@snaught.com>
2020, Jim Evins <evins@snaught.com>
.\" Generated by docutils manpage writer.
.
+3 -3
View File
@@ -47,7 +47,7 @@ master_doc = 'index'
# General information about the project.
project = 'gLabels'
copyright = '2018, Jim Evins <evins@snaught.com>'
copyright = '2020, Jim Evins <evins@snaught.com>'
author = 'Jim Evins'
# The version info for the project you're documenting, acts as replacement for
@@ -149,8 +149,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('man/glabels-qt', 'glabels-qt', 'create labels and business cards', [author], 1),
('man/glabels-batch-qt', 'glabels-batch-qt', 'batch creation of labels and business cards', [author], 1)
('man/glabels-qt', 'glabels-qt', 'create labels and business cards', [], 1),
('man/glabels-batch-qt', 'glabels-batch-qt', 'batch creation of labels and business cards', [], 1)
]
+48 -32
View File
@@ -9,55 +9,61 @@ SYNOPSIS
DESCRIPTION
-----------
:program:`glabels-batch-qt` is a utility for printing files previously
prepared with :program:`glabels-qt` from the command line. It is suitable
for use with scripts.
:program:`glabels-batch-qt` is a utility for printing a glabels project file
from the command line. It is suitable for use with scripts.
OPTIONS
-------
.. program:: glabels-batch-qt
.. option:: -h, --help
Displays usage information and exits.
.. option:: -v, --version
Displays version information and exits.
.. option:: -p <printer>, --printer <printer>
Send output to <printer>.
.. option:: -o [<filename>], --output [<filename>]
Set output filename to <filename>. Set to "-" for stdout.
Set output filename to <filename>. If filename is "-", write to standard output.
(Default="output.pdf")
.. option:: -s <n>, --sheets <n>
Set number of sheets to <n>. (Default=1)
For simple projects, sets number of full sheets to <n>. (Default=1)
.. option:: -c <n>, --copies <n>
Set number of copies to <n>. (Default=1)
.. option:: -a, --collate
Collate merge copies.
.. option:: -g, --group
Start each merge group on a new page.
.. option:: -f <n>, --first <n>
Set starting label on 1st page to <n>. (Default=1)
Set starting position to <n>. (Default=1)
.. option:: -l, --outlines
Print label outlines.
.. option:: -m, --crop-marks
Print crop marks.
.. option:: -r, --reverse
Print in reverse (mirror image).
.. option:: -D <var>=<value>, --define <var>=<value>
@@ -68,21 +74,31 @@ FILES
-----
.. describe:: ${prefix}/share/glabels-qt/templates/
Directory containing predefined product templates distributed with glabels.
.. describe:: ${XDG_CONFIG_HOME}/glabels.org/glabels-qt/
Directory containing user defined product templates created with the
gLabels Product Template Designer. **Do not place manually created
templates here!**
.. describe:: ${HOME}/.glabels/
Directory for manually created product templates.
BUGS
----
KNOWN ISSUES
------------
On GNU/Linux platforms, :program:`glabels-batch-qt` must be run from within a windowing environment, such as X or Wayland. This is because Qt requires a suitable platform to obtain system font information. A work-around is to run :program:`glabels-batch-qt` using a virtual X server environment:
.. code:: shell
xvfb-run glabels-batch-qt -o output.pdf myProject.glabels
REPORTING BUGS
--------------
On GNU/Linux platforms, :program:`glabels-batch-qt` must be run from within a windowing environment, such as X or Wayland. This is because Qt requires a suitable platform to obtain system font information. A work-around is to run :program:`glabels-batch-qt` using a virtual X server environment:
@@ -100,5 +116,5 @@ SEE ALSO
--------
:manpage:`glabels-qt(1)`
The gLabels homepage at <http://glabels.org/>.
+10 -10
View File
@@ -17,30 +17,30 @@ OPTIONS
-------
.. program:: glabels-qt
.. option:: -h, --help
Displays usage information and exits.
.. option:: -v, --version
Displays version information and exits.
FILES
-----
.. describe:: ${prefix}/share/glabels-qt/templates/
Directory containing predefined product templates distributed with glabels.
.. describe:: ${XDG_CONFIG_HOME}/glabels.org/glabels-qt/
Directory containing user defined product templates created with the
gLabels Product Template Designer. **Do not place manually created
templates here!**
.. describe:: ${HOME}/.glabels/
Directory for manually created product templates.
REPORTING BUGS
@@ -53,5 +53,5 @@ SEE ALSO
--------
:manpage:`glabels-batch-qt(1)`
The gLabels homepage at <http://glabels.org/>.