mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-28 14:04:19 -04:00
MAXICODE: scmvv option #212; postcode needn't be space-filled
This commit is contained in:
parent
0ef9fdf684
commit
2b85585e69
23 changed files with 1703 additions and 378 deletions
|
@ -35,22 +35,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblMaxiPrimary">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>P&rimary Message:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>txtMaxiPrimary</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cmbMaxiMode">
|
||||
<property name="sizePolicy">
|
||||
|
@ -84,6 +68,30 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblMaxiPrimary">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>P&rimary Message:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>txtMaxiPrimary</cstring>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Format "PPPPPPPPPCCCSSS" where
|
||||
P is postcode of up to 9 digits for Mode 2 or
|
||||
6 alphanumerics for Mode 3 (will truncate) and
|
||||
C is 3-digit country code
|
||||
S is 3-digit service class
|
||||
(ignored if disabled)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtMaxiPrimary">
|
||||
<property name="enabled">
|
||||
|
@ -100,6 +108,63 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="chkMaxiSCMVV">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable S&CM Prefix</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Prefix Secondary Carrier Message with "[)>\R01\Gvv"
|
||||
where "vv" is version given below
|
||||
(ignored if disabled)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblMaxiSCMVV">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SCM Pre&fix Version:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spnMaxiSCMVV</cstring>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Version "vv" to place at end of SCM prefix (default 96)
|
||||
(ignored if disabled)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="spnMaxiSCMVV">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>96</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -96,7 +96,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
|
|||
"Japanese Postal Barcode",
|
||||
"Korean Postal Barcode",
|
||||
"LOGMARS",
|
||||
"Maxicode (ISO 16023)",
|
||||
"MaxiCode (ISO 16023)",
|
||||
"MicroPDF417 (ISO 24728) (and HIBC)",
|
||||
"Micro QR Code",
|
||||
"MSI Plessey",
|
||||
|
@ -881,10 +881,13 @@ void MainWindow::change_options()
|
|||
return;
|
||||
m_optionWidget=uiload.load(&file);
|
||||
file.close();
|
||||
tabMain->insertTab(1,m_optionWidget,tr("Maxicod&e"));
|
||||
tabMain->insertTab(1,m_optionWidget,tr("MaxiCod&e"));
|
||||
connect(m_optionWidget->findChild<QObject*>("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_primary()));
|
||||
connect(m_optionWidget->findChild<QObject*>("txtMaxiPrimary"), SIGNAL(textChanged( const QString& )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("chkMaxiSCMVV"), SIGNAL(stateChanged( int )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("chkMaxiSCMVV"), SIGNAL(stateChanged( int )), SLOT(maxi_primary()));
|
||||
connect(m_optionWidget->findChild<QObject*>("spnMaxiSCMVV"), SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
if (symbology == BARCODE_CHANNEL)
|
||||
|
@ -1078,12 +1081,19 @@ void MainWindow::maxi_primary()
|
|||
{
|
||||
if (metaObject()->enumerator(0).value(bstyle->currentIndex())!=BARCODE_MAXICODE)
|
||||
return;
|
||||
QCheckBox *chkMaxiSCMVV = m_optionWidget->findChild<QCheckBox*>("chkMaxiSCMVV");
|
||||
if(m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() == 0) {
|
||||
m_optionWidget->findChild<QLabel*>("lblMaxiPrimary")->setEnabled(true);
|
||||
m_optionWidget->findChild<QLineEdit*>("txtMaxiPrimary")->setEnabled(true);
|
||||
chkMaxiSCMVV->setEnabled(true);
|
||||
m_optionWidget->findChild<QLabel*>("lblMaxiSCMVV")->setEnabled(chkMaxiSCMVV->isChecked());
|
||||
m_optionWidget->findChild<QSpinBox*>("spnMaxiSCMVV")->setEnabled(chkMaxiSCMVV->isChecked());
|
||||
} else {
|
||||
m_optionWidget->findChild<QLabel*>("lblMaxiPrimary")->setEnabled(false);
|
||||
m_optionWidget->findChild<QLineEdit*>("txtMaxiPrimary")->setEnabled(false);
|
||||
chkMaxiSCMVV->setEnabled(false);
|
||||
m_optionWidget->findChild<QLabel*>("lblMaxiSCMVV")->setEnabled(false);
|
||||
m_optionWidget->findChild<QSpinBox*>("spnMaxiSCMVV")->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1142,7 +1152,7 @@ void MainWindow::update_preview()
|
|||
} else {
|
||||
m_bc.bc.setText(txtData->text());
|
||||
}
|
||||
m_bc.bc.setSecurityLevel(0);
|
||||
m_bc.bc.setOption1(-1);
|
||||
m_bc.bc.setOption2(0);
|
||||
m_bc.bc.setOption3(0);
|
||||
chkData->setEnabled(true);
|
||||
|
@ -1254,7 +1264,7 @@ void MainWindow::update_preview()
|
|||
|
||||
case BARCODE_PDF417:
|
||||
m_bc.bc.setOption2(m_optionWidget->findChild<QComboBox*>("cmbPDFCols")->currentIndex());
|
||||
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbPDFECC")->currentIndex()-1);
|
||||
m_bc.bc.setOption1(m_optionWidget->findChild<QComboBox*>("cmbPDFECC")->currentIndex() - 1);
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radPDFStand")->isChecked())
|
||||
m_bc.bc.setSymbol(BARCODE_PDF417);
|
||||
|
||||
|
@ -1286,7 +1296,7 @@ void MainWindow::update_preview()
|
|||
m_bc.bc.setOption2(m_optionWidget->findChild<QComboBox*>("cmbAztecSize")->currentIndex() + 1);
|
||||
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radAztecECC")->isChecked())
|
||||
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbAztecECC")->currentIndex() + 1);
|
||||
m_bc.bc.setOption1(m_optionWidget->findChild<QComboBox*>("cmbAztecECC")->currentIndex() + 1);
|
||||
|
||||
set_gs1_mode(m_optionWidget->findChild<QRadioButton*>("radAztecGS1")->isChecked());
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radAztecHIBC")->isChecked())
|
||||
|
@ -1362,7 +1372,7 @@ void MainWindow::update_preview()
|
|||
// Height selection uses option 1 in zint_symbol
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbCbfHeight")->currentIndex();
|
||||
if (item_val) {
|
||||
m_bc.bc.setSecurityLevel(item_val);
|
||||
m_bc.bc.setOption1(item_val);
|
||||
}
|
||||
// Row separator height selection uses option 3 in zint_symbol
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbCbfRowSepHeight")->currentIndex();
|
||||
|
@ -1372,7 +1382,6 @@ void MainWindow::update_preview()
|
|||
break;
|
||||
|
||||
case BARCODE_DATAMATRIX:
|
||||
m_bc.bc.setSecurityLevel(1);
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radDM200HIBC")->isChecked())
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_DM);
|
||||
else
|
||||
|
@ -1425,7 +1434,7 @@ void MainWindow::update_preview()
|
|||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbQRECC")->currentIndex();
|
||||
if (item_val) {
|
||||
m_bc.bc.setSecurityLevel(item_val);
|
||||
m_bc.bc.setOption1(item_val);
|
||||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbQRMask")->currentIndex();
|
||||
if (item_val) {
|
||||
|
@ -1444,7 +1453,7 @@ void MainWindow::update_preview()
|
|||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbMQRECC")->currentIndex();
|
||||
if (item_val) {
|
||||
m_bc.bc.setSecurityLevel(item_val);
|
||||
m_bc.bc.setOption1(item_val);
|
||||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbMQRMask")->currentIndex();
|
||||
if (item_val) {
|
||||
|
@ -1466,7 +1475,7 @@ void MainWindow::update_preview()
|
|||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbRMQRECC")->currentIndex();
|
||||
if (item_val) {
|
||||
m_bc.bc.setSecurityLevel(item_val * 2); // Levels 2 (M) and 4 (H) only
|
||||
m_bc.bc.setOption1(item_val * 2); // Levels 2 (M) and 4 (H) only
|
||||
}
|
||||
if (m_optionWidget->findChild<QCheckBox*>("chkRMQRFullMultibyte")->isChecked()) {
|
||||
m_bc.bc.setOption3(ZINT_FULL_MULTIBYTE);
|
||||
|
@ -1481,7 +1490,7 @@ void MainWindow::update_preview()
|
|||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbGridECC")->currentIndex();
|
||||
if (item_val) {
|
||||
m_bc.bc.setSecurityLevel(item_val);
|
||||
m_bc.bc.setOption1(item_val);
|
||||
}
|
||||
if (m_optionWidget->findChild<QCheckBox*>("chkGridFullMultibyte")->isChecked()) {
|
||||
m_bc.bc.setOption3(ZINT_FULL_MULTIBYTE);
|
||||
|
@ -1492,11 +1501,15 @@ void MainWindow::update_preview()
|
|||
m_bc.bc.setSymbol(BARCODE_MAXICODE);
|
||||
if(m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() == 0)
|
||||
{
|
||||
m_bc.bc.setSecurityLevel(2);
|
||||
m_bc.bc.setOption1(0); /* Auto-determine mode 2 or 3 from primary message (checks that it isn't empty) */
|
||||
m_bc.bc.setPrimaryMessage(m_optionWidget->findChild<QLineEdit*>("txtMaxiPrimary")->text());
|
||||
QCheckBox *chkMaxiSCMVV = m_optionWidget->findChild<QCheckBox*>("chkMaxiSCMVV");
|
||||
if (chkMaxiSCMVV->isEnabled() && chkMaxiSCMVV->isChecked()) {
|
||||
m_bc.bc.setOption2(m_optionWidget->findChild<QSpinBox*>("spnMaxiSCMVV")->value() + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() + 3);
|
||||
m_bc.bc.setOption1(m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() + 3);
|
||||
break;
|
||||
|
||||
case BARCODE_CHANNEL:
|
||||
|
@ -1531,7 +1544,7 @@ void MainWindow::update_preview()
|
|||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbHXECC")->currentIndex();
|
||||
if (item_val) {
|
||||
m_bc.bc.setSecurityLevel(item_val);
|
||||
m_bc.bc.setOption1(item_val);
|
||||
}
|
||||
item_val = m_optionWidget->findChild<QComboBox*>("cmbHXMask")->currentIndex();
|
||||
if (item_val) {
|
||||
|
@ -1545,7 +1558,7 @@ void MainWindow::update_preview()
|
|||
case BARCODE_ULTRA:
|
||||
m_bc.bc.setSymbol(BARCODE_ULTRA);
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radUltraEcc")->isChecked())
|
||||
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbUltraEcc")->currentIndex() + 1);
|
||||
m_bc.bc.setOption1(m_optionWidget->findChild<QComboBox*>("cmbUltraEcc")->currentIndex() + 1);
|
||||
set_gs1_mode(m_optionWidget->findChild<QRadioButton*>("radUltraGS1")->isChecked());
|
||||
break;
|
||||
|
||||
|
@ -1568,7 +1581,7 @@ void MainWindow::update_preview()
|
|||
chkRInit->setEnabled(m_bc.bc.supportsReaderInit() && (m_bc.bc.inputMode() & 0x07) != GS1_MODE);
|
||||
|
||||
if (!grpComposite->isHidden() && chkComposite->isChecked())
|
||||
m_bc.bc.setSecurityLevel(cmbCompType->currentIndex());
|
||||
m_bc.bc.setOption1(cmbCompType->currentIndex());
|
||||
|
||||
if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked()) {
|
||||
m_bc.bc.setHeight(0);
|
||||
|
@ -1832,6 +1845,20 @@ void MainWindow::set_lineedit_from_setting(QSettings &settings, const QString &s
|
|||
}
|
||||
}
|
||||
|
||||
/* Helper to return value of spin box, checking for NULL */
|
||||
int MainWindow::get_spinbox_val(const QString &child) {
|
||||
QSpinBox *spinBox = m_optionWidget->findChild<QSpinBox*>(child);
|
||||
return spinBox ? spinBox->value() : 0;
|
||||
}
|
||||
|
||||
/* Helper to set spin box from settings, checking for NULL */
|
||||
void MainWindow::set_spinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val) {
|
||||
QSpinBox *spinBox = m_optionWidget->findChild<QSpinBox*>(child);
|
||||
if (spinBox) {
|
||||
spinBox->setValue(settings.value(setting, default_val).toInt());
|
||||
}
|
||||
}
|
||||
|
||||
/* Save settings for an individual symbol */
|
||||
void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
|
||||
|
||||
|
@ -2001,6 +2028,8 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
|
|||
case BARCODE_MAXICODE:
|
||||
settings.setValue("studio/bc/maxicode/mode", get_combobox_index("cmbMaxiMode"));
|
||||
settings.setValue("studio/bc/maxicode/primary_message", get_lineedit_val("txtMaxiPrimary"));
|
||||
settings.setValue("studio/bc/maxicode/chk_scm_vv", get_checkbox_val("chkMaxiSCMVV"));
|
||||
settings.setValue("studio/bc/maxicode/spn_scm_vv", get_spinbox_val("spnMaxiSCMVV"));
|
||||
break;
|
||||
|
||||
case BARCODE_CODEONE:
|
||||
|
@ -2227,6 +2256,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
|
|||
case BARCODE_MAXICODE:
|
||||
set_combobox_from_setting(settings, "studio/bc/maxicode/mode", "cmbMaxiMode", 1);
|
||||
set_lineedit_from_setting(settings, "studio/bc/maxicode/primary_message", "txtMaxiPrimary", "Primary Message Here!");
|
||||
set_checkbox_from_setting(settings, "studio/bc/maxicode/chk_scm_vv", "chkMaxiSCMVV");
|
||||
set_spinbox_from_setting(settings, "studio/bc/maxicode/spn_scm_vv", "spnMaxiSCMVV", 96); /* 96 is ASC MH10/SC 8 */
|
||||
break;
|
||||
|
||||
case BARCODE_CODEONE:
|
||||
|
|
|
@ -146,6 +146,8 @@ protected:
|
|||
void set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val = 0);
|
||||
QString get_lineedit_val(const QString &child);
|
||||
void set_lineedit_from_setting(QSettings &settings, const QString &setting, const QString &child, const char *default_val = "");
|
||||
int get_spinbox_val(const QString &child);
|
||||
void set_spinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0);
|
||||
void save_sub_settings(QSettings &settings, int symbology);
|
||||
void load_sub_settings(QSettings &settings, int symbology);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Zint {
|
|||
m_borderType = 0;
|
||||
m_borderWidth = 0;
|
||||
m_fontSetting = 0;
|
||||
m_securityLevel = -1;
|
||||
m_option_1 = -1;
|
||||
m_fgColor = Qt::black;
|
||||
m_bgColor = Qt::white;
|
||||
m_cmyk = false;
|
||||
|
@ -75,7 +75,7 @@ namespace Zint {
|
|||
m_zintSymbol->height = m_height;
|
||||
m_zintSymbol->whitespace_width = m_whitespace;
|
||||
m_zintSymbol->border_width = m_borderWidth;
|
||||
m_zintSymbol->option_1 = m_securityLevel;
|
||||
m_zintSymbol->option_1 = m_option_1;
|
||||
m_zintSymbol->input_mode = m_input_mode;
|
||||
m_zintSymbol->option_2 = m_option_2;
|
||||
if (m_dotty) {
|
||||
|
@ -249,20 +249,12 @@ namespace Zint {
|
|||
m_whitespace = whitespace;
|
||||
}
|
||||
|
||||
int QZint::securityLevel() const {
|
||||
return m_securityLevel;
|
||||
int QZint::option1() const {
|
||||
return m_option_1;
|
||||
}
|
||||
|
||||
void QZint::setSecurityLevel(int securityLevel) {
|
||||
m_securityLevel = securityLevel;
|
||||
}
|
||||
|
||||
int QZint::mode() const {
|
||||
return m_securityLevel;
|
||||
}
|
||||
|
||||
void QZint::setMode(int securityLevel) {
|
||||
m_securityLevel = securityLevel;
|
||||
void QZint::setOption1(int option_1) {
|
||||
m_option_1 = option_1;
|
||||
}
|
||||
|
||||
void QZint::setFontSetting(int fontSettingIndex) {
|
||||
|
|
|
@ -78,11 +78,8 @@ public:
|
|||
int borderWidth() const;
|
||||
void setBorderWidth(int boderWidth);
|
||||
|
||||
int securityLevel() const;
|
||||
void setSecurityLevel(int securityLevel);
|
||||
|
||||
int mode() const;
|
||||
void setMode(int securityLevel);
|
||||
int option1() const;
|
||||
void setOption1(int option_1);
|
||||
|
||||
void setWhitespace(int whitespace);
|
||||
|
||||
|
@ -140,7 +137,7 @@ private:
|
|||
int m_borderWidth;
|
||||
int m_fontSetting;
|
||||
int m_option_2;
|
||||
int m_securityLevel;
|
||||
int m_option_1;
|
||||
int m_input_mode;
|
||||
QColor m_fgColor;
|
||||
QColor m_bgColor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue