Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser for fileformat 3 #39

Closed
wants to merge 62 commits into from
Closed

Parser for fileformat 3 #39

wants to merge 62 commits into from

Conversation

hochwasser
Copy link
Contributor

This is the compatibility parser for file version 3 aka the gtk version of glabels.

hochwasser and others added 30 commits November 21, 2018 00:23
- New parser class for handling the old format.
  It handles all supported options of the new model.
  gdk pixdata is also imported.
- Format for debug output of the distance class

ToDo: Alignment of text seems reversed. This needs to be checked.
For the first try parse all NL tags to a newline.
It should be checked if ever NL implies a new block in the qt document.
- make all barcode style names lowercase to be compatible with glabels-4.0.dtd
- convert backend="libiec16022" and style="IEC16022" to build in datamatrix code
If the size attributes are not updated, the GUI shows 0 for them.
- New parser class for handling the old format.
  It handles all supported options of the new model.
  gdk pixdata is also imported.
- Format for debug output of the distance class

ToDo: Alignment of text seems reversed. This needs to be checked.
For the first try parse all NL tags to a newline.
It should be checked if ever NL implies a new block in the qt document.
- make all barcode style names lowercase to be compatible with glabels-4.0.dtd
- convert backend="libiec16022" and style="IEC16022" to build in datamatrix code
The backend will be added to the application. When the conversation from
gtk to qt happend it got removed.
- sort constructors after the order in the class
- comment unused variable
- remove extra and not needed ;
- New parser class for handling the old format.
  It handles all supported options of the new model.
  gdk pixdata is also imported.
- Format for debug output of the distance class

ToDo: Alignment of text seems reversed. This needs to be checked.
hochwasser and others added 21 commits November 21, 2018 00:32
If the size attributes are not updated, the GUI shows 0 for them.
- New parser class for handling the old format.
  It handles all supported options of the new model.
  gdk pixdata is also imported.
- Format for debug output of the distance class

ToDo: Alignment of text seems reversed. This needs to be checked.
For the first try parse all NL tags to a newline.
It should be checked if ever NL implies a new block in the qt document.
- make all barcode style names lowercase to be compatible with glabels-4.0.dtd
- convert backend="libiec16022" and style="IEC16022" to build in datamatrix code
The backend will be added to the application. When the conversation from
gtk to qt happend it got removed.
- sort constructors after the order in the class
- comment unused variable
- remove extra and not needed ;
- check that a node can be converted to a element
- replace the version 0_4 to 3 since the dtd is named 3
- sort the includes that it is more readable
- rename some variables to reflect the content
Line 546:  no such variable as tagName.
Consistent numbers of blank lines.
Don't need this.  Does not actually override TARGET settings.  Nor do  I want to move to C++14 at this time -- will need to validate in CI environment when the time comes.
@jimevins
Copy link
Owner

jimevins commented Nov 22, 2018

There are two remaining capabilities for this to be feature complete: text box sizes and merge fields within text and barcode objects. The following is a tarball of some test data to help.

test-data-3.tar.gz

Note for the crew-orientation-name-tags-7.glabels example, once converted, you will need to point the merge source to the location of the CSV file in your directory (i.e. the locations are encoded as absolute path names -- merge locations were never designed to be relocatable).

Text Box Sizes

Again, since the text object models are different, I would simply ignore the original sizes if either is set to zero and use the ModelTextObject::naturalSize() method to set the size. For example, the following is the code when pasting text from the clipboard:

        // Create object from clipboard text
        auto* object = new ModelTextObject();
        object->setText( mimeData->text() );
        object->setSize( object->naturalSize() );
        object->setPosition( (w()-object->w())/2.0, (h()-object->h())/2.0 );

You may be able to still use the omnibus constructor and follow it with the setSize() method or you can use the default constructor followed by multiple setters.

Merge Fields in Text and Barcode Objects

Merge fields in these objects are now simply embedded substitution fields. E.g. ${field-name}.

So for barcodes this is easy, if it has an attribute of field="SN", you would simply set its data to ${SN}.

For text objects, when you encounter a <Field name="FIRST_NAME"/> node/element you need to insert a ${FIRST_NAME} into the text at that point.

hochwasser added 2 commits November 26, 2018 17:31
The size of textboxes differ greatly between gtk and qt. So the best option is to ignore the size that is in the file and calculate the size based on the text in it.
For merging of text templates there is a special syntax. so every field hast du be surrounded by ${ and }
@hochwasser
Copy link
Contributor Author

I have fixed the size issue with the recalculation and field are now enclosed with ${}.
Thanks for the test data.
Are there some more testes needed for the older formats before format version 3?

@jimevins
Copy link
Owner

jimevins commented Dec 2, 2018

Cleaned up and manually merged.

@jimevins jimevins closed this Dec 2, 2018
@bdcomp bdcomp mentioned this pull request Dec 3, 2018
@hochwasser hochwasser deleted the parser_for_fileformat_3 branch December 10, 2018 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants