mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
CLI/Tcl: fix version check (need <= 999 for DAFT permille)
UPNQR: fix required binary mode using mode_preset UPNQR: allow mask to be manually specified GUI: use non-native QColorDialog on Unix also; no noEXE for CLI equivalent; add shortcuts for copy-to-clipboard and CLI equivalent CLI: new --version option to print Zint version
This commit is contained in:
parent
f58c80e290
commit
9aae557cdc
@ -65,6 +65,10 @@ Changes
|
||||
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
|
||||
- MICROQR: check versions M1 and M2 for allowed characters so as to give better
|
||||
error messages
|
||||
- UPNQR: allow mask to be manually specified
|
||||
- GUI: use non-native QColorDialog on Unix also; no noEXE for CLI equivalent;
|
||||
add shortcuts for copy-to-clipboard and CLI equivalent
|
||||
- CLI: new --version option to print Zint version
|
||||
|
||||
Bugs
|
||||
----
|
||||
@ -91,6 +95,8 @@ Bugs
|
||||
- HANXIN: fix gate-posts on codeword limits
|
||||
- GUI: cater for HiDPI display, props bitaround (#257)
|
||||
- RMQR: fix ECI encoding (wrong bit length for indicator)
|
||||
- CLI/tcl: fix version check (need <= 999 for DAFT permille)
|
||||
- UPNQR: fix required binary mode using mode_preset
|
||||
|
||||
|
||||
Version 2.10.0 2021-08-14
|
||||
|
@ -122,7 +122,7 @@ static const char hx_module_m[] = {
|
||||
};
|
||||
|
||||
/* Error correction block sizes from Table D1 */
|
||||
static const unsigned short hx_table_d1[] = {
|
||||
static const unsigned char hx_table_d1[] = {
|
||||
/* #blocks, k, 2t, #blocks, k, 2t, #blocks, k, 2t */
|
||||
1, 21, 4, 0, 0, 0, 0, 0, 0, // version 1
|
||||
1, 17, 8, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -1730,6 +1730,7 @@ unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag) {
|
||||
switch (symbol_id) {
|
||||
case BARCODE_QRCODE:
|
||||
case BARCODE_MICROQR:
|
||||
case BARCODE_UPNQR:
|
||||
case BARCODE_HANXIN:
|
||||
case BARCODE_DOTCODE:
|
||||
result |= ZINT_CAP_MASK;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@ -29,7 +29,6 @@
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
@ -55,7 +54,7 @@ INTERNAL int pharma(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
commonly used one-dimensional barcode schemes, pharmacode does not store the data in a
|
||||
form corresponding to the human-readable digits; the number is encoded in binary, rather
|
||||
than decimal. Pharmacode is read from right to left: with n as the bar position starting
|
||||
at 0 on the right, each narrow bar adds 2n to the value and each wide bar adds 2(2^n).
|
||||
at 0 on the right, each narrow bar adds 2^n to the value and each wide bar adds 2(2^n).
|
||||
The minimum barcode is 2 bars and the maximum 16, so the smallest number that could
|
||||
be encoded is 3 (2 narrow bars) and the biggest is 131070 (16 wide bars)."
|
||||
- http://en.wikipedia.org/wiki/Pharmacode */
|
||||
@ -379,3 +378,5 @@ INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "font.h"
|
||||
@ -44,11 +45,11 @@ INTERNAL int out_check_colour_options(struct zint_symbol *symbol) {
|
||||
int bg_len = (int) strlen(symbol->bgcolour);
|
||||
|
||||
if ((fg_len != 6) && (fg_len != 8)) {
|
||||
strcpy(symbol->errtxt, "651: Malformed foreground colour target");
|
||||
strcpy(symbol->errtxt, "651: Malformed foreground colour (6 or 8 characters only)");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
if ((bg_len != 6) && (bg_len != 8)) {
|
||||
strcpy(symbol->errtxt, "652: Malformed background colour target");
|
||||
strcpy(symbol->errtxt, "652: Malformed background colour (6 or 8 characters only)");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
@ -56,12 +57,12 @@ INTERNAL int out_check_colour_options(struct zint_symbol *symbol) {
|
||||
to_upper((unsigned char *) symbol->bgcolour, bg_len);
|
||||
|
||||
if (!is_sane(SSET_F, (unsigned char *) symbol->fgcolour, fg_len)) {
|
||||
strcpy(symbol->errtxt, "653: Malformed foreground colour target");
|
||||
sprintf(symbol->errtxt, "653: Malformed foreground colour '%s' (hexadecimal only)", symbol->fgcolour);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if (!is_sane(SSET_F, (unsigned char *) symbol->bgcolour, bg_len)) {
|
||||
strcpy(symbol->errtxt, "654: Malformed background colour target");
|
||||
sprintf(symbol->errtxt, "654: Malformed background colour '%s' (hexadecimal only)", symbol->bgcolour);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
|
53
backend/qr.c
53
backend/qr.c
@ -1439,15 +1439,17 @@ static int qr_blockLength(const int start, const char mode[], const int length)
|
||||
}
|
||||
|
||||
/* Calculate the actual bitlength of the proposed binary string */
|
||||
static int qr_calc_binlen(const int version, char mode[], const unsigned int ddata[], const int length, const int gs1,
|
||||
const int eci, const int debug_print) {
|
||||
static int qr_calc_binlen(const int version, char mode[], const unsigned int ddata[], const int length,
|
||||
const int mode_preset, const int gs1, const int eci, const int debug_print) {
|
||||
int i, j;
|
||||
char currentMode;
|
||||
int count = 0;
|
||||
int alphalength;
|
||||
int blocklength;
|
||||
|
||||
qr_define_mode(mode, ddata, length, gs1, version, debug_print);
|
||||
if (!mode_preset) {
|
||||
qr_define_mode(mode, ddata, length, gs1, version, debug_print);
|
||||
}
|
||||
|
||||
currentMode = ' '; // Null
|
||||
|
||||
@ -1525,7 +1527,7 @@ static int qr_calc_binlen(const int version, char mode[], const unsigned int dda
|
||||
/* Call `qr_calc_binlen()` on each segment */
|
||||
static int qr_calc_binlen_segs(const int version, char mode[], const unsigned int ddata[],
|
||||
const struct zint_seg segs[], const int seg_count, const struct zint_structapp *p_structapp,
|
||||
const int gs1, const int debug_print) {
|
||||
const int mode_preset, const int gs1, const int debug_print) {
|
||||
int i;
|
||||
int count = 0;
|
||||
const unsigned int *dd = ddata;
|
||||
@ -1544,7 +1546,7 @@ static int qr_calc_binlen_segs(const int version, char mode[], const unsigned in
|
||||
}
|
||||
|
||||
for (i = 0; i < seg_count; i++) {
|
||||
count += qr_calc_binlen(version, m, dd, segs[i].length, gs1, segs[i].eci, debug_print);
|
||||
count += qr_calc_binlen(version, m, dd, segs[i].length, mode_preset, gs1, segs[i].eci, debug_print);
|
||||
m += segs[i].length;
|
||||
dd += segs[i].length;
|
||||
}
|
||||
@ -1671,7 +1673,8 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
|
||||
p_structapp = &symbol->structapp;
|
||||
}
|
||||
|
||||
est_binlen = qr_calc_binlen_segs(40, mode, ddata, local_segs, seg_count, p_structapp, gs1, debug_print);
|
||||
est_binlen = qr_calc_binlen_segs(40, mode, ddata, local_segs, seg_count, p_structapp, 0 /*mode_preset*/, gs1,
|
||||
debug_print);
|
||||
|
||||
ecc_level = QR_LEVEL_L;
|
||||
max_cw = 2956;
|
||||
@ -1722,7 +1725,8 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
|
||||
}
|
||||
}
|
||||
if (autosize != 40) {
|
||||
est_binlen = qr_calc_binlen_segs(autosize, mode, ddata, local_segs, seg_count, p_structapp, gs1, debug_print);
|
||||
est_binlen = qr_calc_binlen_segs(autosize, mode, ddata, local_segs, seg_count, p_structapp, 0 /*mode_preset*/,
|
||||
gs1, debug_print);
|
||||
}
|
||||
|
||||
// Now see if the optimised binary will fit in a smaller symbol.
|
||||
@ -1734,8 +1738,8 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
|
||||
} else {
|
||||
prev_est_binlen = est_binlen;
|
||||
memcpy(prev_mode, mode, eci_length_segs);
|
||||
est_binlen = qr_calc_binlen_segs(autosize - 1, mode, ddata, local_segs, seg_count, p_structapp, gs1,
|
||||
debug_print);
|
||||
est_binlen = qr_calc_binlen_segs(autosize - 1, mode, ddata, local_segs, seg_count, p_structapp,
|
||||
0 /*mode_preset*/, gs1, debug_print);
|
||||
|
||||
switch (ecc_level) {
|
||||
case QR_LEVEL_L:
|
||||
@ -1780,8 +1784,8 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
|
||||
*/
|
||||
if (symbol->option_2 > version) {
|
||||
version = symbol->option_2;
|
||||
est_binlen = qr_calc_binlen_segs(symbol->option_2, mode, ddata, local_segs, seg_count, p_structapp, gs1,
|
||||
debug_print);
|
||||
est_binlen = qr_calc_binlen_segs(symbol->option_2, mode, ddata, local_segs, seg_count, p_structapp,
|
||||
0 /*mode_preset*/, gs1, debug_print);
|
||||
}
|
||||
|
||||
if (symbol->option_2 < version) {
|
||||
@ -2573,7 +2577,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (version_valid[i]) {
|
||||
binary_count[i] = qr_calc_binlen_segs(MICROQR_VERSION + i, mode, ddata, segs, seg_count,
|
||||
NULL /*p_structapp*/, 0 /*gs1*/, debug_print);
|
||||
NULL /*p_structapp*/, 0 /*mode_preset*/, 0 /*gs1*/, debug_print);
|
||||
} else {
|
||||
binary_count[i] = 128 + 1;
|
||||
}
|
||||
@ -2797,6 +2801,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
int i, j, r, est_binlen;
|
||||
int ecc_level, version, target_codewords, blocks, size;
|
||||
int bitmask, error_number;
|
||||
int user_mask;
|
||||
int size_squared;
|
||||
struct zint_seg segs[1];
|
||||
const int seg_count = 1;
|
||||
@ -2821,6 +2826,11 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
|
||||
symbol->eci = 4; /* Set before any processing */
|
||||
|
||||
user_mask = (symbol->option_3 >> 8) & 0x0F; /* User mask is pattern + 1, so >= 1 and <= 8 */
|
||||
if (user_mask > 8) {
|
||||
user_mask = 0; /* Ignore */
|
||||
}
|
||||
|
||||
switch (symbol->input_mode & 0x07) {
|
||||
case DATA_MODE:
|
||||
/* Input is already in ISO-8859-2 format */
|
||||
@ -2850,7 +2860,8 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
segs[0].length = length;
|
||||
segs[0].eci = 4;
|
||||
|
||||
est_binlen = qr_calc_binlen_segs(15, mode, ddata, segs, seg_count, NULL /*p_structapp*/, 0, debug_print);
|
||||
est_binlen = qr_calc_binlen_segs(15, mode, ddata, segs, seg_count, NULL /*p_structapp*/, 1 /*mode_preset*/, 0,
|
||||
debug_print);
|
||||
|
||||
ecc_level = QR_LEVEL_M;
|
||||
|
||||
@ -2893,7 +2904,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
|
||||
qr_add_version_info(grid, size, version);
|
||||
|
||||
bitmask = qr_apply_bitmask(grid, size, ecc_level, 0 /*user_mask*/, debug_print);
|
||||
bitmask = qr_apply_bitmask(grid, size, ecc_level, user_mask, debug_print);
|
||||
|
||||
qr_add_format_info(grid, size, ecc_level, bitmask);
|
||||
|
||||
@ -3061,8 +3072,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int
|
||||
return warn_number;
|
||||
}
|
||||
|
||||
est_binlen = qr_calc_binlen_segs(RMQR_VERSION + 31, mode, ddata, local_segs, seg_count, NULL /*p_structapp*/, gs1,
|
||||
debug_print);
|
||||
est_binlen = qr_calc_binlen_segs(RMQR_VERSION + 31, mode, ddata, local_segs, seg_count, NULL /*p_structapp*/,
|
||||
0 /*mode_preset*/, gs1, debug_print);
|
||||
|
||||
ecc_level = QR_LEVEL_M;
|
||||
max_cw = 152;
|
||||
@ -3099,7 +3110,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int
|
||||
best_footprint = rmqr_height[31] * rmqr_width[31];
|
||||
for (version = 30; version >= 0; version--) {
|
||||
est_binlen = qr_calc_binlen_segs(RMQR_VERSION + version, mode, ddata, local_segs, seg_count,
|
||||
NULL /*p_structapp*/, gs1, debug_print);
|
||||
NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print);
|
||||
footprint = rmqr_height[version] * rmqr_width[version];
|
||||
if (ecc_level == QR_LEVEL_M) {
|
||||
if (8 * rmqr_data_codewords_M[version] >= est_binlen) {
|
||||
@ -3119,14 +3130,14 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int
|
||||
}
|
||||
version = autosize;
|
||||
est_binlen = qr_calc_binlen_segs(RMQR_VERSION + version, mode, ddata, local_segs, seg_count,
|
||||
NULL /*p_structapp*/, gs1, debug_print);
|
||||
NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print);
|
||||
}
|
||||
|
||||
if ((symbol->option_2 >= 1) && (symbol->option_2 <= 32)) {
|
||||
// User specified symbol size
|
||||
version = symbol->option_2 - 1;
|
||||
est_binlen = qr_calc_binlen_segs(RMQR_VERSION + version, mode, ddata, local_segs, seg_count,
|
||||
NULL /*p_structapp*/, gs1, debug_print);
|
||||
NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print);
|
||||
}
|
||||
|
||||
if (symbol->option_2 >= 33) {
|
||||
@ -3134,7 +3145,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int
|
||||
version = rmqr_fixed_height_upper_bound[symbol->option_2 - 32];
|
||||
for (i = version - 1; i > rmqr_fixed_height_upper_bound[symbol->option_2 - 33]; i--) {
|
||||
est_binlen = qr_calc_binlen_segs(RMQR_VERSION + i, mode, ddata, local_segs, seg_count,
|
||||
NULL /*p_structapp*/, gs1, debug_print);
|
||||
NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print);
|
||||
if (ecc_level == QR_LEVEL_M) {
|
||||
if (8 * rmqr_data_codewords_M[i] >= est_binlen) {
|
||||
version = i;
|
||||
@ -3146,7 +3157,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int
|
||||
}
|
||||
}
|
||||
est_binlen = qr_calc_binlen_segs(RMQR_VERSION + version, mode, ddata, local_segs, seg_count,
|
||||
NULL /*p_structapp*/, gs1, debug_print);
|
||||
NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print);
|
||||
}
|
||||
|
||||
if (symbol->option_1 == -1) {
|
||||
|
@ -5306,6 +5306,7 @@ static void test_upnqr_encode(int index, int generate, int debug) {
|
||||
int input_mode;
|
||||
int option_1;
|
||||
int option_2;
|
||||
int option_3;
|
||||
char *data;
|
||||
int ret;
|
||||
|
||||
@ -5315,8 +5316,325 @@ static void test_upnqr_encode(int index, int generate, int debug) {
|
||||
char *expected;
|
||||
};
|
||||
|
||||
// https://www.upn-qr.si/uploads/files/Tehnicni standard UPN QR.pdf
|
||||
struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, "Ą˘Ł¤ĽŚ§¨ŠŞŤŹŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙", 0, 77, 77, "ISO 8859-2",
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, -1, "UPNQR\012\012\012\012\012Janez Novak\012Dunajska 1\0121000 Ljubljana\01200000008105\012\012\012COST\012Plačilo obveznosti 10/2016\012\012SI56051008010486080\012SI0598765432100\012Novo podjetje d.o.o.\012Lepa cesta 15\0123698 Loški Potok\012183\012 ", 0, 77, 77, "Example A",
|
||||
"11111110111111111100010011100010110001111000010010000011011111010000001111111"
|
||||
"10000010100011011111111001110100100100111110110100100100100111100010101000001"
|
||||
"10111010001000100000110111010001001000001000001101001001001001011000101011101"
|
||||
"10111010101000111111100101110000011010110100010001010110010010111000101011101"
|
||||
"10111010001000001001001011111100000110101100001111110101110011110111101011101"
|
||||
"10000010001111111001010010001001001000001000001000101001011001101010001000001"
|
||||
"11111110101010101010101010101010101010101010101010101010101010101010101111111"
|
||||
"00000000110100001001111110001101011101000100101000100100100100100100100000000"
|
||||
"10110111001011100111111111111011000001101011011111101101010000000101001001011"
|
||||
"11001001101111111100011011010011101000111100110110000001000110000010011010010"
|
||||
"10010011010011001101011011110101100100100110100110100100111100100101100100000"
|
||||
"10100000010000010100110110001000001001001001001101011011000001011001001001000"
|
||||
"11000110111001011001100000101001001011110000000011000110001011000111110000010"
|
||||
"01100000001000001010001010000101000110101100000100100111110000100100001100100"
|
||||
"11011010001110100011010100011001011001001001001001001011001001001000001001101"
|
||||
"01100101000011101111001001011100110111010010010110011000011010010010010010011"
|
||||
"01011011110011001110010110000111101100100110110101001010110101100001100110100"
|
||||
"00000101101101100110100111101110101010100001101001010000001101011001100001011"
|
||||
"00000011000011011001011001010011010110010010010000011000110010010011010110110"
|
||||
"11100101110001011000111101110100110110100100100000001101000100100100100000101"
|
||||
"00011010011000100011111101110011011011101011000011000110011000001011011111011"
|
||||
"11101000111110111101100000101011110010011010110111000001110110000000000010010"
|
||||
"10001011110111101111111001111100111100100100101101100110000100100001100000101"
|
||||
"00100000001000110101001110010000001111000001001011011000101001001001101101010"
|
||||
"11111111110101101000100011111000011100111000001111100111000011010100111111010"
|
||||
"11101000100100011011011010001101100110100100001000100101000000110000100011101"
|
||||
"00111010110010001010010010101001001101001001001010101001101011001111101011100"
|
||||
"01101000100011111100011110001010010000011010001000101010010110010010100010101"
|
||||
"10001111100101011010000111111110101110010110111111101001110000100001111110010"
|
||||
"00011000010101110110101111110001101001010001110000010001101110011010011110001"
|
||||
"01101010101101011001000100111010010010010010010110110010010011010011011010101"
|
||||
"01100101110001010010111010111100100000110101011000100100100010100110111011000"
|
||||
"10111010001110111000010101110011000001101010100001101100111010001100001001111"
|
||||
"01001001001010111000000101001010110110011010110011100011010100100001000100010"
|
||||
"00000110111010100100111010001100100100110101110101100100100100100100111001010"
|
||||
"01011001111110011000100111110001001001010100000000001000001111001011011010001"
|
||||
"00111011010010000010110111001110011010111000000110010111101001010110110011100"
|
||||
"01111100011111110001111011111100000110101111000101110101010000010010100110100"
|
||||
"01001010110110000011110111100101001001011011001001101001010001001001010101101"
|
||||
"00100000000111011011011101101110010010010110010010010010010010010000000110011"
|
||||
"10001110000101001100110001011100101101100001101000000000110110001000000000100"
|
||||
"00110001010111011000100111010011101011001000000000011000000100011001001101001"
|
||||
"01010010001111001110110101011100010011010011010010010010010011111010010110110"
|
||||
"11010101111000010110001010111000100100100100001100100100100000111100101100101"
|
||||
"10100010001001000010001100110101000001101110101101001011001100111101100001001"
|
||||
"01101001011100010101001101101110110000011110110011000111000001000010010000010"
|
||||
"11101111111001110000001011111010100100100101101111100010110101000100111110000"
|
||||
"00111000110101111110000010001100001000001101001000101001001001111001100011000"
|
||||
"01111010100010111010110010101011000010110000001010110110000011000110101010010"
|
||||
"11011000101011001011011010001100000110001010001000110111100000100100100010100"
|
||||
"10001111111100100100000111111010011000001111001111100001001001001001111111101"
|
||||
"11100001001110110011111000111010010010010010010010000010010010000011011010011"
|
||||
"11000111010101101011000010000110111101000110100100110000110101110000100100100"
|
||||
"10110001010110000001010000001010101011100001111101010010001101001001001001001"
|
||||
"01010011111110111110111010111100010010010010010011011100010010010010010000110"
|
||||
"01111101011001100100101010011110010101100100100100101100100100100101101100101"
|
||||
"10010010101001000111101010111011000001101011001001001111011000001101101001001"
|
||||
"01011101011000111010101001000010101101011010100110001111010110000011010010010"
|
||||
"11110111111011001000011101001001111001100100100101100000100100100100000110010"
|
||||
"00101101100110101001001100001011011001001001001001001001001001001000000001010"
|
||||
"01001110101000011100110000011010010010110000010100011100100011010010110010000"
|
||||
"01011001110011001100010011101001001010101100010000110000000000110001100100010"
|
||||
"11011110101100100101101111110111011001001001001010000111001001001101101010000"
|
||||
"10110000001001111010001001110000000010011010010000011000010010010011011010001"
|
||||
"00011011010000111010011010100101001010011110100100101000010101100010000100100"
|
||||
"01100101010110100001100110001101101011000001110111011000101101011001001000011"
|
||||
"01001111100111100110111110110101101110010010011011111010110000010011010001100"
|
||||
"00001001111101000000101011011110100000100100101101111101100100100111001101101"
|
||||
"01111010101101000011101111111001000001100011011111111101111111001101111110011"
|
||||
"00000000101101101110101110001110110100001010111000101010110111000000100011010"
|
||||
"11111110110001001100010110101010100100100100111010100100100011100101101010000"
|
||||
"10000010110110110101000110001011001001001001101000101001001111001001100010100"
|
||||
"10111010010110001000101011111010011100101001101111110110100111010111111111110"
|
||||
"10111010111111011111010010100000000110101100000111110101100010010110000000100"
|
||||
"10111010111000101010000010001111001111011001010101101001101011001000001000101"
|
||||
"10000010001101100100010110101010010010001110010010010010110010010010100101001"
|
||||
"11111110100011011001111101001100101100000010111001100000111111111001000100010"
|
||||
},
|
||||
/* 1*/ { UNICODE_MODE, -1, -1, -1, "UPNQR\012SI56020170014356205\012\012\012SI003528-990\012Združenje bank Slovenije\012Šubičeva 2\0121000 Ljubljana\01200000128067\012\012\012ADVA\012Plačilo avansa-ponudba 2016/12\012\012SI56051008010486080\012SI00123456-67890-12345\012Novo podjetje d.o.o.\012Lepa cesta 15\0123698 Loški Potok\012238\012 ", 0, 77, 77, "Example B",
|
||||
"11111110000111011101000010011000101001000000001000111011101100110000001111111"
|
||||
"10000010110011111100001100011111010101001001100001010101010101110010101000001"
|
||||
"10111010001010110110001000110010101011101110001000101010100110110000101011101"
|
||||
"10111010001111111101111110011110011101010101110100010001000110000100101011101"
|
||||
"10111010100111000001000111111010001000000110101111111001100110010011101011101"
|
||||
"10000010010011100010000010001100010100010101011000111101010101110110001000001"
|
||||
"11111110101010101010101010101010101010101010101010101010101010101010101111111"
|
||||
"00000000011101111011101110001101001110110101011000110101010101100101100000000"
|
||||
"10101010010001000011011011111000100000001100111111110000111011011110000010010"
|
||||
"00010001100001111111011101100100101101111001110001000110011001001101011101010"
|
||||
"00100011011101000010110111011010101010101110101110100110111011100011001010001"
|
||||
"10111100001110101010101001111101010100010001010101000111010101110101110101011"
|
||||
"11101110011001000011011001111000110111101000111001100110111011111110101000101"
|
||||
"00110001101101111101111101011101100011011011110101000110011001011101111101001"
|
||||
"00111011101101100010110111101010111110101100101110101010010010101011101000010"
|
||||
"10001000000000001000001000011010010101001001010111000111111101010101010011011"
|
||||
"11001011110100100000011000001000100011010000111011111110010011101110101000111"
|
||||
"00011101111110111010111111110010110011111111110001110000010001000101111101010"
|
||||
"00110011111100100001100001111010101010111110101111101100101010101011001110001"
|
||||
"10010100011100100001001100000100000100001101010101110111011101010101010111001"
|
||||
"11010011100010010000011100010001000000010000111001000110011011101001111010101"
|
||||
"00111101111101101010100011101101111110011101111101000000010001000111000001011"
|
||||
"00000011100101101001100111110010111100111010111110001000101010101111001100111"
|
||||
"00100100010100111001010010001100010000010100110011101110110111010001110101001"
|
||||
"11101111101101011000000011111000110011001000011111100010011001101110111111111"
|
||||
"10111000101011101010111010001100000110001101101000101000010011000010100011010"
|
||||
"00011010101001100001100010101010101110101011101010101110101010101100101011001"
|
||||
"10101000101010100011000010001101000011011101101000111101010011010100100011001"
|
||||
"11101111101001001101001011111000100010000001101111100110011001101101111110101"
|
||||
"01110000000111101010101011101101111011010100111100000100010001100000000011000"
|
||||
"11001010011011111100001100000010100010101011101100001010101010001001100111000"
|
||||
"01110001000000110001101011001101010001000101010110110101010101110101000101001"
|
||||
"01010110101011001100101110010000110010000000100110101110111011001101101100101"
|
||||
"01100100001011110011101010001101110001011100111101000100010001000000000100010"
|
||||
"00000011010110110001011100000010100010111010101011101010001010001100100110011"
|
||||
"11000000100010010111110011101101010101001100001100010100110101111111011111010"
|
||||
"10000111101010100110000110110110100010001010111110101110011001000110000001111"
|
||||
"01001101101110000000001011101101110111000111000100000100011001000111000001010"
|
||||
"11101010010101111000101100000110101010111001111010001010101010100110100110101"
|
||||
"11100101000001010001100011001001010101010001110101110101010001111101010001111"
|
||||
"10000011001010101110011010010110000011101100010110101110110011000100011110001"
|
||||
"01101100001011011000011111011110110111010001011100000100000011001111010001010"
|
||||
"10101010110110100011100010010000101011101110111011001010110011100010110110001"
|
||||
"00100101001000000010100101001001010101010000011101010101010101010101010100111"
|
||||
"10000011001011000010001111110000100011001111110110101110111001101110001010001"
|
||||
"00101100011010010000000110011101110111011000101100000110011001101101010111010"
|
||||
"00101111110111111001100111111010101010101000101111101010101011001010111110001"
|
||||
"11101000100000100111111010001001110010010101011000101101010101001101100011011"
|
||||
"00001010101011100101101010101101111000001100111010100100111011011110101010101"
|
||||
"10101000111010111100001010001110110110011101111000100000011001001101100011010"
|
||||
"01111111111111100000000111111000111111101110101111101000101010000010111110001"
|
||||
"00100101000010010000111100011000110000010101010101000101010101100100010101011"
|
||||
"01001010000100100011001110011011010110001000101010100110111011100110100010101"
|
||||
"10111100101000111111001111110001110110111101100001000110001001011101111101011"
|
||||
"01101010110000000110000010101111100110101010101011101110001010101011101000010"
|
||||
"00111100010111010101011101110111110001010101010101000101010101010101111101011"
|
||||
"01100011101001000100001111001000010011001000101010100110011011101110101010101"
|
||||
"10111001010000011101101111100101010011000101100001000110010001000101010101010"
|
||||
"01000010101011000110010110000000100010111010101001101010001010101010001000000"
|
||||
"00100000100101111101010110100101000000010101010111010111010101010100011101001"
|
||||
"01001110000101001100001100100000000010001000101000110111011011101010001010101"
|
||||
"00101000000010001101100000100100101111101101100001000110010001000001110101100"
|
||||
"00101011001011101110001110110100101110011010101001100010001000101111101001101"
|
||||
"01001001001010100101011000011111010110010100010001001111010001010100011101011"
|
||||
"10000011000110110100001010110011010110001000001000111110011001101100001100111"
|
||||
"01110001010000100101100010011001111010101100100111001110010011000101110011010"
|
||||
"01001111000111001110001010010101001111001010000001100110101000101000001000101"
|
||||
"00001000011010100001101010101111000101000100110011110111010111010110111001101"
|
||||
"01111011000000110000000111111010100010001001001111100110011111101100111110001"
|
||||
"00000000110100100000011010001001100011010101111000100100010001100001100011000"
|
||||
"11111110010011010010010010101100111010111011111010101010001001000111101010000"
|
||||
"10000010001110100101010010001111010101011101101000110100010101010101100011001"
|
||||
"10111010101010100101111011111010110100001001101111101111111011101100111110101"
|
||||
"10111010001000111010010011011001110111011100100111100100110011001000110010010"
|
||||
"10111010111111010100110001101100110100111010111110001010001010100101101010001"
|
||||
"10000010001110111011101001101101010101011101110100110101010001000101100000101"
|
||||
"11111110101101000011101011000010100010000010001101101110011110100111001110011"
|
||||
},
|
||||
/* 2*/ { UNICODE_MODE, -1, -1, -1, "UPNQR\012\012\012\012\012Janez Novak\012Dunajska 1\0121000 Ljubljana\01200000008105\012\012\012RENT\012Plačilo najemnine 10/2016\01215.11.2016\012SI56051008010486080\012RF45SBO2010\012Novo podjetje d.o.o.\012Lepa cesta 15\0123698 Loški Potok\012188\012 ", 0, 77, 77, "Example H",
|
||||
"11111110000111000010011001010010001001000000101010111011100111100000001111111"
|
||||
"10000010110011101110001010110101010101001111000101010101010110110010101000001"
|
||||
"10111010001010100101010100101010101011101011101110101010101010001000101011101"
|
||||
"10111010001111111111100001111111011101110011010110010001000100011100101011101"
|
||||
"10111010100111000110000111111010001000100110001111111011100100011011101011101"
|
||||
"10000010010011000001001010001101010100010110011000110101010100010110001000001"
|
||||
"11111110101010101010101010101010101010101010101010101010101010101010101111111"
|
||||
"00000000000101011111001110001101001100110001011000110101011101110101000000000"
|
||||
"10101010001001000110011011111000100010001000111111101110111011100110100010010"
|
||||
"00001100101001011111011101001100101111111001110011000110011001000101011101010"
|
||||
"00011111001101000001010101100011101010101110101110101010101010101011101010001"
|
||||
"10111100010101101000101100011101010101010101010011010111010101000101010101011"
|
||||
"11110110011001000001011000011000010011001100111011100110111011111110101000101"
|
||||
"00000101111001011011111011111100110111011111110001011110010001010101011101010"
|
||||
"00101111101101100000110101110010111010101010101110101010101010101011101010001"
|
||||
"10101100011100001000001110011011110110010101010011010111010101010101010101011"
|
||||
"11100011111101000000011100001000000100001000111011000100111011101110001000101"
|
||||
"00000001100010011010111011110011110110111101110001001110010001000101111101010"
|
||||
"00011011110101100001100001101011101011001010101110101100001010101011101100001"
|
||||
"10111000001000101001001100000101010101010101010101110101010101010101110101011"
|
||||
"11110011110001000000011110010000110010001000100010100101011011101000111100101"
|
||||
"00001101101111111010100111101100110011011101110000000000010001000111100001010"
|
||||
"00101011111011100001110111110010111010101010100001101111001010101111101000101"
|
||||
"00100000011100100001010010001100010011011101010111000110110101010101110111001"
|
||||
"11011111111011011000011011111000101100010000111111111111111011101100111111101"
|
||||
"10111000111011100010101010001100011111011101111000110100110001000001100010000"
|
||||
"11111010110001100001110010101010100110101010101010101010001010101100101010010"
|
||||
"10001000100100111011011010001101010111000100011000101101010101010101100011111"
|
||||
"10111111101001001100001011111000100000001000111111100110011100101111111110011"
|
||||
"00001000001011100010110011101101110101001100100100001100010000000110000100010"
|
||||
"10011110010011100001111100000010101010101010111110001010101001101011100010010"
|
||||
"00011000000000110011010011001101010001000101100001010101010101010101001110110"
|
||||
"00011111101101000011000110010000100010001000001010001111011001101111101100011"
|
||||
"01001000001101101110101010001101110001011101101100100100010001100110000111010"
|
||||
"11001010110100110110011100000010101010111011111011101010101010101000100111011"
|
||||
"00000100100010011010001011101101010101001000011100110100010001000111000111110"
|
||||
"10000011101010100100101111110110100010000001111110001111010111111110011010111"
|
||||
"10001101101110000101111010001101110111011110100100100100100101110111000110010"
|
||||
"11101011010101110101110100000110101010111000111011101010110010101010111110001"
|
||||
"11100101100000011111101010101001010101010001011100110101010101100111010001011"
|
||||
"10000011001011000111001110010010100011101111100110001110111001101110000111001"
|
||||
"01101101101011000010010010001111110111010100001100000100011001111101000001010"
|
||||
"01101010110111110110001100100100101011101011101010101010101011101010110110001"
|
||||
"01100101001000000100111010001111010101010101111101010101010001000101000101011"
|
||||
"01000011101011000011101111010000100010001101001110101000111111100110001010101"
|
||||
"10101101011010110110001011101111110111011101110100000000011111100101010111010"
|
||||
"01101111110110011011100111111000101010101011101111101100100011001010111110001"
|
||||
"00101000101001000110011010001100010100010101011000110101011101000101100011011"
|
||||
"01001010111011000110001010101011111010001000111010101110101011111110101010101"
|
||||
"10101000111010011110101010001011110111111101111000100110000001010101100011010"
|
||||
"01101111101111000101100111111001111011101010101111101010111010101010111110001"
|
||||
"00100100101000010100111000001011010101010101010101010101010101000100011101011"
|
||||
"01001010001010100101001100011101110011001100101010101110100011111110101010101"
|
||||
"10101101101011111101001111100100110111011111100001000000000001010101010101010"
|
||||
"01011010111111000110000011011110101010101010101011101100100010101010101000001"
|
||||
"00101100100010010101011100111000000011010101010101010101010101010100011101011"
|
||||
"01110011011111000100001011010100100100001000101010101100111011101110001010101"
|
||||
"10001000011001111101101110010011101110111101100001000000010001000101010101000"
|
||||
"01001011100001000110010100100001100110001010101011101100001010101010101000001"
|
||||
"00000001110000110101010011011111010101011101010111000110110101010100111101011"
|
||||
"01100110011100100100001110110010110000000000101000100101111011101010101010111"
|
||||
"00111000010110111101100100010000110011010101100011000000110001000000110101111"
|
||||
"00011111001001000110001000010100101010101010101011100010101010101110101001111"
|
||||
"01101001011110111101001110111111000101010101010111011110110101010101111101001"
|
||||
"10100011000100110100010100111011001100011000101010100111111011101100101010101"
|
||||
"01011001011000101101111010000001101111011101101011000101110001000101010100000"
|
||||
"01001111011111001110000110001101001110111010100011000010101000101010101001011"
|
||||
"00001000001100110001010010101111010001000101111010001100110101010110011100011"
|
||||
"01111011001010100000001111111010100010011000011111111111111100101110111111111"
|
||||
"00000000101000101001111010001001110011001101011000101100010000000001100010010"
|
||||
"11111110011001001010011010101100101010101010111010101010101011101101101010001"
|
||||
"10000010001010100001001010001111010101010101011000110101010101010111100011111"
|
||||
"10111010101110100001000011111010100100010001101111101110011001101001111111101"
|
||||
"10111010001110110111100011010001110111011100101110000100010001100111110001010"
|
||||
"10111010111011000101100001101100101100111011100110001010001010100111101111001"
|
||||
"10000010001010100100100001101101010101001000000101010101110011011111100111001"
|
||||
"11111110101101000110111011000010100010001100001111101110110001100111001110111"
|
||||
},
|
||||
/* 3*/ { UNICODE_MODE, -1, -1, 2 << 8, "UPNQR\012\012\012\012\012Janez Novak\012Dunajska 1\0121000 Ljubljana\01200000008105\012\012\012RENT\012Plačilo najemnine 10/2016\01215.11.2016\012SI56051008010486080\012RF45SBO2010\012Novo podjetje d.o.o.\012Lepa cesta 15\0123698 Loški Potok\012188\012 ", 0, 77, 77, "Example H with explicit mask 001 (auto-mask 000)",
|
||||
"11111110110010010111001100000111011100010101111111101110110010110100001111111"
|
||||
"10000010000110111011011111100000000000011010010000000000000011100110101000001"
|
||||
"10111010111111110000000001111111111110111110111011111111111111011100101011101"
|
||||
"10111010011010101010110100101010001000100110000011000100010001001000101011101"
|
||||
"10111010010010010011010011111111011101110011011111101110110001001111101011101"
|
||||
"10000010100110010100011110001000000001000011001000100000000001000010001000001"
|
||||
"11111110101010101010101010101010101010101010101010101010101010101010101111111"
|
||||
"00000000010000001010011010001000011001100100001000100000001000100000000000000"
|
||||
"10100011011100010011001111111101110111011101101111111011101110110011100100101"
|
||||
"01011001111100001010001000011001111010101100100110010011001100010000001000000"
|
||||
"01001010011000010100000000110110111111111011111011111111111111111110111111011"
|
||||
"11101001000000111101111001001000000000000000000110000010000000010000000000001"
|
||||
"10100011001100010100001101001101000110011001101110110011101110101011111101111"
|
||||
"01010000101100001110101110101001100010001010100100001011000100000000001000000"
|
||||
"01111010111000110101100000100111101111111111111011111111111111111110111111011"
|
||||
"11111001001001011101011011001110100011000000000110000010000000000000000000001"
|
||||
"10110110101000010101001001011101010001011101101110010001101110111011011101111"
|
||||
"01010100110111001111101110100110100011101000100100011011000100010000101000000"
|
||||
"01001110100000110100110100111110111110011111111011111001011111111110111001011"
|
||||
"11101101011101111100011001010000000000000000000000100000000000000000100000001"
|
||||
"10100110100100010101001011000101100111011101110111110000001110111101101001111"
|
||||
"01011000111010101111110010111001100110001000100101010101000100010010110100000"
|
||||
"01111110101110110100100010100111101111111111110100111010011111111010111101111"
|
||||
"01110101001001110100000111011001000110001000000010010011100000000000100010011"
|
||||
"10001111101110001101001111111101111001000101101111101010101110111001111110111"
|
||||
"11101000101110110111111110001001001010001000101000100001100100010100100011010"
|
||||
"10101010100100110100100110101111110011111111111010111111011111111001101011000"
|
||||
"11011000110001101110001110001000000010010001001000111000000000000000100010101"
|
||||
"11101111111100011001011111111101110101011101101111110011001001111010111111001"
|
||||
"01011101011110110111100110111000100000011001110001011001000101010011010001000"
|
||||
"11001011000110110100101001010111111111111111101011011111111100111110110111000"
|
||||
"01001101010101100110000110011000000100010000110100000000000000000000011011100"
|
||||
"01001010111000010110010011000101110111011101011111011010001100111010111001001"
|
||||
"00011101011000111011111111011000100100001000111001110001000100110011010010000"
|
||||
"10011111100001100011001001010111111111101110101110111111111111111101110010001"
|
||||
"01010001110111001111011110111000000000011101001001100001000100010010010010100"
|
||||
"11010110111111110001111010100011110111010100101011011010000010101011001111101"
|
||||
"11011000111011010000101111011000100010001011110001110001110000100010010011000"
|
||||
"10111110000000100000100001010011111111101101101110111111100111111111101011011"
|
||||
"10110000110101001010111111111100000000000100001001100000000000110010000100001"
|
||||
"11010110011110010010011011000111110110111010110011011011101100111011010010011"
|
||||
"00111000111110010111000111011010100010000001011001010001001100101000010100000"
|
||||
"00111111100010100011011001110001111110111110111111111111111110111111100011011"
|
||||
"00110000011101010001101111011010000000000000101000000000000100010000010000001"
|
||||
"00010110111110010110111010000101110111011000011011111101101010110011011111111"
|
||||
"11111000001111100011011110111010100010001000100001010101001010110000000010000"
|
||||
"00111111100011001110110011111101111111111110111111111001110110011111111111011"
|
||||
"01111000111100010011001110001001000001000000001000100000001000010000100010001"
|
||||
"00011010101110010011011110101110101111011101101010111011111110101011101011111"
|
||||
"11111000101111001011111110001110100010101000101000110011010100000000100010000"
|
||||
"00111111111010010000110011111100101110111111111111111111101111111111111111011"
|
||||
"01110001111101000001101101011110000000000000000000000000000000010001001000001"
|
||||
"00011111011111110000011001001000100110011001111111111011110110101011111111111"
|
||||
"11111000111110101000011010110001100010001010110100010101010100000000000000000"
|
||||
"00001111101010010011010110001011111111111111111110111001110111111111111101011"
|
||||
"01111001110111000000001001101101010110000000000000000000000000000001001000001"
|
||||
"00100110001010010001011110000001110001011101111111111001101110111011011111111"
|
||||
"11011101001100101000111011000110111011101000110100010101000100010000000000010"
|
||||
"00011110110100010011000001110100110011011111111110111001011111111111111101011"
|
||||
"01010100100101100000000110001010000000001000000010010011100000000001101000001"
|
||||
"00110011001001110001011011100111100101010101111101110000101110111111111111101"
|
||||
"01101101000011101000110001000101100110000000110110010101100100010101100000101"
|
||||
"01001010011100010011011101000001111111111111111110110111111111111011111100101"
|
||||
"00111100001011101000011011101010010000000000000010001011100000000000101000011"
|
||||
"11110110010001100001000001101110011001001101111111110010101110111001111111111"
|
||||
"00001100001101111000101111010100111010001000111110010000100100010000000001010"
|
||||
"01001110001010011011010011011000011011101111110110010111111101111111111100001"
|
||||
"00001001011001100100000111111010000100010000101111011001100000000011001001001"
|
||||
"01111010011111110101011011111111110111001101001111101010101001111011111110101"
|
||||
"00000000111101111100101110001100100110011000001000111001000101010100100011000"
|
||||
"11111110101100011111001110101001111111111111101010111111111110111000101011011"
|
||||
"10000010011111110100011110001010000000000000001000100000000000000010100010101"
|
||||
"10111010011011110100010111111111110001000100111111111011001100111100111110111"
|
||||
"10111010011011100010110110000100100010001001111011010001000100110010100100000"
|
||||
"10111010101110010000110100111001111001101110110011011111011111110010111010011"
|
||||
"10000010011111110001110100111000000000011101010000000000100110001010110010011"
|
||||
"11111110111000010011101110010111110111011001011010111011100100110010011011101"
|
||||
},
|
||||
/* 4*/ { UNICODE_MODE, -1, -1, -1, "Ą˘Ł¤ĽŚ§¨ŠŞŤŹŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙", 0, 77, 77, "ISO 8859-2",
|
||||
"11111110000111101001000110101100101001111110111011001111111000110000001111111"
|
||||
"10000010001011100100110111111011110100001011110000100001001110011010101000001"
|
||||
"10111010110101111111101101111101001010110101111011011110100001100100101011101"
|
||||
@ -5400,6 +5718,15 @@ static void test_upnqr_encode(int index, int generate, int debug) {
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
char escaped[4096];
|
||||
char cmp_buf[32768];
|
||||
char cmp_msg[1024];
|
||||
|
||||
#if 0 /* Need to add "force binary mode" to BWIPP for this to work */
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
|
||||
#endif
|
||||
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); // Only do ZXing-C++ test if asked, too slow otherwise
|
||||
|
||||
testStart("test_upnqr_encode");
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
@ -5409,15 +5736,16 @@ static void test_upnqr_encode(int index, int generate, int debug) {
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
length = testUtilSetSymbol(symbol, BARCODE_UPNQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
length = testUtilSetSymbol(symbol, BARCODE_UPNQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
|
||||
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||
|
||||
if (generate) {
|
||||
printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, \"%s\",\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
|
||||
data[i].data, testUtilErrorName(data[i].ret),
|
||||
printf(" /*%3d*/ { %s, %d, %d, %s, \"%s\", %s, %d, %d, \"%s\",\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, testUtilOption3Name(data[i].option_3),
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret),
|
||||
symbol->rows, symbol->width, data[i].comment);
|
||||
testUtilModulesPrint(symbol, " ", "\n");
|
||||
printf(" },\n");
|
||||
@ -5430,6 +5758,33 @@ static void test_upnqr_encode(int index, int generate, int debug) {
|
||||
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
|
||||
}
|
||||
|
||||
if (ret < ZINT_ERROR) {
|
||||
#if 0
|
||||
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, debug)) {
|
||||
char modules_dump[77 * 77 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
|
||||
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
|
||||
int cmp_len, ret_len;
|
||||
char modules_dump[77 * 77 + 1];
|
||||
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
|
||||
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
|
||||
|
||||
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
|
||||
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
|
@ -2008,7 +2008,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
|
||||
{ "channelcode", BARCODE_CHANNEL, 140, 0, 0, 0, 0, 0, },
|
||||
{ "codeone", BARCODE_CODEONE, 141, 0, 1, 0, 0, 0, },
|
||||
{ "", BARCODE_GRIDMATRIX, 142, 0, 0, 0, 0, 0, },
|
||||
{ "", BARCODE_UPNQR, 143, 0, 0, 0, 0, 0, },
|
||||
{ "qrcode", BARCODE_UPNQR, 143, 0, 0, 1, 0, 0, },
|
||||
{ "ultracode", BARCODE_ULTRA, 144, 1, 1, 0, 0, 0, },
|
||||
{ "rectangularmicroqrcode", BARCODE_RMQR, 145, 1, 1, 1, 0, 0, },
|
||||
};
|
||||
@ -2244,14 +2244,23 @@ static char *testUtilBwippUtf8Convert(const int index, const int symbology, cons
|
||||
int eci = *p_eci;
|
||||
|
||||
if (eci == 0 && try_sjis
|
||||
&& (symbology == BARCODE_QRCODE || symbology == BARCODE_MICROQR || symbology == BARCODE_RMQR)) {
|
||||
if (utf8_to_eci(0, data, converted, p_data_len) != 0) {
|
||||
if (utf8_to_eci(20, data, converted, p_data_len) != 0) {
|
||||
fprintf(stderr, "i:%d testUtilBwippUtf8Convert: failed to convert UTF-8 data for %s, ECI 0/20\n",
|
||||
&& (symbology == BARCODE_QRCODE || symbology == BARCODE_MICROQR || symbology == BARCODE_RMQR || symbology == BARCODE_UPNQR)) {
|
||||
if (symbology == BARCODE_UPNQR) { // Note need to add "force binary mode" to BWIPP for this to work
|
||||
if (utf8_to_eci(4, data, converted, p_data_len) != 0) {
|
||||
fprintf(stderr, "i:%d testUtilBwippUtf8Convert: failed to convert UTF-8 data for %s, ECI 4\n",
|
||||
index, testUtilBarcodeName(symbology));
|
||||
return NULL;
|
||||
}
|
||||
// NOTE: not setting *p_eci = 20
|
||||
*p_eci = 4;
|
||||
} else {
|
||||
if (utf8_to_eci(0, data, converted, p_data_len) != 0) {
|
||||
if (utf8_to_eci(20, data, converted, p_data_len) != 0) {
|
||||
fprintf(stderr, "i:%d testUtilBwippUtf8Convert: failed to convert UTF-8 data for %s, ECI 0/20\n",
|
||||
index, testUtilBarcodeName(symbology));
|
||||
return NULL;
|
||||
}
|
||||
// NOTE: not setting *p_eci = 20
|
||||
}
|
||||
}
|
||||
return (char *) converted;
|
||||
}
|
||||
@ -3322,7 +3331,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
|
||||
{ "", BARCODE_CHANNEL, 140, },
|
||||
{ "", BARCODE_CODEONE, 141, },
|
||||
{ "", BARCODE_GRIDMATRIX, 142, },
|
||||
{ "", BARCODE_UPNQR, 143, },
|
||||
{ "QRCode", BARCODE_UPNQR, 143, },
|
||||
{ "", BARCODE_ULTRA, 144, },
|
||||
{ "", BARCODE_RMQR, 145, },
|
||||
};
|
||||
|
@ -32,6 +32,7 @@ run_zxingcpp_test "test_qr" "qr_input"
|
||||
run_zxingcpp_test "test_qr" "qr_optimize"
|
||||
run_zxingcpp_test "test_qr" "qr_encode"
|
||||
run_zxingcpp_test "test_qr" "qr_encode_segs"
|
||||
run_zxingcpp_test "test_qr" "upnqr_encode"
|
||||
run_zxingcpp_test "test_rss" "binary_div_modulo_divisor"
|
||||
run_zxingcpp_test "test_rss" "examples"
|
||||
run_zxingcpp_test "test_upcean" "upce_input"
|
||||
|
@ -342,7 +342,7 @@ extern "C" {
|
||||
/* Maximum number of segments allowed for (`seg_count`) */
|
||||
#define ZINT_MAX_SEG_COUNT 256
|
||||
|
||||
/* Debug flags (debug) */
|
||||
/* Debug flags (`symbol->debug`) */
|
||||
#define ZINT_DEBUG_PRINT 0x0001 /* Print debug info (if any) to stdout */
|
||||
#define ZINT_DEBUG_TEST 0x0002 /* For internal test use only */
|
||||
|
||||
|
@ -878,9 +878,9 @@ namespace Zint {
|
||||
If `autoHeight` set then `--height=` option will not be emitted.
|
||||
If HEIGHTPERROW_MODE set and non-zero `heightPerRow` given then use that for height instead of internal
|
||||
height */
|
||||
QString QZint::getAsCLI(const bool win, const bool longOptOnly, const bool barcodeNames,
|
||||
QString QZint::getAsCLI(const bool win, const bool longOptOnly, const bool barcodeNames, const bool noEXE,
|
||||
const bool autoHeight, const float heightPerRow, const QString& outfile) const {
|
||||
QString cmd(win ? QSL("zint.exe") : QSL("zint"));
|
||||
QString cmd(win && !noEXE ? QSL("zint.exe") : QSL("zint"));
|
||||
|
||||
char name_buf[32];
|
||||
if (barcodeNames && ZBarcode_BarcodeName(m_symbol, name_buf) == 0) {
|
||||
@ -898,11 +898,28 @@ namespace Zint {
|
||||
arg_color(cmd, "--bg=", bgColor());
|
||||
}
|
||||
|
||||
bool default_bind = false, default_box = false, default_border = false;
|
||||
if (m_symbol == BARCODE_ITF14) {
|
||||
if ((borderType() & BARCODE_BOX) && borderWidth() == 5) {
|
||||
default_bind = default_box = default_border = true;
|
||||
}
|
||||
} else if (m_symbol == BARCODE_CODABLOCKF || m_symbol == BARCODE_CODE16K || m_symbol == BARCODE_CODE49) {
|
||||
if ((borderType() & BARCODE_BIND) && borderWidth() == 1) {
|
||||
default_bind = default_border = true;
|
||||
}
|
||||
}
|
||||
|
||||
arg_bool(cmd, "--binary", (inputMode() & 0x07) == DATA_MODE);
|
||||
arg_bool(cmd, "--bind", (borderType() & BARCODE_BIND) && !(borderType() & BARCODE_BOX));
|
||||
if (!default_bind) {
|
||||
arg_bool(cmd, "--bind", (borderType() & BARCODE_BIND) && !(borderType() & BARCODE_BOX));
|
||||
}
|
||||
arg_bool(cmd, "--bold", fontSetting() & BOLD_TEXT);
|
||||
arg_int(cmd, "--border=", borderWidth());
|
||||
arg_bool(cmd, "--box", borderType() & BARCODE_BOX);
|
||||
if (!default_border) {
|
||||
arg_int(cmd, "--border=", borderWidth());
|
||||
}
|
||||
if (!default_box) {
|
||||
arg_bool(cmd, "--box", borderType() & BARCODE_BOX);
|
||||
}
|
||||
arg_bool(cmd, "--cmyk", cmyk());
|
||||
|
||||
if (m_symbol == BARCODE_DBAR_EXPSTK || m_symbol == BARCODE_DBAR_EXPSTK_CC
|
||||
|
@ -202,7 +202,8 @@ public:
|
||||
If HEIGHTPERROW_MODE set and non-zero `heightPerRow` given then use that for height instead of internal
|
||||
height */
|
||||
QString getAsCLI(const bool win, const bool longOptOnly = false, const bool barcodeNames = false,
|
||||
const bool autoHeight = false, const float heightPerRow = 0.0f, const QString& outfile = "") const;
|
||||
const bool noEXE = false, const bool autoHeight = false, const float heightPerRow = 0.0f,
|
||||
const QString& outfile = "") const;
|
||||
|
||||
signals:
|
||||
void encoded();
|
||||
|
@ -506,6 +506,7 @@ private slots:
|
||||
QTest::addColumn<QString>("expected_win");
|
||||
QTest::addColumn<QString>("expected_longOptOnly");
|
||||
QTest::addColumn<QString>("expected_barcodeNames");
|
||||
QTest::addColumn<QString>("expected_noexe");
|
||||
|
||||
QTest::newRow("BARCODE_AUSPOST") << true << 0.0f << ""
|
||||
<< BARCODE_AUSPOST << DATA_MODE // symbology-inputMode
|
||||
@ -518,7 +519,8 @@ private slots:
|
||||
<< "zint -b 63 --binary --compliantheight -d '12345678'"
|
||||
<< "zint.exe -b 63 --binary --compliantheight -d \"12345678\""
|
||||
<< "zint --barcode=63 --binary --compliantheight --data='12345678'"
|
||||
<< "zint -b AUSPOST --binary --compliantheight -d '12345678'";
|
||||
<< "zint -b AUSPOST --binary --compliantheight -d '12345678'"
|
||||
<< "zint -b 63 --binary --compliantheight -d \"12345678\"";
|
||||
|
||||
QTest::newRow("BARCODE_AZTEC") << false << 0.0f << ""
|
||||
<< BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode
|
||||
@ -532,7 +534,7 @@ private slots:
|
||||
" --secure=1 --structapp='1,2,as\"dfa'\\''sdf' --vwhitesp=3 -w 2"
|
||||
<< "zint.exe -b 92 --cmyk --eci=7 -d \"12345678Ж0%var%\" --dotsize=0.9 --dotty --fg=0000FF --scale=4"
|
||||
" --secure=1 --structapp=\"1,2,as\\\"dfa'sdf\" --vwhitesp=3 -w 2"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_C25INTER") << true << 0.0f << ""
|
||||
<< BARCODE_C25INTER << UNICODE_MODE // symbology-inputMode
|
||||
@ -544,7 +546,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 3 --compliantheight -d '12345' --small --vers=2"
|
||||
<< "zint.exe -b 3 --compliantheight -d \"12345\" --small --vers=2"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_CHANNEL") << false << 0.0f << ""
|
||||
<< BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode
|
||||
@ -558,7 +560,7 @@ private slots:
|
||||
" --rotate=90 --verbose --vers=7"
|
||||
<< "zint.exe -b 140 --bind --bold --border=2 -d \"453678\" --height=19.7 --nobackground --quietzones"
|
||||
" --rotate=90 --verbose --vers=7"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_GS1_128_CC") << false << 0.0f << ""
|
||||
<< BARCODE_GS1_128_CC << UNICODE_MODE // symbology-inputMode
|
||||
@ -572,7 +574,7 @@ private slots:
|
||||
" --primary='[01]12345678901231[15]121212' --quietzones --scale=3.5"
|
||||
<< "zint.exe -b 131 --compliantheight -d \"[11]901222[99]ABCDE\" --height=71.142 --mode=3 --notext"
|
||||
" --primary=\"[01]12345678901231[15]121212\" --quietzones --scale=3.5"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_CODE16K") << false << 11.7f << ""
|
||||
<< BARCODE_CODE16K << (UNICODE_MODE | HEIGHTPERROW_MODE) // symbology-inputMode
|
||||
@ -582,11 +584,11 @@ private slots:
|
||||
<< false << 1 << 1 << 0 << 0 << SMALL_TEXT // cmyk-fontSetting
|
||||
<< true << false << false << true << true << 0 // showText-rotateAngle
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 23 --bind --border=1 --compliantheight -d '12345678901234567890123456789012'"
|
||||
<< "zint -b 23 --compliantheight -d '12345678901234567890123456789012'"
|
||||
" --height=11.7 --heightperrow --noquietzones --rows=4 --separator=2 --small"
|
||||
<< "zint.exe -b 23 --bind --border=1 --compliantheight -d \"12345678901234567890123456789012\""
|
||||
<< "zint.exe -b 23 --compliantheight -d \"12345678901234567890123456789012\""
|
||||
" --height=11.7 --heightperrow --noquietzones --rows=4 --separator=2 --small"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_CODE49") << true << 0.0f << ""
|
||||
<< BARCODE_CODE49 << UNICODE_MODE // symbology-inputMode
|
||||
@ -598,7 +600,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 24 --compliantheight -d '12345678901234567890'"
|
||||
<< "zint.exe -b 24 --compliantheight -d \"12345678901234567890\""
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_CODABLOCKF") << true << 0.0f << ""
|
||||
<< BARCODE_CODABLOCKF << (DATA_MODE | ESCAPE_MODE) // symbology-inputMode
|
||||
@ -612,7 +614,7 @@ private slots:
|
||||
" --rows=2 --scale=3 --separator=3"
|
||||
<< "zint.exe -b 74 --binary --border=4 --box --cols=5 --compliantheight -d \"T\\n\\xA0t\\\\\"\" --esc --init"
|
||||
" --rows=2 --scale=3 --separator=3"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_DAFT") << false << 0.0f << ""
|
||||
<< BARCODE_DAFT << UNICODE_MODE // symbology-inputMode
|
||||
@ -624,7 +626,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 93 --bg=BFBEBDBC -d 'daft' --fg=30313233 --height=9.2 --vers=251"
|
||||
<< "zint.exe -b 93 --bg=BFBEBDBC -d \"daft\" --fg=30313233 --height=9.2 --vers=251"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_DATAMATRIX") << true << 0.0f << ""
|
||||
<< BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode
|
||||
@ -636,7 +638,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 71 -d '[20]12' --gs1 --gssep --square"
|
||||
<< "zint.exe -b 71 -d \"[20]12\" --gs1 --gssep --square"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_DATAMATRIX") << false << 0.0f << ""
|
||||
<< BARCODE_DATAMATRIX << (DATA_MODE | ESCAPE_MODE | FAST_MODE) // symbology-inputMode
|
||||
@ -648,7 +650,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 71 --binary -d 'ABCDEFGH\\x01I' --esc --fast"
|
||||
<< "zint.exe -b 71 --binary -d \"ABCDEFGH\\x01I\" --esc --fast"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_DBAR_EXPSTK_CC") << false << 40.8f << ""
|
||||
<< BARCODE_DBAR_EXPSTK_CC << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode
|
||||
@ -662,7 +664,7 @@ private slots:
|
||||
" --primary='[91]ABCDEFGHIJKL' --rows=2"
|
||||
<< "zint.exe -b 139 --binary --compliantheight -d \"[11]901222[99]ABCDE\" --height=40.8 --heightperrow"
|
||||
" --primary=\"[91]ABCDEFGHIJKL\" --rows=2"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_DOTCODE") << false << 1.0f << ""
|
||||
<< BARCODE_DOTCODE << GS1_MODE // symbology-inputMode
|
||||
@ -674,7 +676,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 115 --cols=8 -d '[20]01' --dotsize=0.7 --gs1 --mask=0"
|
||||
<< "zint.exe -b 115 --cols=8 -d \"[20]01\" --dotsize=0.7 --gs1 --mask=0"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_EANX") << true << 0.0f << ""
|
||||
<< BARCODE_EANX << UNICODE_MODE // symbology-inputMode
|
||||
@ -686,7 +688,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 13 --addongap=8 --compliantheight -d '123456789012+12' --guarddescent=0"
|
||||
<< "zint.exe -b 13 --addongap=8 --compliantheight -d \"123456789012+12\" --guarddescent=0"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_GRIDMATRIX") << false << 0.0f << ""
|
||||
<< BARCODE_GRIDMATRIX << UNICODE_MODE // symbology-inputMode
|
||||
@ -698,7 +700,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 142 -d 'Your Data Here!' --quietzones --rotate=270 --scale=0.5 --secure=1 --vers=5"
|
||||
<< "zint.exe -b 142 -d \"Your Data Here!\" --quietzones --rotate=270 --scale=0.5 --secure=1 --vers=5"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_HANXIN") << false << 0.0f << ""
|
||||
<< BARCODE_HANXIN << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode
|
||||
@ -710,7 +712,7 @@ private slots:
|
||||
<< 29 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 116 --eci=29 -d 'éβÿ啊\\e\"'\\''' --esc --mask=0 --secure=2 --vers=5"
|
||||
<< "zint.exe -b 116 --eci=29 -d \"éβÿ啊\\e\\\"'\" --esc --mask=0 --secure=2 --vers=5"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_HIBC_DM") << false << 10.0f << ""
|
||||
<< BARCODE_HIBC_DM << UNICODE_MODE // symbology-inputMode
|
||||
@ -722,7 +724,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 102 -d '1234' --dmre --vers=8"
|
||||
<< "zint.exe -b 102 -d \"1234\" --dmre --vers=8"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_HIBC_PDF") << false << 0.0f << ""
|
||||
<< BARCODE_HIBC_PDF << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode
|
||||
@ -736,7 +738,7 @@ private slots:
|
||||
" --rows=10 --scale=10 --secure=3 --structapp=1,2"
|
||||
<< "zint.exe -b 106 --binary --cols=4 -d \"TEXT\" --height=3.5 --heightperrow --quietzones"
|
||||
" --rows=10 --scale=10 --secure=3 --structapp=1,2"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_ITF14") << true << 0.0f << ""
|
||||
<< BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode
|
||||
@ -748,7 +750,19 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 89 --compliantheight -d '9212320967145'"
|
||||
<< "zint.exe -b 89 --compliantheight -d \"9212320967145\""
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_ITF14") << true << 0.0f << ""
|
||||
<< BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode
|
||||
<< "9212320967145" << "" // text-primary
|
||||
<< 30.0f << -1 << 0 << 0 << 1.0f << false << 0.8f // height-dotSize
|
||||
<< 5.0f << 0 << 0 << "" << QColor(Qt::black) << QColor(Qt::white) // guardDescent-bgColor
|
||||
<< false << 0 << 1 << 0 << 0 << 0 // cmyk-fontSetting
|
||||
<< true << false << false << false << true << 0 // showText-rotateAngle
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 89 --border=1 --compliantheight -d '9212320967145'"
|
||||
<< "zint.exe -b 89 --border=1 --compliantheight -d \"9212320967145\""
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_MAXICODE") << true << 0.0f << ""
|
||||
<< BARCODE_MAXICODE << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode
|
||||
@ -763,7 +777,7 @@ private slots:
|
||||
" --esc --primary='152382802840001' --quietzones --scale=2.5 --scmvv=96"
|
||||
<< "zint.exe -b 57 -d \"1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G1 MAIN ST\\GTOWN\\GNY\\R\\E\""
|
||||
" --esc --primary=\"152382802840001\" --quietzones --scale=2.5 --scmvv=96"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_MICROQR") << false << 0.0f << ""
|
||||
<< BARCODE_MICROQR << UNICODE_MODE // symbology-inputMode
|
||||
@ -775,7 +789,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 97 -d '1234' --fullmultibyte --mask=3 --secure=2 --vers=3"
|
||||
<< "zint.exe -b 97 -d \"1234\" --fullmultibyte --mask=3 --secure=2 --vers=3"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_QRCODE") << true << 0.0f << ""
|
||||
<< BARCODE_QRCODE << GS1_MODE // symbology-inputMode
|
||||
@ -789,7 +803,7 @@ private slots:
|
||||
" --secure=1 --vers=5"
|
||||
<< "zint.exe -b 58 -d \"(01)12\" --fullmultibyte --gs1 --gs1parens --gs1nocheck --mask=0 --quietzones"
|
||||
" --secure=1 --vers=5"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_RMQR") << true << 0.0f << ""
|
||||
<< BARCODE_RMQR << UNICODE_MODE // symbology-inputMode
|
||||
@ -801,7 +815,7 @@ private slots:
|
||||
<< 20 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 145 --eci=20 -d 'テ' --rotate=180 --vers=8"
|
||||
<< "zint.exe -b 145 --eci=20 -d \"テ\" --rotate=180 --vers=8"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_ULTRA") << false << 0.0f << ""
|
||||
<< BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode
|
||||
@ -813,7 +827,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 144 -d '(01)1' --gs1 --gs1parens --gs1nocheck --secure=6 --structapp='1,2,4' --vers=2"
|
||||
<< "zint.exe -b 144 -d \"(01)1\" --gs1 --gs1parens --gs1nocheck --secure=6 --structapp=\"1,2,4\" --vers=2"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
|
||||
QTest::newRow("BARCODE_UPCE_CC") << true << 0.0f << "out.svg"
|
||||
<< BARCODE_UPCE_CC << UNICODE_MODE // symbology-inputMode
|
||||
@ -830,7 +844,9 @@ private slots:
|
||||
<< "zint --barcode=136 --bold --compliantheight --data='[11]901222[99]ABCDE' --fg=EF2929"
|
||||
" --guarddescent=6.5 --noquietzones --output='out.svg' --primary='12345670+1234' --small --werror"
|
||||
<< "zint -b UPCE_CC --bold --compliantheight -d '[11]901222[99]ABCDE' --fg=EF2929 --guarddescent=6.5"
|
||||
" --noquietzones -o 'out.svg' --primary='12345670+1234' --small --werror";
|
||||
" --noquietzones -o 'out.svg' --primary='12345670+1234' --small --werror"
|
||||
<< "zint -b 136 --bold --compliantheight -d \"[11]901222[99]ABCDE\" --fg=EF2929 --guarddescent=6.5"
|
||||
" --noquietzones -o \"out.svg\" --primary=\"12345670+1234\" --small --werror";
|
||||
|
||||
QTest::newRow("BARCODE_VIN") << false << 2.0f << ""
|
||||
<< BARCODE_VIN << UNICODE_MODE // symbology-inputMode
|
||||
@ -842,7 +858,7 @@ private slots:
|
||||
<< 0 << false << false << false << WARN_DEFAULT << false // eci-debug
|
||||
<< "zint -b 73 -d '12345678701234567' --height=20 --vers=1"
|
||||
<< "zint.exe -b 73 -d \"12345678701234567\" --height=20 --vers=1"
|
||||
<< "" << "";
|
||||
<< "" << "" << "";
|
||||
}
|
||||
|
||||
void getAsCLITest()
|
||||
@ -895,6 +911,7 @@ private slots:
|
||||
QFETCH(QString, expected_win);
|
||||
QFETCH(QString, expected_longOptOnly);
|
||||
QFETCH(QString, expected_barcodeNames);
|
||||
QFETCH(QString, expected_noexe);
|
||||
|
||||
bc.setSymbol(symbology);
|
||||
bc.setInputMode(inputMode);
|
||||
@ -934,25 +951,31 @@ private slots:
|
||||
bc.setWarnLevel(warnLevel);
|
||||
bc.setDebug(debug);
|
||||
|
||||
cmd = bc.getAsCLI(false /*win*/, false /*longOptOnly*/, false /*barcodeNames*/,
|
||||
cmd = bc.getAsCLI(false /*win*/, false /*longOptOnly*/, false /*barcodeNames*/, false /*noEXE*/,
|
||||
autoHeight, heightPerRow, outfile);
|
||||
QCOMPARE(cmd, expected_cmd);
|
||||
|
||||
cmd = bc.getAsCLI(true /*win*/, false /*longOptOnly*/, false /*barcodeNames*/,
|
||||
cmd = bc.getAsCLI(true /*win*/, false /*longOptOnly*/, false /*barcodeNames*/, false /*noEXE*/,
|
||||
autoHeight, heightPerRow, outfile);
|
||||
QCOMPARE(cmd, expected_win);
|
||||
|
||||
if (!expected_longOptOnly.isEmpty()) {
|
||||
cmd = bc.getAsCLI(false /*win*/, true /*longOptOnly*/, false /*barcodeNames*/,
|
||||
cmd = bc.getAsCLI(false /*win*/, true /*longOptOnly*/, false /*barcodeNames*/, false /*noEXE*/,
|
||||
autoHeight, heightPerRow, outfile);
|
||||
QCOMPARE(cmd, expected_longOptOnly);
|
||||
}
|
||||
|
||||
if (!expected_barcodeNames.isEmpty()) {
|
||||
cmd = bc.getAsCLI(false /*win*/, false /*longOptOnly*/, true /*barcodeNames*/,
|
||||
cmd = bc.getAsCLI(false /*win*/, false /*longOptOnly*/, true /*barcodeNames*/, false /*noEXE*/,
|
||||
autoHeight, heightPerRow, outfile);
|
||||
QCOMPARE(cmd, expected_barcodeNames);
|
||||
}
|
||||
|
||||
if (!expected_noexe.isEmpty()) {
|
||||
cmd = bc.getAsCLI(true /*win*/, false /*longOptOnly*/, false /*barcodeNames*/, true /*noEXE*/,
|
||||
autoHeight, heightPerRow, outfile);
|
||||
QCOMPARE(cmd, expected_noexe);
|
||||
}
|
||||
}
|
||||
|
||||
void getAsCLISegsTest()
|
||||
|
@ -145,6 +145,8 @@
|
||||
- Added -segN options
|
||||
- Added "invariant" and "binary" ECIs
|
||||
- Tcl_GetIndexFromObj() flags arg -> 0
|
||||
2022-05-12 GL
|
||||
- -vers maximum changed to 999 (DAFT)
|
||||
*/
|
||||
|
||||
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
||||
@ -521,6 +523,7 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
|
||||
" -structapp {index count ?id?}: set Structured Append info\n"
|
||||
/* cli option --types not supported */
|
||||
" -vers integer: Symbology option\n"
|
||||
/* cli option --version not supported */
|
||||
" -vwhitesp integer: vertical quiet zone in modules\n"
|
||||
" -whitesp integer: horizontal quiet zone in modules\n"
|
||||
" -werror bool: Convert all warnings into errors\n"
|
||||
@ -1033,6 +1036,7 @@ static int Encode(Tcl_Interp *interp, int objc,
|
||||
case iFG:
|
||||
strncpy(my_symbol->fgcolour, pStr, lStr);
|
||||
my_symbol->fgcolour[lStr]='\0';
|
||||
printf("my_symbol->fgcolour %s\n", my_symbol->fgcolour);
|
||||
break;
|
||||
case iBG:
|
||||
strncpy(my_symbol->bgcolour, pStr, lStr);
|
||||
@ -1138,7 +1142,7 @@ static int Encode(Tcl_Interp *interp, int objc,
|
||||
/* >> Int in Option 2 */
|
||||
if (intValue < 1
|
||||
|| (optionIndex==iCols && intValue > 200)
|
||||
|| (optionIndex==iVers && intValue > 47))
|
||||
|| (optionIndex==iVers && intValue > 999))
|
||||
{
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_NewStringObj("cols/vers out of range", -1));
|
||||
|
@ -96,8 +96,8 @@ static void types(void) {
|
||||
);
|
||||
}
|
||||
|
||||
/* Output usage information */
|
||||
static void usage(void) {
|
||||
/* Output version information */
|
||||
static void version(void) {
|
||||
const int zint_version = ZBarcode_Version();
|
||||
const int version_major = zint_version / 10000;
|
||||
const int version_minor = (zint_version % 10000) / 100;
|
||||
@ -113,6 +113,11 @@ static void usage(void) {
|
||||
/* This is a stable release */
|
||||
printf("Zint version %d.%d.%d\n", version_major, version_minor, version_release);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output usage information */
|
||||
static void usage(void) {
|
||||
version();
|
||||
|
||||
printf( "Encode input data in a barcode and save as BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT\n\n"
|
||||
" -b, --barcode=TYPE Number or name of barcode type. Default is 20 (CODE128)\n"
|
||||
@ -172,6 +177,7 @@ static void usage(void) {
|
||||
" --structapp=I,C[,ID] Set Structured Append info (I index, C count)\n"
|
||||
" -t, --types Display table of barcode types\n"
|
||||
" --vers=NUMBER Set symbol version (size, check digits, other options)\n"
|
||||
" --version Display Zint version\n"
|
||||
" --vwhitesp=NUMBER Set height of vertical whitespace in multiples of X-dim\n"
|
||||
" -w, --whitesp=NUMBER Set width of horizontal whitespace in multiples of X-dim\n"
|
||||
" --werror Convert all warnings into errors\n"
|
||||
@ -900,7 +906,7 @@ int main(int argc, char **argv) {
|
||||
OPT_ROTATE, OPT_ROWS, OPT_SCALE, OPT_SCMVV, OPT_SECURE,
|
||||
OPT_SEG1, OPT_SEG2, OPT_SEG3, OPT_SEG4, OPT_SEG5, OPT_SEG6, OPT_SEG7, OPT_SEG8, OPT_SEG9,
|
||||
OPT_SEPARATOR, OPT_SMALL, OPT_SQUARE, OPT_STRUCTAPP,
|
||||
OPT_VERBOSE, OPT_VERS, OPT_VWHITESP, OPT_WERROR,
|
||||
OPT_VERBOSE, OPT_VERS, OPT_VERSION, OPT_VWHITESP, OPT_WERROR,
|
||||
};
|
||||
int option_index = 0;
|
||||
static const struct option long_options[] = {
|
||||
@ -971,6 +977,7 @@ int main(int argc, char **argv) {
|
||||
{"types", 0, NULL, 't'},
|
||||
{"verbose", 0, NULL, OPT_VERBOSE}, // Currently undocumented, output some debug info
|
||||
{"vers", 1, NULL, OPT_VERS},
|
||||
{"version", 0, NULL, OPT_VERSION},
|
||||
{"vwhitesp", 1, NULL, OPT_VWHITESP},
|
||||
{"werror", 0, NULL, OPT_WERROR},
|
||||
{"whitesp", 1, NULL, 'w'},
|
||||
@ -1335,10 +1342,10 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "Error 133: Invalid version value (digits only)\n");
|
||||
return do_exit(1);
|
||||
}
|
||||
if ((val >= 1) && (val <= 84)) {
|
||||
if ((val >= 1) && (val <= 999)) {
|
||||
my_symbol->option_2 = val;
|
||||
} else {
|
||||
fprintf(stderr, "Warning 113: Version value out of range (1 to 84), ignoring\n");
|
||||
fprintf(stderr, "Warning 113: Version value out of range (1 to 999), ignoring\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
break;
|
||||
@ -1363,6 +1370,11 @@ int main(int argc, char **argv) {
|
||||
help = 1;
|
||||
break;
|
||||
|
||||
case OPT_VERSION:
|
||||
version();
|
||||
help = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
types();
|
||||
help = 1;
|
||||
|
@ -762,7 +762,7 @@ static void test_checks(int index, int debug) {
|
||||
/* 29*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, "Error 128: Invalid separator value (digits only)" },
|
||||
/* 30*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, "Warning 127: Separator value out of range (0 to 4), ignoring" },
|
||||
/* 31*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, "Error 133: Invalid version value (digits only)" },
|
||||
/* 32*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, "Warning 113: Version value out of range (1 to 84), ignoring" },
|
||||
/* 32*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1000, -1, -1, "Warning 113: Version value out of range (1 to 999), ignoring" },
|
||||
/* 33*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, "Error 153: Invalid vertical whitespace value '-2' (digits only)" },
|
||||
/* 34*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, -1, "Warning 154: Vertical whitespace value out of range (0 to 1000), ignoring" },
|
||||
/* 35*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, "Error 120: Invalid horizontal whitespace value '-2' (digits only)" },
|
||||
@ -1000,11 +1000,11 @@ static void test_other_opts(int index, int debug) {
|
||||
/* 0*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900", "" },
|
||||
/* 1*/ { BARCODE_CODE128, "1", -1, " -bg=", "EF9900", "" },
|
||||
/* 2*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900AA", "" },
|
||||
/* 3*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 654: Malformed background colour target" },
|
||||
/* 3*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 654: Malformed background colour 'GF9900' (hexadecimal only)" },
|
||||
/* 4*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000", "" },
|
||||
/* 5*/ { BARCODE_CODE128, "1", -1, " --fg=", "00000000", "" },
|
||||
/* 6*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 651: Malformed foreground colour target" },
|
||||
/* 7*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 653: Malformed foreground colour target" },
|
||||
/* 6*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 651: Malformed foreground colour (6 or 8 characters only)" },
|
||||
/* 7*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 653: Malformed foreground colour '000000FG' (hexadecimal only)" },
|
||||
/* 8*/ { BARCODE_CODE128, "1", -1, " --compliantheight", "", "" },
|
||||
/* 9*/ { BARCODE_CODE128, "1", -1, " --fontsize=", "10", "" },
|
||||
/* 10*/ { BARCODE_CODE128, "1", -1, " --fontsize=", "101", "Warning 126: Font size out of range (0 to 100), ignoring" },
|
||||
|
@ -17,8 +17,8 @@ else()
|
||||
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extSequence.ui extExport.ui)
|
||||
endif()
|
||||
|
||||
# grpAztec.ui grpC39.ui grpCodablockF.ui grpDotCode.ui grpMaxicode.ui grpQR.ui grpVIN.ui
|
||||
# grpC11.ui grpC49.ui grpCodeOne.ui grpGrid.ui grpMicroPDF.ui grpRMQR.ui
|
||||
# grpAztec.ui grpC39.ui grpCodablockF.ui grpDotCode.ui grpMaxicode.ui grpQR.ui grpUPNQR.ui
|
||||
# grpC11.ui grpC49.ui grpCodeOne.ui grpGrid.ui grpMicroPDF.ui grpRMQR.ui grpVIN.ui
|
||||
# grpC128.ui grpC93.ui grpDAFT.ui grpHX.ui grpMQR.ui grpUltra.ui
|
||||
# grpC16k.ui grpChannel.ui grpDBExtend.ui grpITF14.ui grpMSICheck.ui grpUPCA.ui
|
||||
# grpC25.ui grpCodabar.ui grpDM.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -16,7 +16,6 @@
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
//#include <QDebug>
|
||||
#include <QSettings>
|
||||
@ -50,11 +49,14 @@ CLIWindow::CLIWindow(BarcodeItem *bc, const bool autoHeight, const double height
|
||||
#endif
|
||||
if (index == 1) {
|
||||
radCLIWin->setChecked(true);
|
||||
chkCLINoEXE->setEnabled(true);
|
||||
} else {
|
||||
radCLIUnix->setChecked(true);
|
||||
chkCLINoEXE->setEnabled(false);
|
||||
}
|
||||
chkCLILongOpts->setChecked(settings.value(QSL("studio/cli/chk_long_opts"), 0).toInt() ? true : false);
|
||||
chkCLIBarcodeName->setChecked(settings.value(QSL("studio/cli/chk_barcode_name"), 0).toInt() ? true : false);
|
||||
chkCLINoEXE->setChecked(settings.value(QSL("studio/cli/chk_no_exe"), 0).toInt() ? true : false);
|
||||
|
||||
QIcon copyIcon(QIcon::fromTheme(QSL("edit-copy"), QIcon(QSL(":res/copy.svg"))));
|
||||
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
|
||||
@ -67,6 +69,7 @@ CLIWindow::CLIWindow(BarcodeItem *bc, const bool autoHeight, const double height
|
||||
connect(radCLIWin, SIGNAL(toggled( bool )), SLOT(generate_cli()));
|
||||
connect(chkCLILongOpts, SIGNAL(toggled( bool )), SLOT(generate_cli()));
|
||||
connect(chkCLIBarcodeName, SIGNAL(toggled( bool )), SLOT(generate_cli()));
|
||||
connect(chkCLINoEXE, SIGNAL(toggled( bool )), SLOT(generate_cli()));
|
||||
|
||||
generate_cli();
|
||||
}
|
||||
@ -81,6 +84,7 @@ CLIWindow::~CLIWindow()
|
||||
settings.setValue(QSL("studio/cli/rad_unix_win"), radCLIWin->isChecked() ? 1 : 0);
|
||||
settings.setValue(QSL("studio/cli/chk_long_opts"), chkCLILongOpts->isChecked() ? 1 : 0);
|
||||
settings.setValue(QSL("studio/cli/chk_barcode_name"), chkCLIBarcodeName->isChecked() ? 1 : 0);
|
||||
settings.setValue(QSL("studio/cli/chk_no_exe"), chkCLINoEXE->isChecked() ? 1 : 0);
|
||||
}
|
||||
|
||||
void CLIWindow::copy_to_clipboard()
|
||||
@ -94,9 +98,18 @@ void CLIWindow::copy_to_clipboard()
|
||||
|
||||
void CLIWindow::generate_cli()
|
||||
{
|
||||
bool noEXE = false;
|
||||
if (radCLIWin->isChecked()) {
|
||||
noEXE = chkCLINoEXE->isChecked();
|
||||
chkCLINoEXE->setEnabled(true);
|
||||
} else {
|
||||
chkCLINoEXE->setEnabled(false);
|
||||
}
|
||||
QString cmd = m_bc->bc.getAsCLI(radCLIWin->isChecked(), chkCLILongOpts->isChecked(),
|
||||
chkCLIBarcodeName->isChecked(), m_autoHeight, m_heightPerRow);
|
||||
chkCLIBarcodeName->isChecked(), noEXE, m_autoHeight, m_heightPerRow);
|
||||
|
||||
txtCLICmd->setPlainText(cmd);
|
||||
statusBarCLI->clearMessage();
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
@ -113,6 +113,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkCLINoEXE">
|
||||
<property name="text">
|
||||
<string>&No .exe (Windows)</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Do not add ".exe" extension to zint command
|
||||
(Windows only, ignored is disabled)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -51,8 +51,8 @@
|
||||
<string>Subset &C Suppression</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Do not begin in Subset C mode,
|
||||
even if initial data is numeric</string>
|
||||
<string>Do not use Subset C mode
|
||||
(numeric compression)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
112
frontend_qt/grpUPNQR.ui
Normal file
112
frontend_qt/grpUPNQR.ui
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>grpUPNQR</class>
|
||||
<widget class="QWidget" name="grpUPNQR">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>227</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutUPNQR">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayoutUPNQR">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelUPNQRMask">
|
||||
<property name="text">
|
||||
<string>&Mask:</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Manually specify which mask to use</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cmbUPNQRMask</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cmbUPNQRMask">
|
||||
<property name="toolTip">
|
||||
<string>Manually specify which mask to use</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacerQR">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -44,6 +44,17 @@ static const int tempMessageTimeout = 2000;
|
||||
|
||||
static const QKeySequence quitKeySeq(Qt::CTRL | Qt::Key_Q); // Use on Windows also (i.e. not using QKeySequence::Quit)
|
||||
|
||||
static const QKeySequence openCLISeq(Qt::SHIFT | Qt::CTRL | Qt::Key_C);
|
||||
|
||||
static const QKeySequence copyBMPSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_B);
|
||||
static const QKeySequence copyEMFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_E);
|
||||
static const QKeySequence copyGIFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_G);
|
||||
#ifndef NO_PNG
|
||||
static const QKeySequence copyPNGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_P);
|
||||
#endif
|
||||
static const QKeySequence copySVGSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_S);
|
||||
static const QKeySequence copyTIFSeq(Qt::SHIFT | Qt::CTRL | Qt::Key_T);
|
||||
|
||||
struct bstyle_item {
|
||||
const QString text;
|
||||
int symbology;
|
||||
@ -124,7 +135,8 @@ static const struct bstyle_item bstyle_items[] = {
|
||||
};
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
: QWidget(parent, fl), m_optionWidget(nullptr), m_symbology(0), m_saveAsShortcut(nullptr), m_menu(nullptr),
|
||||
: QWidget(parent, fl), m_optionWidget(nullptr), m_symbology(0),
|
||||
m_menu(nullptr),
|
||||
m_lblHeightPerRow(nullptr), m_spnHeightPerRow(nullptr),
|
||||
m_btnHeightPerRowDisable(nullptr), m_btnHeightPerRowDefault(nullptr)
|
||||
{
|
||||
@ -263,8 +275,26 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
|
||||
connect(errtxtBar, SIGNAL(customContextMenuRequested(const QPoint &)), this,
|
||||
SLOT(errtxtBar_context_menu(const QPoint &)));
|
||||
|
||||
m_saveAsShortcut = new QShortcut(QKeySequence::Save, this); // Will enable/disable this on error
|
||||
// Will enable/disable these on error
|
||||
m_saveAsShortcut = new QShortcut(QKeySequence::Save, this);
|
||||
connect(m_saveAsShortcut, SIGNAL(activated()), SLOT(save()));
|
||||
m_openCLIShortcut = new QShortcut(openCLISeq, this);
|
||||
connect(m_openCLIShortcut, SIGNAL(activated()), SLOT(open_cli_dialog()));
|
||||
m_copyBMPShortcut = new QShortcut(copyBMPSeq, this);
|
||||
connect(m_copyBMPShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_bmp()));
|
||||
m_copyEMFShortcut = new QShortcut(copyEMFSeq, this);
|
||||
connect(m_copyEMFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_emf()));
|
||||
m_copyGIFShortcut = new QShortcut(copyGIFSeq, this);
|
||||
connect(m_copyGIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_gif()));
|
||||
#ifndef NO_PNG
|
||||
m_copyPNGShortcut = new QShortcut(copyPNGSeq, this);
|
||||
connect(m_copyPNGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_png()));
|
||||
#endif
|
||||
m_copySVGShortcut = new QShortcut(copySVGSeq, this);
|
||||
connect(m_copySVGShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_svg()));
|
||||
m_copyTIFShortcut = new QShortcut(copyTIFSeq, this);
|
||||
connect(m_copyTIFShortcut, SIGNAL(activated()), SLOT(copy_to_clipboard_tif()));
|
||||
|
||||
QShortcut *helpShortcut = new QShortcut(QKeySequence::HelpContents, this);
|
||||
connect(helpShortcut, SIGNAL(activated()), SLOT(help()));
|
||||
QShortcut *quitShortcut = new QShortcut(quitKeySeq, this);
|
||||
@ -594,7 +624,8 @@ void MainWindow::open_cli_dialog()
|
||||
void MainWindow::on_fgcolor_clicked()
|
||||
{
|
||||
QColor temp = m_fgcolor;
|
||||
m_fgcolor = QColorDialog::getColor(m_fgcolor, this, tr("Set foreground colour"), QColorDialog::ShowAlphaChannel);
|
||||
m_fgcolor = QColorDialog::getColor(m_fgcolor, this, tr("Set foreground colour"),
|
||||
QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel);
|
||||
if (m_fgcolor.isValid()) {
|
||||
update_preview();
|
||||
} else {
|
||||
@ -605,7 +636,8 @@ void MainWindow::on_fgcolor_clicked()
|
||||
void MainWindow::on_bgcolor_clicked()
|
||||
{
|
||||
QColor temp = m_bgcolor;
|
||||
m_bgcolor = QColorDialog::getColor(m_bgcolor, this, tr("Set background colour"), QColorDialog::ShowAlphaChannel);
|
||||
m_bgcolor = QColorDialog::getColor(m_bgcolor, this, tr("Set background colour"),
|
||||
QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel);
|
||||
if (m_bgcolor.isValid()) {
|
||||
update_preview();
|
||||
} else {
|
||||
@ -983,7 +1015,7 @@ void MainWindow::view_context_menu(const QPoint &pos)
|
||||
menu.addAction(m_copySVGAct);
|
||||
menu.addAction(m_copyTIFAct);
|
||||
menu.addSeparator();
|
||||
menu.addAction(m_CLIAct);
|
||||
menu.addAction(m_openCLIAct);
|
||||
menu.addSeparator();
|
||||
menu.addAction(m_saveAsAct);
|
||||
|
||||
@ -1341,6 +1373,16 @@ void MainWindow::change_options()
|
||||
connect(get_widget(QSL("cmbQRStructAppIndex")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("spnQRStructAppID")), SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
|
||||
} else if (symbology == BARCODE_UPNQR) {
|
||||
QFile file(QSL(":/grpUPNQR.ui"));
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
m_optionWidget = uiload.load(&file);
|
||||
file.close();
|
||||
load_sub_settings(settings, symbology);
|
||||
tabMain->insertTab(1, m_optionWidget, tr("UP&NQR"));
|
||||
connect(get_widget(QSL("cmbUPNQRMask")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
} else if (symbology == BARCODE_RMQR) {
|
||||
QFile file(QSL(":/grpRMQR.ui"));
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
@ -2228,6 +2270,17 @@ void MainWindow::update_preview()
|
||||
}
|
||||
break;
|
||||
|
||||
case BARCODE_UPNQR:
|
||||
m_bc.bc.setSymbol(BARCODE_UPNQR);
|
||||
//eci_not_set = false;
|
||||
cmbECI->setCurrentIndex(2 /*ECI 4*/);
|
||||
//cmbECI->setEnabled(false);
|
||||
//lblECI->setEnabled(false);
|
||||
if ((item_val = get_cmb_index(QSL("cmbUPNQRMask"))) != 0) {
|
||||
m_bc.bc.setOption3((item_val << 8) | m_bc.bc.option3());
|
||||
}
|
||||
break;
|
||||
|
||||
case BARCODE_RMQR:
|
||||
m_bc.bc.setSymbol(BARCODE_RMQR);
|
||||
|
||||
@ -2449,10 +2502,12 @@ void MainWindow::createActions()
|
||||
|
||||
m_copyBMPAct = new QAction(copyIcon, tr("Copy as &BMP"), this);
|
||||
m_copyBMPAct->setStatusTip(tr("Copy to clipboard as BMP"));
|
||||
m_copyBMPAct->setShortcut(copyBMPSeq);
|
||||
connect(m_copyBMPAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_bmp()));
|
||||
|
||||
m_copyEMFAct = new QAction(copyIcon, tr("Copy as E&MF"), this);
|
||||
m_copyEMFAct->setStatusTip(tr("Copy to clipboard as EMF"));
|
||||
m_copyEMFAct->setShortcut(copyEMFSeq);
|
||||
connect(m_copyEMFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_emf()));
|
||||
|
||||
#ifdef MAINWINDOW_COPY_EPS /* TODO: see if can get this to work */
|
||||
@ -2463,6 +2518,7 @@ void MainWindow::createActions()
|
||||
|
||||
m_copyGIFAct = new QAction(copyIcon, tr("Copy as &GIF"), this);
|
||||
m_copyGIFAct->setStatusTip(tr("Copy to clipboard as GIF"));
|
||||
m_copyGIFAct->setShortcut(copyGIFSeq);
|
||||
connect(m_copyGIFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_gif()));
|
||||
|
||||
#ifdef MAINWINDOW_COPY_PCX /* TODO: see if can get this to work */
|
||||
@ -2474,20 +2530,24 @@ void MainWindow::createActions()
|
||||
#ifndef NO_PNG
|
||||
m_copyPNGAct = new QAction(copyIcon, tr("Copy as &PNG"), this);
|
||||
m_copyPNGAct->setStatusTip(tr("Copy to clipboard as PNG"));
|
||||
m_copyPNGAct->setShortcut(copyPNGSeq);
|
||||
connect(m_copyPNGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_png()));
|
||||
#endif
|
||||
|
||||
m_copySVGAct = new QAction(copyIcon, tr("Copy as S&VG"), this);
|
||||
m_copySVGAct->setStatusTip(tr("Copy to clipboard as SVG"));
|
||||
m_copySVGAct->setShortcut(copySVGSeq);
|
||||
connect(m_copySVGAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_svg()));
|
||||
|
||||
m_copyTIFAct = new QAction(copyIcon, tr("Copy as &TIF"), this);
|
||||
m_copyTIFAct->setStatusTip(tr("Copy to clipboard as TIF"));
|
||||
m_copyTIFAct->setShortcut(copyTIFSeq);
|
||||
connect(m_copyTIFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_tif()));
|
||||
|
||||
m_CLIAct = new QAction(cliIcon, tr("C&LI equivalent..."), this);
|
||||
m_CLIAct->setStatusTip(tr("Generate CLI equivalent"));
|
||||
connect(m_CLIAct, SIGNAL(triggered()), this, SLOT(open_cli_dialog()));
|
||||
m_openCLIAct = new QAction(cliIcon, tr("C&LI Equivalent..."), this);
|
||||
m_openCLIAct->setStatusTip(tr("Generate CLI equivalent"));
|
||||
m_openCLIAct->setShortcut(openCLISeq);
|
||||
connect(m_openCLIAct, SIGNAL(triggered()), this, SLOT(open_cli_dialog()));
|
||||
|
||||
m_saveAsAct = new QAction(saveIcon, tr("&Save As..."), this);
|
||||
m_saveAsAct->setStatusTip(tr("Output image to file"));
|
||||
@ -2533,7 +2593,7 @@ void MainWindow::createMenu()
|
||||
m_menu->addAction(m_copyTIFAct);
|
||||
m_menu->addSeparator();
|
||||
|
||||
m_menu->addAction(m_CLIAct);
|
||||
m_menu->addAction(m_openCLIAct);
|
||||
m_menu->addSeparator();
|
||||
m_menu->addAction(m_saveAsAct);
|
||||
m_menu->addSeparator();
|
||||
@ -2563,10 +2623,19 @@ void MainWindow::enableActions(bool enabled)
|
||||
#endif
|
||||
m_copySVGAct->setEnabled(enabled);
|
||||
m_copyTIFAct->setEnabled(enabled);
|
||||
m_CLIAct->setEnabled(enabled);
|
||||
m_openCLIAct->setEnabled(enabled);
|
||||
m_saveAsAct->setEnabled(enabled);
|
||||
|
||||
m_saveAsShortcut->setEnabled(enabled);
|
||||
m_openCLIShortcut->setEnabled(enabled);
|
||||
m_copyBMPShortcut->setEnabled(enabled);
|
||||
m_copyEMFShortcut->setEnabled(enabled);
|
||||
m_copyGIFShortcut->setEnabled(enabled);
|
||||
#ifndef NO_PNG
|
||||
m_copyPNGShortcut->setEnabled(enabled);
|
||||
#endif
|
||||
m_copySVGShortcut->setEnabled(enabled);
|
||||
m_copyTIFShortcut->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void MainWindow::copy_to_clipboard(const QString &filename, const QString& name, const char *mimeType)
|
||||
@ -3061,6 +3130,10 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
|
||||
settings.setValue(QSL("studio/bc/qrcode/structapp_id"), get_spn_val(QSL("spnQRStructAppID")));
|
||||
break;
|
||||
|
||||
case BARCODE_UPNQR:
|
||||
settings.setValue(QSL("studio/bc/upnqr/mask"), get_cmb_index(QSL("cmbUPNQRMask")));
|
||||
break;
|
||||
|
||||
case BARCODE_RMQR:
|
||||
settings.setValue(QSL("studio/bc/rmqr/size"), get_cmb_index(QSL("cmbRMQRSize")));
|
||||
settings.setValue(QSL("studio/bc/rmqr/ecc"), get_cmb_index(QSL("cmbRMQRECC")));
|
||||
@ -3445,6 +3518,10 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
|
||||
set_spn_from_setting(settings, QSL("studio/bc/qrcode/structapp_id"), QSL("spnQRStructAppID"), 0);
|
||||
break;
|
||||
|
||||
case BARCODE_UPNQR:
|
||||
set_cmb_from_setting(settings, QSL("studio/bc/upnqr/mask"), QSL("cmbUPNQRMask"));
|
||||
break;
|
||||
|
||||
case BARCODE_RMQR:
|
||||
set_cmb_from_setting(settings, QSL("studio/bc/rmqr/size"), QSL("cmbRMQRSize"));
|
||||
set_cmb_from_setting(settings, QSL("studio/bc/rmqr/ecc"), QSL("cmbRMQRECC"));
|
||||
|
@ -159,8 +159,17 @@ private:
|
||||
QWidget *m_optionWidget;
|
||||
QGraphicsScene *scene;
|
||||
int m_symbology;
|
||||
QShortcut *m_saveAsShortcut;
|
||||
QMenu *m_menu;
|
||||
QShortcut *m_saveAsShortcut;
|
||||
QShortcut *m_openCLIShortcut;
|
||||
QShortcut *m_copyBMPShortcut;
|
||||
QShortcut *m_copyEMFShortcut;
|
||||
QShortcut *m_copyGIFShortcut;
|
||||
#ifndef NO_PNG
|
||||
QShortcut *m_copyPNGShortcut;
|
||||
#endif
|
||||
QShortcut *m_copySVGShortcut;
|
||||
QShortcut *m_copyTIFShortcut;
|
||||
QAction *m_copyBMPAct;
|
||||
QAction *m_copyEMFAct;
|
||||
QAction *m_copyEPSAct;
|
||||
@ -169,7 +178,7 @@ private:
|
||||
QAction *m_copyPNGAct;
|
||||
QAction *m_copySVGAct;
|
||||
QAction *m_copyTIFAct;
|
||||
QAction *m_CLIAct;
|
||||
QAction *m_openCLIAct;
|
||||
QAction *m_saveAsAct;
|
||||
QAction *m_aboutAct;
|
||||
QAction *m_helpAct;
|
||||
|
@ -28,6 +28,7 @@
|
||||
<file>grpQR.ui</file>
|
||||
<file>grpRMQR.ui</file>
|
||||
<file>grpUltra.ui</file>
|
||||
<file>grpUPNQR.ui</file>
|
||||
<file>grpUPCA.ui</file>
|
||||
<file>grpUPCEAN.ui</file>
|
||||
<file>grpVIN.ui</file>
|
||||
|
Loading…
Reference in New Issue
Block a user