GUI: Separate out SCM fields for MAXICODE (Ticket #212)

vector.c: Enforce minimum scale 0.1 and allow down to 0.1 in GUI
This commit is contained in:
gitlost
2021-09-09 21:50:02 +01:00
parent 492d9a41c5
commit f84f82d9a2
8 changed files with 348 additions and 158 deletions

View File

@ -30,6 +30,14 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="toolTip">
<string>Mode 2 (numeric postcode) and Mode 3 (alphanumeric postcode)
use a Structured Carrier Message (SCM) of 3 fields:
Postcode, Country Code, Service Class
Mode 4 uses enhanced ECC for the primary part of the message
Mode 5 uses enhanced ECC for all of the message
Mode 6 sets the scanner (Reader Initialisation/Programming)</string>
</property>
<property name="buddy">
<cstring>cmbMaxiMode</cstring>
</property>
@ -43,6 +51,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Mode 2 (numeric postcode) and Mode 3 (alphanumeric postcode)
use a Structured Carrier Message (SCM) of 3 fields:
Postcode, Country Code, Service Class
Mode 4 uses enhanced ECC for the primary part of the message
Mode 5 uses enhanced ECC for all of the message
Mode 6 sets the scanner (Reader Initialisation/Programming)</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
@ -68,105 +84,223 @@
</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&amp;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 &quot;PPPPPPPPPCCCSSS&quot; 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">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Primary Message Here!</string>
</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&amp;CM Prefix</string>
</property>
<property name="toolTip">
<string>Prefix Secondary Carrier Message with &quot;[)&gt;\R01\Gvv&quot;
where &quot;vv&quot; 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&amp;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 &quot;vv&quot; 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>
<widget class="QGroupBox" name="groupBoxMaxiSCM">
<property name="title">
<string>Structured Carrier Message</string>
</property>
<property name="toolTip">
<string>For Modes 2 and 3 only</string>
</property>
<layout class="QGridLayout" name="gridLayoutMaxiSCM">
<item row="0" column="0">
<widget class="QLabel" name="lblMaxiSCMPostcode">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Postcode of up to 9 digits for Mode 2 or
6 alphanumerics for Mode 3 (will truncate)
Postcodes less than maximum length will
be padded with spaces
(ignored if disabled)</string>
</property>
<property name="text">
<string>Pos&amp;tcode:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>txtMaxiSCMPostcode</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtMaxiSCMPostcode">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Postcode of up to 9 digits for Mode 2 or
6 alphanumerics for Mode 3 (will truncate)
Postcodes less than maximum length will
be padded with spaces
(ignored if disabled)</string>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxLength">
<number>9</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblMaxiSCMCountry">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>ISO 3166 numeric country code
Value ranges from 000 to 999
(ignored if disabled)</string>
</property>
<property name="text">
<string>Cou&amp;ntry code:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>spnMaxiSCMCountry</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spnMaxiSCMCountry">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>ISO 3166 numeric country code
Value ranges from 000 to 999
(ignored if disabled)</string>
</property>
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblMaxiSCMService">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Class of service, assigned by carrier
Value ranges from 000 to 999
(ignored if disabled)</string>
</property>
<property name="text">
<string>Se&amp;rvice Class:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>spnMaxiSCMService</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spnMaxiSCMService">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Class of service, assigned by carrier
Value ranges from 000 to 999
(ignored if disabled)</string>
</property>
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkMaxiSCMVV">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Prefix Structured Carrier Message with &quot;[)&gt;\R01\Gvv&quot;
(ANS MH10.8.2 Format 01) where &quot;vv&quot; is version given below
(ignored if disabled)</string>
</property>
<property name="text">
<string>Enable S&amp;CM Prefix</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblMaxiSCMVV">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Version &quot;vv&quot; to place at end of SCM prefix (default 96)
(ignored if disabled)</string>
</property>
<property name="text">
<string>SCM Pre&amp;fix Version:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>spnMaxiSCMVV</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spnMaxiSCMVV">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Version &quot;vv&quot; to place at end of SCM prefix (default 96)
(ignored if disabled)</string>
</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>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -175,7 +309,7 @@ where &quot;vv&quot; is version given below
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>20</height>
</size>
</property>
</spacer>

View File

@ -722,6 +722,9 @@ as delimiters for GS1 Application Identifiers
<property name="value">
<double>50.000000000000000</double>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
@ -870,7 +873,7 @@ in X-dimensions</string>
<number>2</number>
</property>
<property name="minimum">
<double>0.500000000000000</double>
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>99.500000000000000</double>

View File

@ -895,10 +895,12 @@ void MainWindow::change_options()
file.close();
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*>("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_scm()));
connect(m_optionWidget->findChild<QObject*>("txtMaxiSCMPostcode"), SIGNAL(textChanged( const QString& )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("spnMaxiSCMCountry"), SIGNAL(valueChanged( int )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("spnMaxiSCMService"), SIGNAL(valueChanged( int )), 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*>("chkMaxiSCMVV"), SIGNAL(stateChanged( int )), SLOT(maxi_scm()));
connect(m_optionWidget->findChild<QObject*>("spnMaxiSCMVV"), SIGNAL(valueChanged( int )), SLOT(update_preview()));
} else if (symbology == BARCODE_CHANNEL) {
@ -1071,24 +1073,24 @@ void MainWindow::composite_ean_check()
chkComposite->setChecked(false);
}
void MainWindow::maxi_primary()
void MainWindow::maxi_scm()
{
if (bstyle_items[bstyle->currentIndex()].symbology != 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);
}
bool isMode2or3 = m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() == 0;
m_optionWidget->findChild<QLabel*>("lblMaxiSCMPostcode")->setEnabled(isMode2or3);
m_optionWidget->findChild<QLineEdit*>("txtMaxiSCMPostcode")->setEnabled(isMode2or3);
m_optionWidget->findChild<QLabel*>("lblMaxiSCMCountry")->setEnabled(isMode2or3);
m_optionWidget->findChild<QSpinBox*>("spnMaxiSCMCountry")->setEnabled(isMode2or3);
m_optionWidget->findChild<QLabel*>("lblMaxiSCMService")->setEnabled(isMode2or3);
m_optionWidget->findChild<QSpinBox*>("spnMaxiSCMService")->setEnabled(isMode2or3);
chkMaxiSCMVV->setEnabled(isMode2or3);
m_optionWidget->findChild<QLabel*>("lblMaxiSCMVV")->setEnabled(isMode2or3 && chkMaxiSCMVV->isChecked());
m_optionWidget->findChild<QSpinBox*>("spnMaxiSCMVV")->setEnabled(isMode2or3 && chkMaxiSCMVV->isChecked());
}
void MainWindow::msi_plessey_ui_set()
@ -1290,23 +1292,22 @@ void MainWindow::update_preview()
case BARCODE_PDF417:
m_bc.bc.setOption2(m_optionWidget->findChild<QComboBox*>("cmbPDFCols")->currentIndex());
m_bc.bc.setOption1(m_optionWidget->findChild<QComboBox*>("cmbPDFECC")->currentIndex() - 1);
if(m_optionWidget->findChild<QRadioButton*>("radPDFStand")->isChecked())
m_bc.bc.setSymbol(BARCODE_PDF417);
if(m_optionWidget->findChild<QRadioButton*>("radPDFTruncated")->isChecked())
if (m_optionWidget->findChild<QRadioButton*>("radPDFTruncated")->isChecked())
m_bc.bc.setSymbol(BARCODE_PDF417COMP);
if(m_optionWidget->findChild<QRadioButton*>("radPDFHIBC")->isChecked())
else if (m_optionWidget->findChild<QRadioButton*>("radPDFHIBC")->isChecked())
m_bc.bc.setSymbol(BARCODE_HIBC_PDF);
else
m_bc.bc.setSymbol(BARCODE_PDF417);
break;
case BARCODE_MICROPDF417:
m_bc.bc.setOption2(m_optionWidget->findChild<QComboBox*>("cmbMPDFCols")->currentIndex());
if(m_optionWidget->findChild<QRadioButton*>("radMPDFStand")->isChecked())
m_bc.bc.setSymbol(BARCODE_MICROPDF417);
if(m_optionWidget->findChild<QRadioButton*>("radMPDFHIBC")->isChecked())
if (m_optionWidget->findChild<QRadioButton*>("radMPDFHIBC")->isChecked())
m_bc.bc.setSymbol(BARCODE_HIBC_MICPDF);
else
m_bc.bc.setSymbol(BARCODE_MICROPDF417);
break;
case BARCODE_DOTCODE:
@ -1549,17 +1550,18 @@ void MainWindow::update_preview()
case BARCODE_MAXICODE:
m_bc.bc.setSymbol(BARCODE_MAXICODE);
if(m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() == 0)
{
if (m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() == 0) {
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());
m_bc.bc.setPrimaryMessage(QString::asprintf("%s%03d%03d",
get_lineedit_val("txtMaxiSCMPostcode").toUtf8().constData(),
get_spinbox_val("spnMaxiSCMCountry"), get_spinbox_val("spnMaxiSCMService")));
QCheckBox *chkMaxiSCMVV = m_optionWidget->findChild<QCheckBox*>("chkMaxiSCMVV");
if (chkMaxiSCMVV->isEnabled() && chkMaxiSCMVV->isChecked()) {
m_bc.bc.setOption2(m_optionWidget->findChild<QSpinBox*>("spnMaxiSCMVV")->value() + 1);
}
}
else
} else {
m_bc.bc.setOption1(m_optionWidget->findChild<QComboBox*>("cmbMaxiMode")->currentIndex() + 3);
}
break;
case BARCODE_CHANNEL:
@ -2135,7 +2137,9 @@ 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/scm_postcode", get_lineedit_val("txtMaxiSCMPostcode"));
settings.setValue("studio/bc/maxicode/scm_country", get_spinbox_val("spnMaxiSCMCountry"));
settings.setValue("studio/bc/maxicode/scm_service", get_spinbox_val("spnMaxiSCMService"));
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;
@ -2389,7 +2393,9 @@ 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_lineedit_from_setting(settings, "studio/bc/maxicode/scm_postcode", "txtMaxiSCMPostcode", "");
set_spinbox_from_setting(settings, "studio/bc/maxicode/scm_country", "spnMaxiSCMCountry", 0);
set_spinbox_from_setting(settings, "studio/bc/maxicode/scm_service", "spnMaxiSCMService", 0);
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;

View File

@ -42,7 +42,7 @@ public slots:
void on_bgcolor_clicked();
void composite_ui_set();
void composite_ean_check();
void maxi_primary();
void maxi_scm();
void msi_plessey_ui_set();
void change_print_scale();
void change_cmyk();