How gipson-dev/labelprinterapp works
1. Overall shape: This is a single-process Windows desktop application built with C++/CMake + Qt 6. There is no server or cloud boundary; the app’s main responsibility is to turn label definitions and CSV data into raw ZPL and send that ZPL directly to a Zebra printer.
2. Core domain model: The core/ folder holds the app’s central data model. LabelTemplate, LabelElement, and PrinterSettings represent the editable label design and printer configuration. These are the objects that move through the rest of the system.
3. Template persistence boundary: TemplateStorage is the persistence layer for label templates. Templates are stored as JSON files under templates/, which makes them both user-loadable in the UI and easy to version/control as assets.
4. CSV ingestion boundary: CsvImporter reads external CSV files into row data for batch printing. The README indicates support for Quantity/Qty columns, selected rows, and full-file printing, so CSV data is not just imported but also drives print multiplicity.
5. Variable resolution layer: VariableResolver sits between data input and rendering. It resolves placeholders like {ItemNumber}, {Lot}, {Date}, {Time}, {Serial}, and {RecordIndex} against the current record or print context, so the same template can be reused across single labels, serial ranges, and CSV batches.
6. ZPL generation pipeline: ZplGenerator converts the template model into Zebra Programming Language. This is the key transformation step in the architecture: structured label elements and resolved variables become printer-ready command text. The repo includes docs/example_generated.zpl and label.zpl as concrete output/reference artifacts.
7. Printer output boundary: ZebraPrinter is the hardware-facing adapter. It sends the generated raw ZPL to a Windows printer configured for Zebra/ZPL output. The app’s printing model is therefore “generate ZPL locally, send it directly to the driver/printer,” not rasterize or spool through a separate print service.
8. Qt UI composition: The ui/ folder contains the interactive front end. MainWindow is the shell that exposes the app’s major modes/tabs: Design, Elements, Data, Print, Templates, and Settings. ElementEditorWidget edits the properties of the selected label element, and PreviewWidget is the visual label canvas.
9. Editing and preview flow: User interaction starts in the UI, updates the template model, and immediately feeds preview/rendering and later print generation. Dragging in the preview changes element placement; property edits change typography, barcode/QR options, rotation, alignment, wrapping, margins, and other label settings.
10. Batch-print flow: For CSV-driven printing, the flow is: import CSV → optionally map columns to template placeholders → select rows or choose all → resolve variables per row → generate ZPL per label → send to printer. This is the main data path for operational use.
11. Template library and examples: The templates/ folder contains ready-made label definitions such as inventory, shelf/bin, price, serial number, asset QR, and mini shipping labels. examples/sample_items.csv provides a sample batch input file. These assets define the “starter content” boundary of the app.
12. Validation and regression coverage: tests/model_zpl_tests.cpp suggests automated coverage around the model-to-ZPL transformation, which is the most critical non-UI logic in the system. That implies the core rendering/output behavior is intended to be stable independent of the UI.
13. Build and release tooling: The repository is packaged as a CMake project with Windows-focused scripts in scripts/, plus GitHub Actions workflows for build and release. windeployqt support in packaging indicates a Qt desktop distribution that bundles runtime dependencies into dist/LabelPrinterApp.
14. Architecture in one sentence: The app is a Qt desktop editor + batch-print tool where the UI edits a JSON-backed label model, CSV data fills template variables, core services generate ZPL, and a printer adapter streams that ZPL to a Zebra printer.
Main entry points: ZplGenerator.cpp ZPL generator · LabelTemplate.h Label model · MainWindow.cpp Main window · VariableResolver.cpp Variable resolver
Components 18
Application
Desktop entrypoint and build packaging
- App entry · Program startup and app bootstrap
main.cpp
Core
Domain model and processing services
- Label model · Template, element, and printer configuration data
core/LabelTemplate.h - Label element · Editable text, barcode, QR, and layout element definition
core/LabelElement.h - Printer settings · Printer-specific output and device configuration
core/PrinterSettings.h - Template storage · Loads and saves label templates from JSON files
core/TemplateStorage.cpp - CSV importer · Reads row data for batch printing
core/CsvImporter.cpp - Variable resolver · Resolves record fields and print-context variables
core/VariableResolver.cpp - ZPL generator · Transforms the label model into Zebra Programming Language
core/ZplGenerator.cpp - Zebra printer · Sends raw ZPL directly to the configured Windows printer
core/ZebraPrinter.cpp
UI
Qt desktop interface
- Main window · Primary tabbed workspace for design, data, print, templates, and settings
ui/MainWindow.cpp - Element editor · Edits the selected label element properties
ui/ElementEditorWidget.cpp - Preview canvas · Interactive label layout and visual preview
ui/PreviewWidget.cpp
Assets
Templates, sample data, and reference ZPL
- Templates · Starter label definitions stored as JSON assets
templates - Sample CSV · Example batch data for printing
examples/sample_items.csv - ZPL reference · Example generated Zebra command output
docs/example_generated.zpl - Label sample · Reference ZPL label artifact
label.zpl
Tooling
Tests and release automation
- ZPL tests · Regression coverage for model-to-ZPL generation
tests/model_zpl_tests.cpp - Build scripts · Windows build, test, and release scripting
scripts/build-and-test.ps1
Connections 19
- App entry → Main window: launches · Starts the desktop UI
- Main window → Element editor: edits · Routes element property editing through the side panel
- Main window → Preview canvas: shows · Hosts the interactive label preview
- Main window → Label model: binds · Operates on the current label template
- Element editor → Label element: updates · Modifies the selected element definition
- Preview canvas → Label element: positions · Supports drag-and-drop element placement
- Preview canvas → Label model: renders · Displays the current template state
- Template storage → Templates: reads/writes · Persists templates as JSON assets
- Template storage → Label model: loads · Materializes templates into domain objects
- CSV importer → Sample CSV: ingests · Reads batch input rows from CSV files
- CSV importer → Variable resolver: feeds · Supplies imported row data for placeholder resolution
- Variable resolver → Label model: fills · Resolves placeholders against the current template context
- Variable resolver → ZPL generator: prepares · Provides resolved values for output generation
- ZPL generator → Label model: converts · Transforms the label model into ZPL commands
- ZPL generator → ZPL reference: matches · Produces output comparable to the documented example
- ZPL generator → Label sample: matches · Produces output comparable to the reference artifact
- ZPL generator → Zebra printer: outputs · Generates raw ZPL for printer delivery
- Zebra printer → Build scripts: packages with · Distribution scripts bundle the Qt app and printer support
- ZPL tests → ZPL generator: verifies · Checks model-to-ZPL rendering behavior