Add Ultracode options to UI

This commit is contained in:
Robin Stuart 2020-04-07 18:09:53 +01:00
parent 92cfd65b56
commit 4b584a6344
3 changed files with 159 additions and 0 deletions

135
frontend_qt/grpUltra.ui Normal file
View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpAztec</class>
<widget class="QWidget" name="grpAztec">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>461</width>
<height>237</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="radUltraAuto">
<property name="text">
<string>A&amp;utomatic Resizing</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmbUltraEcc">
<property name="enabled">
<bool>false</bool>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>ECO - Error Detection Only</string>
</property>
</item>
<item>
<property name="text">
<string>EC1 - Approx 5%</string>
</property>
</item>
<item>
<property name="text">
<string>EC2 - Approx 9%</string>
</property>
</item>
<item>
<property name="text">
<string>EC3 - Approx 17%</string>
</property>
</item>
<item>
<property name="text">
<string>EC4 - Approx 25%</string>
</property>
</item>
<item>
<property name="text">
<string>EC5 - Approx 33%</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radUltraEcc">
<property name="text">
<string>Error Correction Level:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Encoding Mode</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>453</width>
<height>71</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QRadioButton" name="radUltraGS1">
<property name="text">
<string>GS1 Data Mode</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radUltraStand">
<property name="text">
<string>Standard Mode</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>radUltraEcc</sender>
<signal>toggled(bool)</signal>
<receiver>cmbUltraEcc</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>85</x>
<y>47</y>
</hint>
<hint type="destinationlabel">
<x>331</x>
<y>47</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -687,6 +687,21 @@ void MainWindow::change_options()
connect(m_optionWidget->findChild<QObject*>("cmbCols"), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); connect(m_optionWidget->findChild<QObject*>("cmbCols"), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview()));
} }
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_ULTRA)
{
QFile file(":/grpUltra.ui");
if (!file.open(QIODevice::ReadOnly))
return;
m_optionWidget=uiload.load(&file);
file.close();
tabMain->insertTab(1,m_optionWidget,tr("Ultracode"));
connect(m_optionWidget->findChild<QObject*>("radUltraAuto"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("radUltraEcc"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("cmbUltraEcc"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("radUltraStand"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("radUltraGS1"), SIGNAL(clicked( bool )), SLOT(update_preview()));
}
switch(metaObject()->enumerator(0).value(bstyle->currentIndex())) switch(metaObject()->enumerator(0).value(bstyle->currentIndex()))
{ {
case BARCODE_CODE128: case BARCODE_CODE128:
@ -1058,6 +1073,14 @@ void MainWindow::update_preview()
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbHXECC")->currentIndex() + 1); m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbHXECC")->currentIndex() + 1);
break; break;
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);
if(m_optionWidget->findChild<QRadioButton*>("radUltraGS1")->isChecked())
m_bc.bc.setInputMode(GS1_MODE);
break;
default: default:
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex())); m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex()));
break; break;

View File

@ -25,5 +25,6 @@
<file>grpDotCode.ui</file> <file>grpDotCode.ui</file>
<file>grpCodablockF.ui</file> <file>grpCodablockF.ui</file>
<file>grpRMQR.ui</file> <file>grpRMQR.ui</file>
<file>grpUltra.ui</file>
</qresource> </qresource>
</RCC> </RCC>