Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2108e2cf15 | |||
| 8290870f06 | |||
| 9b970804fc | |||
| 2a789e30f8 | |||
| e619699660 | |||
| f7e35652a9 | |||
| d5fb872518 | |||
| 13d4047fe1 | |||
| 4f2de8a92c | |||
| 34b72ca384 | |||
| 4a0185df53 | |||
| cb2f687a6b | |||
| 0631c55c0f | |||
| caee5291ff | |||
| 9cc418c68f | |||
| 52096c0d63 | |||
| 33525a8c1d | |||
| da74709433 | |||
| d3e14c63c0 | |||
| 8e272c0bd8 | |||
| 9dc6776bb4 | |||
| d1ee78e58a | |||
| 06675f8314 | |||
| 226841fe38 | |||
| 6ad97b76dc | |||
| 1220c04f37 | |||
| e6673a0a24 | |||
| 993e1e460d | |||
| 73d90c28f8 | |||
| 6018daf56e | |||
| d51091e089 | |||
| 78448a44c9 | |||
| 0f758456b4 | |||
| 9341a3b6a2 | |||
| 56713aa86f | |||
| 1b8b6e55dc | |||
| 4b16b0900b | |||
| 7cadf5308d | |||
| 1c902230fe | |||
| 3cd173a37f | |||
| 45a92eda89 | |||
| 742b80fc47 | |||
| d17bb2e1be | |||
| 3309837080 | |||
| 19a8c246ad | |||
| ce8bbad26c | |||
| 82b264a7a0 | |||
| 90e236f847 | |||
| aba0f11616 | |||
| 41656aef6b | |||
| 7f1fa64114 | |||
| 6c10571ba4 | |||
| f1e50d8574 | |||
| b6cac2d208 |
+180
-22
@@ -1,28 +1,72 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -8
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
AlignFunctionPointers: false
|
||||
PadOperators: true
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
AlignFunctionPointers: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
AlignFunctionPointers: false
|
||||
PadOperators: true
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
AlignFunctionPointers: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveShortCaseStatements:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCaseColons: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 0
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowBreakBeforeNoexceptSpecifier: Never
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortCompoundRequirementOnASingleLine: true
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
BitFieldColonSpacing: Both
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterExternBlock: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
@@ -30,62 +74,176 @@ BraceWrapping:
|
||||
AfterUnion: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakAdjacentStringLiterals: true
|
||||
BreakAfterAttributes: Leave
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 110
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: true
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"[A-Z].*\.h'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^<Q[A-Za-z]*\>'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^<[a-z]*>'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 4
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentRequiresClause: true
|
||||
IndentWidth: 8
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertBraces: false
|
||||
InsertNewlineAtEOF: false
|
||||
InsertTrailingCommas: None
|
||||
IntegerLiteralSeparator:
|
||||
Binary: 0
|
||||
BinaryMinDigits: 0
|
||||
Decimal: 0
|
||||
DecimalMinDigits: 0
|
||||
Hex: 0
|
||||
HexMinDigits: 0
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
KeepEmptyLinesAtEOF: false
|
||||
LambdaBodyIndentation: Signature
|
||||
LineEnding: DeriveLF
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: All
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PackConstructorInitializers: NextLine
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakScopeResolution: 500
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
PPIndentWidth: -1
|
||||
QualifierAlignment: Leave
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
RemoveBracesLLVM: false
|
||||
RemoveParentheses: Leave
|
||||
RemoveSemicolon: false
|
||||
RequiresClausePosition: OwnLine
|
||||
RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SkipMacroDefinitionBody: false
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: LexicographicNumeric
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeJsonColon: false
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
AfterPlacementOperator: true
|
||||
AfterRequiresInClause: false
|
||||
AfterRequiresInExpression: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInAngles: Never
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: true
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParens: Custom
|
||||
SpacesInParensOptions:
|
||||
InCStyleCasts: false
|
||||
InConditionalStatements: true
|
||||
InEmptyParentheses: false
|
||||
Other: true
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseTab: ForIndentation
|
||||
UseTab: Never
|
||||
VerilogBreakBetweenInstancePorts: true
|
||||
WhitespaceSensitiveMacros:
|
||||
- BOOST_PP_STRINGIZE
|
||||
- CF_SWIFT_NAME
|
||||
- NS_SWIFT_NAME
|
||||
- PP_STRINGIZE
|
||||
- STRINGIZE
|
||||
...
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
# Handoff: Packaging design spec approved — implementation plan pending
|
||||
|
||||
## Session Metadata
|
||||
- Created: 2026-04-29 09:55:34 UTC
|
||||
- Project: /home/claude/bin/sethLabels
|
||||
- Branch: main
|
||||
- Session duration: ~1 hour
|
||||
- Live URL: https://git.sethpc.xyz/Seth/sethLabels
|
||||
|
||||
### Recent Commits (for context)
|
||||
- d3e14c6 docs: refresh CLAUDE.md + IDEA.md for design-approved phase
|
||||
- 8e272c0 docs: add packaging design spec + decision log
|
||||
- 9dc6776 chore: add sethLabels deployment-fork scaffold
|
||||
- d1ee78e Fix incorrect font sizes (#321) ← upstream HEAD
|
||||
- 06675f8 Create template style guide and minor updates… ← upstream
|
||||
|
||||
The first three commits are sethLabels'; everything from `d1ee78e` back is upstream's history (preserved untouched per strict-zero policy — see Important Context below).
|
||||
|
||||
## Handoff Chain
|
||||
|
||||
- **Continues from**: [2026-04-29-125823-scaffold-only.md](./2026-04-29-125823-scaffold-only.md)
|
||||
- Previous title: sethLabels scaffolded — no code yet
|
||||
- **Supersedes**: None. The scaffold-only handoff documented an empty-dir state; this one documents the post-design-approval state.
|
||||
|
||||
> Review the previous handoff for full context before filling this one. The "scaffold-only" predecessor's "Suggested Next Steps" #1 (decide upstream-tracking strategy) and #5 (initialize git + push to Gitea) are now complete; #2 (verify upstream alive) and #3 (confirm Qt version) are also resolved during this session.
|
||||
|
||||
## Current State Summary
|
||||
|
||||
This session moved sethLabels from "scaffold-only, no upstream pulled" to "design-approved, ready for implementation plan." Three things happened in order: (1) upstream `j-evins/glabels-qt` was cloned in-place and pushed to Gitea as `main`, with all 24 upstream contributors' commit authorship preserved end-to-end; (2) the brainstorming skill ran a 6-question multiple-choice round to lock all packaging-strategy decisions; (3) the resulting design was written into a 398-line spec at `sethlabels-docs/specs/2026-04-29-packaging-design.md` and committed. No `scripts/` or `packaging/` code was written — that's the next session's job. The spec is the load-bearing artifact; everything else (CLAUDE.md, IDEA.md, DECISIONS.md) was updated to point at it.
|
||||
|
||||
The user explicitly chose option **(3) pause here** at session close, declining to invoke writing-plans this session. The spec is sufficient to resume cleanly; there are no in-progress edits or half-implemented states.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
**sethLabels is a deployment fork, not a real fork.** The discipline (locked as Invariant I1 in the spec) is **strict zero source patches** — no upstream-tracked file is ever edited. The only exception is `.gitignore` (allowlisted as a one-time scaffold-time touch). Every sethLabels addition lives in NEW files in NEW top-level directories:
|
||||
|
||||
- Already created: `CLAUDE.md`, `IDEA.md`, `DECISIONS.md`, `GITEA_API.md` (gitignored symlink), `.claude/handoffs/`, `sethlabels-docs/specs/`
|
||||
- Planned per spec: `scripts/` (build-deb, build-appimages, compute-version, check-no-upstream-edits, lib/), `packaging/` (deb-metadata.env, appimage-recipe.env, changelog.md), `README.sethlabels.md`
|
||||
|
||||
The "fork" is therefore best thought of as a **packaging repo with upstream's history embedded** — anyone can audit it instantly and confirm we changed nothing in the application itself.
|
||||
|
||||
**Upstream details discovered during the session:**
|
||||
- Qt version: **Qt6 6.2** (find_package at `CMakeLists.txt:119`)
|
||||
- CPack metadata: pre-wired at `CMakeLists.txt:84-104`; generators NOT pinned → `cpack -G DEB` and `cpack -G DragNDrop` selectable at command line with zero source change
|
||||
- Install rules: clean and FHS-compliant across all subdirs (`bin`, `share/icons/hicolor`, `share/applications`, `share/mime`, `share/metainfo`, `share/man/man1`, `share/glabels-qt/{templates,translations}`)
|
||||
- Desktop integration: `.desktop` file, AppStream metainfo, MIME XML, hicolor icon set already provided by upstream
|
||||
- Two binaries shipped: `glabels-qt` (GUI) + `glabels-batch-qt` (CLI for scripted/mail-merge use)
|
||||
- CI matrix exists for ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest — but upstream doesn't publish binary releases ("Currently there are no self-hosted binary snapshot releases available" — upstream README). sethLabels exists to fill this gap.
|
||||
|
||||
## Critical Files
|
||||
|
||||
| File | Purpose | Relevance |
|
||||
|------|---------|-----------|
|
||||
| `sethlabels-docs/specs/2026-04-29-packaging-design.md` | THE design spec — 13 sections covering invariants, decisions, repo layout, build pipeline, release flow, brew tap, failure modes, smoke tests, glossary | **Must read before any implementation.** All design questions are answered here; do not re-derive. |
|
||||
| `DECISIONS.md` | Short-form decision log (6 settled choices + 13 rejected/deferred items) | Quick scan to check what's already been decided/rejected |
|
||||
| `CLAUDE.md` | Durable project instructions (refreshed this session) | Loaded on every session start; points at this handoff + the spec |
|
||||
| `IDEA.md` | Plain-language project brief (refreshed this session) | Read if scope feels unclear |
|
||||
| `CMakeLists.txt` (upstream root) | Defines Qt6 dep, CPack metadata, install rules | Read-only — strict-zero forbids edits. Reference for understanding what `cpack` and `linuxdeploy` will see. |
|
||||
| `.github/workflows/build-tests.yml` (upstream) | Upstream CI multi-platform build matrix | Reference for valid `apt install` deps + cmake invocation patterns when writing `scripts/lib/deps-debian.sh` |
|
||||
| `docs/BUILD-INSTRUCTIONS-LINUX.md` (upstream) | Upstream's manual build instructions | Reference for the `apt install` list + cmake flags; our `scripts/build-deb.sh` automates this |
|
||||
|
||||
## Key Patterns Discovered
|
||||
|
||||
- **Authorship preservation:** the gitea repo holds all 24 upstream contributors' commit authorship intact; the only Seth-authored commits are the sethLabels-specific additions (scaffold + spec + context-refresh). Verifiable via `git log --format='%an' origin/main | sort -u | wc -l` → 25 (24 upstream + Seth).
|
||||
- **Convention from sibling Seth projects** (`blind_chess`, `sethmux`, `kitty-web`, `mcp-gemma4`, `seth-orchestrator`): `GITEA_API.md` is gitignored (it's a local symlink to `~/bin/GITEA_API.md`); `.backup/` is gitignored; project-tracked files are `CLAUDE.md`, `IDEA.md`, `DECISIONS.md`, `.claude/handoffs/*.md`. sethLabels follows this convention but adds the strict-zero-policy gitignore section.
|
||||
- **Versioning convention:** `<upstream-tag>-seth<N>` (e.g., `3.99-master618-seth1`). Tag is `git describe --tags --abbrev=0 upstream/master`; `<N>` increments on re-package of the same upstream commit. See spec §D4 + §5.4.
|
||||
|
||||
## Tasks Finished
|
||||
|
||||
- [x] Cloned upstream `j-evins/glabels-qt` in-place; preserved all upstream commit authorship
|
||||
- [x] Created Gitea repo `git.sethpc.xyz/Seth/sethLabels` (default branch: `main`); pushed full history + scaffold commit
|
||||
- [x] Configured `upstream` remote → `github.com/j-evins/glabels-qt` for periodic rebases
|
||||
- [x] Added scaffold commit (`9dc6776`) with author `Seth Freiberg <seth@sethfreiberg.com>` containing CLAUDE.md, IDEA.md, DECISIONS.md, .claude/handoffs/, .gitignore additions
|
||||
- [x] Brainstormed all 6 packaging-strategy decisions: Linux format, macOS format, build infra, versioning, upstream-touch policy, package name
|
||||
- [x] Wrote design spec at `sethlabels-docs/specs/2026-04-29-packaging-design.md` (398 lines, 13 sections); self-reviewed and fixed 5 inline issues (FF/rebase wording, --peek removal, tag-fetch caller responsibility, T3 brittleness, working-tree drift in check-no-upstream-edits)
|
||||
- [x] Updated `DECISIONS.md` with 6 settled + 13 rejected/deferred decisions (all dated 2026-04-29)
|
||||
- [x] Refreshed `CLAUDE.md` "Current State" + "Conventions" sections; refreshed `IDEA.md` "Constraints / preferences"
|
||||
- [x] All 3 sethLabels commits pushed to Gitea immediately per the gitea-workflow convention
|
||||
|
||||
## Files Modified
|
||||
|
||||
| File | Changes | Rationale |
|
||||
|------|---------|-----------|
|
||||
| `.gitignore` | Appended sethLabels section (`.backup/`, `GITEA_API.md`, `.env*`, `.claude/handoffs/*.draft.md`) | Allowlisted exception to strict-zero (one-time scaffold touch) |
|
||||
| `CLAUDE.md` | NEW — project instructions | Created at scaffold time; refreshed this session for design-approved phase |
|
||||
| `IDEA.md` | NEW — project brief | Created at scaffold time; refreshed this session |
|
||||
| `DECISIONS.md` | NEW — populated with 6 settled + 13 rejected/deferred decisions | Tracks what was decided vs. explicitly rejected (per Seth's global persistence convention) |
|
||||
| `sethlabels-docs/specs/2026-04-29-packaging-design.md` | NEW — design spec | The design artifact this session produced |
|
||||
| `.claude/handoffs/2026-04-29-095534-spec-approved-pre-implementation.md` | NEW — this handoff | Session close artifact |
|
||||
|
||||
No upstream files were modified (verified by `git diff --name-only upstream/master..HEAD` — only allowlist entries appear).
|
||||
|
||||
## Decisions Made
|
||||
|
||||
| Decision | Options Considered | Rationale |
|
||||
|----------|-------------------|-----------|
|
||||
| Linux: `.deb` + AppImage | AppImage-only, .deb-only, both, Flatpak | `.deb` for Debian-family install ergonomics + AppImage for any-Linux portability. Flatpak too heavyweight for use case. See spec §D1. |
|
||||
| macOS: Homebrew tap, build-from-source | Unsigned .dmg, signed+notarized .dmg ($99/yr), brew tap, brew tap with cask | Brew tap eliminates macOS CI/signing/Apple Dev ID entirely. User's Mac builds from source on `brew install`. See spec §D2. |
|
||||
| Build infrastructure: manual local builds | Manual, Gitea Actions runner, GitHub Actions public, GitHub Actions private | Local feedback loop beats CI loop during iteration. Scripts in `scripts/` are canonical recipe; CI YAML at the public-flip will call them unmodified. See spec §D3. |
|
||||
| Versioning: `<upstream-tag>-seth<N>` | This vs. plain upstream tag, independent semver, date-based | Lineage-preserving + rebuild counter survives packaging-only fixes + sorts correctly under `dpkg --compare-versions`. See spec §D4. |
|
||||
| Upstream-touch policy: strict zero | Strict zero, permissive small patches, strict-zero-with-CMakeLists-carveout | CPack `-D` flags cover all needed metadata at build time → no edit required to package. See spec §D5. |
|
||||
| Package name: `glabels-qt` | This vs. `sethlabels` | Strict-zero forbids renaming the binary, so package name should match command name. sethLabels identity lives in repo name + version-string `-seth<N>` marker. See spec §D6. |
|
||||
| Spec/docs location: `sethlabels-docs/` (top-level new dir) | This vs. `docs/superpowers/specs/` (inside upstream's docs/) | Strict-zero spirit forbids polluting upstream namespaces, even with new files. Top-level new dir = cleanest fork boundary. |
|
||||
|
||||
## Immediate Next Steps
|
||||
|
||||
1. **Invoke `writing-plans` skill** with the spec at `sethlabels-docs/specs/2026-04-29-packaging-design.md` as input. The plan should produce an ordered, dependency-aware implementation sequence — likely something like: (a) scripts/lib/deps-debian.sh, (b) scripts/check-no-upstream-edits.sh, (c) scripts/compute-version.sh, (d) scripts/build-deb.sh + smoke test on a clean Debian 13 box, (e) scripts/build-appimages.sh + smoke tests, (f) packaging/ env files, (g) README.sethlabels.md, (h) homebrew tap repo + initial formula, (i) first end-to-end release dry run.
|
||||
2. **Address the 4 user-flagged review items** before or during plan execution:
|
||||
- §5.1 build dependency list — Seth may know Debian 13 quirks (e.g., `qt6-tools-dev-tools` vs `qt6-tools-dev` package naming)
|
||||
- §5.5 allowlist pattern — anything Seth wants to add that doesn't fit `scripts/`/`packaging/`/`sethlabels-docs/`?
|
||||
- §7.2 brew formula `:recommended` deps — `qrencode` and `zint` as recommended (default-on) vs required vs optional
|
||||
- §10 smoke test T5 — gate every release on a fresh-Debian-13-VM install test, or only on upstream-tag bumps?
|
||||
3. **Consider whether to spike Path A (Qt for WebAssembly)** later — Seth raised this as a hypothetical and we concluded it's "possible but not easy" because Qt's `QPrintSupport` doesn't work in WASM (would need to render-to-PDF and let user download). Not blocking, just flagged for future.
|
||||
|
||||
## Blockers / Open Questions
|
||||
|
||||
- None blocking. The 4 review items in step 2 above are open but optional — they can be addressed during plan execution as small fixups, not gating questions.
|
||||
|
||||
## Deferred Items
|
||||
|
||||
- **Windows packaging** — deferred per project brief. Upstream's NSIS support is intact and works for anyone who wants to build their own.
|
||||
- **Custom default templates baked into the package** — strict-zero forbids; user-specific templates can live in `~/.config/glabels-qt/templates/` or a future separate repo.
|
||||
- **Branding, icon, splash, or string changes** — strict-zero forbids. sethLabels is a packaging fork, not a rebrand.
|
||||
- **CI infrastructure (Gitea Actions / GitHub Actions runner)** — battle-test phase is manual local builds; CI is added at the eventual public-flip on GitHub.
|
||||
- **Distribution to Debian backports / PPA / Ubuntu universe** — requires Debian Developer mentorship + ongoing policy compliance work; not justified for current scope.
|
||||
- **Headless print-server CT** — mentioned in `IDEA.md` as "optional/later"; not in current spec scope.
|
||||
|
||||
## Important Context
|
||||
|
||||
**The strict-zero source-patch policy is not a guideline, it is the project's defining discipline.** Violating it means the project drifts from "deployment fork" toward "real fork," which breaks the trivial-rebase property that makes the whole approach work. The spec's Invariant I1 is enforced by `scripts/check-no-upstream-edits.sh` (to be implemented per spec §5.5). Any temptation to "just edit one upstream file to fix a packaging issue" should be resisted — the right move is either (a) pass via `cpack -D` flags or `linuxdeploy` config, or (b) upstream the fix as a PR to glabels-qt.
|
||||
|
||||
**The eventually-public-on-GitHub framing matters for build-host neutrality.** During battle-test, builds happen on steel141 (Seth's primary dev machine, Debian 13). At public-flip, builds move to GitHub Actions ubuntu-latest runners. The build scripts MUST work on a clean Debian 13 / Ubuntu LTS VM with nothing pre-installed beyond what `scripts/lib/deps-debian.sh` declares. Any steel141-specific path or tool dependency is a bug.
|
||||
|
||||
**Steel141 is a build host, NOT an install target.** Earlier session draft framed it as the deploy target — that was wrong, corrected during Q1. The artifacts ship to anyone running Debian-family Linux or macOS-with-brew.
|
||||
|
||||
**Authorship in git history is load-bearing.** All 24 upstream contributors' commits appear in `git log` with their original author/committer fields intact. Only sethLabels-specific commits (currently 3) carry Seth's authorship. This makes the fork's relationship to upstream provable end-to-end and is critical for the eventual public-fork narrative.
|
||||
|
||||
**The "scaffold commit" is the only sethLabels commit on top of upstream/master.** Currently `9dc6776 chore: add sethLabels deployment-fork scaffold`. Two more commits exist (`8e272c0` spec + `d3e14c6` CLAUDE.md/IDEA.md refresh) but they only touch sethLabels-namespaced files. The number of commits on top of upstream will grow; what matters is that all of them honor strict-zero.
|
||||
|
||||
## Assumptions Made
|
||||
|
||||
- **The user picked `glabels-qt` as the package name** (Q6 → α) intending the binary, brew formula, and `.deb` package to all share the name. If a future Debian official `glabels-qt` package emerges, the version-string `-seth<N>` marker will dominate the sort, but a name conflict could be revisited.
|
||||
- **The user has Homebrew on the macOS machines they intend to install on.** The brew-tap approach assumes a technical user; if a non-technical macOS user enters scope, signed-DMG would have to be reconsidered.
|
||||
- **The user's scaffold commit (Author: Seth Freiberg <seth@sethfreiberg.com>) was set explicitly via `git config user.email seth@sethfreiberg.com` for this repo only.** The global git identity on steel141 is `Mortdecai` (a bot identity). Future commits in this repo from Claude Code should use the same Seth identity to maintain authorship consistency. The per-repo `.git/config` is already set; new agents inherit it automatically.
|
||||
|
||||
## Potential Gotchas
|
||||
|
||||
- **Don't run a non-rebase pull from upstream.** `git pull upstream master` (without `--rebase`) would create a merge commit, breaking linear history and complicating future strict-zero enforcement. The release flow's step 2 (spec §6) says `git rebase upstream/master`, which is correct.
|
||||
- **`compute-version.sh` reads local tag database.** If invoked outside the release flow without a fresh `git fetch --all --tags`, it can produce a stale `<N>` value. Spec §5.4 calls this out, but it's easy to miss when running scripts manually during development.
|
||||
- **AppImage builds need `linuxdeploy` and `linuxdeploy-plugin-qt` from GitHub releases — neither is apt-installable.** `scripts/lib/linuxdeploy.sh` (to be written) handles bootstrap to a script-local cache. The cache directory must be added to `.gitignore`.
|
||||
- **`dpkg-shlibdeps` (CPack's `SHLIBDEPS=ON`) sometimes mis-detects runtime deps** — particularly with optional Qt6 plugins. Mitigation in spec §F8: smoke-test install on a clean Debian 13 VM (T5).
|
||||
- **`brew tap` from non-GitHub URLs requires the explicit URL form.** Initial install is `brew tap seth/tap https://git.sethpc.xyz/Seth/homebrew-tap.git`, not `brew tap seth/tap`. This is documented in spec §7.3 but easy to forget when writing the brew tap README.
|
||||
- **Don't add `superpowers/` paths under `docs/`.** The brainstorming skill's default spec location is `docs/superpowers/specs/`, but `docs/` is an upstream directory, so we use `sethlabels-docs/specs/` instead. This was caught and corrected mid-session.
|
||||
|
||||
## Environment State
|
||||
|
||||
### Tools/Services Used
|
||||
|
||||
- **gitea CLI** (`~/bin/gitea`) — used for `gitea create sethLabels`, `gitea remote sethLabels`. Token loaded from `~/.config/gitea/token`. Documented in `~/bin/GITEA_API.md` (symlinked into project but gitignored).
|
||||
- **git** — local tooling for clone, fetch, commit, push, tag. Per-repo identity set to `Seth Freiberg <seth@sethfreiberg.com>` to override the global `Mortdecai` bot identity.
|
||||
- **curl + python3** — used for Gitea API calls to verify `default_branch=main` post-push.
|
||||
|
||||
### Active Processes
|
||||
|
||||
- None. No background services were started or left running. No long-running shells.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
- `HOMELAB_PASSWORD` — referenced by `~/bin/CLAUDE.md` for SSH access, NOT used in this session.
|
||||
- No other env vars set or required for the current state.
|
||||
|
||||
## Related Resources
|
||||
|
||||
- **Gitea repo:** https://git.sethpc.xyz/Seth/sethLabels (default branch `main`)
|
||||
- **Spec:** [`sethlabels-docs/specs/2026-04-29-packaging-design.md`](../../sethlabels-docs/specs/2026-04-29-packaging-design.md) — read this before any implementation
|
||||
- **Decision log:** [`DECISIONS.md`](../../DECISIONS.md) — short-form
|
||||
- **Predecessor handoff:** [`2026-04-29-125823-scaffold-only.md`](./2026-04-29-125823-scaffold-only.md) — the empty-scaffold state we resumed from
|
||||
- **Upstream:** https://github.com/j-evins/glabels-qt (j-evins is Jaye Evins of glabels.org)
|
||||
- **Upstream README packaging gap:** the line we're filling — *"Currently there are no self-hosted binary snapshot releases available… I encourage you to try building the code yourself."*
|
||||
- **Sibling Seth projects with similar conventions:** `~/bin/blind_chess/` (handoff structure reference), `~/bin/sethmux/` (gitignore convention)
|
||||
|
||||
---
|
||||
|
||||
**Security Reminder**: Validated via `validate_handoff.py` post-write. No secrets present.
|
||||
@@ -0,0 +1,73 @@
|
||||
# Handoff: sethLabels scaffolded — no code yet
|
||||
|
||||
## Session Metadata
|
||||
|
||||
- Created: 2026-04-29 12:58:23 UTC
|
||||
- Project: /home/claude/bin/sethLabels
|
||||
- Branch: n/a (no git repo yet)
|
||||
- Session duration: ~5 min
|
||||
- Live URL: n/a
|
||||
|
||||
## Handoff Chain
|
||||
|
||||
- **Continues from:** None — this is the project's first handoff.
|
||||
- **Supersedes:** None.
|
||||
|
||||
## Current State Summary
|
||||
|
||||
Project directory scaffolded per `~/bin/CREATE_PROJECT.md` as a deployment fork of upstream [glabels-qt](https://github.com/j-evins/glabels-qt). No code has been pulled, no git repo initialized, no Gitea repo created. Only the `~/bin/`-convention files exist:
|
||||
|
||||
```
|
||||
sethLabels/
|
||||
├── CLAUDE.md durable project instructions
|
||||
├── DECISIONS.md empty decision log (template-derived, header set)
|
||||
├── GITEA_API.md symlink → ~/bin/GITEA_API.md
|
||||
├── IDEA.md plain-language brief
|
||||
└── .claude/handoffs/
|
||||
└── 2026-04-29-125823-scaffold-only.md (this file)
|
||||
```
|
||||
|
||||
Phase: **ideation**. Nothing is running anywhere. No upstream commit pinned. No build attempted.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
This is a *deployment fork* — the discipline is to keep the diff against `j-evins/glabels-qt` master surgical so we can rebase periodically without pain. Anything we add should be additive (new files: deploy scripts, packaging recipes, Seth-specific templates) rather than invasive edits to upstream source. If we need to patch upstream code, prefer a thin patch series we can replay.
|
||||
|
||||
Stack is Qt + CMake + C++ (GPL-3.0). Target host is **steel141** (Debian 13). A future option is a headless print-server CT, but that's not part of this scaffold's scope.
|
||||
|
||||
## Critical Files
|
||||
|
||||
| File | Purpose | Relevance |
|
||||
|------|---------|-----------|
|
||||
| `~/bin/sethLabels/IDEA.md` | Plain-language brief — why this fork exists | Read first if upstream choice or scope feels unclear |
|
||||
| `~/bin/sethLabels/CLAUDE.md` | Durable project instructions | Loaded every session |
|
||||
| `~/bin/sethLabels/DECISIONS.md` | Empty — populate as architectural choices land | Write to when locking in upstream-pin strategy, Qt5-vs-Qt6, etc. |
|
||||
| `~/bin/CREATE_PROJECT.md` | Recipe used to scaffold this | Reference if future projects need the same shape |
|
||||
|
||||
## Suggested Next Steps (ordered)
|
||||
|
||||
The user said *just scaffold + handoff* — none of this was attempted. Pick up here next session:
|
||||
|
||||
1. **Decide upstream-tracking strategy.** Options:
|
||||
- (a) Clone `j-evins/glabels-qt` into this dir, push to Gitea as `sethLabels`, add upstream as a remote, merge from `upstream/master` periodically.
|
||||
- (b) Keep upstream as a git submodule and layer deployment glue around it.
|
||||
Record the choice in `DECISIONS.md` before pulling code.
|
||||
2. **Verify upstream is alive.** Check `j-evins/glabels-qt` for last commit date + open issues; this is a fork of mate-desktop's glabels lineage and forks-of-forks have a tendency to bitrot. If `j-evins` is stale, the real upstream might be elsewhere — re-evaluate before forking.
|
||||
3. **Confirm Qt version.** Upstream's `CMakeLists.txt` will say Qt5 or Qt6. Debian 13 ships both — pick whichever upstream targets.
|
||||
4. **Build it once on steel141** to establish the known-good build recipe. Capture exact `apt install` deps and CMake invocation in a `BUILD.md` (or in `CLAUDE.md` if short).
|
||||
5. **Initialize git + push to Gitea.** `gitea create sethLabels` → `gitea remote sethLabels` → `gitea push`. Use a descriptive commit message like `init: scaffold + import upstream glabels-qt @ <sha>`.
|
||||
6. **Only then** start any deployment-specific work (templates, packaging, install scripts).
|
||||
|
||||
## Open Questions
|
||||
|
||||
- Is `j-evins/glabels-qt` actually the right upstream, or should we be tracking a different fork? (See "verify upstream is alive" above.)
|
||||
- Does Seth want a `.deb` package, an AppImage, or just a built binary in `/usr/local/bin`?
|
||||
- Is there a printer model or label-stock library we should pre-load as default templates?
|
||||
|
||||
These don't block scaffolding — they block the *first real coding session*. Ask before implementing.
|
||||
|
||||
## Risks / Watch-outs
|
||||
|
||||
- Upstream is GPL-3.0. Any code we add that links against it must also be GPL-3.0-compatible. Don't accidentally relicense.
|
||||
- "Deployment fork" failure mode: scope creep into a real fork. If we find ourselves writing >100 lines of upstream-source patches, that's a signal to either upstream the change or rethink whether we actually want a fork.
|
||||
- glabels-qt is one of those projects with multiple competing forks (j-evins, jimevins-original, mate-desktop's glabels-3, etc.). Pin the upstream we choose explicitly in `DECISIONS.md` so we don't drift.
|
||||
@@ -23,23 +23,18 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
build_type: Release
|
||||
c_compiler: gcc
|
||||
cpp_compiler: g++
|
||||
- os: ubuntu-latest
|
||||
build_type: Release
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
- os: ubuntu-22.04
|
||||
build_type: Release
|
||||
c_compiler: gcc
|
||||
cpp_compiler: g++
|
||||
- os: windows-latest
|
||||
build_type: Release
|
||||
c_compiler: cl
|
||||
cpp_compiler: cl
|
||||
- os: macos-latest
|
||||
build_type: Release
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
|
||||
@@ -105,7 +100,7 @@ jobs:
|
||||
with:
|
||||
version: '6.2.*'
|
||||
install-deps: 'true'
|
||||
archives: 'qtbase qtsvg qttools icu qttranslations'
|
||||
archives: 'qtbase qtsvg qttools icu qttranslations qtwayland'
|
||||
|
||||
- name: Set reusable strings
|
||||
id: strings
|
||||
@@ -118,32 +113,162 @@ jobs:
|
||||
cmake -B ${{ steps.strings.outputs.build-output-dir }}
|
||||
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
|
||||
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_TOOLCHAIN_FILE=${{ env.TOOLCHAIN_FILE }}
|
||||
-S ${{ github.workspace }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
|
||||
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release
|
||||
|
||||
- name: Test (Ubuntu)
|
||||
if: startsWith( matrix.os, 'ubuntu-' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
run: |
|
||||
xvfb-run ./glabels/glabels-qt --Version
|
||||
xvfb-run ctest --build-config ${{ matrix.build_type }}
|
||||
xvfb-run -a ./glabels/glabels-qt --Version
|
||||
xvfb-run -a ctest --build-config Release
|
||||
|
||||
- name: Test (Windows)
|
||||
if: startsWith( matrix.os, 'windows-' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
env:
|
||||
QT_ASSUME_STDERR_HAS_CONSOLE: 1
|
||||
run: |
|
||||
ctest --build-config ${{ matrix.build_type }}
|
||||
./glabels-batch/Release/glabels-batch-qt --Version
|
||||
ctest --build-config Release
|
||||
|
||||
- name: Test (MacOS)
|
||||
if: startsWith( matrix.os, 'macos-' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
run: |
|
||||
./glabels/glabels-qt --Version
|
||||
ctest --build-config ${{ matrix.build_type }}
|
||||
ctest --build-config Release
|
||||
|
||||
- name: Install render test dependencies (Ubuntu-latest)
|
||||
if: startsWith( matrix.os, 'ubuntu-latest' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
run: |
|
||||
sudo apt-get -y install xwayland-run
|
||||
sudo apt-get -y install comparepdf
|
||||
|
||||
- name: Install render test dependencies (Windows)
|
||||
if: startsWith( matrix.os, 'windows' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
run: |
|
||||
choco install diff-pdf
|
||||
|
||||
- name: Install render test dependencies (MacOS)
|
||||
if: startsWith( matrix.os, 'macos' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
run: |
|
||||
brew install diff-pdf
|
||||
|
||||
- name: Render tests (Ubuntu-latest)
|
||||
if: startsWith( matrix.os, 'ubuntu-latest' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
shell: bash
|
||||
env:
|
||||
TEST_DIR: ${{ github.workspace }}/test-data
|
||||
run: |
|
||||
set +e
|
||||
run-x() { xvfb-run -a "$@"; }
|
||||
run-w() { wlheadless-run -c weston --log=/dev/null -- "$@"; }
|
||||
#
|
||||
#
|
||||
echo "================"
|
||||
echo "X11 render tests"
|
||||
echo "================"
|
||||
run-x ./glabels-batch/glabels-batch-qt --Version
|
||||
#
|
||||
# echo "-- Available fonts (X) -------------------------------------------------"
|
||||
# run-x fc-list : family
|
||||
# echo "------------------------------------------------------------------------"
|
||||
#
|
||||
echo "-----------------------------------"
|
||||
run-x ./glabels-batch/glabels-batch-qt -o simple-shapes-x.pdf "$TEST_DIR/simple-shapes.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-shapes.pdf" simple-shapes-x.pdf
|
||||
echo "-----------------------------------"
|
||||
run-x ./glabels-batch/glabels-batch-qt -o simple-code39-x.pdf "$TEST_DIR/simple-code39.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-code39.pdf" simple-code39-x.pdf
|
||||
echo "-----------------------------------"
|
||||
run-x ./glabels-batch/glabels-batch-qt -o simple-text-liberation-sans-x.pdf "$TEST_DIR/simple-text-liberation-sans.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-text-liberation-sans.pdf" simple-text-liberation-sans-x.pdf
|
||||
echo "-----------------------------------"
|
||||
run-x ./glabels-batch/glabels-batch-qt -o simple-text-liberation-serif-x.pdf "$TEST_DIR/simple-text-liberation-serif.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-text-liberation-serif.pdf" simple-text-liberation-serif-x.pdf
|
||||
echo "-----------------------------------"
|
||||
#
|
||||
#
|
||||
echo "===================="
|
||||
echo "Wayland render tests"
|
||||
echo "===================="
|
||||
run-w ./glabels-batch/glabels-batch-qt --Version
|
||||
#
|
||||
# echo "-- Available fonts (X) -------------------------------------------------"
|
||||
# run-w fc-list : family
|
||||
# echo "------------------------------------------------------------------------"
|
||||
#
|
||||
echo "-----------------------------------"
|
||||
run-w ./glabels-batch/glabels-batch-qt -o simple-shapes-w.pdf "$TEST_DIR/simple-shapes.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-shapes.pdf" simple-shapes-w.pdf
|
||||
echo "-----------------------------------"
|
||||
run-w ./glabels-batch/glabels-batch-qt -o simple-code39-w.pdf "$TEST_DIR/simple-code39.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-code39.pdf" simple-code39-w.pdf
|
||||
echo "-----------------------------------"
|
||||
run-w ./glabels-batch/glabels-batch-qt -o simple-text-liberation-sans-w.pdf "$TEST_DIR/simple-text-liberation-sans.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-text-liberation-sans.pdf" simple-text-liberation-sans-w.pdf
|
||||
echo "-----------------------------------"
|
||||
run-w ./glabels-batch/glabels-batch-qt -o simple-text-liberation-serif-w.pdf "$TEST_DIR/simple-text-liberation-serif.glabels"
|
||||
comparepdf -ca -v2 "$TEST_DIR/simple-text-liberation-serif.pdf" simple-text-liberation-serif-w.pdf
|
||||
echo "-----------------------------------"
|
||||
|
||||
- name: Render tests (Windows)
|
||||
if: startsWith( matrix.os, 'windows' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
shell: pwsh
|
||||
env:
|
||||
TEST_DIR: ${{ github.workspace }}/test-data
|
||||
QT_ASSUME_STDERR_HAS_CONSOLE: 1
|
||||
run: |
|
||||
set +e
|
||||
./glabels-batch/Release/glabels-batch-qt --Version
|
||||
echo "-----------------------------------"
|
||||
./glabels-batch/Release/glabels-batch-qt -o simple-shapes-windows.pdf "$env:TEST_DIR/simple-shapes.glabels" 2>&1
|
||||
diff-pdf -v "$env:TEST_DIR/simple-shapes.pdf" simple-shapes-windows.pdf 2>&1
|
||||
echo "-----------------------------------"
|
||||
./glabels-batch/Release/glabels-batch-qt -o simple-code39-windows.pdf "$env:TEST_DIR/simple-code39.glabels" 2>&1
|
||||
diff-pdf -v "$env:TEST_DIR/simple-code39.pdf" simple-code39-windows.pdf 2>&1
|
||||
echo "-----------------------------------"
|
||||
#
|
||||
# TODO: Create text-based rendering tests using fonts available on Windows
|
||||
#
|
||||
|
||||
- name: Render tests (MacOS)
|
||||
if: startsWith( matrix.os, 'macos' )
|
||||
working-directory: ${{ steps.strings.outputs.build-output-dir }}
|
||||
shell: bash
|
||||
env:
|
||||
TEST_DIR: ${{ github.workspace }}/test-data
|
||||
run: |
|
||||
set +e
|
||||
./glabels-batch/glabels-batch-qt --Version
|
||||
echo "-----------------------------------"
|
||||
./glabels-batch/glabels-batch-qt -o simple-shapes-mac.pdf "$TEST_DIR/simple-shapes.glabels"
|
||||
diff-pdf -v "$TEST_DIR/simple-shapes.pdf" simple-shapes-mac.pdf
|
||||
echo "-----------------------------------"
|
||||
./glabels-batch/glabels-batch-qt -o simple-code39-mac.pdf "$TEST_DIR/simple-code39.glabels"
|
||||
diff-pdf -v "$TEST_DIR/simple-code39.pdf" simple-code39-mac.pdf
|
||||
echo "-----------------------------------"
|
||||
#
|
||||
# TODO: Create text-based rendering tests using fonts available on MacOS
|
||||
#
|
||||
|
||||
- name: Upload render tests for manual inspection
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: render-tests-${{ matrix.os }}-${{ matrix.cpp_compiler }}-${{ github.run_number }}
|
||||
path: ${{ steps.strings.outputs.build-output-dir }}/*.pdf
|
||||
|
||||
|
||||
# - name: Tmate
|
||||
# uses: mxschmitt/action-tmate@v3
|
||||
|
||||
+22
@@ -40,3 +40,25 @@ TEST-DATA
|
||||
SAV*
|
||||
OLD*
|
||||
|
||||
# === sethLabels (deployment fork) additions ===
|
||||
# Local backup snapshots (per ~/.claude/CLAUDE.md safety rule)
|
||||
.backup/
|
||||
|
||||
# Local-only symlink to ~/bin/GITEA_API.md (target is outside the repo)
|
||||
GITEA_API.md
|
||||
|
||||
# Secrets / env
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# Handoff drafts (operator scratch — final handoffs ARE committed)
|
||||
.claude/handoffs/*.draft.md
|
||||
|
||||
# Build outputs (out-of-tree)
|
||||
build/
|
||||
|
||||
# linuxdeploy + plugin caches (downloaded by scripts/lib/linuxdeploy.sh on first AppImage build)
|
||||
scripts/.cache/
|
||||
|
||||
# Locally-produced AppImage artifacts
|
||||
*.AppImage
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# sethLabels
|
||||
|
||||
> Deployment fork of glabels-qt — Qt label designer/printer, packaged for Seth's homelab.
|
||||
|
||||
## Start Here
|
||||
|
||||
**Read the latest handoff first:** `.claude/handoffs/` (most recent file).
|
||||
It has session state, in-progress work, and ordered next steps.
|
||||
|
||||
Then check `IDEA.md` for the project brief and `DECISIONS.md` for settled choices.
|
||||
|
||||
## Project Identity
|
||||
|
||||
sethLabels is a thin deployment fork of [glabels-qt](https://github.com/j-evins/glabels-qt). Upstream is the real project — this fork's job is to keep a known-good build recipe, any deployment glue (packaging, install paths, default templates), and any local patches in one place, while staying close enough to upstream `master` that periodic rebases stay cheap.
|
||||
|
||||
## Current State
|
||||
|
||||
- **Phase:** design-approved, pre-implementation. Spec written and committed; no scripts/packaging code yet.
|
||||
- **Repo:** live at `git.sethpc.xyz/Seth/sethLabels` (default branch `main`). Upstream `j-evins/glabels-qt` configured as `upstream` remote for periodic rebases. Eventually-public on GitHub once battle-tested.
|
||||
- **Deploy target:** Debian-family Linux (`.deb` + AppImage) + macOS via Homebrew tap (build-from-source). Steel141 is a build host, not a deploy target. Windows deferred.
|
||||
- **Upstream:** https://github.com/j-evins/glabels-qt (GPL-3.0, Qt6 6.2 + CMake + C++)
|
||||
- **Design spec:** `sethlabels-docs/specs/2026-04-29-packaging-design.md` — all packaging decisions (artifacts, versioning, build pipeline, release flow, brew tap) live here. Read this before touching `scripts/` or `packaging/`.
|
||||
|
||||
## Conventions
|
||||
|
||||
- This is a **deployment fork**, not a real fork. The discipline is **strict zero source patches** — no upstream-tracked file is ever edited. All sethLabels content lives in NEW top-level dirs (`scripts/`, `packaging/`, `sethlabels-docs/`, `.claude/`). Allowlist exception: `.gitignore` (one-time scaffold-time touch).
|
||||
- Enforced by `scripts/check-no-upstream-edits.sh` (to be implemented per spec §5.5).
|
||||
- Preserve upstream license (GPL-3.0) and copyright headers — strict-zero handles this automatically by never touching upstream files.
|
||||
- Versioning: `<upstream-tag>-seth<N>` (e.g., `3.99-master618-seth1`). See spec §D4 + §5.4.
|
||||
- See `~/bin/CLAUDE.md` for global homelab conventions (gitea CLI, conventional commits, credentials handling).
|
||||
+14
-2
@@ -17,6 +17,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/"
|
||||
set (ORGANIZATION_NAME "glabels.org")
|
||||
set (ORGANIZATION_DOMAIN "glabels.org")
|
||||
set (APPLICATION_NAME "glabels-qt")
|
||||
set (DESKTOP_FILE_NAME "org.glabels.glabels-qt")
|
||||
|
||||
set (WEBSITE "glabels.org")
|
||||
set (BUG_WEBSITE "https://github.com/j-evins/glabels-qt/issues")
|
||||
@@ -115,7 +116,7 @@ if (MINGW)
|
||||
set (CMAKE_PREFIX_PATH ${MINGW_BASE_DIR} )
|
||||
endif ()
|
||||
|
||||
find_package (Qt6 6.2 REQUIRED COMPONENTS Core Gui Widgets PrintSupport Xml Svg LinguistTools Test)
|
||||
find_package (Qt6 6.2 REQUIRED COMPONENTS Concurrent Core Gui Widgets PrintSupport Xml Svg LinguistTools Test)
|
||||
|
||||
if (WIN32)
|
||||
# Locate Qt directories
|
||||
@@ -140,7 +141,17 @@ find_package (Qt5Test 5.6 QUIET)
|
||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
#
|
||||
# Uncomment to compile everything with aggressively pedantic options
|
||||
# (not recommended -- only for testing -- also not portable)
|
||||
# (not recommended -- only for testing)
|
||||
#
|
||||
#add_compile_options("-Wall" "-Wextra" "-Wpedantic" "-Wno-unused-parameter" "-Werror")
|
||||
|
||||
# Uncomment to always compile with debug symbols
|
||||
add_compile_options("-g")
|
||||
endif ()
|
||||
if (${CMAKE_CXX_COMPILER_ID} MATCHES "^.*Clang$") # "Clang", "AppleClang", etc.
|
||||
#
|
||||
# Uncomment to compile everything with aggressively pedantic options
|
||||
# (not recommended -- only for testing)
|
||||
#
|
||||
#add_compile_options("-Wall" "-Wextra" "-Wpedantic" "-Wno-unused-parameter" "-Werror")
|
||||
|
||||
@@ -156,6 +167,7 @@ if (Qt6Test_FOUND)
|
||||
enable_testing ()
|
||||
endif ()
|
||||
|
||||
|
||||
#=======================================
|
||||
# Subdirectories
|
||||
#=======================================
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# DECISIONS.md — sethLabels Decision Log
|
||||
|
||||
Project-specific decisions. For global/cross-cutting decisions, see `~/bin/DECISIONS.md`.
|
||||
|
||||
Format: `YYYY-MM-DD: <decision> — <why>`
|
||||
|
||||
## Architecture
|
||||
|
||||
- **2026-04-29: Strict-zero source patches.** Never edit any upstream-tracked file. All sethLabels content lives in new files in new top-level directories at the repo root. — Makes `git pull upstream master --ff-only` succeed forever; rebase friction = 0. Allowlist exception: `.gitignore` (one-time scaffold-time touch). Enforced by `scripts/check-no-upstream-edits.sh`. See spec §I1, §D5.
|
||||
- **2026-04-29: Eventual-public fork.** sethLabels stays on Gitea during battle-test, then promotes to a formally public fork on GitHub once the build/release pipeline is solid. — Drives spec invariants: build host must be a clean Debian 13 / Ubuntu LTS box (not steel141-specific); brew tap source URL must be cleanly flippable Gitea→GitHub; CI is added at the flip, not before.
|
||||
- **2026-04-29: Linux artifacts = `.deb` + AppImage; macOS via Homebrew tap (build from source).** — `.deb` for Debian-family install ergonomics, AppImage for portability to non-Debian Linux. Brew tap eliminates macOS CI/signing/$99 Apple Dev ID entirely; users' Macs build from source. See spec §D1, §D2.
|
||||
- **2026-04-29: Build infrastructure = manual local builds during battle-test.** Shell scripts under `scripts/` are the canonical build recipe; CI YAML at the public-flip will call those scripts unmodified. — Local feedback loop beats CI loop during iteration on packaging. Defers infra cost. See spec §I3, §D3.
|
||||
- **2026-04-29: Versioning = `<upstream-tag>-seth<N>`.** E.g., `3.99-master618-seth1`. — Lineage-preserving; rebuild counter survives packaging-only fixes; sorts correctly under `dpkg --compare-versions`. See spec §D4.
|
||||
- **2026-04-29: Package name = `glabels-qt`.** Same name as upstream binary, brew formula, and the command users run. — sethLabels identity lives at repo level + version-string `-seth<N>` marker, not in the package name. Avoids confusing identity-split between package name and binary name. See spec §D6.
|
||||
|
||||
## Implementation
|
||||
|
||||
- **2026-04-29: macOS = no CI required.** Homebrew tap with build-from-source means no macOS runner, no Apple Developer ID, no notarization pipeline. Tap repo (`git.sethpc.xyz/Seth/homebrew-tap`) is one ~30-line Ruby file. — Major simplification; Mac users build locally on first install (~5–10 min), all subsequent installs are version pin bumps to the tap formula.
|
||||
- **2026-04-29: Debian-family is the install target, not steel141.** Build host happens to be steel141 (or any clean Debian/Ubuntu box); install target is generic Debian-family. — No homelab paths, hostnames, or assumptions in scripts. Reproducibility on a fresh VM is the bar.
|
||||
- **2026-04-29: Spec, scripts, and packaging metadata live in NEW top-level dirs.** `sethlabels-docs/`, `scripts/`, `packaging/`. NOT in upstream's `docs/` directory. — Clear fork boundary; preserves strict-zero spirit (don't pollute upstream namespaces with our content).
|
||||
|
||||
## Deferred / Rejected
|
||||
<!-- Decisions NOT to do something are just as valuable -- prevents re-proposing rejected ideas -->
|
||||
|
||||
- **Rejected 2026-04-29: AppImage-only Linux distribution.** — Loses native Debian package manager integration (`apt remove`, dependency tracking) on the primary target distros.
|
||||
- **Rejected 2026-04-29: `.deb`-only Linux distribution.** — Loses portability to non-Debian Linux (RHEL/Fedora/Arch users couldn't install without recompiling).
|
||||
- **Rejected 2026-04-29: Flatpak.** — Sandbox runtime requirement + manifest complexity overkill for a personal-use packaging fork.
|
||||
- **Rejected 2026-04-29: Signed + notarized macOS `.dmg` (Apple Developer ID).** — $99/year recurring + notarization CI complexity not justified for a build-from-source Homebrew alternative.
|
||||
- **Rejected 2026-04-29: Unsigned macOS `.dmg`.** — Gatekeeper friction (right-click → Open) is a poor first-run experience compared to brew install.
|
||||
- **Rejected 2026-04-29: Gitea Actions self-hosted runner during battle-test.** — Homelab CT spin-up + workflow YAML setup not justified before public-flip; manual builds are faster to iterate on.
|
||||
- **Rejected 2026-04-29: Public GitHub Actions from day one.** — Skips the "battle-test in private" intent; want to validate the pipeline before going public.
|
||||
- **Rejected 2026-04-29: Plain upstream-tag versioning (no `-seth<N>` marker).** — No way to distinguish v1 of the `.deb` from v2 after a packaging fix; would have to lie about which upstream commit the package contains.
|
||||
- **Rejected 2026-04-29: Independent semver (`0.1.0`, `0.2.0`).** — Loses upstream-lineage info from the version string; users couldn't tell which glabels-qt commit they have without checking the changelog.
|
||||
- **Rejected 2026-04-29: Date-based versioning (`2026.04.29`).** — Loses both upstream-lineage and rebuild-counter information.
|
||||
- **Rejected 2026-04-29: Permissive small-patches policy on upstream files.** — Creates rebase friction on each `git pull upstream master`; even a one-file CMakeLists carve-out turned out to be unnecessary since CPack `-D` flags cover all needed metadata at build time.
|
||||
- **Rejected 2026-04-29: Package name `sethlabels`.** — Strict-zero policy forbids renaming the executable, so `apt install sethlabels` then running `glabels-qt` would split package identity from binary identity. Confusing.
|
||||
- **Deferred: Windows packaging.** — Per project brief. Upstream's NSIS support is intact; can be revisited later. Not blocking macOS+Linux delivery.
|
||||
- **Deferred: Custom default templates baked into the package.** — Strict-zero forbids; user-specific templates can live in `~/.config/glabels-qt/templates/` or a separate repo if/when needed.
|
||||
- **Deferred: Branding, icon, splash, or string changes.** — Strict-zero forbids. sethLabels is a packaging fork, not a rebrand.
|
||||
- **Deferred: Distribution to Debian backports / PPA / Ubuntu universe.** — Requires Debian Developer mentorship + ongoing policy compliance work; not justified for current scope.
|
||||
@@ -0,0 +1,21 @@
|
||||
# IDEA.md — Project Idea
|
||||
|
||||
## What is this?
|
||||
|
||||
sethLabels is a deployment fork of [glabels-qt](https://github.com/j-evins/glabels-qt) — a Qt-based desktop application for designing and printing labels, business cards, and similar small-format documents (with CSV mail-merge and barcode support).
|
||||
|
||||
The fork exists to layer Seth's deployment-specific concerns (packaging, install paths, default templates, branding, any local patches) on top of upstream without forking the whole project lifecycle. Goal is to keep the diff small enough to rebase onto upstream `master` periodically.
|
||||
|
||||
## Problem it solves
|
||||
|
||||
Need a reliable, scriptable label designer/printer for homelab + household use (shipping labels, equipment tags, drive labels for the tank pool, cable labels, etc.). Upstream glabels-qt is solid but has no published Debian 13 / current-Ubuntu binaries and the build needs some hand-holding. This fork bakes a known-good build recipe + any local templates + deployment scripts into one repo.
|
||||
|
||||
## Constraints / preferences
|
||||
|
||||
- **Upstream:** https://github.com/j-evins/glabels-qt (track this, don't drift). The glabels.org team are the real authors — strict-zero source-patch policy preserves their attribution end-to-end.
|
||||
- **Stack:** Qt6 6.2 + CMake + C++ (confirmed by reading upstream `CMakeLists.txt:119`).
|
||||
- **Target install hosts:** any Debian-family Linux (Debian 13 / Ubuntu LTS) for `.deb` + AppImage; any macOS for Homebrew tap. Steel141 is a *build host*, not a deploy target. CT for headless print serving optional/later. Windows deferred.
|
||||
- **Branding/customization:** zero — this is a packaging fork, not a rebrand. Strict-zero policy forbids icon/string/UI edits.
|
||||
- **License:** glabels-qt is GPL-3.0 — preserved automatically (we never touch upstream files).
|
||||
- **Repo:** live at `git.sethpc.xyz/Seth/sethLabels`. Eventually-public on GitHub once the build/release pipeline is battle-tested.
|
||||
- **Eventual public-flip:** when promoted to a formal public fork on GitHub, brew tap source URL flips Gitea→GitHub (one-line tap formula edit), and CI is added via GitHub Actions calling the same `scripts/` shell scripts unmodified.
|
||||
@@ -1,3 +1,6 @@
|
||||
>[!IMPORTANT]
|
||||
>This repo is for *glabels-qt*, NOT the legacy *glabels-3* version (which I have not maintained since 2018).
|
||||
|
||||

|
||||
|
||||

|
||||
@@ -31,13 +34,14 @@ There are currently no official releases of gLabels 4.
|
||||
|
||||
Currently there are no self-hosted binary snapshot releases available. I plan to make these available again once 4.0 is more imminent. In the mean time, I encourage you to try building the code yourself.
|
||||
|
||||
Some third-party packages may be available available:
|
||||
Some third-party packages may be available:
|
||||
|
||||
|
||||
| Platform | Files | Notes |
|
||||
|:----------|:-------------------------------------------------------------------------------------|:--------------------------------------------------------------|
|
||||
| Archlinux | [Archlinux User Repository Page](https://aur.archlinux.org/packages/glabels-qt-git/) | Maintained by [Mario Blättermann](https://github.com/mariobl) |
|
||||
| Archlinux | [Archlinux User Repository Page](https://aur.archlinux.org/packages/glabels-qt-git/) | Maintained by [Maud Spierings](https://github.com/SpieringsAE) |
|
||||
| Ubuntu | [PPA Page](https://code.launchpad.net/~krisives/+archive/ubuntu/glabels-qt) | Maintained by [Kristopher Ives](https://github.com/krisives) |
|
||||
| Fedora | [Copr Repository Page](https://copr.fedorainfracloud.org/coprs/mariobl/glabels-qt/) | Maintained by [Mario Blättermann](https://github.com/mariobl) |
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# sethLabels
|
||||
|
||||
> Deployment fork of [glabels-qt](https://github.com/j-evins/glabels-qt) — Qt6
|
||||
> label designer / printer, packaged for Debian-family Linux and macOS.
|
||||
|
||||
This is **not** a code fork. The upstream application is unchanged; sethLabels
|
||||
exists solely to publish installable binary artifacts that upstream explicitly
|
||||
does not provide ("Currently there are no self-hosted binary snapshot releases
|
||||
available… I encourage you to try building the code yourself" — upstream README).
|
||||
|
||||
For the application itself — what it does, screenshots, full feature list — see
|
||||
the upstream [`README.md`](README.md).
|
||||
|
||||
## Install
|
||||
|
||||
### Debian / Ubuntu (`.deb`)
|
||||
|
||||
Download the latest `.deb` from the [releases page](https://git.sethpc.xyz/Seth/sethLabels/releases),
|
||||
then:
|
||||
|
||||
```
|
||||
sudo apt install ./glabels-qt_<VERSION>_amd64.deb
|
||||
glabels-qt --version
|
||||
```
|
||||
|
||||
### Any Linux (AppImage)
|
||||
|
||||
Download `sethlabels-gui-<VERSION>-x86_64.AppImage` from the [releases page](https://git.sethpc.xyz/Seth/sethLabels/releases),
|
||||
make it executable, and run it:
|
||||
|
||||
```
|
||||
chmod +x sethlabels-gui-<VERSION>-x86_64.AppImage
|
||||
./sethlabels-gui-<VERSION>-x86_64.AppImage
|
||||
```
|
||||
|
||||
A separate `sethlabels-batch-<VERSION>-x86_64.AppImage` provides the CLI for
|
||||
scripted / mail-merge use.
|
||||
|
||||
### macOS (Homebrew)
|
||||
|
||||
```
|
||||
brew tap seth/tap https://git.sethpc.xyz/Seth/homebrew-tap.git
|
||||
brew install seth/tap/glabels-qt
|
||||
```
|
||||
|
||||
The explicit URL form is needed because brew defaults to GitHub for tap names.
|
||||
First install builds Qt6 + glabels-qt from source (~5–10 min one-time cost; see
|
||||
spec §D2). Subsequent updates are a fast `brew upgrade`.
|
||||
|
||||
## Build from source
|
||||
|
||||
If you'd rather build the artifacts yourself instead of downloading a release:
|
||||
|
||||
```
|
||||
git clone https://git.sethpc.xyz/Seth/sethLabels.git
|
||||
cd sethLabels
|
||||
./scripts/lib/deps-debian.sh # check / install build deps
|
||||
./scripts/build-deb.sh # → build/deb/glabels-qt_*.deb
|
||||
./scripts/build-appimages.sh # → sethlabels-{gui,batch}-*.AppImage
|
||||
```
|
||||
|
||||
See [`scripts/README.md`](scripts/README.md) for full operator docs.
|
||||
|
||||
## How this fork works
|
||||
|
||||
sethLabels is a **deployment fork**: every sethLabels addition lives in NEW
|
||||
files in NEW top-level directories (`scripts/`, `packaging/`,
|
||||
`sethlabels-docs/`, `tests-impl/`, plus this file). Upstream files are never
|
||||
edited. The single allowlisted exception is `.gitignore`. This discipline is
|
||||
enforced by `scripts/check-no-upstream-edits.sh`.
|
||||
|
||||
The `<upstream-tag>-seth<N>` versioning preserves the upstream-lineage in every
|
||||
artifact. Periodic `git rebase upstream/master` is conflict-free by construction.
|
||||
|
||||
## Spec & decisions
|
||||
|
||||
- [Design spec](sethlabels-docs/specs/2026-04-29-packaging-design.md) — invariants, decisions, build pipeline, failure modes
|
||||
- [Decision log](DECISIONS.md) — settled choices + rejected alternatives
|
||||
- [Project brief](IDEA.md) — plain-language motivation
|
||||
|
||||
## License
|
||||
|
||||
The upstream code is licensed under [GPL-3.0](LICENSE). sethLabels-specific
|
||||
files (everything in the dirs listed above, plus this file) are licensed under
|
||||
the same terms.
|
||||
|
||||
## Upstream
|
||||
|
||||
- Upstream: https://github.com/j-evins/glabels-qt (Jaye Evins / glabels.org)
|
||||
- This fork: https://git.sethpc.xyz/Seth/sethLabels
|
||||
- Brew tap: https://git.sethpc.xyz/Seth/homebrew-tap
|
||||
+505
-507
File diff suppressed because it is too large
Load Diff
@@ -1,98 +0,0 @@
|
||||
/* Backends.h
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_Backends_h
|
||||
#define barcode_Backends_h
|
||||
|
||||
|
||||
#include "Style.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Backends Database
|
||||
///
|
||||
class Backends : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
Backends();
|
||||
|
||||
public:
|
||||
static void init();
|
||||
|
||||
/////////////////////////////////
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static const QStringList& backendList();
|
||||
static QString backendName( const QString& backendId );
|
||||
static const QList<Style>& styleList();
|
||||
static const Style& defaultStyle();
|
||||
static const Style& style( const QString& backendId, const QString& StyleId );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
static void registerBackend( const QString &backendId, const QString &backendName );
|
||||
|
||||
static void registerStyle( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeForm,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Members
|
||||
/////////////////////////////////
|
||||
static QStringList mBackendIdList;
|
||||
static QMap<QString,QString> mBackendNameMap;
|
||||
|
||||
static QList<Style> mStyleList;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Backends_h
|
||||
@@ -0,0 +1,95 @@
|
||||
// Backends.hpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_Backends_hpp
|
||||
#define barcode_Backends_hpp
|
||||
|
||||
|
||||
#include "Style.hpp"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels::barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Backends Database
|
||||
///
|
||||
class Backends : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
Backends();
|
||||
|
||||
public:
|
||||
static void init();
|
||||
|
||||
/////////////////////////////////
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static const QStringList& backendList();
|
||||
static QString backendName( const QString& backendId );
|
||||
static const QList<Style>& styleList();
|
||||
static const Style& defaultStyle();
|
||||
static const Style& style( const QString& backendId, const QString& StyleId );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
static void registerBackend( const QString &backendId, const QString &backendName );
|
||||
|
||||
static void registerStyle( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeForm,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Members
|
||||
/////////////////////////////////
|
||||
static QStringList mBackendIdList;
|
||||
static QMap<QString,QString> mBackendNameMap;
|
||||
|
||||
static QList<Style> mStyleList;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Backends_hpp
|
||||
@@ -37,7 +37,7 @@ set (barcode_sources
|
||||
)
|
||||
|
||||
set (barcode_qobject_headers
|
||||
Backends.h
|
||||
Backends.hpp
|
||||
)
|
||||
|
||||
qt6_wrap_cpp (barcode_moc_sources ${barcode_qobject_headers})
|
||||
@@ -50,10 +50,9 @@ add_library (Barcode STATIC
|
||||
${barcode_moc_sources}
|
||||
)
|
||||
|
||||
#target_compile_features (Barcode
|
||||
# PUBLIC cxx_std_11
|
||||
#)
|
||||
set_property (TARGET Barcode PROPERTY CXX_STANDARD 11)
|
||||
target_compile_features (Barcode
|
||||
PUBLIC cxx_std_20
|
||||
)
|
||||
|
||||
target_include_directories (Barcode
|
||||
PUBLIC ..
|
||||
|
||||
+891
-893
File diff suppressed because it is too large
Load Diff
@@ -1,424 +0,0 @@
|
||||
/* GnuBarcode.h
|
||||
*
|
||||
* Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_GnuBarcode_h
|
||||
#define barcode_GnuBarcode_h
|
||||
|
||||
#if HAVE_GNU_BARCODE
|
||||
|
||||
#include "glbarcode/Barcode1dBase.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
namespace GnuBarcode
|
||||
{
|
||||
|
||||
/**
|
||||
* GnuBarcode::Base base class for all GNU Barcodes
|
||||
*
|
||||
* Implements glbarcode::Barcode1dBase.
|
||||
*/
|
||||
class Base : public glbarcode::Barcode1dBase
|
||||
{
|
||||
protected:
|
||||
int flags;
|
||||
|
||||
bool isAscii( const std::string& data ) const;
|
||||
|
||||
bool isNumericLengthValid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength1Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength2Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
void vectorize( const std::string& encodedData,
|
||||
const std::string& displayText,
|
||||
const std::string& cookedData,
|
||||
double& w,
|
||||
double& h ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN Barcode (Any)
|
||||
*/
|
||||
class Ean : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8 Barcode
|
||||
*/
|
||||
class Ean8 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+2 Barcode
|
||||
*/
|
||||
class Ean8_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+5 Barcode
|
||||
*/
|
||||
class Ean8_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13 Barcode
|
||||
*/
|
||||
class Ean13 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+2 Barcode
|
||||
*/
|
||||
class Ean13_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+5 Barcode
|
||||
*/
|
||||
class Ean13_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC Barcode (Any)
|
||||
*/
|
||||
class Upc : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A Barcode
|
||||
*/
|
||||
class UpcA : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+2 Barcode
|
||||
*/
|
||||
class UpcA_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+5 Barcode
|
||||
*/
|
||||
class UpcA_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E Barcode
|
||||
*/
|
||||
class UpcE : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+2 Barcode
|
||||
*/
|
||||
class UpcE_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+5 Barcode
|
||||
*/
|
||||
class UpcE_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN Barcode
|
||||
*/
|
||||
class Isbn : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN+5 Barcode
|
||||
*/
|
||||
class Isbn_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code39 Barcode
|
||||
*/
|
||||
class Code39 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128 Barcode
|
||||
*/
|
||||
class Code128 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128C Barcode
|
||||
*/
|
||||
class Code128C : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128B Barcode
|
||||
*/
|
||||
class Code128B : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* I25 Barcode
|
||||
*/
|
||||
class I25 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CBR Barcode
|
||||
*/
|
||||
class Cbr : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* MSI Barcode
|
||||
*/
|
||||
class Msi : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* PLS Barcode
|
||||
*/
|
||||
class Pls : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code93 Barcode
|
||||
*/
|
||||
class Code93 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_GNU_BARCODE
|
||||
|
||||
#endif // barcode_GnuBarcode_h
|
||||
@@ -0,0 +1,419 @@
|
||||
// GnuBarcode.hpp
|
||||
//
|
||||
// Copyright (C) 2017-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_GnuBarcode_hpp
|
||||
#define barcode_GnuBarcode_hpp
|
||||
|
||||
#if HAVE_GNU_BARCODE
|
||||
|
||||
|
||||
#include "glbarcode/Barcode1dBase.hpp"
|
||||
|
||||
|
||||
namespace glabels::barcode::GnuBarcode
|
||||
{
|
||||
|
||||
/**
|
||||
* GnuBarcode::Base base class for all GNU Barcodes
|
||||
*
|
||||
* Implements glbarcode::Barcode1dBase.
|
||||
*/
|
||||
class Base : public glbarcode::Barcode1dBase
|
||||
{
|
||||
protected:
|
||||
int flags;
|
||||
|
||||
bool isAscii( const std::string& data ) const;
|
||||
|
||||
bool isNumericLengthValid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength1Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
bool isNumericLength2Valid( const std::string& data,
|
||||
unsigned int nMin,
|
||||
unsigned int nMax ) const;
|
||||
|
||||
void vectorize( const std::string& encodedData,
|
||||
const std::string& displayText,
|
||||
const std::string& cookedData,
|
||||
double& w,
|
||||
double& h ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN Barcode (Any)
|
||||
*/
|
||||
class Ean : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8 Barcode
|
||||
*/
|
||||
class Ean8 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+2 Barcode
|
||||
*/
|
||||
class Ean8_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-8+5 Barcode
|
||||
*/
|
||||
class Ean8_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13 Barcode
|
||||
*/
|
||||
class Ean13 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+2 Barcode
|
||||
*/
|
||||
class Ean13_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* EAN-13+5 Barcode
|
||||
*/
|
||||
class Ean13_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC Barcode (Any)
|
||||
*/
|
||||
class Upc : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A Barcode
|
||||
*/
|
||||
class UpcA : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+2 Barcode
|
||||
*/
|
||||
class UpcA_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-A+5 Barcode
|
||||
*/
|
||||
class UpcA_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E Barcode
|
||||
*/
|
||||
class UpcE : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+2 Barcode
|
||||
*/
|
||||
class UpcE_2 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UPC-E+5 Barcode
|
||||
*/
|
||||
class UpcE_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN Barcode
|
||||
*/
|
||||
class Isbn : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISBN+5 Barcode
|
||||
*/
|
||||
class Isbn_5 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code39 Barcode
|
||||
*/
|
||||
class Code39 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128 Barcode
|
||||
*/
|
||||
class Code128 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128C Barcode
|
||||
*/
|
||||
class Code128C : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code128B Barcode
|
||||
*/
|
||||
class Code128B : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* I25 Barcode
|
||||
*/
|
||||
class I25 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CBR Barcode
|
||||
*/
|
||||
class Cbr : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* MSI Barcode
|
||||
*/
|
||||
class Msi : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* PLS Barcode
|
||||
*/
|
||||
class Pls : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Code93 Barcode
|
||||
*/
|
||||
class Code93 : public Base
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
protected:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
std::string encode( const std::string& cookedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_GNU_BARCODE
|
||||
|
||||
#endif // barcode_GnuBarcode_hpp
|
||||
@@ -1,91 +1,86 @@
|
||||
/* QrEncode.cpp
|
||||
*
|
||||
* Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// QrEncode.cpp
|
||||
//
|
||||
// Copyright (C) 2017-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#if HAVE_QRENCODE
|
||||
|
||||
#include "QrEncode.h"
|
||||
|
||||
#include "QrEncode.hpp"
|
||||
|
||||
#include <qrencode.h>
|
||||
|
||||
|
||||
namespace glabels
|
||||
namespace glabels::barcode::QrEncode
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
namespace QrEncode
|
||||
{
|
||||
|
||||
/*
|
||||
* Static QrCode barcode creation method
|
||||
*/
|
||||
glbarcode::Barcode* QrCode::create()
|
||||
{
|
||||
return new QrCode();
|
||||
}
|
||||
/*
|
||||
* Static QrCode barcode creation method
|
||||
*/
|
||||
glbarcode::Barcode* QrCode::create()
|
||||
{
|
||||
return new QrCode();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QrCode data validation, implements glbarcode::Barcode2dBase::validate()
|
||||
*/
|
||||
bool QrCode::validate( const std::string& rawData )
|
||||
{
|
||||
if ( rawData.size() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* QrCode data validation, implements glbarcode::Barcode2dBase::validate()
|
||||
*/
|
||||
bool QrCode::validate( const std::string& rawData )
|
||||
{
|
||||
if ( rawData.size() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QrCode data encoding, implements glbarcode::Barcode2dBase::encode()
|
||||
*/
|
||||
bool QrCode::encode( const std::string& cookedData, glbarcode::Matrix<bool>& encodedData )
|
||||
{
|
||||
QRcode *qrcode = QRcode_encodeString( cookedData.c_str(), 0, QR_ECLEVEL_M, QR_MODE_8, 1 );
|
||||
if ( qrcode == nullptr )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* QrCode data encoding, implements glbarcode::Barcode2dBase::encode()
|
||||
*/
|
||||
bool QrCode::encode( const std::string& cookedData, glbarcode::Matrix<bool>& encodedData )
|
||||
{
|
||||
QRcode *qrcode = QRcode_encodeString( cookedData.c_str(), 0, QR_ECLEVEL_M, QR_MODE_8, 1 );
|
||||
if ( qrcode == nullptr )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int w = qrcode->width;
|
||||
encodedData.resize( w, w );
|
||||
|
||||
|
||||
for ( int iy = 0; iy < w; iy++ )
|
||||
{
|
||||
for ( int ix = 0; ix < w; ix++ )
|
||||
{
|
||||
encodedData[iy][ix] = qrcode->data[ iy*w + ix ] & 0x01;
|
||||
}
|
||||
}
|
||||
int w = qrcode->width;
|
||||
encodedData.resize( w, w );
|
||||
|
||||
|
||||
QRcode_free( qrcode );
|
||||
for ( int iy = 0; iy < w; iy++ )
|
||||
{
|
||||
for ( int ix = 0; ix < w; ix++ )
|
||||
{
|
||||
encodedData[iy][ix] = qrcode->data[ iy*w + ix ] & 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
QRcode_free( qrcode );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/* QrEncode.h
|
||||
*
|
||||
* Copyright (C) 2017 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_QrEncode_h
|
||||
#define barcode_QrEncode_h
|
||||
|
||||
#if HAVE_QRENCODE
|
||||
|
||||
#include "glbarcode/Barcode2dBase.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
namespace QrEncode
|
||||
{
|
||||
|
||||
/**
|
||||
* QrEncode::QrCode QR Code Barcode
|
||||
*
|
||||
* Implements glbarcode::Barcode2dBase.
|
||||
*/
|
||||
class QrCode : public glbarcode::Barcode2dBase
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
private:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
|
||||
bool encode( const std::string& cookedData,
|
||||
glbarcode::Matrix<bool>& encodedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_QRENCODE
|
||||
|
||||
#endif // barcode_QrEncode_h
|
||||
@@ -0,0 +1,55 @@
|
||||
// QrEncode.hpp
|
||||
//
|
||||
// Copyright (C) 2017-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_QrEncode_hpp
|
||||
#define barcode_QrEncode_hpp
|
||||
|
||||
#if HAVE_QRENCODE
|
||||
|
||||
|
||||
#include "glbarcode/Barcode2dBase.hpp"
|
||||
|
||||
|
||||
namespace glabels::barcode::QrEncode
|
||||
{
|
||||
|
||||
///
|
||||
/// QrEncode::QrCode QR Code Barcode
|
||||
///
|
||||
/// Implements glbarcode::Barcode2dBase.
|
||||
///
|
||||
class QrCode : public glbarcode::Barcode2dBase
|
||||
{
|
||||
public:
|
||||
static Barcode* create();
|
||||
|
||||
private:
|
||||
bool validate( const std::string& rawData ) override;
|
||||
|
||||
bool encode( const std::string& cookedData,
|
||||
glbarcode::Matrix<bool>& encodedData ) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_QRENCODE
|
||||
|
||||
#endif // barcode_QrEncode_hpp
|
||||
+190
-192
@@ -1,225 +1,223 @@
|
||||
/* Style.cpp
|
||||
*
|
||||
* Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Style.h"
|
||||
|
||||
#include "Backends.h"
|
||||
// Style.cpp
|
||||
//
|
||||
// Copyright (C) 2013-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "Style.hpp"
|
||||
|
||||
#include "Backends.hpp"
|
||||
|
||||
|
||||
namespace glabels::barcode
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Default Constructor
|
||||
///
|
||||
Style::Style ()
|
||||
: mId( "" ),
|
||||
mBackendId( "" ),
|
||||
mName( "" ),
|
||||
mCanText( false ),
|
||||
mTextOptional( false ),
|
||||
mCanChecksum( false ),
|
||||
mChecksumOptional( false ),
|
||||
mDefaultDigits( "" ),
|
||||
mCanFreeform( false ),
|
||||
mPreferedN( 0 )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
///
|
||||
/// Default Constructor
|
||||
///
|
||||
Style::Style ()
|
||||
: mId( "" ),
|
||||
mBackendId( "" ),
|
||||
mName( "" ),
|
||||
mCanText( false ),
|
||||
mTextOptional( false ),
|
||||
mCanChecksum( false ),
|
||||
mChecksumOptional( false ),
|
||||
mDefaultDigits( "" ),
|
||||
mCanFreeform( false ),
|
||||
mPreferedN( 0 )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor From Data
|
||||
///
|
||||
Style::Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN )
|
||||
: mId( id ),
|
||||
mBackendId( backendId ),
|
||||
mName( name ),
|
||||
mCanText( canText ),
|
||||
mTextOptional( textOptional ),
|
||||
mCanChecksum( canChecksum ),
|
||||
mChecksumOptional( checksumOptional ),
|
||||
mDefaultDigits( defaultDigits ),
|
||||
mCanFreeform( canFreeform ),
|
||||
mPreferedN( preferedN )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
///
|
||||
/// Constructor From Data
|
||||
///
|
||||
Style::Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN )
|
||||
: mId( id ),
|
||||
mBackendId( backendId ),
|
||||
mName( name ),
|
||||
mCanText( canText ),
|
||||
mTextOptional( textOptional ),
|
||||
mCanChecksum( canChecksum ),
|
||||
mChecksumOptional( checksumOptional ),
|
||||
mDefaultDigits( defaultDigits ),
|
||||
mCanFreeform( canFreeform ),
|
||||
mPreferedN( preferedN )
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// ID Property Getter
|
||||
///
|
||||
const QString& Style::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
///
|
||||
/// ID Property Getter
|
||||
///
|
||||
const QString& Style::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Full ID Property Getter
|
||||
///
|
||||
QString Style::fullId() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mBackendId + "::" + mId;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Full ID Property Getter
|
||||
///
|
||||
QString Style::fullId() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mBackendId + "::" + mId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Backend ID Property Getter
|
||||
///
|
||||
const QString& Style::backendId() const
|
||||
{
|
||||
return mBackendId;
|
||||
}
|
||||
///
|
||||
/// Backend ID Property Getter
|
||||
///
|
||||
const QString& Style::backendId() const
|
||||
{
|
||||
return mBackendId;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Name Property Getter
|
||||
///
|
||||
const QString& Style::name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
///
|
||||
/// Name Property Getter
|
||||
///
|
||||
const QString& Style::name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Full Name Property Getter
|
||||
///
|
||||
QString Style::fullName() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Backends::backendName(mBackendId) + " / " + mName;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Full Name Property Getter
|
||||
///
|
||||
QString Style::fullName() const
|
||||
{
|
||||
if ( mBackendId == "" )
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Backends::backendName(mBackendId) + " / " + mName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Can Text Property Getter
|
||||
///
|
||||
bool Style::canText() const
|
||||
{
|
||||
return mCanText;
|
||||
}
|
||||
///
|
||||
/// Can Text Property Getter
|
||||
///
|
||||
bool Style::canText() const
|
||||
{
|
||||
return mCanText;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Text Optional Property Getter
|
||||
///
|
||||
bool Style::textOptional() const
|
||||
{
|
||||
return mTextOptional;
|
||||
}
|
||||
///
|
||||
/// Text Optional Property Getter
|
||||
///
|
||||
bool Style::textOptional() const
|
||||
{
|
||||
return mTextOptional;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Can Checksum Property Getter
|
||||
///
|
||||
bool Style::canChecksum() const
|
||||
{
|
||||
return mCanChecksum;
|
||||
}
|
||||
///
|
||||
/// Can Checksum Property Getter
|
||||
///
|
||||
bool Style::canChecksum() const
|
||||
{
|
||||
return mCanChecksum;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Checksum Optional Property Getter
|
||||
///
|
||||
bool Style::checksumOptional() const
|
||||
{
|
||||
return mChecksumOptional;
|
||||
}
|
||||
///
|
||||
/// Checksum Optional Property Getter
|
||||
///
|
||||
bool Style::checksumOptional() const
|
||||
{
|
||||
return mChecksumOptional;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Default Digits Property Getter
|
||||
///
|
||||
const QString& Style::defaultDigits() const
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
///
|
||||
/// Default Digits Property Getter
|
||||
///
|
||||
const QString& Style::defaultDigits() const
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Can Freeform Property Getter
|
||||
///
|
||||
bool Style::canFreeform() const
|
||||
{
|
||||
return mCanFreeform;
|
||||
}
|
||||
///
|
||||
/// Can Freeform Property Getter
|
||||
///
|
||||
bool Style::canFreeform() const
|
||||
{
|
||||
return mCanFreeform;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Preferred N Property Getter
|
||||
///
|
||||
int Style::preferedN() const
|
||||
{
|
||||
return mPreferedN;
|
||||
}
|
||||
///
|
||||
/// Preferred N Property Getter
|
||||
///
|
||||
int Style::preferedN() const
|
||||
{
|
||||
return mPreferedN;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Generate Example Digits
|
||||
///
|
||||
QString Style::exampleDigits( int n ) const
|
||||
{
|
||||
if ( mCanFreeform )
|
||||
{
|
||||
return QString( qMax( n, 1 ), QChar('0') );
|
||||
}
|
||||
else
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Generate Example Digits
|
||||
///
|
||||
QString Style::exampleDigits( int n ) const
|
||||
{
|
||||
if ( mCanFreeform )
|
||||
{
|
||||
return QString( qMax( n, 1 ), QChar('0') );
|
||||
}
|
||||
else
|
||||
{
|
||||
return mDefaultDigits;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// "Not equals" operator
|
||||
///
|
||||
bool Style::operator!=( const Style& other ) const
|
||||
{
|
||||
return (mBackendId != other.mBackendId) || (mId != other.mId);
|
||||
}
|
||||
|
||||
} // namespace barcode
|
||||
} // namespace glabels
|
||||
///
|
||||
/// "Not equals" operator
|
||||
///
|
||||
bool Style::operator!=( const Style& other ) const
|
||||
{
|
||||
return (mBackendId != other.mBackendId) || (mId != other.mId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/* Style.h
|
||||
*
|
||||
* Copyright (C) 2013 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef barcode_Style_h
|
||||
#define barcode_Style_h
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Style Type
|
||||
///
|
||||
class Style
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
Style ();
|
||||
|
||||
Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
const QString& id() const;
|
||||
|
||||
QString fullId() const;
|
||||
|
||||
const QString& backendId() const;
|
||||
|
||||
const QString& name() const;
|
||||
|
||||
QString fullName() const;
|
||||
|
||||
bool canText() const;
|
||||
|
||||
bool textOptional() const;
|
||||
|
||||
bool canChecksum() const;
|
||||
|
||||
bool checksumOptional() const;
|
||||
|
||||
const QString& defaultDigits() const;
|
||||
|
||||
bool canFreeform() const;
|
||||
|
||||
int preferedN() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString exampleDigits( int n ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Operators
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool operator!=( const Style& other ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QString mId;
|
||||
QString mBackendId;
|
||||
QString mName;
|
||||
bool mCanText;
|
||||
bool mTextOptional;
|
||||
bool mCanChecksum;
|
||||
bool mChecksumOptional;
|
||||
QString mDefaultDigits;
|
||||
bool mCanFreeform;
|
||||
int mPreferedN;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Style_h
|
||||
@@ -0,0 +1,117 @@
|
||||
// Style.hpp
|
||||
//
|
||||
// Copyright (C) 2013-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef barcode_Style_hpp
|
||||
#define barcode_Style_hpp
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels::barcode
|
||||
{
|
||||
|
||||
///
|
||||
/// Style Type
|
||||
///
|
||||
class Style
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
Style ();
|
||||
|
||||
Style ( const QString& id,
|
||||
const QString& backendId,
|
||||
const QString& name,
|
||||
bool canText,
|
||||
bool textOptional,
|
||||
bool canChecksum,
|
||||
bool checksumOptional,
|
||||
const QString& defaultDigits,
|
||||
bool canFreeform,
|
||||
int preferedN );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
const QString& id() const;
|
||||
|
||||
QString fullId() const;
|
||||
|
||||
const QString& backendId() const;
|
||||
|
||||
const QString& name() const;
|
||||
|
||||
QString fullName() const;
|
||||
|
||||
bool canText() const;
|
||||
|
||||
bool textOptional() const;
|
||||
|
||||
bool canChecksum() const;
|
||||
|
||||
bool checksumOptional() const;
|
||||
|
||||
const QString& defaultDigits() const;
|
||||
|
||||
bool canFreeform() const;
|
||||
|
||||
int preferedN() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString exampleDigits( int n ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Operators
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool operator!=( const Style& other ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QString mId;
|
||||
QString mBackendId;
|
||||
QString mName;
|
||||
bool mCanText;
|
||||
bool mTextOptional;
|
||||
bool mCanChecksum;
|
||||
bool mChecksumOptional;
|
||||
QString mDefaultDigits;
|
||||
bool mCanFreeform;
|
||||
int mPreferedN;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // barcode_Style_hpp
|
||||
+1543
-1551
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ set (merge_sources
|
||||
)
|
||||
|
||||
set (merge_qobject_headers
|
||||
Merge.h
|
||||
Merge.hpp
|
||||
)
|
||||
|
||||
qt6_wrap_cpp (merge_moc_sources ${merge_qobject_headers})
|
||||
@@ -33,10 +33,9 @@ add_library (Merge STATIC
|
||||
${merge_moc_sources}
|
||||
)
|
||||
|
||||
#target_compile_features (Merge
|
||||
# PUBLIC cxx_std_11
|
||||
#)
|
||||
set_property (TARGET Merge PROPERTY CXX_STANDARD 11)
|
||||
target_compile_features (Merge
|
||||
PUBLIC cxx_std_20
|
||||
)
|
||||
|
||||
target_include_directories (Merge
|
||||
PUBLIC ..
|
||||
|
||||
+187
-189
@@ -1,222 +1,220 @@
|
||||
/* Merge/Factory.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Factory.h"
|
||||
|
||||
#include "None.h"
|
||||
#include "TextCsv.h"
|
||||
#include "TextCsvKeys.h"
|
||||
#include "TextTsv.h"
|
||||
#include "TextTsvKeys.h"
|
||||
#include "TextColon.h"
|
||||
#include "TextColonKeys.h"
|
||||
#include "TextSemicolon.h"
|
||||
#include "TextSemicolonKeys.h"
|
||||
// Merge/Factory.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "Factory.hpp"
|
||||
|
||||
#include "None.hpp"
|
||||
#include "TextCsv.hpp"
|
||||
#include "TextCsvKeys.hpp"
|
||||
#include "TextTsv.hpp"
|
||||
#include "TextTsvKeys.hpp"
|
||||
#include "TextColon.hpp"
|
||||
#include "TextColonKeys.hpp"
|
||||
#include "TextSemicolon.hpp"
|
||||
#include "TextSemicolonKeys.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
//
|
||||
// Static data
|
||||
//
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendIdMap;
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendNameMap;
|
||||
QStringList Factory::mNameList;
|
||||
//
|
||||
// Static data
|
||||
//
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendIdMap;
|
||||
QMap<QString,Factory::BackendEntry> Factory::mBackendNameMap;
|
||||
QStringList Factory::mNameList;
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Factory::Factory()
|
||||
{
|
||||
registerBackend( None::id(),
|
||||
tr("None"),
|
||||
NONE,
|
||||
&None::create );
|
||||
|
||||
registerBackend( TextCsv::id(),
|
||||
tr("Text: Comma Separated Values (CSV)"),
|
||||
FILE,
|
||||
&TextCsv::create );
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Factory::Factory()
|
||||
{
|
||||
registerBackend( None::id(),
|
||||
tr("None"),
|
||||
NONE,
|
||||
&None::create );
|
||||
|
||||
registerBackend( TextCsvKeys::id(),
|
||||
tr("Text: Comma Separated Values (CSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextCsvKeys::create );
|
||||
registerBackend( TextCsv::id(),
|
||||
tr("Text: Comma Separated Values (CSV)"),
|
||||
FILE,
|
||||
&TextCsv::create );
|
||||
|
||||
registerBackend( TextTsv::id(),
|
||||
tr("Text: Tab Separated Values (TSV)"),
|
||||
FILE,
|
||||
&TextTsv::create );
|
||||
registerBackend( TextCsvKeys::id(),
|
||||
tr("Text: Comma Separated Values (CSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextCsvKeys::create );
|
||||
|
||||
registerBackend( TextTsvKeys::id(),
|
||||
tr("Text: Tab Separated Values (TSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextTsvKeys::create );
|
||||
registerBackend( TextTsv::id(),
|
||||
tr("Text: Tab Separated Values (TSV)"),
|
||||
FILE,
|
||||
&TextTsv::create );
|
||||
|
||||
registerBackend( TextColon::id(),
|
||||
tr("Text: Colon Separated Values"),
|
||||
FILE,
|
||||
&TextColon::create );
|
||||
registerBackend( TextTsvKeys::id(),
|
||||
tr("Text: Tab Separated Values (TSV), keys on line 1"),
|
||||
FILE,
|
||||
&TextTsvKeys::create );
|
||||
|
||||
registerBackend( TextColonKeys::id(),
|
||||
tr("Text: Colon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextColonKeys::create );
|
||||
registerBackend( TextColon::id(),
|
||||
tr("Text: Colon Separated Values"),
|
||||
FILE,
|
||||
&TextColon::create );
|
||||
|
||||
registerBackend( TextSemicolon::id(),
|
||||
tr("Text: Semicolon Separated Values"),
|
||||
FILE,
|
||||
&TextSemicolon::create );
|
||||
registerBackend( TextColonKeys::id(),
|
||||
tr("Text: Colon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextColonKeys::create );
|
||||
|
||||
registerBackend( TextSemicolonKeys::id(),
|
||||
tr("Text: Semicolon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextSemicolonKeys::create );
|
||||
}
|
||||
registerBackend( TextSemicolon::id(),
|
||||
tr("Text: Semicolon Separated Values"),
|
||||
FILE,
|
||||
&TextSemicolon::create );
|
||||
|
||||
registerBackend( TextSemicolonKeys::id(),
|
||||
tr("Text: Semicolon Separated Values, keys on line 1"),
|
||||
FILE,
|
||||
&TextSemicolonKeys::create );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Initialize
|
||||
///
|
||||
void Factory::init()
|
||||
{
|
||||
static Factory* singletonInstance = nullptr;
|
||||
if ( !singletonInstance )
|
||||
{
|
||||
singletonInstance = new Factory();
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Initialize
|
||||
///
|
||||
void Factory::init()
|
||||
{
|
||||
static Factory* singletonInstance = nullptr;
|
||||
if ( !singletonInstance )
|
||||
{
|
||||
singletonInstance = new Factory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create Merge object
|
||||
///
|
||||
Merge* Factory::createMerge( const QString& id )
|
||||
{
|
||||
QMap<QString,BackendEntry>::iterator iBackend = mBackendIdMap.find( id );
|
||||
if ( iBackend != mBackendIdMap.end() )
|
||||
{
|
||||
return iBackend->create();
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
///
|
||||
/// Create Merge object
|
||||
///
|
||||
Merge* Factory::createMerge( const QString& id )
|
||||
{
|
||||
QMap<QString,BackendEntry>::iterator iBackend = mBackendIdMap.find( id );
|
||||
if ( iBackend != mBackendIdMap.end() )
|
||||
{
|
||||
return iBackend->create();
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get name list
|
||||
///
|
||||
QStringList Factory::nameList()
|
||||
{
|
||||
return mNameList;
|
||||
}
|
||||
///
|
||||
/// Get name list
|
||||
///
|
||||
QStringList Factory::nameList()
|
||||
{
|
||||
return mNameList;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Convert ID to name
|
||||
///
|
||||
QString Factory::idToName( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tr("None");
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Convert ID to name
|
||||
///
|
||||
QString Factory::idToName( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tr("None");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Convert name to ID
|
||||
///
|
||||
QString Factory::nameToId( const QString& name )
|
||||
{
|
||||
if ( mBackendNameMap.contains( name ) )
|
||||
{
|
||||
return mBackendNameMap[name].id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Convert name to ID
|
||||
///
|
||||
QString Factory::nameToId( const QString& name )
|
||||
{
|
||||
if ( mBackendNameMap.contains( name ) )
|
||||
{
|
||||
return mBackendNameMap[name].id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Convert ID to type
|
||||
///
|
||||
Factory::SourceType Factory::idToType( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Convert ID to type
|
||||
///
|
||||
Factory::SourceType Factory::idToType( const QString& id )
|
||||
{
|
||||
if ( mBackendIdMap.contains( id ) )
|
||||
{
|
||||
return mBackendIdMap[id].type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Lookup ID from index
|
||||
///
|
||||
QString Factory::indexToId( int index )
|
||||
{
|
||||
if ( (index > 0) && (index < mNameList.size()) )
|
||||
{
|
||||
QString name = mNameList[index];
|
||||
|
||||
return mBackendNameMap[ name ].id;
|
||||
}
|
||||
///
|
||||
/// Lookup ID from index
|
||||
///
|
||||
QString Factory::indexToId( int index )
|
||||
{
|
||||
if ( (index > 0) && (index < mNameList.size()) )
|
||||
{
|
||||
QString name = mNameList[index];
|
||||
|
||||
return "None";
|
||||
}
|
||||
return mBackendNameMap[ name ].id;
|
||||
}
|
||||
|
||||
return "None";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Register backend
|
||||
///
|
||||
void Factory::registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create )
|
||||
{
|
||||
BackendEntry backend;
|
||||
///
|
||||
/// Register backend
|
||||
///
|
||||
void Factory::registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create )
|
||||
{
|
||||
BackendEntry backend;
|
||||
|
||||
backend.id = id;
|
||||
backend.name = name;
|
||||
backend.type = type;
|
||||
backend.create = create;
|
||||
|
||||
mBackendIdMap[ id ] = backend;
|
||||
mBackendNameMap[ name ] = backend;
|
||||
backend.id = id;
|
||||
backend.name = name;
|
||||
backend.type = type;
|
||||
backend.create = create;
|
||||
|
||||
mNameList << name;
|
||||
}
|
||||
mBackendIdMap[ id ] = backend;
|
||||
mBackendNameMap[ name ] = backend;
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
mNameList << name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/* Merge/Factory.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Factory_h
|
||||
#define merge_Factory_h
|
||||
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Merge;
|
||||
|
||||
|
||||
///
|
||||
/// Factory
|
||||
///
|
||||
class Factory
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Factory)
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Source Type
|
||||
/////////////////////////////////
|
||||
public:
|
||||
enum SourceType { NONE, FIXED, FILE };
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Factory();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static void init();
|
||||
|
||||
static Merge* createMerge( const QString& id );
|
||||
|
||||
static QStringList nameList();
|
||||
static QString idToName( const QString& id );
|
||||
static QString nameToId( const QString& name );
|
||||
static SourceType idToType( const QString& id );
|
||||
static QString indexToId( int index );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
using CreateFct = Merge* (*)();
|
||||
|
||||
static void registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private data
|
||||
/////////////////////////////////
|
||||
class BackendEntry
|
||||
{
|
||||
public:
|
||||
QString id;
|
||||
QString name;
|
||||
SourceType type;
|
||||
CreateFct create;
|
||||
};
|
||||
|
||||
static QMap<QString,BackendEntry> mBackendIdMap;
|
||||
static QMap<QString,BackendEntry> mBackendNameMap;
|
||||
|
||||
static QStringList mNameList;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Factory_h
|
||||
@@ -0,0 +1,107 @@
|
||||
// Merge/Factory.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Factory_hpp
|
||||
#define merge_Factory_hpp
|
||||
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Merge;
|
||||
|
||||
|
||||
///
|
||||
/// Factory
|
||||
///
|
||||
class Factory
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Factory)
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Source Type
|
||||
/////////////////////////////////
|
||||
public:
|
||||
enum SourceType { NONE, FIXED, FILE };
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Factory();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static void init();
|
||||
|
||||
static Merge* createMerge( const QString& id );
|
||||
|
||||
static QStringList nameList();
|
||||
static QString idToName( const QString& id );
|
||||
static QString nameToId( const QString& name );
|
||||
static SourceType idToType( const QString& id );
|
||||
static QString indexToId( int index );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
using CreateFct = Merge* (*)();
|
||||
|
||||
static void registerBackend( const QString& id,
|
||||
const QString& name,
|
||||
SourceType type,
|
||||
CreateFct create );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// private data
|
||||
/////////////////////////////////
|
||||
class BackendEntry
|
||||
{
|
||||
public:
|
||||
QString id;
|
||||
QString name;
|
||||
SourceType type;
|
||||
CreateFct create;
|
||||
};
|
||||
|
||||
static QMap<QString,BackendEntry> mBackendIdMap;
|
||||
static QMap<QString,BackendEntry> mBackendNameMap;
|
||||
|
||||
static QStringList mNameList;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Factory_hpp
|
||||
+167
-170
@@ -1,201 +1,198 @@
|
||||
/* Merge/Merge.cpp
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Merge/Merge.cpp
|
||||
//
|
||||
// Copyright (C) 2015-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
#include "Merge.h"
|
||||
#include "Merge.hpp"
|
||||
|
||||
|
||||
namespace glabels
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Merge::Merge( const Merge* merge )
|
||||
: mId(merge->mId),
|
||||
mSource(merge->mSource),
|
||||
mRecordList(merge->mRecordList)
|
||||
{
|
||||
}
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Merge::Merge( const Merge* merge )
|
||||
: mId(merge->mId),
|
||||
mSource(merge->mSource),
|
||||
mRecordList(merge->mRecordList)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get id
|
||||
///
|
||||
QString Merge::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
///
|
||||
/// Get id
|
||||
///
|
||||
QString Merge::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get source
|
||||
///
|
||||
QString Merge::source() const
|
||||
{
|
||||
return mSource;
|
||||
}
|
||||
///
|
||||
/// Get source
|
||||
///
|
||||
QString Merge::source() const
|
||||
{
|
||||
return mSource;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Set source
|
||||
///
|
||||
void Merge::setSource( const QString& source )
|
||||
{
|
||||
mSource = source;
|
||||
///
|
||||
/// Set source
|
||||
///
|
||||
void Merge::setSource( const QString& source )
|
||||
{
|
||||
mSource = source;
|
||||
|
||||
// Clear out any old records
|
||||
mRecordList.clear();
|
||||
// Clear out any old records
|
||||
mRecordList.clear();
|
||||
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
|
||||
emit sourceChanged();
|
||||
}
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
|
||||
emit sourceChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Reload source
|
||||
///
|
||||
void Merge::reloadSource()
|
||||
{
|
||||
// temporary map of original selections
|
||||
QMap<QString,bool> origSelectionMap;
|
||||
///
|
||||
/// Reload source
|
||||
///
|
||||
void Merge::reloadSource()
|
||||
{
|
||||
// temporary map of original selections
|
||||
QMap<QString,bool> origSelectionMap;
|
||||
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
origSelectionMap[ record[ primaryKey() ] ] = record.isSelected();
|
||||
}
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
origSelectionMap[ record[ primaryKey() ] ] = record.isSelected();
|
||||
}
|
||||
|
||||
// Clear the original records
|
||||
mRecordList.clear();
|
||||
// Clear the original records
|
||||
mRecordList.clear();
|
||||
|
||||
// Read the new records, preserve any original selections
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
auto key = record[ primaryKey() ];
|
||||
auto it = origSelectionMap.find( key );
|
||||
if ( it != origSelectionMap.end() )
|
||||
{
|
||||
record.setSelected( it.value() );
|
||||
}
|
||||
// Read the new records, preserve any original selections
|
||||
open();
|
||||
for ( Record record = readNextRecord(); !record.isEmpty(); record = readNextRecord() )
|
||||
{
|
||||
auto key = record[ primaryKey() ];
|
||||
auto it = origSelectionMap.find( key );
|
||||
if ( it != origSelectionMap.end() )
|
||||
{
|
||||
record.setSelected( it.value() );
|
||||
}
|
||||
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
mRecordList.push_back( record );
|
||||
}
|
||||
close();
|
||||
|
||||
emit sourceChanged();
|
||||
}
|
||||
emit sourceChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get record list
|
||||
///
|
||||
const QList<Record>& Merge::recordList( ) const
|
||||
{
|
||||
return mRecordList;
|
||||
}
|
||||
///
|
||||
/// Get record list
|
||||
///
|
||||
const QList<Record>& Merge::recordList( ) const
|
||||
{
|
||||
return mRecordList;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Select/unselect i'th record
|
||||
///
|
||||
void Merge::setSelected( int i, bool state )
|
||||
{
|
||||
if ( (i >= 0) && (i < mRecordList.size()) )
|
||||
{
|
||||
mRecordList[i].setSelected( state );
|
||||
emit selectionChanged();
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Select/unselect i'th record
|
||||
///
|
||||
void Merge::setSelected( int i, bool state )
|
||||
{
|
||||
if ( (i >= 0) && (i < mRecordList.size()) )
|
||||
{
|
||||
mRecordList[i].setSelected( state );
|
||||
emit selectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Select all records
|
||||
///
|
||||
void Merge::selectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( true );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Unselect all records
|
||||
///
|
||||
void Merge::unselectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( false );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Return count of selected records
|
||||
///
|
||||
int Merge::nSelectedRecords() const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
///
|
||||
/// Select all records
|
||||
///
|
||||
void Merge::selectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( true );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Return list of selected records
|
||||
///
|
||||
const QList<Record> Merge::selectedRecords() const
|
||||
{
|
||||
QList<Record> list;
|
||||
///
|
||||
/// Unselect all records
|
||||
///
|
||||
void Merge::unselectAll()
|
||||
{
|
||||
for ( auto& record : mRecordList )
|
||||
{
|
||||
record.setSelected( false );
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
list.append( record );
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
///
|
||||
/// Return count of selected records
|
||||
///
|
||||
int Merge::nSelectedRecords() const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Return list of selected records
|
||||
///
|
||||
const QList<Record> Merge::selectedRecords() const
|
||||
{
|
||||
QList<Record> list;
|
||||
|
||||
for ( const auto& record : mRecordList )
|
||||
{
|
||||
if ( record.isSelected() )
|
||||
{
|
||||
list.append( record );
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/* Merge/Merge.h
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Merge_h
|
||||
#define merge_Merge_h
|
||||
|
||||
|
||||
#include "Record.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Record;
|
||||
|
||||
|
||||
///
|
||||
/// Merge Object
|
||||
///
|
||||
class Merge : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Merge() = default;
|
||||
Merge( const Merge* merge );
|
||||
public:
|
||||
virtual ~Merge() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
virtual Merge* clone() const = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString id() const;
|
||||
QString source() const;
|
||||
void setSource( const QString& source );
|
||||
void reloadSource();
|
||||
|
||||
const QList<Record>& recordList( ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Selection methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void setSelected( int i, bool state = true );
|
||||
void selectAll();
|
||||
void unselectAll();
|
||||
|
||||
int nSelectedRecords() const;
|
||||
const QList<Record> selectedRecords() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
virtual QStringList keys() const = 0;
|
||||
virtual QString primaryKey() const = 0;
|
||||
protected:
|
||||
virtual void open() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual Record readNextRecord() = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void sourceChanged();
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
QString mId;
|
||||
private:
|
||||
QString mSource;
|
||||
QList<Record> mRecordList;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Merge_h
|
||||
@@ -0,0 +1,121 @@
|
||||
// Merge/Merge.hpp
|
||||
//
|
||||
// Copyright (C) 2015-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Merge_hpp
|
||||
#define merge_Merge_hpp
|
||||
|
||||
|
||||
#include "Record.hpp"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
// Forward references
|
||||
class Record;
|
||||
|
||||
|
||||
///
|
||||
/// Merge Object
|
||||
///
|
||||
class Merge : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Merge() = default;
|
||||
Merge( const Merge* merge );
|
||||
public:
|
||||
virtual ~Merge() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
virtual Merge* clone() const = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QString id() const;
|
||||
QString source() const;
|
||||
void setSource( const QString& source );
|
||||
void reloadSource();
|
||||
|
||||
const QList<Record>& recordList( ) const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Selection methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void setSelected( int i, bool state = true );
|
||||
void selectAll();
|
||||
void unselectAll();
|
||||
|
||||
int nSelectedRecords() const;
|
||||
const QList<Record> selectedRecords() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
virtual QStringList keys() const = 0;
|
||||
virtual QString primaryKey() const = 0;
|
||||
protected:
|
||||
virtual void open() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual Record readNextRecord() = 0;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void sourceChanged();
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
QString mId;
|
||||
private:
|
||||
QString mSource;
|
||||
QList<Record> mRecordList;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Merge_hpp
|
||||
+92
-94
@@ -1,117 +1,115 @@
|
||||
/* Merge/None.cpp
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "None.h"
|
||||
// Merge/None.cpp
|
||||
//
|
||||
// Copyright (C) 2015-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "None.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None() : Merge()
|
||||
{
|
||||
mId = "None";
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None() : Merge()
|
||||
{
|
||||
mId = "None";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None( const None* merge ) : Merge( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
None::None( const None* merge ) : Merge( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
None* None::clone() const
|
||||
{
|
||||
return new None( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
None* None::clone() const
|
||||
{
|
||||
return new None( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString None::id()
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString None::id()
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* None::create()
|
||||
{
|
||||
return new None();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* None::create()
|
||||
{
|
||||
return new None();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList None::keys() const
|
||||
{
|
||||
QStringList emptyList;
|
||||
return emptyList;
|
||||
}
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList None::keys() const
|
||||
{
|
||||
QStringList emptyList;
|
||||
return emptyList;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString None::primaryKey() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString None::primaryKey() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void None::open()
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void None::open()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void None::close()
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void None::close()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record None::readNextRecord()
|
||||
{
|
||||
return NullRecord();
|
||||
}
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record None::readNextRecord()
|
||||
{
|
||||
return NullRecord();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/* Merge/None.h
|
||||
*
|
||||
* Copyright (C) 2015-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_None_h
|
||||
#define merge_None_h
|
||||
|
||||
#include "Merge.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// None Merge Backend
|
||||
///
|
||||
struct None : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
None();
|
||||
None( const None* merge );
|
||||
virtual ~None() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
None* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_None_h
|
||||
@@ -0,0 +1,76 @@
|
||||
// Merge/None.hpp
|
||||
//
|
||||
// Copyright (C) 2015-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_None_hpp
|
||||
#define merge_None_hpp
|
||||
|
||||
|
||||
#include "Merge.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// None Merge Backend
|
||||
///
|
||||
struct None : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
None();
|
||||
None( const None* merge );
|
||||
virtual ~None() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
None* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_None_hpp
|
||||
+38
-40
@@ -1,47 +1,45 @@
|
||||
/* Merge/Record.cpp
|
||||
*
|
||||
* Copyright (C) 2013-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Record.h"
|
||||
// Merge/Record.cpp
|
||||
//
|
||||
// Copyright (C) 2013-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "Record.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Is record selected?
|
||||
///
|
||||
bool Record::isSelected() const
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
///
|
||||
/// Is record selected?
|
||||
///
|
||||
bool Record::isSelected() const
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Set selected on not selected
|
||||
///
|
||||
void Record::setSelected( bool value )
|
||||
{
|
||||
mSelected = value;
|
||||
}
|
||||
///
|
||||
/// Set selected on not selected
|
||||
///
|
||||
void Record::setSelected( bool value )
|
||||
{
|
||||
mSelected = value;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/* Merge/Record.h
|
||||
*
|
||||
* Copyright (C) 2013-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Record_h
|
||||
#define merge_Record_h
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Merge Record
|
||||
///
|
||||
class Record : public QMap<QString,QString>
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool isSelected() const;
|
||||
void setSelected( bool value );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
bool mSelected{ true };
|
||||
|
||||
};
|
||||
|
||||
|
||||
using NullRecord = const Record;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Record_h
|
||||
@@ -0,0 +1,59 @@
|
||||
// Merge/Record.hpp
|
||||
//
|
||||
// Copyright (C) 2013-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Record_hpp
|
||||
#define merge_Record_hpp
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Merge Record
|
||||
///
|
||||
class Record : public QMap<QString,QString>
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
bool isSelected() const;
|
||||
void setSelected( bool value );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
bool mSelected{ true };
|
||||
|
||||
};
|
||||
|
||||
|
||||
using NullRecord = const Record;
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Record_hpp
|
||||
+370
-373
@@ -1,419 +1,416 @@
|
||||
/* Merge/Text.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Merge/Text.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
#include "Text.hpp"
|
||||
|
||||
#include "Record.h"
|
||||
#include "Record.hpp"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
namespace glabels::merge
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( QChar delimiter, bool line1HasKeys )
|
||||
: Merge(),
|
||||
mDelimeter(delimiter),
|
||||
mLine1HasKeys(line1HasKeys),
|
||||
mNFieldsMax(0)
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( QChar delimiter, bool line1HasKeys )
|
||||
: Merge(),
|
||||
mDelimeter(delimiter),
|
||||
mLine1HasKeys(line1HasKeys),
|
||||
mNFieldsMax(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( const Text* merge )
|
||||
: Merge( merge ),
|
||||
mDelimeter(merge->mDelimeter),
|
||||
mLine1HasKeys(merge->mLine1HasKeys),
|
||||
mKeys(merge->mKeys),
|
||||
mNFieldsMax(merge->mNFieldsMax)
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
Text::Text( const Text* merge )
|
||||
: Merge( merge ),
|
||||
mDelimeter(merge->mDelimeter),
|
||||
mLine1HasKeys(merge->mLine1HasKeys),
|
||||
mKeys(merge->mKeys),
|
||||
mNFieldsMax(merge->mNFieldsMax)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList Text::keys() const
|
||||
{
|
||||
QStringList keys;
|
||||
for ( int iField = 0; iField < mNFieldsMax; iField++ )
|
||||
{
|
||||
keys << keyFromIndex(iField);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
///
|
||||
/// Get key list
|
||||
///
|
||||
QStringList Text::keys() const
|
||||
{
|
||||
QStringList keys;
|
||||
for ( int iField = 0; iField < mNFieldsMax; iField++ )
|
||||
{
|
||||
keys << keyFromIndex(iField);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString Text::primaryKey() const
|
||||
{
|
||||
return keyFromIndex(0);
|
||||
}
|
||||
///
|
||||
/// Get primary key
|
||||
///
|
||||
QString Text::primaryKey() const
|
||||
{
|
||||
return keyFromIndex(0);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void Text::open()
|
||||
{
|
||||
mKeys.clear();
|
||||
mNFieldsMax = 0;
|
||||
///
|
||||
/// Open source
|
||||
///
|
||||
void Text::open()
|
||||
{
|
||||
mKeys.clear();
|
||||
mNFieldsMax = 0;
|
||||
|
||||
mFile.setFileName( source() );
|
||||
if (mFile.open( QIODevice::ReadOnly|QIODevice::Text ))
|
||||
{
|
||||
if ( mLine1HasKeys )
|
||||
{
|
||||
mKeys = parseLine();
|
||||
if ( (mKeys.size() == 1) && (mKeys[0] == "") )
|
||||
{
|
||||
mKeys.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
mNFieldsMax = mKeys.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mFile.setFileName( source() );
|
||||
if (mFile.open( QIODevice::ReadOnly|QIODevice::Text ))
|
||||
{
|
||||
if ( mLine1HasKeys )
|
||||
{
|
||||
mKeys = parseLine();
|
||||
if ( (mKeys.size() == 1) && (mKeys[0] == "") )
|
||||
{
|
||||
mKeys.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
mNFieldsMax = mKeys.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void Text::close()
|
||||
{
|
||||
if ( mFile.isOpen() )
|
||||
{
|
||||
mFile.close();
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Close source
|
||||
///
|
||||
void Text::close()
|
||||
{
|
||||
if ( mFile.isOpen() )
|
||||
{
|
||||
mFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record Text::readNextRecord()
|
||||
{
|
||||
QStringList values = parseLine();
|
||||
if ( !values.isEmpty() )
|
||||
{
|
||||
Record record;
|
||||
///
|
||||
/// Read next record
|
||||
///
|
||||
Record Text::readNextRecord()
|
||||
{
|
||||
QStringList values = parseLine();
|
||||
if ( !values.isEmpty() )
|
||||
{
|
||||
Record record;
|
||||
|
||||
int iField = 0;
|
||||
for ( const auto& value : values )
|
||||
{
|
||||
record[ keyFromIndex(iField) ] = value;
|
||||
iField++;
|
||||
}
|
||||
mNFieldsMax = std::max( mNFieldsMax, iField );
|
||||
int iField = 0;
|
||||
for ( const auto& value : values )
|
||||
{
|
||||
record[ keyFromIndex(iField) ] = value;
|
||||
iField++;
|
||||
}
|
||||
mNFieldsMax = std::max( mNFieldsMax, iField );
|
||||
|
||||
return record;
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
return NullRecord();
|
||||
}
|
||||
return NullRecord();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Key from field index
|
||||
///
|
||||
QString Text::keyFromIndex( int iField ) const
|
||||
{
|
||||
if ( mLine1HasKeys && ( iField < mKeys.size() ) )
|
||||
{
|
||||
return mKeys[iField];
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString::number( iField+1 );
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Key from field index
|
||||
///
|
||||
QString Text::keyFromIndex( int iField ) const
|
||||
{
|
||||
if ( mLine1HasKeys && ( iField < mKeys.size() ) )
|
||||
{
|
||||
return mKeys[iField];
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString::number( iField+1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Parse line.
|
||||
///
|
||||
/// Attempt to be a robust parser of various CSV (and similar) formats.
|
||||
///
|
||||
/// Based on CSV format described in RFC 4180 section 2.
|
||||
///
|
||||
/// Additions to RFC 4180 rules:
|
||||
/// - delimeters and other special characters may be "escaped" by a leading
|
||||
/// backslash (\)
|
||||
/// - C escape sequences for newline (\n) and tab (\t) are also translated.
|
||||
/// - if quoted text is not followed by a delimeter, any additional text is
|
||||
/// concatenated with quoted portion.
|
||||
///
|
||||
/// Returns a list of fields. A blank line is considered a line with one
|
||||
/// empty field. Returns an empty list when done.
|
||||
///
|
||||
QStringList Text::parseLine()
|
||||
{
|
||||
QStringList fields;
|
||||
|
||||
enum State
|
||||
{
|
||||
DELIM, QUOTED, QUOTED_QUOTE1, QUOTED_ESCAPED, SIMPLE, SIMPLE_ESCAPED, DONE
|
||||
} state = DELIM;
|
||||
///
|
||||
/// Parse line.
|
||||
///
|
||||
/// Attempt to be a robust parser of various CSV (and similar) formats.
|
||||
///
|
||||
/// Based on CSV format described in RFC 4180 section 2.
|
||||
///
|
||||
/// Additions to RFC 4180 rules:
|
||||
/// - delimeters and other special characters may be "escaped" by a leading
|
||||
/// backslash (\)
|
||||
/// - C escape sequences for newline (\n) and tab (\t) are also translated.
|
||||
/// - if quoted text is not followed by a delimeter, any additional text is
|
||||
/// concatenated with quoted portion.
|
||||
///
|
||||
/// Returns a list of fields. A blank line is considered a line with one
|
||||
/// empty field. Returns an empty list when done.
|
||||
///
|
||||
QStringList Text::parseLine()
|
||||
{
|
||||
QStringList fields;
|
||||
|
||||
QByteArray field;
|
||||
|
||||
while ( state != DONE )
|
||||
{
|
||||
char c;
|
||||
if ( mFile.getChar( &c ) )
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
enum State
|
||||
{
|
||||
DELIM, QUOTED, QUOTED_QUOTE1, QUOTED_ESCAPED, SIMPLE, SIMPLE_ESCAPED, DONE
|
||||
} state = DELIM;
|
||||
|
||||
case DELIM:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* last field is empty. */
|
||||
fields << "";
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = DELIM;
|
||||
break;
|
||||
case '"':
|
||||
/* start a quoted field. */
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\\':
|
||||
/* simple field, but 1st character is an escape. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* field is empty. */
|
||||
fields << "";
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* beginning of a simple field. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
QByteArray field;
|
||||
|
||||
case QUOTED:
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
/* Possible end of field, but could be 1st of a pair. */
|
||||
state = QUOTED_QUOTE1;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = QUOTED_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
while ( state != DONE )
|
||||
{
|
||||
char c;
|
||||
if ( mFile.getChar( &c ) )
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
|
||||
case QUOTED_QUOTE1:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended after quoted item */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '"':
|
||||
/* second quote, insert and stay quoted. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore and go to fallback */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fallback if not a delim or another quote. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DELIM:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* last field is empty. */
|
||||
fields << "";
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = DELIM;
|
||||
break;
|
||||
case '"':
|
||||
/* start a quoted field. */
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\\':
|
||||
/* simple field, but 1st character is an escape. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* field is empty. */
|
||||
fields << "";
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* beginning of a simple field. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case QUOTED_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case QUOTED:
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
/* Possible end of field, but could be 1st of a pair. */
|
||||
state = QUOTED_QUOTE1;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = QUOTED_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMPLE:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case QUOTED_QUOTE1:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended after quoted item */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '"':
|
||||
/* second quote, insert and stay quoted. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore and go to fallback */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fallback if not a delim or another quote. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMPLE_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( (char)c );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case QUOTED_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = QUOTED;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = QUOTED;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #1" );
|
||||
break;
|
||||
}
|
||||
case SIMPLE:
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
/* line ended */
|
||||
fields << QString( field );
|
||||
state = DONE;
|
||||
break;
|
||||
case '\r':
|
||||
/* ignore */
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case '\\':
|
||||
/* Escape next character, or special escape, e.g. \n. */
|
||||
state = SIMPLE_ESCAPED;
|
||||
break;
|
||||
default:
|
||||
if ( c == mDelimeter )
|
||||
{
|
||||
/* end of field. */
|
||||
fields << QString( field );
|
||||
field.clear();
|
||||
state = DELIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use character literally. */
|
||||
field.append( c );
|
||||
state = SIMPLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle EOF (could also be an error while reading). */
|
||||
switch (state)
|
||||
{
|
||||
case SIMPLE_ESCAPED:
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
/* Decode "\n" as newline. */
|
||||
field.append( '\n' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
case 't':
|
||||
/* Decode "\t" as tab. */
|
||||
field.append( '\t' );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
default:
|
||||
/* Use character literally. */
|
||||
field.append( (char)c );
|
||||
state = SIMPLE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DELIM:
|
||||
/* EOF, no more lines. */
|
||||
break;
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #1" );
|
||||
break;
|
||||
}
|
||||
|
||||
case QUOTED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle EOF (could also be an error while reading). */
|
||||
switch (state)
|
||||
{
|
||||
|
||||
case QUOTED_QUOTE1:
|
||||
/* File ended after quoted item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case DELIM:
|
||||
/* EOF, no more lines. */
|
||||
break;
|
||||
|
||||
case QUOTED_ESCAPED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case QUOTED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
case SIMPLE:
|
||||
/* File ended after simple item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case QUOTED_QUOTE1:
|
||||
/* File ended after quoted item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
case SIMPLE_ESCAPED:
|
||||
/* File ended midway through escaped item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
case QUOTED_ESCAPED:
|
||||
/* File ended midway through quoted item. Truncate field. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #2" );
|
||||
break;
|
||||
}
|
||||
|
||||
state = DONE;
|
||||
}
|
||||
}
|
||||
|
||||
case SIMPLE:
|
||||
/* File ended after simple item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
return fields;
|
||||
}
|
||||
case SIMPLE_ESCAPED:
|
||||
/* File ended midway through escaped item. */
|
||||
fields << QString( field );
|
||||
break;
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
default:
|
||||
qWarning( "merge::Text::parseLine()::Should not be reached! #2" );
|
||||
break;
|
||||
}
|
||||
|
||||
state = DONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/* Merge/Text.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_Text_h
|
||||
#define merge_Text_h
|
||||
|
||||
|
||||
#include "Merge.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Text Merge Backend
|
||||
///
|
||||
struct Text : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Text( QChar delimiter, bool line1HasKeys );
|
||||
Text( const Text* merge );
|
||||
virtual ~Text() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////
|
||||
QString keyFromIndex( int iField ) const;
|
||||
QStringList parseLine();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QChar mDelimeter;
|
||||
bool mLine1HasKeys;
|
||||
|
||||
QFile mFile;
|
||||
QStringList mKeys;
|
||||
int mNFieldsMax;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Text_h
|
||||
@@ -0,0 +1,82 @@
|
||||
// Merge/Text.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_Text_hpp
|
||||
#define merge_Text_hpp
|
||||
|
||||
|
||||
#include "Merge.hpp"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Text Merge Backend
|
||||
///
|
||||
struct Text : public Merge
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
protected:
|
||||
Text( QChar delimiter, bool line1HasKeys );
|
||||
Text( const Text* merge );
|
||||
virtual ~Text() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Implementation of virtual methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
QStringList keys() const override;
|
||||
QString primaryKey() const override;
|
||||
protected:
|
||||
void open() override;
|
||||
void close() override;
|
||||
Record readNextRecord() override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////
|
||||
QString keyFromIndex( int iField ) const;
|
||||
QStringList parseLine();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QChar mDelimeter;
|
||||
bool mLine1HasKeys;
|
||||
|
||||
QFile mFile;
|
||||
QStringList mKeys;
|
||||
int mNFieldsMax;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_Text_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextColon.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextColon.h"
|
||||
// Merge/TextColon.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextColon.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Colon";
|
||||
static const QString ID = "Text/Colon";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon() : Text(':',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon() : Text(':',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon( const TextColon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColon::TextColon( const TextColon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColon* TextColon::clone() const
|
||||
{
|
||||
return new TextColon( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColon* TextColon::clone() const
|
||||
{
|
||||
return new TextColon( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColon::create()
|
||||
{
|
||||
return new TextColon();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColon::create()
|
||||
{
|
||||
return new TextColon();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextColon.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextColon_h
|
||||
#define merge_TextColon_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColon Merge Backend
|
||||
///
|
||||
struct TextColon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColon();
|
||||
TextColon( const TextColon* merge );
|
||||
virtual ~TextColon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColon_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextColon.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextColon_hpp
|
||||
#define merge_TextColon_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColon Merge Backend
|
||||
///
|
||||
struct TextColon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColon();
|
||||
TextColon( const TextColon* merge );
|
||||
virtual ~TextColon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColon_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextColonKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextColonKeys.h"
|
||||
// Merge/TextColonKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextColonKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Colon/Line1Keys";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys() : Text(':',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Colon/Line1Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys( const TextColonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys() : Text(':',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColonKeys* TextColonKeys::clone() const
|
||||
{
|
||||
return new TextColonKeys( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextColonKeys::TextColonKeys( const TextColonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextColonKeys* TextColonKeys::clone() const
|
||||
{
|
||||
return new TextColonKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColonKeys::create()
|
||||
{
|
||||
return new TextColonKeys();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextColonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextColonKeys::create()
|
||||
{
|
||||
return new TextColonKeys();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextColonKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextColonKeys_h
|
||||
#define merge_TextColonKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColonKeys Merge Backend
|
||||
///
|
||||
struct TextColonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColonKeys();
|
||||
TextColonKeys( const TextColonKeys* merge );
|
||||
virtual ~TextColonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColonKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextColonKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextColonKeys_hpp
|
||||
#define merge_TextColonKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextColonKeys Merge Backend
|
||||
///
|
||||
struct TextColonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextColonKeys();
|
||||
TextColonKeys( const TextColonKeys* merge );
|
||||
virtual ~TextColonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextColonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextColonKeys_hpp
|
||||
+65
-64
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextCsv.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextCsv.h"
|
||||
// Merge/TextCsv.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextCsv.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Comma";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv() : Text(',',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Comma";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv( const TextCsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv() : Text(',',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsv* TextCsv::clone() const
|
||||
{
|
||||
return new TextCsv( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsv::TextCsv( const TextCsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsv* TextCsv::clone() const
|
||||
{
|
||||
return new TextCsv( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsv::create()
|
||||
{
|
||||
return new TextCsv();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsv::create()
|
||||
{
|
||||
return new TextCsv();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextCsv.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextCsv_h
|
||||
#define merge_TextCsv_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsv Merge Backend
|
||||
///
|
||||
struct TextCsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsv();
|
||||
TextCsv( const TextCsv* merge );
|
||||
virtual ~TextCsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsv_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextCsv.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextCsv_hpp
|
||||
#define merge_TextCsv_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsv Merge Backend
|
||||
///
|
||||
struct TextCsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsv();
|
||||
TextCsv( const TextCsv* merge );
|
||||
virtual ~TextCsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsv_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextCsvKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextCsvKeys.h"
|
||||
// Merge/TextCsvKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextCsvKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Comma/Line1Keys";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys() : Text(',',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Comma/Line1Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys( const TextCsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys() : Text(',',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsvKeys* TextCsvKeys::clone() const
|
||||
{
|
||||
return new TextCsvKeys( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextCsvKeys::TextCsvKeys( const TextCsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextCsvKeys* TextCsvKeys::clone() const
|
||||
{
|
||||
return new TextCsvKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsvKeys::create()
|
||||
{
|
||||
return new TextCsvKeys();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextCsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextCsvKeys::create()
|
||||
{
|
||||
return new TextCsvKeys();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextCsvKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextCsvKeys_h
|
||||
#define merge_TextCsvKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsvKeys Merge Backend
|
||||
///
|
||||
struct TextCsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsvKeys();
|
||||
TextCsvKeys( const TextCsvKeys* merge );
|
||||
virtual ~TextCsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsvKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextCsvKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextCsvKeys_hpp
|
||||
#define merge_TextCsvKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextCsvKeys Merge Backend
|
||||
///
|
||||
struct TextCsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextCsvKeys();
|
||||
TextCsvKeys( const TextCsvKeys* merge );
|
||||
virtual ~TextCsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextCsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextCsvKeys_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextSemicolon.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextSemicolon.h"
|
||||
// Merge/TextSemicolon.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextSemicolon.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Semicolon";
|
||||
static const QString ID = "Text/Semicolon";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon() : Text(';',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon() : Text(';',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon( const TextSemicolon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolon::TextSemicolon( const TextSemicolon* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolon* TextSemicolon::clone() const
|
||||
{
|
||||
return new TextSemicolon( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolon* TextSemicolon::clone() const
|
||||
{
|
||||
return new TextSemicolon( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolon::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolon::create()
|
||||
{
|
||||
return new TextSemicolon();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolon::create()
|
||||
{
|
||||
return new TextSemicolon();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextSemicolon.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextSemicolon_h
|
||||
#define merge_TextSemicolon_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolon Merge Backend
|
||||
///
|
||||
struct TextSemicolon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolon();
|
||||
TextSemicolon( const TextSemicolon* merge );
|
||||
virtual ~TextSemicolon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolon_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextSemicolon.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextSemicolon_hpp
|
||||
#define merge_TextSemicolon_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolon Merge Backend
|
||||
///
|
||||
struct TextSemicolon : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolon();
|
||||
TextSemicolon( const TextSemicolon* merge );
|
||||
virtual ~TextSemicolon() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolon* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolon_hpp
|
||||
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextSemicolonKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextSemicolonKeys.h"
|
||||
// Merge/TextSemicolonKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextSemicolonKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Semicolon/Keys";
|
||||
static const QString ID = "Text/Semicolon/Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys() : Text(';',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys() : Text(';',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys( const TextSemicolonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextSemicolonKeys::TextSemicolonKeys( const TextSemicolonKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolonKeys* TextSemicolonKeys::clone() const
|
||||
{
|
||||
return new TextSemicolonKeys( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextSemicolonKeys* TextSemicolonKeys::clone() const
|
||||
{
|
||||
return new TextSemicolonKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextSemicolonKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolonKeys::create()
|
||||
{
|
||||
return new TextSemicolonKeys();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextSemicolonKeys::create()
|
||||
{
|
||||
return new TextSemicolonKeys();
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextSemicolonKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextSemicolonKeys_h
|
||||
#define merge_TextSemicolonKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolonKeys Merge Backend
|
||||
///
|
||||
struct TextSemicolonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolonKeys();
|
||||
TextSemicolonKeys( const TextSemicolonKeys* merge );
|
||||
virtual ~TextSemicolonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolonKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextSemicolonKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextSemicolonKeys_hpp
|
||||
#define merge_TextSemicolonKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextSemicolonKeys Merge Backend
|
||||
///
|
||||
struct TextSemicolonKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextSemicolonKeys();
|
||||
TextSemicolonKeys( const TextSemicolonKeys* merge );
|
||||
virtual ~TextSemicolonKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextSemicolonKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextSemicolonKeys_hpp
|
||||
+65
-64
@@ -1,76 +1,77 @@
|
||||
/* Merge/TextTsv.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextTsv.h"
|
||||
// Merge/TextTsv.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextTsv.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Tab";
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv() : Text('\t',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
static const QString ID = "Text/Tab";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv( const TextTsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv() : Text('\t',false)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsv* TextTsv::clone() const
|
||||
{
|
||||
return new TextTsv( this );
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsv::TextTsv( const TextTsv* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsv* TextTsv::clone() const
|
||||
{
|
||||
return new TextTsv( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsv::create()
|
||||
{
|
||||
return new TextTsv();
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsv::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsv::create()
|
||||
{
|
||||
return new TextTsv();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextTsv.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextTsv_h
|
||||
#define merge_TextTsv_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsv Merge Backend
|
||||
///
|
||||
struct TextTsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsv();
|
||||
TextTsv( const TextTsv* merge );
|
||||
virtual ~TextTsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsv_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextTsv.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextTsv_hpp
|
||||
#define merge_TextTsv_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsv Merge Backend
|
||||
///
|
||||
struct TextTsv : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsv();
|
||||
TextTsv( const TextTsv* merge );
|
||||
virtual ~TextTsv() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsv* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsv_hpp
|
||||
@@ -1,76 +1,78 @@
|
||||
/* Merge/TextTsvKeys.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TextTsvKeys.h"
|
||||
// Merge/TextTsvKeys.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
namespace glabels
|
||||
#include "TextTsvKeys.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
static const QString ID = "Text/Tab/Line1Keys";
|
||||
static const QString ID = "Text/Tab/Line1Keys";
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys() : Text('\t',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys() : Text('\t',true)
|
||||
{
|
||||
mId = ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys( const TextTsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
TextTsvKeys::TextTsvKeys( const TextTsvKeys* merge ) : Text( merge )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsvKeys* TextTsvKeys::clone() const
|
||||
{
|
||||
return new TextTsvKeys( this );
|
||||
}
|
||||
///
|
||||
/// Clone
|
||||
///
|
||||
TextTsvKeys* TextTsvKeys::clone() const
|
||||
{
|
||||
return new TextTsvKeys( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
///
|
||||
/// Get ID
|
||||
///
|
||||
QString TextTsvKeys::id()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsvKeys::create()
|
||||
{
|
||||
return new TextTsvKeys();
|
||||
}
|
||||
///
|
||||
/// Create
|
||||
///
|
||||
Merge* TextTsvKeys::create()
|
||||
{
|
||||
return new TextTsvKeys();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace merge
|
||||
} // namespace glabels
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Merge/TextTsvKeys.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef merge_TextTsvKeys_h
|
||||
#define merge_TextTsvKeys_h
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsvKeys Merge Backend
|
||||
///
|
||||
struct TextTsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsvKeys();
|
||||
TextTsvKeys( const TextTsvKeys* merge );
|
||||
virtual ~TextTsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsvKeys_h
|
||||
@@ -0,0 +1,65 @@
|
||||
// Merge/TextTsvKeys.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef merge_TextTsvKeys_hpp
|
||||
#define merge_TextTsvKeys_hpp
|
||||
|
||||
|
||||
#include "Text.hpp"
|
||||
|
||||
|
||||
namespace glabels::merge
|
||||
{
|
||||
|
||||
///
|
||||
/// TextTsvKeys Merge Backend
|
||||
///
|
||||
struct TextTsvKeys : public Text
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
private:
|
||||
TextTsvKeys();
|
||||
TextTsvKeys( const TextTsvKeys* merge );
|
||||
virtual ~TextTsvKeys() = default;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Object duplication
|
||||
/////////////////////////////////
|
||||
public:
|
||||
TextTsvKeys* clone() const override;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Static methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
static QString id();
|
||||
static Merge* create();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // merge_TextTsvKeys_hpp
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
#=======================================
|
||||
# Install
|
||||
#=======================================
|
||||
install (FILES glabels-qt.desktop DESTINATION share/applications)
|
||||
install (FILES x-glabels-document.mime.xml DESTINATION share/mime/packages)
|
||||
install (FILES glabels-qt.appdata.xml DESTINATION share/appdata)
|
||||
install (FILES org.glabels.glabels-qt.desktop DESTINATION share/applications)
|
||||
install (FILES org.glabels.glabels-qt.mime.xml DESTINATION share/mime/packages)
|
||||
install (FILES org.glabels.glabels-qt.metainfo.xml DESTINATION share/metainfo)
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>glabels-qt.desktop</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0+</project_license>
|
||||
<name>gLabels</name>
|
||||
<summary>Create labels, business cards and media covers</summary>
|
||||
<description>
|
||||
<p>gLabels is a program for creating labels and business cards. It is
|
||||
designed to work with various laser/ink-jet peel-off label and business
|
||||
card sheets that you'll find at most office supply stores.</p>
|
||||
<p>gLabels can be used to design address labels, name tags, price tags,
|
||||
cd/dvd labels, or just about anything else that is organized in a regular
|
||||
pattern on a sheet of paper. Labels (or cards) can contain text, images,
|
||||
lines, shapes, and barcodes. gLabels also includes a document-merge feature
|
||||
which lets you print a unique label for each record from an external data
|
||||
source, such as a CSV file.</p>
|
||||
</description>
|
||||
<!--
|
||||
<screenshots>
|
||||
<screenshot width="881" type="default" height="640">
|
||||
<image>http://glabels.org/screenshots/400-screenshot-main.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
-->
|
||||
<url type="homepage">http://glabels.org/</url>
|
||||
<url type="bugtracker">https://github.com/j-evins/glabels-qt/issues</url>
|
||||
<update_contact>evins_at_snaught.com</update_contact>
|
||||
</component>
|
||||
@@ -1,11 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=gLabels Label Designer 4
|
||||
Comment=Create labels, business cards and media covers
|
||||
Keywords=label;card;print;office;barcode;
|
||||
Exec=glabels-qt %F
|
||||
Icon=glabels
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Office;
|
||||
StartupNotify=true
|
||||
MimeType=application/x-glabels;
|
||||
@@ -0,0 +1,19 @@
|
||||
[Desktop Entry]
|
||||
Name=gLabels Label Designer 4
|
||||
Comment=Create labels and business cards
|
||||
Comment[de]=Entwurf von Etiketten und Visitenkarten
|
||||
Comment[es]=Crear etiquetas y tarjetas de visita
|
||||
Comment[fr]=Créer des étiquettes et des cartes de visite
|
||||
Comment[it]=Crea etichette e biglietti da visita
|
||||
Comment[pl]=Twórz etykiety i wizytówki
|
||||
Comment[pt]=Crie etiquetas e cartões de visita
|
||||
Comment[pt_BR]=Crie etiquetas e cartões de visita
|
||||
Comment[uk]=Створюйте етикетки та візитки
|
||||
Keywords=label;card;print;office;barcode;
|
||||
Exec=glabels-qt %F
|
||||
Icon=glabels
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Office;
|
||||
StartupNotify=true
|
||||
MimeType=application/x-glabels;
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>org.glabels.glabels-qt</id>
|
||||
<developer id="io.github.j-evins">
|
||||
<name>Jaye Evins</name>
|
||||
</developer>
|
||||
<launchable type="desktop-id">org.glabels.glabels-qt.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0+</project_license>
|
||||
<name>gLabels</name>
|
||||
<summary>Create labels and business cards</summary>
|
||||
<summary xml:lang="de">Entwurf von Etiketten und Visitenkarten</summary>
|
||||
<summary xml:lang="es">Crear etiquetas y tarjetas de visita</summary>
|
||||
<summary xml:lang="fr">Créer des étiquettes et des cartes de visite</summary>
|
||||
<summary xml:lang="it">Crea etichette e biglietti da visita</summary>
|
||||
<summary xml:lang="pl">Twórz etykiety i wizytówki</summary>
|
||||
<summary xml:lang="pt">Crie etiquetas e cartões de visita</summary>
|
||||
<summary xml:lang="pt_BR">Crie etiquetas e cartões de visita</summary>
|
||||
<summary xml:lang="uk">Створюйте етикетки та візитки</summary>
|
||||
<description>
|
||||
<p>gLabels is a program for creating labels, business cards and media covers.
|
||||
It is designed to work with various laser/ink-jet peel-off label and business
|
||||
card sheets that you'll find at most office supply stores.</p>
|
||||
<p>gLabels can be used to design address labels, name tags, price tags,
|
||||
cd/dvd labels, or just about anything else that is organized in a regular
|
||||
pattern on a sheet of paper. Labels (or cards) can contain text, images,
|
||||
lines, shapes, and barcodes. gLabels also includes a document-merge feature
|
||||
which lets you print a unique label for each record from an external data
|
||||
source, such as a CSV file.</p>
|
||||
</description>
|
||||
<categories>
|
||||
<category>Office</category>
|
||||
</categories>
|
||||
<keywords>
|
||||
<keyword>label</keyword>
|
||||
<keyword>card</keyword>
|
||||
<keyword>print</keyword>
|
||||
<keyword>office</keyword>
|
||||
<keyword>barcode</keyword>
|
||||
<keyword translate="no">qt</keyword>
|
||||
</keywords>
|
||||
<url type="homepage">https://glabels.org/</url>
|
||||
<url type="bugtracker">https://github.com/j-evins/glabels-qt/issues</url>
|
||||
<url type="vcs-browser">https://github.com/j-evins/glabels-qt</url>
|
||||
<update_contact>evins_at_snaught.com</update_contact>
|
||||
<content_rating type="oars-1.1" />
|
||||
<branding>
|
||||
<color type="primary" scheme_preference="light">#bbdb69</color>
|
||||
<color type="primary" scheme_preference="dark">#4e9a06</color>
|
||||
</branding>
|
||||
<translation type="qt">glabels-qt/translations/glabels</translation>
|
||||
<!--
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>https://glabels.org/screenshots/400-screenshot-main.png</image>
|
||||
<caption>...</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release version="4.0.0" date="2025-12-01">
|
||||
<url type="details">https://example.org/changelog.html#version_4.0.0</url>
|
||||
<description>
|
||||
<p>Release description</p>
|
||||
<ul>
|
||||
<li>List of changes</li>
|
||||
<li>List of changes</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
</releases>
|
||||
-->
|
||||
</component>
|
||||
@@ -3,7 +3,7 @@
|
||||
<mime-type type="application/x-glabels">
|
||||
<comment>gLabels Project File</comment>
|
||||
<sub-class-of type="application/xml"/>
|
||||
<generic-icon name="x-glabels-project"/>
|
||||
<icon name="x-glabels-project"/>
|
||||
<glob pattern="*.glabels"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
@@ -2,19 +2,37 @@ gLabels MacOS Build Instructions
|
||||
================================
|
||||
|
||||
## Prerequisites
|
||||
|
||||
```
|
||||
brew install cmake
|
||||
brew install qt
|
||||
brew install qt@6
|
||||
```
|
||||
|
||||
## Optional dependencies
|
||||
```
|
||||
brew install zlib
|
||||
brew install qrencode
|
||||
brew install zint
|
||||
```
|
||||
|
||||
## Compile and Install
|
||||
|
||||
<pre>
|
||||
export SDKROOT=$(xcrun --show-sdk-path)
|
||||
# Detect architecture and set appropriate paths
|
||||
if [[ "$(uname -m)" == "arm64" ]]; then
|
||||
# Apple Silicon
|
||||
CMAKE_PATH="/opt/homebrew/bin/cmake"
|
||||
CMAKE_PREFIX_PATH="/opt/homebrew/opt"
|
||||
else
|
||||
# Intel
|
||||
CMAKE_PATH="/usr/local/bin/cmake"
|
||||
CMAKE_PREFIX_PATH="/usr/local/opt"
|
||||
fi
|
||||
|
||||
cd <i>glabels_source_directory</i>
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -D CMAKE_PREFIX_PATH=/usr/local/opt/qt ..
|
||||
$CMAKE_PATH -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH/qt@6 ..
|
||||
make
|
||||
sudo make install
|
||||
</pre>
|
||||
|
||||
+39
-20
@@ -4,29 +4,20 @@ Glabels Coding Style
|
||||
This file describes the coding style used in all glabels source code. Any
|
||||
patches or pull requests should adhere to this style.
|
||||
|
||||
:bulb: **Note:** The top-level glabels source directory includes a *.clang-format* file.
|
||||
This file can be used with `clang-format` to reformat code to a reasonable approximation
|
||||
of the style described here.
|
||||
|
||||
|
||||
Formatting
|
||||
----------
|
||||
|
||||
### Tabs vs. Spaces
|
||||
|
||||
Tabs are only used at the beginning of a line, and only used to express
|
||||
indentation level. Spaces are used for any other type of vertical alignment,
|
||||
e.g. aligning function arguments. This ensures that the code displays
|
||||
correctly everywhere, regardless of the viewer's tab size, and does not inflict
|
||||
the viewer with my choice of tab size (8 spaces).
|
||||
|
||||
I use the emacs smart-tabs-mode to automatically enforce this. See
|
||||
https://www.emacswiki.org/emacs/SmartTabs for more information.
|
||||
Use spaces for all code indentation and line-to-line alignment of code elements.
|
||||
(e.g. aligning function arguments). This ensures that the code displays
|
||||
correctly everywhere.
|
||||
|
||||
|
||||
### Indentation Style
|
||||
|
||||
Glabels code uses the Allman style (a.k.a "BSD Style") of code indentation.
|
||||
Glabels code uses the Allman[^1] style (a.k.a "BSD Style") of code indentation.
|
||||
I.e. the brace associated with a control statement is placed on the next line,
|
||||
indented to the same level as the control statement. Statements within the
|
||||
braces are indented to the next level.
|
||||
@@ -50,8 +41,6 @@ else
|
||||
|
||||
Also applies to function, class and namespace declaration statements.
|
||||
|
||||
See https://en.wikipedia.org/wiki/Indent_style#Allman_style for more
|
||||
information.
|
||||
|
||||
|
||||
### Parenthesis
|
||||
@@ -98,8 +87,8 @@ Code Organization
|
||||
Generally code is organized into modules. Usually a module defines a single
|
||||
class or a small namespace of functions/constants/etc. A module is defined by
|
||||
two files: a header file (its specification) and an implementation file.
|
||||
Header filenames have a ".h" extension and implementation filenames have a
|
||||
".cpp" extension.
|
||||
Header filenames have a `.hpp` extension[^2] and implementation filenames have a
|
||||
`.cpp` extension.
|
||||
|
||||
|
||||
### Self-contained Headers
|
||||
@@ -114,8 +103,8 @@ shall include its header file before any other includes.
|
||||
All header files should have an ifndef guard to prevent multiple inclusion.
|
||||
|
||||
```
|
||||
#ifndef ns_Module_h
|
||||
#define ns_Module_h
|
||||
#ifndef ns_Module_hpp
|
||||
#define ns_Module_hpp
|
||||
|
||||
...
|
||||
|
||||
@@ -127,7 +116,7 @@ All header files should have an ifndef guard to prevent multiple inclusion.
|
||||
|
||||
Header files should be included in the following order.
|
||||
|
||||
1. header file for this module (e.g. this would be "Foo.h" in "Foo.cpp").
|
||||
1. header file for this module (e.g. this would be `Foo.hpp` in `Foo.cpp`).
|
||||
2. Glabels header files.
|
||||
3. Qt header files
|
||||
3. C++ system header files (e.g. STL files)
|
||||
@@ -152,3 +141,33 @@ include directives instead.
|
||||
|
||||
- Private definitions are placed in unnamed namespaces to limit scope to the current translation unit.
|
||||
- All other glabels code is placed in the top-level "glabels" namespace.
|
||||
- Nested namespace declarations should follow the more concise C++17 syntax
|
||||
```
|
||||
namespace glabels::model
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
### Emacs
|
||||
|
||||
The following is an excerpt from my emacs configuration supporting the style
|
||||
```
|
||||
(defun my-c++-hook ()
|
||||
(setq c-default-style "bsd"
|
||||
c-basic-offset 8
|
||||
indent-tabs-mode nil
|
||||
show-trailing-whitespace t))
|
||||
|
||||
(add-hook 'c++-mode-hook 'my-c++-hook)
|
||||
```
|
||||
|
||||
|
||||
References
|
||||
----------
|
||||
[^1]: https://en.wikipedia.org/wiki/Indent_style#Allman_style
|
||||
[^2]: [C++ Weekly - Ep 442 - Stop Using .h For C++ Header Files!](https://www.youtube.com/watch?v=mr3sOT-Delg)
|
||||
|
||||
@@ -26,7 +26,7 @@ How To Contribute to gLabels
|
||||
|
||||
### Would you like to submit new product templates?
|
||||
|
||||
* Before submitting, please read [PRODUCT-TEMPLATES.md](PRODUCT-TEMPLATES.md) located in this directory.
|
||||
* Before submitting, please read [PRODUCT-TEMPLATES.md](PRODUCT-TEMPLATES.md) and [TEMPLATE-STYLE.md](TEMPLATE-STYLE.md) located in this directory.
|
||||
|
||||
* [Open an issue](https://github.com/j-evins/glabels-qt/issues/new) and attach your completed product template file(s).
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ gLabels Version numbering
|
||||
* major version indicates a major change in architecture or technology
|
||||
- 2.x.x was based on gtk+-2
|
||||
- 3.x.x was based on gtk+-3
|
||||
- 4.x.x is based on qt-5
|
||||
- 4.x.x is based on qt-6
|
||||
* minor version indicates a minor change in features or design
|
||||
- A new stable branch will be created for each new minor version
|
||||
* micro version indicates a bugfix release
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
Manually Creating Product Templates
|
||||
===================================
|
||||
|
||||
This document is a reference for manually creating *gLabels* product templates.
|
||||
This document is a reference for manually creating *gLabels* product templates. See
|
||||
[TEMPLATE-STYLE.md](TEMPLATE-STYLE.md) located in this directory for style guidelines
|
||||
for product template submissions.
|
||||
|
||||
*gLabels* searches for templates in several locations as described here:</p>
|
||||
|
||||
@@ -83,7 +85,7 @@ Property | Type | Description
|
||||
*_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.
|
||||
*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 *part* 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
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
gLabels Product Template Style Guide
|
||||
====================================
|
||||
|
||||
This file describes the prefered style for product template submissions. See
|
||||
[PRODUCT-TEMPLATES.md](PRODUCT-TEMPLATES.md) located in this directory for detailed
|
||||
systax documentation.
|
||||
|
||||
|
||||
Organization
|
||||
------------
|
||||
|
||||
Template files are located in the [templates](../templates/) directory. The following
|
||||
is the naming convention for these files:
|
||||
|
||||
<pre><i>brand</i>-<i>class</i>-templates.xml</pre>
|
||||
|
||||
Where *brand* is the lowercase brand name, and *class* is the media size class (currently
|
||||
`iso`, `us`, and `other`).
|
||||
|
||||
Templates should be sorted in [natural order](https://en.wikipedia.org/wiki/Natural_sort_order)
|
||||
by part number within each file. An exception to this rule is to group equivalent templates
|
||||
directly below their referenced template. For example:
|
||||
|
||||
```xml
|
||||
<Template brand="Avery" part="5126" size="US-Letter" _description="Shipping labels">
|
||||
<Meta category="label"/>
|
||||
<Meta category="rectangle-label"/>
|
||||
<Meta category="mail"/>
|
||||
<Label-rectangle id="0" width="8.5in" height="5.5in" round="0in" x_waste="0in" y_waste="0in">
|
||||
<Markup-margin size="9pt"/>
|
||||
<Layout nx="1" ny="2" x0="0in" y0="0in" dx="0in" dy="5.5in"/>
|
||||
</Label-rectangle>
|
||||
</Template>
|
||||
|
||||
<Template brand="Avery" part="5526" equiv="5126"/>
|
||||
<Template brand="Avery" part="8126" equiv="5126"/>
|
||||
<Template brand="Avery" part="15516" equiv="5126"/>
|
||||
<Template brand="Avery" part="18126" equiv="5126"/>
|
||||
|
||||
|
||||
<Template brand="Avery" part="5159" size="US-Letter" _description="Address labels">...
|
||||
```
|
||||
|
||||
When creating a new template file, it must be added to the variable template_files in
|
||||
the [CMakeLists.txt](../templates/CMakeLists.txt) file in this same directory.
|
||||
|
||||
|
||||
*Template* Node Attributes
|
||||
--------------------------
|
||||
|
||||
### *brand* Attribute
|
||||
|
||||
This is the brand name or manufacturer of the product. It must match one of the vendors
|
||||
in the [vendors.xml](../templates/vendors.xml) file. Add a new vendor line if it does not
|
||||
currently exist.
|
||||
|
||||
|
||||
### *part* Attribute
|
||||
|
||||
This is the actual part number of the product. This is usually a short set of numbers and/or
|
||||
letters. This is not a description or name of the product. The following are examples
|
||||
of part numbers:
|
||||
|
||||
- `5160`
|
||||
- `WL-102`
|
||||
- `J8435B`
|
||||
|
||||
Sometimes a product includes multiple label types, either as separate sheets or different
|
||||
types of labels on the same sheet. In these cases, providing a short suffix to part number
|
||||
is acceptable. For example:
|
||||
|
||||
- `3274.1`, `3274.2`, and `3274.3`
|
||||
- `5931-Disc`, and `5931-Spine`
|
||||
|
||||
|
||||
### *_description* Attribute
|
||||
|
||||
- Descriptions should be short. They should describe what the product is in very simple terms
|
||||
without being too detailed. They should not describe details such as size, quantity, layout,
|
||||
color, or material. The description should not include brand or part number information.
|
||||
Size, quantity, layout, brand, and part number are described by other elements of the
|
||||
template - do not repeat them in the description.
|
||||
|
||||
- If at all possible, try to reuse descriptions from other templates (this keeps the
|
||||
number of unique strings that need translation to a minimum).
|
||||
|
||||
- Don't repeat the brand or part number in the description.
|
||||
|
||||
- Only capitalize the first word of the description.
|
||||
|
||||
The following are good bad descriptions:
|
||||
|
||||
| description | Good/Bad | Notes |
|
||||
|:-------------------------|:--------:|:----------------------------------------------|
|
||||
| `Address labels` | ✅ | |
|
||||
| `Address Labels` | ❌ | Capitalized second word of description. |
|
||||
| `Business cards` | ✅ | |
|
||||
| `Multipurpose labels` | ✅ | |
|
||||
| `CD/DVD labels` | ✅ | |
|
||||
| `19mm x 30mm labels` | ❌ | Don't include size information. |
|
||||
| `Labels 15 per sheet` | ❌ | Don't include layout or quantity information. |
|
||||
| `Dymo continuous labels` | ❌ | Don't include brand or part number. |
|
||||
|
||||
|
||||
|
||||
*Meta* Node Attributes
|
||||
----------------------
|
||||
|
||||
### *category* Attribute
|
||||
|
||||
- All templates should include all appropriate `<Meta category=...` nodes.
|
||||
- Categories must match one of the existing categories in the [categories.xml](../templates/categories.xml) file. Do not add new categories!
|
||||
- All templates should include either a `<Meta category="label"/>` or `<Meta category="card"/>` node.
|
||||
|
||||
|
||||
### *product_url* Attribute
|
||||
|
||||
Unfortunately, manufacturer websites are constantly being updated and rearranged, rendering such deep URLs obsolete very quickly. Therefore,
|
||||
use of this attribute is deprecated.
|
||||
|
||||
+11
-1
@@ -39,7 +39,7 @@ To Do List for gLabels 4.0 -- 2019-10-07
|
||||
|
||||
|
||||
|
||||
To Do List for post gLabels 4.0 -- 2019-03-17
|
||||
To Do List for post gLabels 4.0 -- 2026-02-18
|
||||
=============================================
|
||||
|
||||
- [ ] Create a "built-in" merge source
|
||||
@@ -71,4 +71,14 @@ To Do List for post gLabels 4.0 -- 2019-03-17
|
||||
The current built-in fixed margin seems to confuse people when dealing with
|
||||
different horizontal and vertical alignments.
|
||||
|
||||
- [ ] Add support for arbitrary DPI when defining templates. Some label
|
||||
printers use native units in their label specifications (e.g. pins, pixels, etc.)
|
||||
This would look something like this
|
||||
|
||||
`... dpi="300" ... width="525d" height="350d" ...`
|
||||
|
||||
These would be converted to model::Distance when parsing.
|
||||
|
||||
- [ ] Resurrect the evolution and vcard backends. This would be optional based
|
||||
on availability.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
## Translation management
|
||||
# Translations
|
||||
|
||||
We manage all translations within a [transifex](https://explore.transifex.com/glabels/). Please don't send your files via Github, use only transifex.
|
||||
The translations of the user interface, the template database and the user manual (which is still under development)
|
||||
are maintained at [Fedora Weblate](https://translate.fedoraproject.org/projects/glabels-qt/). Please always use
|
||||
Weblate for translation submissions; we do not accept contributions from outside this platform. For more information about
|
||||
using Weblate, read the [documentation](https://docs.weblate.org/en/latest/).
|
||||
|
||||
To contribute to translations, you need an account in the [Fedora Account System](https://accounts.fedoraproject.org/).
|
||||
More information about the account system can be found [here](https://docs.fedoraproject.org/en-US/fedora-accounts/).
|
||||
|
||||
@@ -10,12 +10,12 @@ set (glabels-batch_sources
|
||||
#=====================================
|
||||
# Target
|
||||
#=====================================
|
||||
add_executable (glabels-batch-qt WIN32
|
||||
add_executable (glabels-batch-qt
|
||||
${glabels-batch_sources}
|
||||
)
|
||||
|
||||
target_compile_features (glabels-batch-qt
|
||||
PUBLIC cxx_std_11
|
||||
PUBLIC cxx_std_20
|
||||
)
|
||||
|
||||
target_link_libraries (glabels-batch-qt
|
||||
|
||||
+262
-244
@@ -1,32 +1,33 @@
|
||||
/* main.cpp
|
||||
*
|
||||
* Copyright (C) 2013-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// main.cpp
|
||||
//
|
||||
// Copyright (C) 2013-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "model/FileUtil.h"
|
||||
#include "model/Db.h"
|
||||
#include "model/Model.h"
|
||||
#include "model/PageRenderer.h"
|
||||
#include "model/Version.h"
|
||||
#include "model/XmlLabelParser.h"
|
||||
|
||||
#include "barcode/Backends.h"
|
||||
#include "merge/Factory.h"
|
||||
#include "model/FileUtil.hpp"
|
||||
#include "model/Db.hpp"
|
||||
#include "model/Model.hpp"
|
||||
#include "model/PageRenderer.hpp"
|
||||
#include "model/Version.hpp"
|
||||
#include "model/XmlLabelParser.hpp"
|
||||
|
||||
#include "barcode/Backends.hpp"
|
||||
#include "merge/Factory.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
@@ -35,21 +36,22 @@
|
||||
#include <QLocale>
|
||||
#include <QPrinter>
|
||||
#include <QPrinterInfo>
|
||||
#include <QTextStream>
|
||||
#include <QTranslator>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
const QString STDOUT_FILENAME = "CON:";
|
||||
const QString STDIN_FILENAME = "CON:";
|
||||
const QString STDOUT_FILENAME = "CON:";
|
||||
const QString STDIN_FILENAME = "CON:";
|
||||
#elif defined(Q_OS_LINUX)
|
||||
const QString STDOUT_FILENAME = "/dev/stdout";
|
||||
const QString STDIN_FILENAME = "/dev/stdin";
|
||||
const QString STDOUT_FILENAME = "/dev/stdout";
|
||||
const QString STDIN_FILENAME = "/dev/stdin";
|
||||
#else
|
||||
const QString STDOUT_FILENAME = "/dev/stdout";
|
||||
const QString STDIN_FILENAME = "/dev/stdin";
|
||||
const QString STDOUT_FILENAME = "/dev/stdout";
|
||||
const QString STDIN_FILENAME = "/dev/stdin";
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -57,237 +59,253 @@ namespace
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
QGuiApplication app( argc, argv );
|
||||
QGuiApplication app( argc, argv );
|
||||
|
||||
QCoreApplication::setOrganizationName( "glabels.org" );
|
||||
QCoreApplication::setOrganizationDomain( "glabels.org" );
|
||||
QCoreApplication::setApplicationName( "glabels-batch-qt" );
|
||||
QCoreApplication::setApplicationVersion( glabels::model::Version::LONG_STRING );
|
||||
QCoreApplication::setOrganizationName( "glabels.org" );
|
||||
QCoreApplication::setOrganizationDomain( "glabels.org" );
|
||||
QCoreApplication::setApplicationName( "glabels-batch-qt" );
|
||||
QCoreApplication::setApplicationVersion( glabels::model::Version::LONG_STRING );
|
||||
|
||||
//
|
||||
// Setup translators
|
||||
//
|
||||
QLocale locale = QLocale::system();
|
||||
QString qtTranslationsDir = QLibraryInfo::path( QLibraryInfo::TranslationsPath );
|
||||
QString myTranslationsDir = glabels::model::FileUtil::translationsDir().canonicalPath();
|
||||
|
||||
QTranslator qtTranslator;
|
||||
if ( qtTranslator.load( locale, "qt", "_", qtTranslationsDir ) )
|
||||
{
|
||||
app.installTranslator(&qtTranslator);
|
||||
}
|
||||
//
|
||||
// Setup translators
|
||||
//
|
||||
QLocale locale = QLocale::system();
|
||||
QString qtTranslationsDir = QLibraryInfo::path( QLibraryInfo::TranslationsPath );
|
||||
QString myTranslationsDir = glabels::model::FileUtil::translationsDir().canonicalPath();
|
||||
|
||||
QTranslator glabelsTranslator;
|
||||
if ( glabelsTranslator.load( locale, "glabels", "_", myTranslationsDir ) )
|
||||
{
|
||||
app.installTranslator(&glabelsTranslator);
|
||||
}
|
||||
QTranslator qtTranslator;
|
||||
if ( qtTranslator.load( locale, "qt", "_", qtTranslationsDir ) )
|
||||
{
|
||||
app.installTranslator(&qtTranslator);
|
||||
}
|
||||
|
||||
QTranslator templatesTranslator;
|
||||
if ( templatesTranslator.load( locale, "templates", "_", myTranslationsDir ) )
|
||||
{
|
||||
app.installTranslator(&templatesTranslator);
|
||||
}
|
||||
QTranslator glabelsTranslator;
|
||||
if ( glabelsTranslator.load( locale, "glabels", "_", myTranslationsDir ) )
|
||||
{
|
||||
app.installTranslator(&glabelsTranslator);
|
||||
}
|
||||
|
||||
QTranslator templatesTranslator;
|
||||
if ( templatesTranslator.load( locale, "templates", "_", myTranslationsDir ) )
|
||||
{
|
||||
app.installTranslator(&templatesTranslator);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Parse command line
|
||||
//
|
||||
const QList<QCommandLineOption> options = {
|
||||
{{"p","printer"},
|
||||
QString( QCoreApplication::translate( "main", "Send output to <printer>. (Default=\"%1\")") ).arg( QPrinterInfo::defaultPrinterName() ),
|
||||
QCoreApplication::translate( "main", "printer" ),
|
||||
QPrinterInfo::defaultPrinterName() },
|
||||
|
||||
{{"o","output"},
|
||||
QCoreApplication::translate( "main", "Set output filename to <filename>. Set to \"-\" for stdout. (Default=\"output.pdf\")" ),
|
||||
QCoreApplication::translate( "main", "filename" ),
|
||||
"output.pdf" },
|
||||
|
||||
{{"s","sheets"},
|
||||
QCoreApplication::translate( "main", "Set number of sheets to <n>. (Default=1)" ),
|
||||
"n", "1" },
|
||||
//
|
||||
// Parse command line
|
||||
//
|
||||
const QList<QCommandLineOption> options = {
|
||||
{{"p","printer"},
|
||||
QString( QCoreApplication::translate( "main", "Send output to <printer>. (Default=\"%1\")") ).arg( QPrinterInfo::defaultPrinterName() ),
|
||||
QCoreApplication::translate( "main", "printer" ),
|
||||
QPrinterInfo::defaultPrinterName() },
|
||||
|
||||
{{"c","copies"},
|
||||
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 position to <n>. (Default=1)" ),
|
||||
"n", "1" },
|
||||
{{"i","input"},
|
||||
QCoreApplication::translate( "main", "Set merge input to <source> (typically a filename). Set to \"-\" for stdin." ),
|
||||
QCoreApplication::translate( "main", "source" ),
|
||||
"" },
|
||||
|
||||
{{"l","outlines"},
|
||||
QCoreApplication::translate( "main", "Print label outlines." ) },
|
||||
|
||||
{{"m","crop-marks"},
|
||||
QCoreApplication::translate( "main", "Print crop marks." ) },
|
||||
|
||||
{{"r","reverse"},
|
||||
QCoreApplication::translate( "main", "Print in reverse (mirror image)." ) },
|
||||
{{"o","output"},
|
||||
QCoreApplication::translate( "main", "Set output filename to <filename>. Set to \"-\" for stdout. (Default=\"output.pdf\")" ),
|
||||
QCoreApplication::translate( "main", "filename" ),
|
||||
"output.pdf" },
|
||||
|
||||
{{"D","define"},
|
||||
QCoreApplication::translate( "main", "Set user variable <var> to <value>" ),
|
||||
QCoreApplication::translate( "main", "var>=<value" ) }
|
||||
};
|
||||
{{"s","sheets"},
|
||||
QCoreApplication::translate( "main", "Set number of sheets to <n>. (Default=1)" ),
|
||||
"n", "1" },
|
||||
|
||||
{{"c","copies"},
|
||||
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 position to <n>. (Default=1)" ),
|
||||
"n", "1" },
|
||||
|
||||
{{"l","outlines"},
|
||||
QCoreApplication::translate( "main", "Print label outlines." ) },
|
||||
|
||||
{{"m","crop-marks"},
|
||||
QCoreApplication::translate( "main", "Print crop marks." ) },
|
||||
|
||||
{{"r","reverse"},
|
||||
QCoreApplication::translate( "main", "Print in reverse (mirror image)." ) },
|
||||
|
||||
{{"D","define"},
|
||||
QCoreApplication::translate( "main", "Set user variable <var> to <value>" ),
|
||||
QCoreApplication::translate( "main", "var>=<value" ) }
|
||||
};
|
||||
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription( QCoreApplication::translate( "main", "gLabels Label Designer (Batch Front-end)" ) );
|
||||
parser.addOptions( options );
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addOption( { { "V", "Version" }, QCoreApplication::translate( "main", "More detailed version information." ) } );
|
||||
parser.addPositionalArgument( "file",
|
||||
QCoreApplication::translate( "main", "gLabels project file to print." ),
|
||||
"file" );
|
||||
parser.process( app );
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription( QCoreApplication::translate( "main", "gLabels Label Designer (Batch Front-end)" ) );
|
||||
parser.addOptions( options );
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addOption( { { "V", "Version" }, QCoreApplication::translate( "main", "More detailed version information." ) } );
|
||||
parser.addPositionalArgument( "file",
|
||||
QCoreApplication::translate( "main", "gLabels project file to print." ),
|
||||
"file" );
|
||||
parser.process( app );
|
||||
|
||||
// Handle verbose version option
|
||||
if ( parser.isSet( "Version" ) )
|
||||
{
|
||||
qInfo().noquote() << glabels::model::Version::details();
|
||||
return 0;
|
||||
}
|
||||
// Handle verbose version option
|
||||
if ( parser.isSet( "Version" ) )
|
||||
{
|
||||
QTextStream(stdout) << glabels::model::Version::details() << Qt::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Parse variable definitions from command line, if any
|
||||
//
|
||||
QMap<QString,QString> variableDefinitions;
|
||||
|
||||
for ( QString definition : parser.values("define") )
|
||||
{
|
||||
QStringList parts = definition.split( '=' );
|
||||
if ( parts.size() != 2 )
|
||||
{
|
||||
qWarning() << "Error: bad variable definition: " << definition;
|
||||
return -1;
|
||||
}
|
||||
//
|
||||
// Parse variable definitions from command line, if any
|
||||
//
|
||||
QMap<QString,QString> variableDefinitions;
|
||||
|
||||
variableDefinitions[ parts[0] ] = parts[1];
|
||||
}
|
||||
for ( QString definition : parser.values("define") )
|
||||
{
|
||||
QStringList parts = definition.split( '=' );
|
||||
if ( parts.size() != 2 )
|
||||
{
|
||||
qWarning() << "Error: bad variable definition: " << definition;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize subsystems
|
||||
//
|
||||
glabels::model::Settings::init();
|
||||
glabels::model::Db::init();
|
||||
glabels::merge::Factory::init();
|
||||
glabels::barcode::Backends::init();
|
||||
variableDefinitions[ parts[0] ] = parts[1];
|
||||
}
|
||||
|
||||
|
||||
if ( parser.positionalArguments().size() == 1 )
|
||||
{
|
||||
qDebug() << "Batch mode.";
|
||||
//
|
||||
// Initialize subsystems
|
||||
//
|
||||
glabels::model::Settings::init();
|
||||
glabels::model::Db::init();
|
||||
glabels::merge::Factory::init();
|
||||
glabels::barcode::Backends::init();
|
||||
|
||||
QString filename = parser.positionalArguments().constFirst();
|
||||
if ( filename == "-" )
|
||||
{
|
||||
filename = STDIN_FILENAME;
|
||||
}
|
||||
qDebug() << "Project file =" << filename;
|
||||
|
||||
glabels::model::Model *model = glabels::model::XmlLabelParser::readFile( filename );
|
||||
if ( model )
|
||||
{
|
||||
model->variables().setVariables( variableDefinitions );
|
||||
if ( parser.positionalArguments().size() == 1 )
|
||||
{
|
||||
qDebug() << "Batch mode.";
|
||||
|
||||
QPrinter printer( QPrinter::HighResolution );
|
||||
printer.setColorMode( QPrinter::Color );
|
||||
if ( parser.isSet("printer") )
|
||||
{
|
||||
qDebug() << "Printer =" << parser.value("printer");
|
||||
printer.setPrinterName( parser.value("printer") );
|
||||
}
|
||||
else if ( parser.isSet("output") )
|
||||
{
|
||||
QString outputFilename = parser.value("output");
|
||||
if ( outputFilename == "-" )
|
||||
{
|
||||
outputFilename = STDOUT_FILENAME;
|
||||
}
|
||||
qDebug() << "Output =" << outputFilename;
|
||||
printer.setOutputFileName( outputFilename );
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Batch mode. printer =" << QPrinterInfo::defaultPrinterName();
|
||||
}
|
||||
QString filename = parser.positionalArguments().constFirst();
|
||||
if ( filename == "-" )
|
||||
{
|
||||
filename = STDIN_FILENAME;
|
||||
}
|
||||
qDebug() << "Project file =" << filename;
|
||||
|
||||
glabels::model::PageRenderer renderer( model );
|
||||
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" ) );
|
||||
glabels::model::Model *model = glabels::model::XmlLabelParser::readFile( filename );
|
||||
if ( model )
|
||||
{
|
||||
model->variables().setVariables( variableDefinitions );
|
||||
|
||||
// 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.";
|
||||
}
|
||||
QPrinter printer( QPrinter::HighResolution );
|
||||
printer.setColorMode( QPrinter::Color );
|
||||
if ( parser.isSet("printer") )
|
||||
{
|
||||
qDebug() << "Printer =" << parser.value("printer");
|
||||
printer.setPrinterName( parser.value("printer") );
|
||||
}
|
||||
else if ( parser.isSet("output") )
|
||||
{
|
||||
QString outputFilename = parser.value("output");
|
||||
if ( outputFilename == "-" )
|
||||
{
|
||||
outputFilename = STDOUT_FILENAME;
|
||||
}
|
||||
qDebug() << "Output =" << outputFilename;
|
||||
printer.setOutputFileName( outputFilename );
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Batch mode. printer =" << QPrinterInfo::defaultPrinterName();
|
||||
}
|
||||
|
||||
// Do it!
|
||||
renderer.print( &printer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( parser.positionalArguments().size() == 0 )
|
||||
{
|
||||
qWarning() << "Error: missing glabels project file.";
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "Error: batch mode supports only one glabels project file.";
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
if ( parser.isSet( "input" ) )
|
||||
{
|
||||
QString inputSource = parser.value( "input" );
|
||||
if ( inputSource == "-" )
|
||||
{
|
||||
inputSource = STDIN_FILENAME;
|
||||
}
|
||||
qDebug() << "Merge source =" << inputSource;
|
||||
model->merge()->setSource( inputSource );
|
||||
}
|
||||
|
||||
glabels::model::PageRenderer renderer( model );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( parser.positionalArguments().size() == 0 )
|
||||
{
|
||||
qWarning() << "Error: missing glabels project file.";
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "Error: batch mode supports only one glabels project file.";
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+69
-68
@@ -1,87 +1,88 @@
|
||||
/* AboutDialog.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// AboutDialog.cpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "AboutDialog.h"
|
||||
|
||||
#include "model/Version.h"
|
||||
#include "AboutDialog.hpp"
|
||||
|
||||
#include "model/Version.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
AboutDialog::AboutDialog( QWidget *parent )
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi( this );
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
AboutDialog::AboutDialog( QWidget *parent )
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
QString version = tr("Version") + " " + model::Version::LONG_STRING;
|
||||
|
||||
QString description = tr("A program to create labels and business cards.");
|
||||
|
||||
QString copyright = "Copyright © 2018 Jaye Evins <evins@snaught.com>";
|
||||
|
||||
QString licenseParagraph1 =
|
||||
tr( "gLabels is free software: you can redistribute it and/or modify "
|
||||
"it under the terms of the GNU General Public License as published by "
|
||||
"the Free Software Foundation, either version 3 of the License, or "
|
||||
"(at your option) any later version." );
|
||||
QString version = tr("Version") + " " + model::Version::LONG_STRING;
|
||||
|
||||
QString licenseParagraph2 =
|
||||
tr( "gLabels is distributed in the hope that it will be useful, "
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
|
||||
"GNU General Public License for more details." );
|
||||
|
||||
QString markup =
|
||||
"<p align='center'>" + version + "</p>" +
|
||||
"<p align='center'>" + description + "</p>" +
|
||||
"<p align='center'>" + copyright + "</p>" +
|
||||
"<p align='left'>" + licenseParagraph1 + "</p>" +
|
||||
"<p align='left'>" + licenseParagraph2 + "</p>";
|
||||
QString description = tr("A program to create labels and business cards.");
|
||||
|
||||
aboutLabel->setText( markup );
|
||||
}
|
||||
QString copyright = "Copyright © 2016-2026 Jaye Evins <evins@snaught.com>";
|
||||
|
||||
QString licenseParagraph1 =
|
||||
tr( "gLabels is free software: you can redistribute it and/or modify "
|
||||
"it under the terms of the GNU General Public License as published by "
|
||||
"the Free Software Foundation, either version 3 of the License, or "
|
||||
"(at your option) any later version." );
|
||||
|
||||
QString licenseParagraph2 =
|
||||
tr( "gLabels is distributed in the hope that it will be useful, "
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
|
||||
"GNU General Public License for more details." );
|
||||
|
||||
QString markup =
|
||||
"<p align='center'>" + version + "</p>" +
|
||||
"<p align='center'>" + description + "</p>" +
|
||||
"<p align='center'>" + copyright + "</p>" +
|
||||
"<p align='left'>" + licenseParagraph1 + "</p>" +
|
||||
"<p align='left'>" + licenseParagraph2 + "</p>";
|
||||
|
||||
aboutLabel->setText( markup );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// "License" Button Clicked Slot
|
||||
///
|
||||
void AboutDialog::onLicenseButtonClicked()
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl("http://www.gnu.org/licenses/gpl-3.0.txt") );
|
||||
}
|
||||
///
|
||||
/// "License" Button Clicked Slot
|
||||
///
|
||||
void AboutDialog::onLicenseButtonClicked()
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl("http://www.gnu.org/licenses/gpl-3.0.txt") );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// "Website" Button Clicked Slot
|
||||
///
|
||||
void AboutDialog::onWebsiteButtonClicked()
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl(model::Version::WEBSITE) );
|
||||
}
|
||||
///
|
||||
/// "Website" Button Clicked Slot
|
||||
///
|
||||
void AboutDialog::onWebsiteButtonClicked()
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl(model::Version::WEBSITE) );
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/* AboutDialog.h
|
||||
*
|
||||
* Copyright (C) 2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef AboutDialog_h
|
||||
#define AboutDialog_h
|
||||
|
||||
|
||||
#include "ui_AboutDialog.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// About Dialog Widget
|
||||
///
|
||||
class AboutDialog : public QDialog, public Ui_AboutDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
AboutDialog( QWidget *parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onLicenseButtonClicked();
|
||||
void onWebsiteButtonClicked();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // AboutDialog_h
|
||||
@@ -0,0 +1,58 @@
|
||||
// AboutDialog.hpp
|
||||
//
|
||||
// Copyright (C) 2016-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef AboutDialog_hpp
|
||||
#define AboutDialog_hpp
|
||||
|
||||
|
||||
#include "ui_AboutDialog.h"
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// About Dialog Widget
|
||||
///
|
||||
class AboutDialog : public QDialog, public Ui_AboutDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
AboutDialog( QWidget *parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onLicenseButtonClicked();
|
||||
void onWebsiteButtonClicked();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // AboutDialog_hpp
|
||||
+71
-70
@@ -1,88 +1,89 @@
|
||||
/* BarcodeMenu.cpp
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// BarcodeMenu.cpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "BarcodeMenu.h"
|
||||
|
||||
#include "BarcodeMenuItem.h"
|
||||
#include "BarcodeMenu.hpp"
|
||||
|
||||
#include "barcode/Backends.h"
|
||||
#include "BarcodeMenuItem.hpp"
|
||||
|
||||
#include <QtDebug>
|
||||
#include "barcode/Backends.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
BarcodeMenu::BarcodeMenu()
|
||||
{
|
||||
foreach ( const barcode::Style& bcStyle, barcode::Backends::styleList() )
|
||||
{
|
||||
if ( bcStyle.backendId() == "" )
|
||||
{
|
||||
auto* bcMenuItem = new BarcodeMenuItem( bcStyle );
|
||||
connect( bcMenuItem, SIGNAL(activated(const barcode::Style&)),
|
||||
this, SLOT(onMenuItemActivated(const barcode::Style&)) );
|
||||
|
||||
addAction( bcMenuItem );
|
||||
}
|
||||
}
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
BarcodeMenu::BarcodeMenu()
|
||||
{
|
||||
for ( const barcode::Style& bcStyle : barcode::Backends::styleList() )
|
||||
{
|
||||
if ( bcStyle.backendId() == "" )
|
||||
{
|
||||
auto* bcMenuItem = new BarcodeMenuItem( bcStyle );
|
||||
connect( bcMenuItem, SIGNAL(activated(const barcode::Style&)),
|
||||
this, SLOT(onMenuItemActivated(const barcode::Style&)) );
|
||||
|
||||
foreach ( const QString& backendId, barcode::Backends::backendList() )
|
||||
{
|
||||
QMenu* subMenu = addMenu( barcode::Backends::backendName( backendId ) );
|
||||
|
||||
foreach ( const barcode::Style& bcStyle, barcode::Backends::styleList() )
|
||||
{
|
||||
if ( bcStyle.backendId() == backendId )
|
||||
{
|
||||
auto* bcMenuItem = new BarcodeMenuItem( bcStyle );
|
||||
connect( bcMenuItem, SIGNAL(activated(const barcode::Style&)),
|
||||
this, SLOT(onMenuItemActivated(const barcode::Style&)) );
|
||||
addAction( bcMenuItem );
|
||||
}
|
||||
}
|
||||
|
||||
subMenu->addAction( bcMenuItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( const QString& backendId : barcode::Backends::backendList() )
|
||||
{
|
||||
QMenu* subMenu = addMenu( barcode::Backends::backendName( backendId ) );
|
||||
|
||||
for ( const barcode::Style& bcStyle : barcode::Backends::styleList() )
|
||||
{
|
||||
if ( bcStyle.backendId() == backendId )
|
||||
{
|
||||
auto* bcMenuItem = new BarcodeMenuItem( bcStyle );
|
||||
connect( bcMenuItem, SIGNAL(activated(const barcode::Style&)),
|
||||
this, SLOT(onMenuItemActivated(const barcode::Style&)) );
|
||||
|
||||
subMenu->addAction( bcMenuItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// bcStyle getter
|
||||
///
|
||||
barcode::Style BarcodeMenu::bcStyle() const
|
||||
{
|
||||
return mBcStyle;
|
||||
}
|
||||
///
|
||||
/// bcStyle getter
|
||||
///
|
||||
barcode::Style BarcodeMenu::bcStyle() const
|
||||
{
|
||||
return mBcStyle;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// onMenuItemActivated slot
|
||||
///
|
||||
void BarcodeMenu::onMenuItemActivated( const barcode::Style& bcStyle )
|
||||
{
|
||||
mBcStyle = bcStyle;
|
||||
///
|
||||
/// onMenuItemActivated slot
|
||||
///
|
||||
void BarcodeMenu::onMenuItemActivated( const barcode::Style& bcStyle )
|
||||
{
|
||||
mBcStyle = bcStyle;
|
||||
|
||||
emit selectionChanged();
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* BarcodeMenu.h
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BarcodeMenu_h
|
||||
#define BarcodeMenu_h
|
||||
|
||||
|
||||
#include "barcode/Style.h"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Barcode Menu
|
||||
///
|
||||
class BarcodeMenu : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
BarcodeMenu();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
barcode::Style bcStyle() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onMenuItemActivated( const barcode::Style& bcStyle );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
barcode::Style mBcStyle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BarcodeMenu_h
|
||||
@@ -0,0 +1,79 @@
|
||||
// BarcodeMenu.hpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef BarcodeMenu_hpp
|
||||
#define BarcodeMenu_hpp
|
||||
|
||||
|
||||
#include "barcode/Style.hpp"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Barcode Menu
|
||||
///
|
||||
class BarcodeMenu : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
BarcodeMenu();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
barcode::Style bcStyle() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onMenuItemActivated( const barcode::Style& bcStyle );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
barcode::Style mBcStyle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BarcodeMenu_hpp
|
||||
@@ -1,79 +1,80 @@
|
||||
/* BarcodeMenuButton.cpp
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// BarcodeMenuButton.cpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "BarcodeMenuButton.h"
|
||||
|
||||
#include "BarcodeMenuItem.h"
|
||||
#include "BarcodeMenuButton.hpp"
|
||||
|
||||
#include "barcode/Backends.h"
|
||||
#include "BarcodeMenuItem.hpp"
|
||||
|
||||
#include <QtDebug>
|
||||
#include "barcode/Backends.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
BarcodeMenuButton::BarcodeMenuButton( QWidget* parent )
|
||||
: QPushButton(parent)
|
||||
{
|
||||
mMenu = new BarcodeMenu();
|
||||
setMenu( mMenu );
|
||||
|
||||
mBcStyle = barcode::Backends::defaultStyle();
|
||||
setText( mBcStyle.fullName() );
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
BarcodeMenuButton::BarcodeMenuButton( QWidget* parent )
|
||||
: QPushButton(parent)
|
||||
{
|
||||
mMenu = new BarcodeMenu();
|
||||
setMenu( mMenu );
|
||||
|
||||
connect( mMenu, SIGNAL(selectionChanged()), this, SLOT(onMenuSelectionChanged()) );
|
||||
}
|
||||
mBcStyle = barcode::Backends::defaultStyle();
|
||||
setText( mBcStyle.fullName() );
|
||||
|
||||
connect( mMenu, SIGNAL(selectionChanged()), this, SLOT(onMenuSelectionChanged()) );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// bcStyle getter
|
||||
///
|
||||
barcode::Style BarcodeMenuButton::bcStyle() const
|
||||
{
|
||||
return mBcStyle;
|
||||
}
|
||||
///
|
||||
/// bcStyle getter
|
||||
///
|
||||
barcode::Style BarcodeMenuButton::bcStyle() const
|
||||
{
|
||||
return mBcStyle;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// bcStyle setter
|
||||
///
|
||||
void BarcodeMenuButton::setBcStyle( const barcode::Style& bcStyle )
|
||||
{
|
||||
mBcStyle = bcStyle;
|
||||
setText( mBcStyle.fullName() );
|
||||
}
|
||||
///
|
||||
/// bcStyle setter
|
||||
///
|
||||
void BarcodeMenuButton::setBcStyle( const barcode::Style& bcStyle )
|
||||
{
|
||||
mBcStyle = bcStyle;
|
||||
setText( mBcStyle.fullName() );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// onMenuStyleChanged slot
|
||||
///
|
||||
void BarcodeMenuButton::onMenuSelectionChanged()
|
||||
{
|
||||
mBcStyle = mMenu->bcStyle();
|
||||
setText( mBcStyle.fullName() );
|
||||
///
|
||||
/// onMenuStyleChanged slot
|
||||
///
|
||||
void BarcodeMenuButton::onMenuSelectionChanged()
|
||||
{
|
||||
mBcStyle = mMenu->bcStyle();
|
||||
setText( mBcStyle.fullName() );
|
||||
|
||||
emit selectionChanged();
|
||||
}
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/* BarcodeMenuButton.h
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BarcodeMenuButton_h
|
||||
#define BarcodeMenuButton_h
|
||||
|
||||
|
||||
#include "BarcodeMenu.h"
|
||||
|
||||
#include "barcode/Style.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Barcode Menu Button
|
||||
///
|
||||
class BarcodeMenuButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
BarcodeMenuButton( QWidget* parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
barcode::Style bcStyle() const;
|
||||
void setBcStyle( const barcode::Style& bcStyle );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onMenuSelectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
BarcodeMenu* mMenu;
|
||||
barcode::Style mBcStyle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BarcodeMenuButton_h
|
||||
@@ -0,0 +1,83 @@
|
||||
// BarcodeMenuButton.hpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef BarcodeMenuButton_hpp
|
||||
#define BarcodeMenuButton_hpp
|
||||
|
||||
|
||||
#include "BarcodeMenu.hpp"
|
||||
|
||||
#include "barcode/Style.hpp"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Barcode Menu Button
|
||||
///
|
||||
class BarcodeMenuButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
BarcodeMenuButton( QWidget* parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void selectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
barcode::Style bcStyle() const;
|
||||
void setBcStyle( const barcode::Style& bcStyle );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onMenuSelectionChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
BarcodeMenu* mMenu;
|
||||
barcode::Style mBcStyle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BarcodeMenuButton_hpp
|
||||
+45
-44
@@ -1,58 +1,59 @@
|
||||
/* BarcodeMenuItem.cpp
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// BarcodeMenuItem.cpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "BarcodeMenuItem.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include "BarcodeMenuItem.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor From Data
|
||||
///
|
||||
BarcodeMenuItem::BarcodeMenuItem( const barcode::Style& bcStyle, QObject* parent )
|
||||
: QAction(parent), mBcStyle(bcStyle)
|
||||
{
|
||||
setText( bcStyle.name() );
|
||||
///
|
||||
/// Constructor From Data
|
||||
///
|
||||
BarcodeMenuItem::BarcodeMenuItem( const barcode::Style& bcStyle, QObject* parent )
|
||||
: QAction(parent), mBcStyle(bcStyle)
|
||||
{
|
||||
setText( bcStyle.name() );
|
||||
|
||||
connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) );
|
||||
}
|
||||
connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// bcStyle Property Getter
|
||||
///
|
||||
barcode::Style BarcodeMenuItem::bcStyle() const
|
||||
{
|
||||
return mBcStyle;
|
||||
}
|
||||
///
|
||||
/// bcStyle Property Getter
|
||||
///
|
||||
barcode::Style BarcodeMenuItem::bcStyle() const
|
||||
{
|
||||
return mBcStyle;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// onTriggered slot
|
||||
///
|
||||
void BarcodeMenuItem::onTriggered()
|
||||
{
|
||||
emit activated( mBcStyle );
|
||||
}
|
||||
///
|
||||
/// onTriggered slot
|
||||
///
|
||||
void BarcodeMenuItem::onTriggered()
|
||||
{
|
||||
emit activated( mBcStyle );
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* BarcodeMenuItem.h
|
||||
*
|
||||
* Copyright (C) 2014 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BarcodeMenuItem_h
|
||||
#define BarcodeMenuItem_h
|
||||
|
||||
|
||||
#include "barcode/Style.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Barcode Menu Item
|
||||
///
|
||||
class BarcodeMenuItem : public QAction
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
BarcodeMenuItem( const barcode::Style& bcStyle, QObject* parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void activated( const barcode::Style& bcStyle );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
barcode::Style bcStyle() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onTriggered();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
barcode::Style mBcStyle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BarcodeMenuItem_h
|
||||
@@ -0,0 +1,79 @@
|
||||
// BarcodeMenuItem.hpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef BarcodeMenuItem_hpp
|
||||
#define BarcodeMenuItem_hpp
|
||||
|
||||
|
||||
#include "barcode/Style.hpp"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Barcode Menu Item
|
||||
///
|
||||
class BarcodeMenuItem : public QAction
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
BarcodeMenuItem( const barcode::Style& bcStyle, QObject* parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void activated( const barcode::Style& bcStyle );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Properties
|
||||
/////////////////////////////////
|
||||
public:
|
||||
barcode::Style bcStyle() const;
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onTriggered();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
barcode::Style mBcStyle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BarcodeMenuItem_hpp
|
||||
+32
-29
@@ -21,6 +21,7 @@ set (glabels_sources
|
||||
Help.cpp
|
||||
LabelEditor.cpp
|
||||
MainWindow.cpp
|
||||
MergeTableModel.cpp
|
||||
MergeView.cpp
|
||||
MiniPreviewPixmap.cpp
|
||||
NotebookUtil.cpp
|
||||
@@ -44,34 +45,35 @@ set (glabels_sources
|
||||
)
|
||||
|
||||
set (glabels_qobject_headers
|
||||
AboutDialog.h
|
||||
BarcodeMenu.h
|
||||
BarcodeMenuButton.h
|
||||
BarcodeMenuItem.h
|
||||
ColorButton.h
|
||||
ColorHistory.h
|
||||
ColorPaletteDialog.h
|
||||
ColorPaletteItem.h
|
||||
EditVariableDialog.h
|
||||
FieldButton.h
|
||||
File.h
|
||||
LabelEditor.h
|
||||
MainWindow.h
|
||||
MergeView.h
|
||||
ObjectEditor.h
|
||||
PreferencesDialog.h
|
||||
PrinterMonitor.h
|
||||
PrintView.h
|
||||
PropertiesView.h
|
||||
Preview.h
|
||||
ReportBugDialog.h
|
||||
SelectProductDialog.h
|
||||
SimplePreview.h
|
||||
StartupView.h
|
||||
TemplateDesigner.h
|
||||
TemplatePicker.h
|
||||
UndoRedoModel.h
|
||||
VariablesView.h
|
||||
AboutDialog.hpp
|
||||
BarcodeMenu.hpp
|
||||
BarcodeMenuButton.hpp
|
||||
BarcodeMenuItem.hpp
|
||||
ColorButton.hpp
|
||||
ColorHistory.hpp
|
||||
ColorPaletteDialog.hpp
|
||||
ColorPaletteItem.hpp
|
||||
EditVariableDialog.hpp
|
||||
FieldButton.hpp
|
||||
File.hpp
|
||||
LabelEditor.hpp
|
||||
MainWindow.hpp
|
||||
MergeTableModel.hpp
|
||||
MergeView.hpp
|
||||
ObjectEditor.hpp
|
||||
PreferencesDialog.hpp
|
||||
PrinterMonitor.hpp
|
||||
PrintView.hpp
|
||||
PropertiesView.hpp
|
||||
Preview.hpp
|
||||
ReportBugDialog.hpp
|
||||
SelectProductDialog.hpp
|
||||
SimplePreview.hpp
|
||||
StartupView.hpp
|
||||
TemplateDesigner.hpp
|
||||
TemplatePicker.hpp
|
||||
UndoRedoModel.hpp
|
||||
VariablesView.hpp
|
||||
)
|
||||
|
||||
set (glabels_forms
|
||||
@@ -129,7 +131,7 @@ add_executable (glabels-qt WIN32
|
||||
)
|
||||
|
||||
target_compile_features (glabels-qt
|
||||
PUBLIC cxx_std_11
|
||||
PUBLIC cxx_std_20
|
||||
)
|
||||
|
||||
target_include_directories (glabels-qt
|
||||
@@ -138,6 +140,7 @@ target_include_directories (glabels-qt
|
||||
|
||||
target_link_libraries (glabels-qt
|
||||
Model
|
||||
Qt6::Concurrent
|
||||
Qt6::Widgets
|
||||
)
|
||||
|
||||
|
||||
+145
-144
@@ -1,184 +1,185 @@
|
||||
/* ColorButton.cpp
|
||||
*
|
||||
* Copyright (C) 2014-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// ColorButton.cpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "ColorButton.h"
|
||||
|
||||
#include "ColorSwatch.h"
|
||||
#include "ColorButton.hpp"
|
||||
|
||||
#include "ColorSwatch.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QIcon>
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
//
|
||||
// Private
|
||||
//
|
||||
namespace
|
||||
{
|
||||
const int SWATCH_W = 64;
|
||||
const int SWATCH_H = 24;
|
||||
}
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
//
|
||||
// Private
|
||||
//
|
||||
namespace
|
||||
{
|
||||
const int SWATCH_W = 64;
|
||||
const int SWATCH_H = 24;
|
||||
}
|
||||
|
||||
ColorButton::ColorButton( QWidget* parent )
|
||||
: QPushButton( parent ), mIsDefault(0), mDialog(nullptr)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
ColorButton::ColorButton( QWidget* parent )
|
||||
: QPushButton( parent ), mIsDefault(0), mDialog(nullptr)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
void ColorButton::init( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton )
|
||||
{
|
||||
mDefaultColor = defaultColor;
|
||||
mColorNode = model::ColorNode( color );
|
||||
|
||||
setMinimumSize( QSize( 85, 34 ) );
|
||||
setIconSize( QSize(SWATCH_W, SWATCH_H) );
|
||||
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) );
|
||||
setText( "" );
|
||||
setCheckable( true );
|
||||
|
||||
mDialog = new ColorPaletteDialog( defaultLabel,
|
||||
defaultColor,
|
||||
color,
|
||||
showUseFieldButton );
|
||||
|
||||
connect( this, SIGNAL(toggled(bool)), this, SLOT(onButtonToggled(bool)) );
|
||||
connect( mDialog, SIGNAL(colorChanged(model::ColorNode,bool)),
|
||||
this, SLOT(onPaletteDialogChanged(model::ColorNode,bool)) );
|
||||
connect( mDialog, SIGNAL(accepted()), this, SLOT(onPaletteDialogAccepted()) );
|
||||
connect( mDialog, SIGNAL(rejected()), this, SLOT(onPaletteDialogRejected()) );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::init( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton )
|
||||
{
|
||||
mDefaultColor = defaultColor;
|
||||
mColorNode = model::ColorNode( color );
|
||||
void ColorButton::setColorNode( model::ColorNode colorNode )
|
||||
{
|
||||
mIsDefault = false;
|
||||
|
||||
setMinimumSize( QSize( 85, 34 ) );
|
||||
setIconSize( QSize(SWATCH_W, SWATCH_H) );
|
||||
mColorNode = colorNode;
|
||||
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) );
|
||||
setText( "" );
|
||||
setCheckable( true );
|
||||
if ( colorNode.isField() )
|
||||
{
|
||||
setIcon( QIcon() );
|
||||
setText( QString("${%1}").arg( colorNode.key() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, colorNode.color() ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
|
||||
mDialog = new ColorPaletteDialog( defaultLabel,
|
||||
defaultColor,
|
||||
color,
|
||||
showUseFieldButton );
|
||||
|
||||
connect( this, SIGNAL(toggled(bool)), this, SLOT(onButtonToggled(bool)) );
|
||||
connect( mDialog, SIGNAL(colorChanged(model::ColorNode,bool)),
|
||||
this, SLOT(onPaletteDialogChanged(model::ColorNode,bool)) );
|
||||
connect( mDialog, SIGNAL(accepted()), this, SLOT(onPaletteDialogAccepted()) );
|
||||
connect( mDialog, SIGNAL(rejected()), this, SLOT(onPaletteDialogRejected()) );
|
||||
}
|
||||
mDialog->setColorNode( colorNode );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::setColorNode( model::ColorNode colorNode )
|
||||
{
|
||||
mIsDefault = false;
|
||||
void ColorButton::setColor( QColor color )
|
||||
{
|
||||
mIsDefault = false;
|
||||
|
||||
mColorNode = colorNode;
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( color );
|
||||
mColorNode.setKey( "" );
|
||||
|
||||
if ( colorNode.isField() )
|
||||
{
|
||||
setIcon( QIcon() );
|
||||
setText( QString("${%1}").arg( colorNode.key() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, colorNode.color() ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
|
||||
mDialog->setColorNode( colorNode );
|
||||
}
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::setColor( QColor color )
|
||||
{
|
||||
mIsDefault = false;
|
||||
void ColorButton::setToDefault()
|
||||
{
|
||||
mIsDefault = true;
|
||||
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( color );
|
||||
mColorNode.setKey( "" );
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( mDefaultColor );
|
||||
mColorNode.setKey( "" );
|
||||
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, color ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
setIcon( QIcon(ColorSwatch( SWATCH_W, SWATCH_H, mDefaultColor ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::setToDefault()
|
||||
{
|
||||
mIsDefault = true;
|
||||
|
||||
mColorNode.setField( false );
|
||||
mColorNode.setColor( mDefaultColor );
|
||||
mColorNode.setKey( "" );
|
||||
|
||||
setIcon( QIcon(ColorSwatch( SWATCH_W, SWATCH_H, mDefaultColor ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
model::ColorNode ColorButton::colorNode()
|
||||
{
|
||||
return mColorNode;
|
||||
}
|
||||
|
||||
|
||||
model::ColorNode ColorButton::colorNode()
|
||||
{
|
||||
return mColorNode;
|
||||
}
|
||||
void ColorButton::setKeys( const merge::Merge* merge,
|
||||
const model::Variables& variables )
|
||||
{
|
||||
mDialog->setKeys( merge, variables );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::setKeys( const merge::Merge* merge,
|
||||
const model::Variables& variables )
|
||||
{
|
||||
mDialog->setKeys( merge, variables );
|
||||
}
|
||||
void ColorButton::onButtonToggled( bool checked )
|
||||
{
|
||||
if ( checked )
|
||||
{
|
||||
///
|
||||
/// @TODO: improve positioning of dialog -- near edges of screen.
|
||||
///
|
||||
QPoint dialogPos( 0, height() );
|
||||
mDialog->move( mapToGlobal(dialogPos) );
|
||||
|
||||
mDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::onButtonToggled( bool checked )
|
||||
{
|
||||
if ( checked )
|
||||
{
|
||||
///
|
||||
/// @TODO: improve positioning of dialog -- near edges of screen.
|
||||
///
|
||||
QPoint dialogPos( 0, height() );
|
||||
mDialog->move( mapToGlobal(dialogPos) );
|
||||
|
||||
mDialog->show();
|
||||
}
|
||||
}
|
||||
void ColorButton::onPaletteDialogAccepted()
|
||||
{
|
||||
setChecked( false );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::onPaletteDialogAccepted()
|
||||
{
|
||||
setChecked( false );
|
||||
}
|
||||
void ColorButton::onPaletteDialogRejected()
|
||||
{
|
||||
setChecked( false );
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::onPaletteDialogRejected()
|
||||
{
|
||||
setChecked( false );
|
||||
}
|
||||
void ColorButton::onPaletteDialogChanged( model::ColorNode colorNode, bool isDefault )
|
||||
{
|
||||
mColorNode = colorNode;
|
||||
mIsDefault = isDefault;
|
||||
|
||||
if ( colorNode.isField() )
|
||||
{
|
||||
setIcon( QIcon() );
|
||||
setText( QString("${%1}").arg( colorNode.key() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, colorNode.color() ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
|
||||
void ColorButton::onPaletteDialogChanged( model::ColorNode colorNode, bool isDefault )
|
||||
{
|
||||
mColorNode = colorNode;
|
||||
mIsDefault = isDefault;
|
||||
|
||||
if ( colorNode.isField() )
|
||||
{
|
||||
setIcon( QIcon() );
|
||||
setText( QString("${%1}").arg( colorNode.key() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setIcon( QIcon( ColorSwatch( SWATCH_W, SWATCH_H, colorNode.color() ) ) );
|
||||
setText( "" );
|
||||
}
|
||||
|
||||
emit colorChanged();
|
||||
}
|
||||
emit colorChanged();
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/* ColorButton.h
|
||||
*
|
||||
* Copyright (C) 2014-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ColorButton_h
|
||||
#define ColorButton_h
|
||||
|
||||
|
||||
#include "ColorPaletteDialog.h"
|
||||
|
||||
#include "model/ColorNode.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Color Button
|
||||
///
|
||||
class ColorButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
ColorButton( QWidget* parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void colorChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void init( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton = true );
|
||||
|
||||
void setColorNode( model::ColorNode colorNode );
|
||||
void setColor( QColor color );
|
||||
void setToDefault();
|
||||
model::ColorNode colorNode();
|
||||
|
||||
void setKeys( const merge::Merge* merge,
|
||||
const model::Variables& variables );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onButtonToggled( bool checked );
|
||||
void onPaletteDialogAccepted();
|
||||
void onPaletteDialogRejected();
|
||||
void onPaletteDialogChanged( model::ColorNode colorNode, bool isDefault );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Members
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QColor mDefaultColor;
|
||||
bool mIsDefault;
|
||||
model::ColorNode mColorNode;
|
||||
|
||||
ColorPaletteDialog* mDialog;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // ColorButton_h
|
||||
@@ -0,0 +1,105 @@
|
||||
// ColorButton.hpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef ColorButton_hpp
|
||||
#define ColorButton_hpp
|
||||
|
||||
|
||||
#include "ColorPaletteDialog.hpp"
|
||||
|
||||
#include "model/ColorNode.hpp"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Color Button
|
||||
///
|
||||
class ColorButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
ColorButton( QWidget* parent = nullptr );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Signals
|
||||
/////////////////////////////////
|
||||
signals:
|
||||
void colorChanged();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Public Methods
|
||||
/////////////////////////////////
|
||||
public:
|
||||
void init( const QString& defaultLabel,
|
||||
const QColor& defaultColor,
|
||||
const QColor& color,
|
||||
bool showUseFieldButton = true );
|
||||
|
||||
void setColorNode( model::ColorNode colorNode );
|
||||
void setColor( QColor color );
|
||||
void setToDefault();
|
||||
model::ColorNode colorNode();
|
||||
|
||||
void setKeys( const merge::Merge* merge,
|
||||
const model::Variables& variables );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onButtonToggled( bool checked );
|
||||
void onPaletteDialogAccepted();
|
||||
void onPaletteDialogRejected();
|
||||
void onPaletteDialogChanged( model::ColorNode colorNode, bool isDefault );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Members
|
||||
/////////////////////////////////
|
||||
private:
|
||||
QColor mDefaultColor;
|
||||
bool mIsDefault;
|
||||
model::ColorNode mColorNode;
|
||||
|
||||
ColorPaletteDialog* mDialog;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // ColorButton_hpp
|
||||
+124
-129
@@ -1,155 +1,150 @@
|
||||
/* ColorHistory.cpp
|
||||
*
|
||||
* Copyright (C) 2014-2016 Jaye Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// ColorHistory.cpp
|
||||
//
|
||||
// Copyright (C) 2014-2026 Jaye Evins <evins@snaught.com>
|
||||
//
|
||||
// This file is part of gLabels-qt.
|
||||
//
|
||||
// gLabels-qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// gLabels-qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "ColorHistory.h"
|
||||
|
||||
#include "ColorHistory.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
ColorHistory::ColorHistory()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
ColorHistory* ColorHistory::instance()
|
||||
{
|
||||
static ColorHistory* singletonInstance = nullptr;
|
||||
|
||||
if ( singletonInstance == nullptr )
|
||||
{
|
||||
singletonInstance = new ColorHistory();
|
||||
}
|
||||
|
||||
return singletonInstance;
|
||||
}
|
||||
|
||||
|
||||
ColorHistory* ColorHistory::instance()
|
||||
{
|
||||
static ColorHistory* singletonInstance = nullptr;
|
||||
void ColorHistory::addColor( const QColor &color, const QString& name )
|
||||
{
|
||||
QString nameColor = name + ":" + color.name();
|
||||
|
||||
if ( singletonInstance == nullptr )
|
||||
{
|
||||
singletonInstance = new ColorHistory();
|
||||
}
|
||||
QStringList nameColorList = readNameColorList();
|
||||
|
||||
return singletonInstance;
|
||||
}
|
||||
// Remove any occurrences of this color already in list
|
||||
nameColorList.removeAll( nameColor );
|
||||
|
||||
// Now add to list
|
||||
nameColorList.append( nameColor );
|
||||
|
||||
// Remove oldest colors, if size exceeds current max
|
||||
while ( nameColorList.size() > MAX_COLORS )
|
||||
{
|
||||
nameColorList.removeFirst();
|
||||
}
|
||||
|
||||
writeNameColorList( nameColorList );
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
void ColorHistory::addColor( const QColor &color, const QString& name )
|
||||
{
|
||||
QString nameColor = name + ":" + color.name();
|
||||
QList<QColor> ColorHistory::getColors()
|
||||
{
|
||||
QList<QColor> colorList;
|
||||
|
||||
QStringList nameColorList = readNameColorList();
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
QStringList v = nameColor.split( ':' );
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
colorList << QColor( v[1] );
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
colorList << QColor( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any occurrences of this color already in list
|
||||
nameColorList.removeAll( nameColor );
|
||||
|
||||
// Now add to list
|
||||
nameColorList.append( nameColor );
|
||||
|
||||
// Remove oldest colors, if size exceeds current max
|
||||
while ( nameColorList.size() > MAX_COLORS )
|
||||
{
|
||||
nameColorList.removeFirst();
|
||||
}
|
||||
|
||||
writeNameColorList( nameColorList );
|
||||
|
||||
emit changed();
|
||||
}
|
||||
return colorList;
|
||||
}
|
||||
|
||||
|
||||
QList<QColor> ColorHistory::getColors()
|
||||
{
|
||||
QList<QColor> colorList;
|
||||
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
QStringList v = nameColor.split( ':' );
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
colorList << QColor( v[1] );
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
colorList << QColor( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
QStringList ColorHistory::getNames()
|
||||
{
|
||||
QStringList nameList;
|
||||
|
||||
return colorList;
|
||||
}
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
QStringList v = nameColor.split( ':' );
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
nameList << v[0];
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
nameList << QString(tr("color %1")).arg( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
|
||||
return nameList;
|
||||
}
|
||||
|
||||
|
||||
QStringList ColorHistory::getNames()
|
||||
{
|
||||
QStringList nameList;
|
||||
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
QStringList v = nameColor.split( ':' );
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
nameList << v[0];
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
nameList << QString(tr("color %1")).arg( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
QStringList ColorHistory::readNameColorList()
|
||||
{
|
||||
QStringList defaultList;
|
||||
QSettings settings;
|
||||
|
||||
return nameList;
|
||||
}
|
||||
settings.beginGroup( "ColorHistory" );
|
||||
QStringList nameColorList = settings.value( "colors", defaultList ).toStringList();
|
||||
settings.endGroup();
|
||||
|
||||
// Remove oldest colors, if size exceeds current max
|
||||
while ( nameColorList.size() > MAX_COLORS )
|
||||
{
|
||||
nameColorList.removeFirst();
|
||||
}
|
||||
|
||||
return nameColorList;
|
||||
}
|
||||
|
||||
|
||||
QStringList ColorHistory::readNameColorList()
|
||||
{
|
||||
QStringList defaultList;
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup( "ColorHistory" );
|
||||
QStringList nameColorList = settings.value( "colors", defaultList ).toStringList();
|
||||
settings.endGroup();
|
||||
|
||||
// Remove oldest colors, if size exceeds current max
|
||||
while ( nameColorList.size() > MAX_COLORS )
|
||||
{
|
||||
nameColorList.removeFirst();
|
||||
}
|
||||
|
||||
return nameColorList;
|
||||
}
|
||||
|
||||
|
||||
void ColorHistory::writeNameColorList( const QStringList& nameColorList )
|
||||
{
|
||||
// Save
|
||||
QSettings settings;
|
||||
settings.beginGroup( "ColorHistory" );
|
||||
settings.setValue( "colors", nameColorList );
|
||||
settings.endGroup();
|
||||
}
|
||||
void ColorHistory::writeNameColorList( const QStringList& nameColorList )
|
||||
{
|
||||
// Save
|
||||
QSettings settings;
|
||||
settings.beginGroup( "ColorHistory" );
|
||||
settings.setValue( "colors", nameColorList );
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user