From 1564cd7a34c8185ff7af363f1526332a787e1848 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Mon, 21 Oct 2019 08:29:21 +0100 Subject: [PATCH] Add Automatic Height option to UI and enable by default Brings UI default settings in line with CLI default settings --- backend_qt/qzint.cpp | 2 +- frontend_qt/mainWindow.ui | 25 ++++++++++++++++++++++--- frontend_qt/mainwindow.cpp | 19 ++++++++++++++++++- frontend_qt/mainwindow.h | 1 + 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index f56284a2..417169ea 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -27,7 +27,7 @@ namespace Zint { QZint::QZint() { m_symbol = BARCODE_CODE128; - m_height = 50; + m_height = 0; m_border = NO_BORDER; m_borderWidth = 0; m_securityLevel = -1; diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index 3fb5dacf..9bbd2e3e 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -308,8 +308,8 @@ Remember to place [square brackets] around AI data <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans [monotype]'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">Your Data Here!</span></p></body></html> +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Your Data Here!</span></p></body></html> false @@ -331,7 +331,10 @@ p, li { white-space: pre-wrap; } - + + + false + &Height: @@ -384,6 +387,9 @@ p, li { white-space: pre-wrap; } + + false + Overall symbol height @@ -522,6 +528,19 @@ p, li { white-space: pre-wrap; } + + + + true + + + Automatic Height + + + true + + + diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index a358b0b8..988320c3 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -160,6 +160,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) connect(btnMoreData, SIGNAL(clicked( bool )), SLOT(open_data_dialog())); connect(btnSequence, SIGNAL(clicked( bool )), SLOT(open_sequence_dialog())); connect(chkHRTHide, SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(chkAutoHeight, SIGNAL(stateChanged( int )), SLOT(autoheight_clicked())); connect(btnCopySVG, SIGNAL(clicked( bool )), SLOT(copy_to_clipboard_svg())); connect(btnCopyBMP, SIGNAL(clicked( bool )), SLOT(copy_to_clipboard_bmp())); } @@ -329,6 +330,18 @@ void MainWindow::on_bgcolor_clicked() } } +void MainWindow::autoheight_clicked() +{ + if (chkAutoHeight->isChecked()) { + lblHeight->setEnabled(false); + heightb->setEnabled(false); + } else { + lblHeight->setEnabled(true); + heightb->setEnabled(true); + } + update_preview(); +} + void MainWindow::change_print_scale() { /* This value is only used when printing (saving) to file */ @@ -1032,7 +1045,11 @@ void MainWindow::update_preview() m_bc.bc.setBorderType((Zint::QZint::BorderType)(btype->currentIndex()*2)); m_bc.bc.setBorderWidth(bwidth->value()); - m_bc.bc.setHeight(heightb->value()); + if(chkAutoHeight->isChecked()) { + m_bc.bc.setHeight(0); + } else { + m_bc.bc.setHeight(heightb->value()); + } m_bc.bc.setWhitespace(spnWhitespace->value()); m_bc.bc.setFgColor(m_fgcolor); m_bc.bc.setBgColor(m_bgcolor); diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index dbb2c6c7..e54aa3cb 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -121,6 +121,7 @@ public slots: void composite_ean_check(); void maxi_primary(); void change_print_scale(); + void autoheight_clicked(); protected: void resizeEvent(QResizeEvent *event);