mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Change height and row_height array to floats; DAFT tracker ratio
This commit is contained in:
@ -16,11 +16,11 @@ else()
|
||||
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui)
|
||||
qt5_add_resources(zint-qt_SRCS resources.qrc)
|
||||
endif()
|
||||
# grpAztec.ui grpC39.ui grpCodeOne.ui grpHX.ui grpMSICheck.ui grpUPCA.ui
|
||||
# grpC11.ui grpC49.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui
|
||||
# grpC128.ui grpChannel.ui grpDM.ui grpMaxicode.ui grpQR.ui grpVIN.ui
|
||||
# grpC16k.ui grpCodabar.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui
|
||||
# grpC25.ui grpCodablockF.ui grpGrid.ui grpMQR.ui grpUltra.ui
|
||||
# grpAztec.ui grpC39.ui grpCodeOne.ui grpGrid.ui grpMQR.ui grpUltra.ui
|
||||
# grpC11.ui grpC49.ui grpDAFT.ui grpHX.ui grpMSICheck.ui grpUPCA.ui
|
||||
# grpC128.ui grpChannel.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui
|
||||
# grpC16k.ui grpCodabar.ui grpDM.ui grpMaxicode.ui grpQR.ui grpVIN.ui
|
||||
# grpC25.ui grpCodablockF.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui
|
||||
|
||||
add_executable(zint-qt ${zint-qt_SRCS})
|
||||
add_dependencies(zint-qt zint)
|
||||
|
@ -72,6 +72,7 @@ FORMS += extData.ui \
|
||||
grpCodabar.ui \
|
||||
grpCodeOne.ui \
|
||||
grpCodablockF.ui \
|
||||
grpDAFT.ui \
|
||||
grpDBExtend.ui \
|
||||
grpDM.ui \
|
||||
grpDotCode.ui \
|
||||
|
@ -25,6 +25,7 @@ FORMS += extData.ui \
|
||||
grpCodabar.ui \
|
||||
grpCodablockF.ui \
|
||||
grpCodeOne.ui \
|
||||
grpDAFT.ui \
|
||||
grpDBExtend.ui \
|
||||
grpDM.ui \
|
||||
grpDotCode.ui \
|
||||
|
122
frontend_qt/grpDAFT.ui
Normal file
122
frontend_qt/grpDAFT.ui
Normal file
@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>grpDAFT</class>
|
||||
<widget class="QWidget" name="grpDAFT">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>310</width>
|
||||
<height>78</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="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDAFTTrackerRatio">
|
||||
<property name="text">
|
||||
<string>&Tracker Ratio:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spnDAFTTrackerRatio</cstring>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Size of tracker as percentage of full height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spnDAFTTrackerRatio">
|
||||
<property name="toolTip">
|
||||
<string>Size of tracker as percentage of full height</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> %</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>25.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="noteTrackerRatios">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Examples of tracker ratios:<table cellspacing="3">
|
||||
<tr><td>Australia Post&nbsp;</td><td>26%</td></tr>
|
||||
<tr><td>Japan Post&nbsp;</td><td>33%</td></tr>
|
||||
<tr><td>PLANET, POSTNET&nbsp;</td><td>40%</td></tr>
|
||||
<tr><td>Royal Mail, Dutch Post&nbsp;</td><td>25.6%</td></tr>
|
||||
<tr><td>USPS Intelligent Mail&nbsp;</td><td>33.1%</td></tr>
|
||||
<tr><td>Default&nbsp;</td><td>25%</td></tr>
|
||||
</table></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeft</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -672,7 +672,7 @@ as GS1 application identifiers delimiters
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="heightb">
|
||||
<widget class="QDoubleSpinBox" name="heightb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -680,20 +680,26 @@ as GS1 application identifiers delimiters
|
||||
<string>Overall symbol height
|
||||
(ignored if disabled)</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> X</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> X</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<double>0.500000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>300</number>
|
||||
<double>300.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
<double>50.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -165,7 +165,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
|
||||
chkRInit->setChecked(settings.value("studio/chk_rinit").toInt() ? true : false);
|
||||
chkGS1Parens->setChecked(settings.value("studio/chk_gs1parens").toInt() ? true : false);
|
||||
chkAutoHeight->setChecked(settings.value("studio/appearance/autoheight", 1).toInt() ? true : false);
|
||||
heightb->setValue(settings.value("studio/appearance/height", 50).toInt());
|
||||
heightb->setValue(settings.value("studio/appearance/height", 50.0f).toFloat());
|
||||
bwidth->setValue(settings.value("studio/appearance/border", 0).toInt());
|
||||
spnWhitespace->setValue(settings.value("studio/appearance/whitespace", 0).toInt());
|
||||
spnVWhitespace->setValue(settings.value("studio/appearance/vwhitespace", 0).toInt());
|
||||
@ -187,7 +187,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
|
||||
connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(change_options()));
|
||||
connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(filter_bstyle, SIGNAL(textChanged( const QString& )), SLOT(filter_symbologies()));
|
||||
connect(heightb, SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
connect(heightb, SIGNAL(valueChanged( double )), SLOT(update_preview()));
|
||||
connect(bwidth, SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbFontSetting, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
@ -481,7 +481,9 @@ void MainWindow::dotty_ui_set()
|
||||
void MainWindow::on_encoded()
|
||||
{
|
||||
if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked()) {
|
||||
heightb->setValue(m_bc.bc.height());
|
||||
/* setValue() rounds up/down to precision (decimals 3), we want round up only */
|
||||
float height = (float) (ceil(m_bc.bc.height() * 1000.0f) / 1000.0f);
|
||||
heightb->setValue(height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -782,6 +784,15 @@ void MainWindow::change_options()
|
||||
connect(m_optionWidget->findChild<QObject*>("radCbfStand"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radCbfHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
|
||||
} else if (symbology == BARCODE_DAFT) {
|
||||
QFile file(":/grpDAFT.ui");
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
m_optionWidget = uiload.load(&file);
|
||||
file.close();
|
||||
tabMain->insertTab(1, m_optionWidget, tr("DAFT"));
|
||||
connect(m_optionWidget->findChild<QObject*>("spnDAFTTrackerRatio"), SIGNAL(valueChanged( double )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
} else if (symbology == BARCODE_DATAMATRIX) {
|
||||
QFile file(":/grpDM.ui");
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
@ -907,6 +918,7 @@ void MainWindow::change_options()
|
||||
btype->setItemText(0, tr("Default (bind)"));
|
||||
connect(m_optionWidget->findChild<QObject*>("cmbC49RowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
|
||||
} else if (symbology == BARCODE_DBAR_EXPSTK) {
|
||||
QFile file(":/grpDBExtend.ui");
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
@ -1381,6 +1393,11 @@ void MainWindow::update_preview()
|
||||
}
|
||||
break;
|
||||
|
||||
case BARCODE_DAFT:
|
||||
m_bc.bc.setSymbol(BARCODE_DAFT);
|
||||
m_bc.bc.setOption2((int) (get_doublespinbox_val("spnDAFTTrackerRatio") * 10)); // Kept as percentage, convert to thousandths
|
||||
break;
|
||||
|
||||
case BARCODE_DATAMATRIX:
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radDM200HIBC")->isChecked())
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_DM);
|
||||
@ -1848,6 +1865,20 @@ void MainWindow::set_checkbox_from_setting(QSettings &settings, const QString &s
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper to return value of double spinner, checking for NULL */
|
||||
double MainWindow::get_doublespinbox_val(const QString &child) {
|
||||
QDoubleSpinBox *spinBox = m_optionWidget->findChild<QDoubleSpinBox*>(child);
|
||||
return spinBox ? spinBox->value() : 0.0;
|
||||
}
|
||||
|
||||
/* Helper to set double spinner from settings, checking for NULL */
|
||||
void MainWindow::set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val) {
|
||||
QDoubleSpinBox *spinBox = m_optionWidget->findChild<QDoubleSpinBox*>(child);
|
||||
if (spinBox) {
|
||||
spinBox->setValue(settings.value(setting, default_val).toFloat());
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper to return text of line edit, checking for NULL */
|
||||
QString MainWindow::get_lineedit_val(const QString &child) {
|
||||
QLineEdit *lineEdit = m_optionWidget ? m_optionWidget->findChild<QLineEdit*>(child) : nullptr;
|
||||
@ -2017,6 +2048,10 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
|
||||
settings.setValue("studio/bc/codablockf/encoding_mode", get_button_group_index(QStringList() << "radCbfStand" << "radCbfHIBC"));
|
||||
break;
|
||||
|
||||
case BARCODE_DAFT:
|
||||
settings.setValue("studio/bc/daft/tracker_ratio", QString::number(get_doublespinbox_val("spnDAFTTrackerRatio"), 'f', 1 /*precision*/));
|
||||
break;
|
||||
|
||||
case BARCODE_DATAMATRIX:
|
||||
case BARCODE_HIBC_DM:
|
||||
settings.setValue("studio/bc/datamatrix/size", get_combobox_index("cmbDM200Size"));
|
||||
@ -2146,7 +2181,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
|
||||
chkGS1Parens->setChecked(settings.value(QString("studio/bc/%1/chk_gs1parens").arg(name)).toInt() ? true : false);
|
||||
if (chkAutoHeight->isEnabled()) {
|
||||
chkAutoHeight->setChecked(settings.value(QString("studio/bc/%1/appearance/autoheight").arg(name), 1).toInt() ? true : false);
|
||||
heightb->setValue(settings.value(QString("studio/bc/%1/appearance/height").arg(name), 50).toInt());
|
||||
heightb->setValue(settings.value(QString("studio/bc/%1/appearance/height").arg(name), 50.0f).toFloat());
|
||||
}
|
||||
bwidth->setValue(settings.value(QString("studio/bc/%1/appearance/border").arg(name), 0).toInt());
|
||||
spnWhitespace->setValue(settings.value(QString("studio/bc/%1/appearance/whitespace").arg(name), 0).toInt());
|
||||
@ -2266,6 +2301,10 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
|
||||
set_radiobutton_from_setting(settings, "studio/bc/codablockf/encoding_mode", QStringList() << "radCbfStand" << "radCbfHIBC");
|
||||
break;
|
||||
|
||||
case BARCODE_DAFT:
|
||||
set_doublespinbox_from_setting(settings, "studio/bc/daft/tracker_ratio", "spnDAFTTrackerRatio", 25.0f);
|
||||
break;
|
||||
|
||||
case BARCODE_DATAMATRIX:
|
||||
case BARCODE_HIBC_DM:
|
||||
set_combobox_from_setting(settings, "studio/bc/datamatrix/size", "cmbDM200Size");
|
||||
|
@ -136,19 +136,22 @@ protected:
|
||||
void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled);
|
||||
void upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base);
|
||||
void set_gs1_mode(bool gs1_mode);
|
||||
|
||||
const char *get_setting_name(int symbology);
|
||||
|
||||
int get_button_group_index(const QStringList &children);
|
||||
void set_radiobutton_from_setting(QSettings &settings, const QString &setting, const QStringList &children, int default_val = 0);
|
||||
int get_combobox_index(const QString &child);
|
||||
void set_combobox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0);
|
||||
int get_checkbox_val(const QString &child);
|
||||
void set_checkbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0);
|
||||
float get_doublespinbox_val(const QString &child);
|
||||
void set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val = 0);
|
||||
double get_doublespinbox_val(const QString &child);
|
||||
void set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val = 0.0f);
|
||||
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);
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace Zint {
|
||||
|
||||
QZint::QZint() {
|
||||
m_symbol = BARCODE_CODE128;
|
||||
m_height = 0;
|
||||
m_height = 0.0f;
|
||||
m_borderType = 0;
|
||||
m_borderWidth = 0;
|
||||
m_fontSetting = 0;
|
||||
@ -170,11 +170,11 @@ namespace Zint {
|
||||
m_primaryMessage = primaryMessage;
|
||||
}
|
||||
|
||||
int QZint::height() const {
|
||||
float QZint::height() const {
|
||||
return m_height;
|
||||
}
|
||||
|
||||
void QZint::setHeight(int height) {
|
||||
void QZint::setHeight(float height) {
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ public:
|
||||
QString primaryMessage() const;
|
||||
void setPrimaryMessage(const QString & primaryMessage);
|
||||
|
||||
int height() const;
|
||||
void setHeight(int height);
|
||||
float height() const;
|
||||
void setHeight(float height);
|
||||
|
||||
int option2() const;
|
||||
void setOption2(int option);
|
||||
@ -138,7 +138,7 @@ private:
|
||||
int m_symbol;
|
||||
QString m_text;
|
||||
QString m_primaryMessage;
|
||||
int m_height;
|
||||
float m_height;
|
||||
int m_borderType;
|
||||
int m_borderWidth;
|
||||
int m_fontSetting;
|
||||
|
@ -11,6 +11,7 @@
|
||||
<file>grpCodabar.ui</file>
|
||||
<file>grpCodablockF.ui</file>
|
||||
<file>grpCodeOne.ui</file>
|
||||
<file>grpDAFT.ui</file>
|
||||
<file>grpDBExtend.ui</file>
|
||||
<file>grpDM.ui</file>
|
||||
<file>grpDotCode.ui</file>
|
||||
|
Reference in New Issue
Block a user