mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-30 14:55:20 -04:00
- AZTEC/CHANNEL/CODABLOCKF/CODE16K/CODE49/CODEONE/DATAMATRIX/
DOTCODE/GRIDMATRIX/HANXIN/MICROPDF417/MICROQR/PDF417/QRCODE/ RMQR/ULTRA: set `option_1/2/3` to values used in encodation ("Feedback options"), and add new access methods `encodedOption1()` etc. to Qt Backend, and use in GUI to provide better feedback on "Automatic" selections - AZTEC: give more precise warnings in low ECC situations, and indicate via `option_1` by setting to -1 (min 3 words), 0 (<5% + 3 words) (`ecc_ratio`) - set_height: fix non-compliance false positives by using epsilon in checks (prompted by CODABLOCKF non-compliant warning for zint-generated compliant height - floating point `rows` mult != `zero_count` div; one test regression for CODE93); better warning messages on non-compliant heights (min/max) - manual/man page: fix DATAMATRIX Sizes tables "28 12x26" -> "27 12x26" - GUI: AZTEC/CODEONE: add Zint versions to comboboxes - DOTCODE: improve error messages re size too small/large - ULTRA: better ZINT_TEST codeword dump (ZINT_DEBUG_TEST) - general: various tabs -> spaces; prettify main .rc files; trailing spaces; small amount of code fiddling (CODE16K)
This commit is contained in:
parent
d0465375bb
commit
d222add96d
68 changed files with 1929 additions and 1497 deletions
|
@ -8,8 +8,8 @@ CONFIG += staticlib
|
|||
#CONFIG += dll
|
||||
|
||||
macx{
|
||||
CONFIG -= dll
|
||||
CONFIG += lib_bundle
|
||||
CONFIG -= dll
|
||||
CONFIG += lib_bundle
|
||||
}
|
||||
|
||||
TARGET = QtZint
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
win32 {
|
||||
TEMPLATE = vclib
|
||||
CONFIG += staticlib debug-and-release
|
||||
TEMPLATE = vclib
|
||||
CONFIG += staticlib debug-and-release
|
||||
}
|
||||
|
||||
TARGET = QtZint2
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
//#include <QDebug>
|
||||
#if 0
|
||||
#include <QDebug>
|
||||
#endif
|
||||
#include <QFontDatabase>
|
||||
#include <QFontMetrics>
|
||||
/* The following include is necessary to compile with Qt 5.15 on Windows; Qt 5.7 did not require it */
|
||||
|
@ -204,6 +206,7 @@ namespace Zint {
|
|||
m_warn_level(WARN_DEFAULT), m_debug(false),
|
||||
m_encodedWidth(0), m_encodedRows(0), m_encodedHeight(0.0f),
|
||||
m_vectorWidth(0.0f), m_vectorHeight(0.0f),
|
||||
m_encodedOption1(-1), m_encodedOption2(0), m_encodedOption3(0),
|
||||
m_error(0),
|
||||
target_size_horiz(0), target_size_vert(0) // Legacy
|
||||
{
|
||||
|
@ -315,10 +318,16 @@ namespace Zint {
|
|||
m_encodedHeight = m_zintSymbol->height;
|
||||
m_vectorWidth = m_zintSymbol->vector->width;
|
||||
m_vectorHeight = m_zintSymbol->vector->height;
|
||||
m_encodedOption1 = m_zintSymbol->option_1;
|
||||
m_encodedOption2 = m_zintSymbol->option_2;
|
||||
m_encodedOption3 = m_zintSymbol->option_3;
|
||||
emit encoded();
|
||||
} else {
|
||||
m_encodedWidth = m_encodedRows = 0;
|
||||
m_encodedHeight = m_vectorWidth = m_vectorHeight = 0.0f;
|
||||
m_encodedOption1 = -1;
|
||||
m_encodedOption2 = 0;
|
||||
m_encodedOption3 = 0;
|
||||
emit errored();
|
||||
}
|
||||
}
|
||||
|
@ -798,6 +807,18 @@ namespace Zint {
|
|||
return m_vectorHeight;
|
||||
}
|
||||
|
||||
int QZint::encodedOption1() const { // Read-only, encoded `option_1`
|
||||
return m_encodedOption1;
|
||||
}
|
||||
|
||||
int QZint::encodedOption2() const { // Read-only, encoded `option_2`
|
||||
return m_encodedOption2;
|
||||
}
|
||||
|
||||
int QZint::encodedOption3() const { // Read-only, encoded `option_3`
|
||||
return m_encodedOption3;
|
||||
}
|
||||
|
||||
/* Legacy property getters/setters */
|
||||
void QZint::setWidth(int width) { setOption2(width); }
|
||||
int QZint::width() const { return m_option_2; }
|
||||
|
|
|
@ -235,6 +235,9 @@ public:
|
|||
float encodedHeight() const; // Read-only, in X-dimensions
|
||||
float vectorWidth() const; // Read-only, scaled width
|
||||
float vectorHeight() const; // Read-only, scaled height
|
||||
int encodedOption1() const; // Read-only, encoded `option_1`
|
||||
int encodedOption2() const; // Read-only, encoded `option_2`
|
||||
int encodedOption3() const; // Read-only, encoded `option_3`
|
||||
|
||||
|
||||
/* Legacy property getters/setters */
|
||||
|
@ -397,6 +400,9 @@ private:
|
|||
float m_encodedHeight;
|
||||
float m_vectorWidth;
|
||||
float m_vectorHeight;
|
||||
int m_encodedOption1;
|
||||
int m_encodedOption2;
|
||||
int m_encodedOption3;
|
||||
QString m_lastError;
|
||||
int m_error;
|
||||
|
||||
|
|
|
@ -311,6 +311,9 @@ private slots:
|
|||
QCOMPARE(bc.encodedWidth(), 0); // Read-only
|
||||
QCOMPARE(bc.encodedRows(), 0); // Read-only
|
||||
QCOMPARE(bc.encodedHeight(), 0.0f); // Read-only
|
||||
QCOMPARE(bc.encodedOption1(), -1); // Read-only
|
||||
QCOMPARE(bc.encodedOption2(), 0); // Read-only
|
||||
QCOMPARE(bc.encodedOption3(), 0); // Read-only
|
||||
|
||||
QCOMPARE(bc.vectorWidth(), 0.0f); // Read-only
|
||||
QCOMPARE(bc.vectorHeight(), 0.0f); // Read-only
|
||||
|
@ -429,18 +432,21 @@ private slots:
|
|||
QTest::addColumn<int>("encodedWidth");
|
||||
QTest::addColumn<int>("encodedRows");
|
||||
QTest::addColumn<float>("encodedHeight");
|
||||
QTest::addColumn<int>("encodedOption1");
|
||||
QTest::addColumn<int>("encodedOption2");
|
||||
QTest::addColumn<int>("encodedOption3");
|
||||
QTest::addColumn<float>("vectorWidth");
|
||||
QTest::addColumn<float>("vectorHeight");
|
||||
|
||||
QTest::newRow("BARCODE_CODE128") << BARCODE_CODE128 << "1234" << 0.0f << 0 << "" << 57 << 1 << 50.0f << 114.0f << 100.0f;
|
||||
QTest::newRow("BARCODE_CODE128 Scale 2") << BARCODE_CODE128 << "1234" << 2.0f << 0 << "" << 57 << 1 << 50.0f << 228.0f << 200.0f;
|
||||
QTest::newRow("BARCODE_QRCODE") << BARCODE_QRCODE << "1234" << 0.0f << 0 << "" << 21 << 21 << 21.0f << 42.0f << 42.0f;
|
||||
QTest::newRow("BARCODE_QRCODE Scale 1.5") << BARCODE_QRCODE << "1234" << 1.5f << 0 << "" << 21 << 21 << 21.0f << 63.0f << 63.0f;
|
||||
QTest::newRow("BARCODE_CODE128") << BARCODE_CODE128 << "1234" << 0.0f << 0 << "" << 57 << 1 << 50.0f << -1 << 0 << 0 << 114.0f << 100.0f;
|
||||
QTest::newRow("BARCODE_CODE128 Scale 2") << BARCODE_CODE128 << "1234" << 2.0f << 0 << "" << 57 << 1 << 50.0f << -1 << 0 << 0 << 228.0f << 200.0f;
|
||||
QTest::newRow("BARCODE_QRCODE") << BARCODE_QRCODE << "1234" << 0.0f << 0 << "" << 21 << 21 << 21.0f << 4 << 1 << (7 << 8) << 42.0f << 42.0f;
|
||||
QTest::newRow("BARCODE_QRCODE Scale 1.5") << BARCODE_QRCODE << "1234" << 1.5f << 0 << "" << 21 << 21 << 21.0f << 4 << 1 << (7 << 8) << 63.0f << 63.0f;
|
||||
if (!m_skipIfFontUsed) {
|
||||
QTest::newRow("BARCODE_QRCODE no text") << BARCODE_QRCODE << "" << 0.0f << ZINT_ERROR_INVALID_DATA << "Error 228: No input data (segment 0 empty)" << 0 << 0 << 0.0f << 0.0f << 0.0f;
|
||||
QTest::newRow("BARCODE_QRCODE no text") << BARCODE_QRCODE << "" << 0.0f << ZINT_ERROR_INVALID_DATA << "Error 228: No input data (segment 0 empty)" << 0 << 0 << 0.0f << 0 << 0 << 0 << 0.0f << 0.0f;
|
||||
}
|
||||
QTest::newRow("BARCODE_MAXICODE") << BARCODE_MAXICODE << "1234" << 0.0f << 0 << "" << 30 << 33 << 28.578f << 60.0f << 57.7334f;
|
||||
QTest::newRow("BARCODE_MAXICODE Scale 2") << BARCODE_MAXICODE << "1234" << 2.0f << 0 << "" << 30 << 33 << 28.578f << 120.0f << 115.467f;
|
||||
QTest::newRow("BARCODE_MAXICODE") << BARCODE_MAXICODE << "1234" << 0.0f << 0 << "" << 30 << 33 << 28.578f << -1 << 0 << 0 << 60.0f << 57.7334f;
|
||||
QTest::newRow("BARCODE_MAXICODE Scale 2") << BARCODE_MAXICODE << "1234" << 2.0f << 0 << "" << 30 << 33 << 28.578f << -1 << 0 << 0 << 120.0f << 115.467f;
|
||||
}
|
||||
|
||||
void renderTest()
|
||||
|
@ -469,6 +475,9 @@ private slots:
|
|||
QFETCH(int, encodedWidth);
|
||||
QFETCH(int, encodedRows);
|
||||
QFETCH(float, encodedHeight);
|
||||
QFETCH(int, encodedOption1);
|
||||
QFETCH(int, encodedOption2);
|
||||
QFETCH(int, encodedOption3);
|
||||
QFETCH(float, vectorWidth);
|
||||
QFETCH(float, vectorHeight);
|
||||
|
||||
|
@ -494,6 +503,9 @@ private slots:
|
|||
QCOMPARE(bc.encodedWidth(), encodedWidth);
|
||||
QCOMPARE(bc.encodedRows(), encodedRows);
|
||||
QCOMPARE(bc.encodedHeight(), encodedHeight);
|
||||
QCOMPARE(bc.encodedOption1(), encodedOption1);
|
||||
QCOMPARE(bc.encodedOption2(), encodedOption2);
|
||||
QCOMPARE(bc.encodedOption3(), encodedOption3);
|
||||
QCOMPARE(bc.vectorWidth(), vectorWidth);
|
||||
QCOMPARE(bc.vectorHeight(), vectorHeight);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue