From ac00e381a68619020607d6a00c51975d7a832323 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Mon, 25 Nov 2019 21:20:21 +0000 Subject: [PATCH] Add rMQR to Barcode Studio and perform some code beautifying at the same time --- backend/qr.h | 10 +- frontend_qt/mainwindow.cpp | 1487 ++++++++++++++++++------------------ frontend_qt/mainwindow.h | 197 +++-- 3 files changed, 839 insertions(+), 855 deletions(-) diff --git a/backend/qr.h b/backend/qr.h index 5f48e53d..80c8487d 100644 --- a/backend/qr.h +++ b/backend/qr.h @@ -1,7 +1,7 @@ /* qr.h Data for QR Code, Micro QR Code and rMQR libzint - the open source barcode library - Copyright (C) 2008-2017 Robin Stuart + Copyright (C) 2008-2019 Robin Stuart Copyright (C) 2006 Kentaro Fukuchi Redistribution and use in source and binary forms, with or without @@ -30,10 +30,10 @@ SUCH DAMAGE. */ -#define LEVEL_L 1 -#define LEVEL_M 2 -#define LEVEL_Q 3 -#define LEVEL_H 4 +#define LEVEL_L 1 +#define LEVEL_M 2 +#define LEVEL_Q 3 +#define LEVEL_H 4 #define RHODIUM "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:" diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 988320c3..8f7e157c 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by BogDan Vatra * - * Copyright (C) 2009-2017 by Robin Stuart * + * Copyright (C) 2009-2019 by Robin Stuart * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -34,7 +34,7 @@ #include MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) - : QWidget(parent, fl),m_optionWidget(0) + : QWidget(parent, fl),m_optionWidget(0) { QCoreApplication::setOrganizationName("zint"); @@ -43,94 +43,92 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) QSettings settings; - char bstyle_text[][50] = { - "Australia Post Redirect Code", - "Australia Post Reply-Paid", - "Australia Post Routing Code", - "Australia Post Standard Customer", - "Aztec Code (ISO 24778)", - "Aztec Runes", - "Channel Code", - "Codabar", - "Codablock-F", - "Code 11", - "Code 128 (ISO 15417)", - "Code 16k", - "Code 2 of 5 Data Logic", - "Code 2 of 5 IATA", - "Code 2 of 5 Industrial", - "Code 2 of 5 Interleaved", - "Code 2 of 5 Matrix", - "Code 32 (Italian Pharmacode)", - "Code 39 (ISO 16388)", - "Code 39 Extended", - "Code 49", - "Code 93", - "Code One", - "Data Matrix (ISO 16022)", - "Deutsche Post Identcode", - "Deutsche Post Leitcode", - "DotCode", - "Dutch Post KIX", - "EAN-14", - "European Article Number (EAN)", - "Facing Identification Mark (FIM)", - "Flattermarken", - "Grid Matrix", - "GS1 DataBar Expanded Omnidirectional", - "GS1 DataBar Expanded Stacked Omnidirectional", - "GS1 DataBar Limited", - "GS1 DataBar Omnidirectional", - "GS1 DataBar Stacked", - "GS1 DataBar Stacked Omnidirectional", - "Han Xin (Chinese Sensible) Code", - "ITF-14", - "International Standard Book Number (ISBN)", - "Japanese Postal Barcode", - "Korean Postal Barcode", - "LOGMARS", - "Maxicode (ISO 16023)", - "MicroPDF417 (ISO 24728)", - "Micro QR Code", - "MSI Plessey", - "NVE-18", - "PDF417 (ISO 15438)", - "Pharmacode", - "Pharmacode 2-track", - "Pharma Zentralnummer (PZN)", - "PLANET", - "Postnet", - "QR Code (ISO 18004)", - "Royal Mail 4-state Barcode", - "Royal Mail 4-state Mailmark", - "Telepen", - "Telepen Numeric", - "UK Plessey", - "UPNQR", - "Universal Product Code (UPC-A)", - "Universal Product Code (UPC-E)", - "USPS Intelligent Mail" - }; + char bstyle_text[][50] = { + "Australia Post Redirect Code", + "Australia Post Reply-Paid", + "Australia Post Routing Code", + "Australia Post Standard Customer", + "Aztec Code (ISO 24778)", + "Aztec Runes", + "Channel Code", + "Codabar", + "Codablock-F", + "Code 11", + "Code 128 (ISO 15417)", + "Code 16k", + "Code 2 of 5 Data Logic", + "Code 2 of 5 IATA", + "Code 2 of 5 Industrial", + "Code 2 of 5 Interleaved", + "Code 2 of 5 Matrix", + "Code 32 (Italian Pharmacode)", + "Code 39 (ISO 16388)", + "Code 39 Extended", + "Code 49", + "Code 93", + "Code One", + "Data Matrix (ISO 16022)", + "Deutsche Post Identcode", + "Deutsche Post Leitcode", + "DotCode", + "Dutch Post KIX", + "EAN-14", + "European Article Number (EAN)", + "Facing Identification Mark (FIM)", + "Flattermarken", + "Grid Matrix", + "GS1 DataBar Expanded Omnidirectional", + "GS1 DataBar Expanded Stacked Omnidirectional", + "GS1 DataBar Limited", + "GS1 DataBar Omnidirectional", + "GS1 DataBar Stacked", + "GS1 DataBar Stacked Omnidirectional", + "Han Xin (Chinese Sensible) Code", + "ITF-14", + "International Standard Book Number (ISBN)", + "Japanese Postal Barcode", + "Korean Postal Barcode", + "LOGMARS", + "Maxicode (ISO 16023)", + "MicroPDF417 (ISO 24728)", + "Micro QR Code", + "MSI Plessey", + "NVE-18", + "PDF417 (ISO 15438)", + "Pharmacode", + "Pharmacode 2-track", + "Pharma Zentralnummer (PZN)", + "PLANET", + "Postnet", + "QR Code (ISO 18004)", + "Reduced Micro QR (rMQR)", + "Royal Mail 4-state Barcode", + "Royal Mail 4-state Mailmark", + "Telepen", + "Telepen Numeric", + "UK Plessey", + "UPNQR", + "Universal Product Code (UPC-A)", + "Universal Product Code (UPC-E)", + "USPS Intelligent Mail" + }; - /* createActions(); - createMenus(); */ + scene = new QGraphicsScene(this); - scene = new QGraphicsScene(this); + setupUi(this); + view->setScene(scene); - setupUi(this); - view->setScene(scene); - - m_fgcolor=qRgb(settings.value("studio/ink/red", 0).toInt(), + m_fgcolor=qRgb(settings.value("studio/ink/red", 0).toInt(), settings.value("studio/ink/green", 0).toInt(), settings.value("studio/ink/blue", 0).toInt()); - m_bgcolor=qRgb(settings.value("studio/paper/red", 0xff).toInt(), + m_bgcolor=qRgb(settings.value("studio/paper/red", 0xff).toInt(), settings.value("studio/paper/green", 0xff).toInt(), settings.value("studio/paper/blue", 0xff).toInt()); - for (int i=0;ienumerator(0).keyCount();i++) { - bstyle->addItem(metaObject()->enumerator(0).key(i)); - bstyle->setItemText(i,bstyle_text[i]); - } - bstyle->setCurrentIndex(settings.value("studio/symbology", 10).toInt()); + for (int i=0;ienumerator(0).keyCount();i++) { + bstyle->addItem(metaObject()->enumerator(0).key(i)); + bstyle->setItemText(i,bstyle_text[i]); + } + bstyle->setCurrentIndex(settings.value("studio/symbology", 10).toInt()); txtData->setText(settings.value("studio/data", "Your Data Here!").toString()); txtComposite->setText(settings.value("studio/composite_text", "Your Data Here!").toString()); heightb->setValue(settings.value("studio/appearance/height", 50).toInt()); @@ -138,28 +136,28 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) spnWhitespace->setValue(settings.value("studio/appearance/whitespace", 0).toInt()); spnScale->setValue(settings.value("studio/appearance/scale", 1.0).toFloat()); btype->setCurrentIndex(settings.value("studio/appearance/border_type", 0).toInt()); - change_options(); + change_options(); scene->addItem(&m_bc); - update_preview(); - connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(change_options())); - connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(heightb, SIGNAL(valueChanged( int )), SLOT(update_preview())); - connect(bwidth, SIGNAL(valueChanged( int )), SLOT(update_preview())); - connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(update_preview())); - connect(txtComposite, SIGNAL(textChanged()), SLOT(update_preview())); - connect(chkComposite, SIGNAL(stateChanged( int )), SLOT(composite_enable())); - connect(chkComposite, SIGNAL(stateChanged( int )), SLOT(update_preview())); - connect(cmbCompType, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(spnWhitespace, SIGNAL(valueChanged( int )), SLOT(update_preview())); - connect(btnAbout, SIGNAL(clicked( bool )), SLOT(about())); - connect(btnSave, SIGNAL(clicked( bool )), SLOT(save())); - connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale())); - connect(btnExit, SIGNAL(clicked( bool )), SLOT(quit_now())); - connect(btnReset, SIGNAL(clicked( bool )), SLOT(reset_view())); - 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())); + update_preview(); + connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(change_options())); + connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(heightb, SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(bwidth, SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(update_preview())); + connect(txtComposite, SIGNAL(textChanged()), SLOT(update_preview())); + connect(chkComposite, SIGNAL(stateChanged( int )), SLOT(composite_enable())); + connect(chkComposite, SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(cmbCompType, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(spnWhitespace, SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(btnAbout, SIGNAL(clicked( bool )), SLOT(about())); + connect(btnSave, SIGNAL(clicked( bool )), SLOT(save())); + connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale())); + connect(btnExit, SIGNAL(clicked( bool )), SLOT(quit_now())); + connect(btnReset, SIGNAL(clicked( bool )), SLOT(reset_view())); + 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())); @@ -193,141 +191,139 @@ void MainWindow::resizeEvent(QResizeEvent* event) void MainWindow::reset_view() { - m_fgcolor=qRgb(0,0,0); - m_bgcolor=qRgb(0xff,0xff,0xff); - update_preview(); + m_fgcolor=qRgb(0,0,0); + m_bgcolor=qRgb(0xff,0xff,0xff); + update_preview(); } bool MainWindow::save() { - QSettings settings; - QFileDialog save_dialog; - QString filename; - QString suffix; + QSettings settings; + QFileDialog save_dialog; + QString filename; + QString suffix; - save_dialog.setAcceptMode(QFileDialog::AcceptSave); - save_dialog.setWindowTitle("Save Barcode Image"); - save_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); + save_dialog.setAcceptMode(QFileDialog::AcceptSave); + save_dialog.setWindowTitle("Save Barcode Image"); + save_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); #ifdef NO_PNG - suffix = settings.value("studio/default_suffix", "gif").toString(); - save_dialog.setNameFilter(tr("Encapsulated Post Script (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Extended Metafile (*.emf);;Tagged Image File Format (*.tif)")); + suffix = settings.value("studio/default_suffix", "gif").toString(); + save_dialog.setNameFilter(tr("Encapsulated Post Script (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Extended Metafile (*.emf);;Tagged Image File Format (*.tif)")); #else - suffix = settings.value("studio/default_suffix", "png").toString(); - save_dialog.setNameFilter(tr("Portable Network Graphic (*.png);;Encapsulated Post Script (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Extended Metafile (*.emf);;Tagged Image File Format (*.tif)")); + suffix = settings.value("studio/default_suffix", "png").toString(); + save_dialog.setNameFilter(tr("Portable Network Graphic (*.png);;Encapsulated Post Script (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Extended Metafile (*.emf);;Tagged Image File Format (*.tif)")); #endif - if (QString::compare(suffix, "png", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("Portable Network Graphic (*.png)"); - if (QString::compare(suffix, "eps", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("Encapsulated Post Script (*.eps)"); - if (QString::compare(suffix, "gif", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("Graphics Interchange Format (*.gif)"); - if (QString::compare(suffix, "svg", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("Scalable Vector Graphic (*.svg)"); - if (QString::compare(suffix, "bmp", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("Windows Bitmap (*.bmp)"); - if (QString::compare(suffix, "pcx", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("ZSoft PC Painter Image (*.pcx)"); - if (QString::compare(suffix, "emf", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("Extended Metafile (*.emf)"); - if (QString::compare(suffix, "tif", Qt::CaseInsensitive) == 0) - save_dialog.selectNameFilter("Tagged Image File Format (*.tif)"); + if (QString::compare(suffix, "png", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("Portable Network Graphic (*.png)"); + if (QString::compare(suffix, "eps", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("Encapsulated Post Script (*.eps)"); + if (QString::compare(suffix, "gif", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("Graphics Interchange Format (*.gif)"); + if (QString::compare(suffix, "svg", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("Scalable Vector Graphic (*.svg)"); + if (QString::compare(suffix, "bmp", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("Windows Bitmap (*.bmp)"); + if (QString::compare(suffix, "pcx", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("ZSoft PC Painter Image (*.pcx)"); + if (QString::compare(suffix, "emf", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("Extended Metafile (*.emf)"); + if (QString::compare(suffix, "tif", Qt::CaseInsensitive) == 0) + save_dialog.selectNameFilter("Tagged Image File Format (*.tif)"); - if (save_dialog.exec()) { - filename = save_dialog.selectedFiles().at(0); - if ((filename.lastIndexOf(".") == -1) || (filename.lastIndexOf(".") < (filename.length() - 5))) { - suffix = save_dialog.selectedNameFilter(); - suffix = suffix.mid((suffix.lastIndexOf(".") + 1), 3); - filename.append("."); - filename.append(suffix); - } else { - suffix = filename.right(filename.length() - (filename.lastIndexOf('.') + 1)); - } + if (save_dialog.exec()) { + filename = save_dialog.selectedFiles().at(0); + if ((filename.lastIndexOf(".") == -1) || (filename.lastIndexOf(".") < (filename.length() - 5))) { + suffix = save_dialog.selectedNameFilter(); + suffix = suffix.mid((suffix.lastIndexOf(".") + 1), 3); + filename.append("."); + filename.append(suffix); } else { - return false; + suffix = filename.right(filename.length() - (filename.lastIndexOf('.') + 1)); } + } else { + return false; + } - if(m_bc.bc.save_to_file(filename) == false) { + if(m_bc.bc.save_to_file(filename) == false) { if (m_bc.bc.getError() > 4) { - QMessageBox::critical(this,tr("Save Error"),m_bc.bc.error_message()); + QMessageBox::critical(this,tr("Save Error"),m_bc.bc.error_message()); return false; } else { QMessageBox::warning(this, tr("Save Warning"),m_bc.bc.error_message()); return true; } - } + } settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator()))); settings.setValue("studio/default_suffix", suffix); - return true; + return true; } void MainWindow::about() { - QMessageBox::about(this, tr("About Zint"), - tr("

Zint Barcode Studio 2.6.7

" - "

A free barcode generator" - "

Instruction manual is available at the project homepage:
" - "http://www.zint.org.uk" - "

Copyright © 2006-2018 Robin Stuart and others.
" - "Qt back end by BogDan Vatra
" - "Windows port by Harald Oehlmann

" - "

Qt version " QT_VERSION_STR - "

With thanks to Norbert Szabó, Robert Elliott, " - "Milton Neal and many others at Sourceforge." - "

Released under the GNU General Public License ver. 3 or later.
" - "\"QR Code\" is a Registered Trademark of Denso Corp.
" - "\"Telepen\" is a Registered Trademark of SB Electronics." - "

Currently supported standards include:
" - "EN 797:1996, EN 798:1996, EN 12323:2005, ISO/IEC 15417:2007,
" - "ISO/IEC 15438:2015, ISO/IEC 16022:2006, ISO/IEC 16023:2000,
" - "ISO/IEC 16388:2007, ISO/IEC 18004:2015, ISO/IEC 24723:2010,
" - "ISO/IEC 24724:2011, ISO/IEC 24728:2006, ISO/IEC 24778:2008,
" - "ISO/IEC 21471:2019, ANSI-HIBC 2.3-2009, ANSI/AIM BC6-2000,
" - "ANSI/AIM BC12-1998, AIMD014 (v 1.63), USPS-B-3200" - "
" - - )); + QMessageBox::about(this, tr("About Zint"), + tr("

Zint Barcode Studio 2.6.7

" + "

A free barcode generator" + "

Instruction manual is available at the project homepage:
" + "http://www.zint.org.uk" + "

Copyright © 2006-2018 Robin Stuart and others.
" + "Qt back end by BogDan Vatra
" + "Windows port by Harald Oehlmann

" + "

Qt version " QT_VERSION_STR + "

With thanks to Norbert Szabó, Robert Elliott, " + "Milton Neal and many others at Sourceforge." + "

Released under the GNU General Public License ver. 3 or later.
" + "\"QR Code\" is a Registered Trademark of Denso Corp.
" + "\"Telepen\" is a Registered Trademark of SB Electronics." + "

Currently supported standards include:
" + "EN 797:1996, EN 798:1996, EN 12323:2005, ISO/IEC 15417:2007,
" + "ISO/IEC 15438:2015, ISO/IEC 16022:2006, ISO/IEC 16023:2000,
" + "ISO/IEC 16388:2007, ISO/IEC 18004:2015, ISO/IEC 24723:2010,
" + "ISO/IEC 24724:2011, ISO/IEC 24728:2006, ISO/IEC 24778:2008,
" + "ISO/IEC 21471:2019, ANSI-HIBC 2.3-2009, ANSI/AIM BC6-2000,
" + "ANSI/AIM BC12-1998, AIMD014 (v 1.63), USPS-B-3200" + "
")); } int MainWindow::open_data_dialog() { - int retval; - DataWindow dlg(txtData->text()); - retval = dlg.exec(); - if (dlg.Valid == 1) - txtData->setText(dlg.DataOutput); - return retval; + int retval; + DataWindow dlg(txtData->text()); + retval = dlg.exec(); + if (dlg.Valid == 1) + txtData->setText(dlg.DataOutput); + return retval; } int MainWindow::open_sequence_dialog() { - SequenceWindow dlg; - dlg.barcode = &m_bc; - return dlg.exec(); + SequenceWindow dlg; + dlg.barcode = &m_bc; + return dlg.exec(); } void MainWindow::on_fgcolor_clicked() { QColor temp = m_fgcolor; - m_fgcolor=QColorDialog::getColor(m_fgcolor,this,"Set foreground colour"); - if (m_fgcolor.isValid()) { - update_preview(); - } else { - m_fgcolor = temp; - } + m_fgcolor=QColorDialog::getColor(m_fgcolor,this,"Set foreground colour"); + if (m_fgcolor.isValid()) { + update_preview(); + } else { + m_fgcolor = temp; + } } void MainWindow::on_bgcolor_clicked() { QColor temp = m_bgcolor; - m_bgcolor=QColorDialog::getColor(m_bgcolor,this,"Set background colour"); - if (m_bgcolor.isValid()) { - update_preview(); - } else { - m_bgcolor = temp; - } + m_bgcolor=QColorDialog::getColor(m_bgcolor,this,"Set background colour"); + if (m_bgcolor.isValid()) { + update_preview(); + } else { + m_bgcolor = temp; + } } void MainWindow::autoheight_clicked() @@ -344,13 +340,13 @@ void MainWindow::autoheight_clicked() void MainWindow::change_print_scale() { - /* This value is only used when printing (saving) to file */ - m_bc.bc.setScale((float)spnScale->value()); + /* This value is only used when printing (saving) to file */ + m_bc.bc.setScale((float)spnScale->value()); } void MainWindow::quit_now() { - close(); + close(); } void MainWindow::copy_to_clipboard_svg() @@ -363,7 +359,7 @@ void MainWindow::copy_to_clipboard_svg() spnScale->setValue(5); if (!m_bc.bc.save_to_file(filename)) { - return; + return; } data->setImageData(QImage(filename)); @@ -381,7 +377,7 @@ void MainWindow::copy_to_clipboard_bmp() QString filename = ".zint.bmp"; if (!m_bc.bc.save_to_file(filename)) { - return; + return; } data->setImageData(QImage(filename)); @@ -392,57 +388,56 @@ void MainWindow::copy_to_clipboard_bmp() void MainWindow::change_options() { - QUiLoader uiload; + QUiLoader uiload; - if (tabMain->count()==3) - tabMain->removeTab(1); + if (tabMain->count()==3) + tabMain->removeTab(1); - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE128) - { - QFile file(":/grpC128.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 128")); - chkComposite->setText(tr("Add 2D Component (GS1-128 only)")); - connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(toggled( bool )), SLOT(composite_ean_check())); - connect(m_optionWidget->findChild("radC128Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC128CSup"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC128HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - } - else - chkComposite->setText(tr("Add 2D Component")); + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE128) + { + QFile file(":/grpC128.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Code 128")); + chkComposite->setText(tr("Add 2D Component (GS1-128 only)")); + connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(toggled( bool )), SLOT(composite_ean_check())); + connect(m_optionWidget->findChild("radC128Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radC128CSup"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radC128HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + } + else + chkComposite->setText(tr("Add 2D Component")); + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_PDF417) + { + QFile file(":/grpPDF417.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("PDF417")); + connect(m_optionWidget->findChild("codewords"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbPDFECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radPDFTruncated"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radPDFStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radPDFHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_PDF417) - { - QFile file(":/grpPDF417.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("PDF417")); - connect(m_optionWidget->findChild("codewords"), SIGNAL(valueChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbPDFECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radPDFTruncated"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radPDFStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radPDFHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - } - - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MICROPDF417) - { - QFile file(":/grpMicroPDF.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Micro PDF417")); - connect(m_optionWidget->findChild("cmbMPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radMPDFStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MICROPDF417) + { + QFile file(":/grpMicroPDF.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Micro PDF417")); + connect(m_optionWidget->findChild("cmbMPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radMPDFStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); + } if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_DOTCODE) { @@ -458,415 +453,414 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("txtDotSize"), SIGNAL(textChanged( QString )), SLOT(update_preview())); } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_AZTEC) - { - QFile file(":/grpAztec.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Aztec Code")); - connect(m_optionWidget->findChild("radAztecAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbAztecSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbAztecECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_AZTEC) + { + QFile file(":/grpAztec.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Aztec Code")); + connect(m_optionWidget->findChild("radAztecAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radAztecSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radAztecECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbAztecSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbAztecECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radAztecStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radAztecGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radAztecHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MSI_PLESSEY) - { - QFile file(":/grpMSICheck.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("MSI Plessey")); - connect(m_optionWidget->findChild("cmbMSICheck"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MSI_PLESSEY) + { + QFile file(":/grpMSICheck.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("MSI Plessey")); + connect(m_optionWidget->findChild("cmbMSICheck"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + } - if((metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE39) || - (metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39)) - { - QFile file(":/grpC39.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 39")); - connect(m_optionWidget->findChild("radC39Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC39Check"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC39HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39) - { - if(m_optionWidget->findChild("radC39HIBC")->isChecked() == true) - { - m_optionWidget->findChild("radC39HIBC")->setChecked(false); - m_optionWidget->findChild("radC39Stand")->setChecked(true); - } - m_optionWidget->findChild("radC39HIBC")->setEnabled(false); - } - else - m_optionWidget->findChild("radC39HIBC")->setEnabled(true); - } - - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE16K) - { - QFile file(":/grpC16k.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 16K")); - connect(m_optionWidget->findChild("radC16kStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); - } - - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODABLOCKF) + if((metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE39) || + (metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39)) + { + QFile file(":/grpC39.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Code 39")); + connect(m_optionWidget->findChild("radC39Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radC39Check"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radC39HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39) { - QFile file (":/grpCodablockF.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Codablock-F")); - connect(m_optionWidget->findChild("radCbfAutosize"), SIGNAL(toggled( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radCbfSetWidth"), SIGNAL(toggled( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radCbfSetHeight"), SIGNAL(toggled( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbCbfWidth"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbCbfHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + if(m_optionWidget->findChild("radC39HIBC")->isChecked() == true) + { + m_optionWidget->findChild("radC39HIBC")->setChecked(false); + m_optionWidget->findChild("radC39Stand")->setChecked(true); + } + m_optionWidget->findChild("radC39HIBC")->setEnabled(false); } + else + m_optionWidget->findChild("radC39HIBC")->setEnabled(true); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_DATAMATRIX) - { - QFile file(":/grpDM.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Data Matrix")); - connect(m_optionWidget->findChild("radDM200Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radDM200GS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radDM200HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbDM200Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkDMRectangle"), SIGNAL(stateChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkDMRE"), SIGNAL(stateChanged( int )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE16K) + { + QFile file(":/grpC16k.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Code 16K")); + connect(m_optionWidget->findChild("radC16kStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_QRCODE) - { - QFile file(":/grpQR.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("QR Code")); - connect(m_optionWidget->findChild("radQRAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODABLOCKF) + { + QFile file (":/grpCodablockF.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Codablock-F")); + connect(m_optionWidget->findChild("radCbfAutosize"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radCbfSetWidth"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radCbfSetHeight"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbCbfWidth"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbCbfHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_HANXIN) - { - QFile file (":/grpHX.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Han Xin Code")); - connect(m_optionWidget->findChild("radHXAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radHXSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radHXECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbHXSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbHXECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_DATAMATRIX) + { + QFile file(":/grpDM.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Data Matrix")); + connect(m_optionWidget->findChild("radDM200Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radDM200GS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radDM200HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbDM200Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("chkDMRectangle"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("chkDMRE"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MICROQR) - { - QFile file(":/grpMQR.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Micro QR Code")); - connect(m_optionWidget->findChild("radMQRAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radMQRSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radMQRECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_QRCODE) + { + QFile file(":/grpQR.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("QR Code")); + connect(m_optionWidget->findChild("radQRAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radQRSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radQRECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radQRHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_GRIDMATRIX) - { - QFile file(":/grpGrid.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Grid Matrix")); - connect(m_optionWidget->findChild("radGridAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radGridSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radGridECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbGridSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbGridECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_HANXIN) + { + QFile file (":/grpHX.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Han Xin Code")); + connect(m_optionWidget->findChild("radHXAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radHXSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radHXECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbHXSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbHXECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MAXICODE) - { - QFile file(":/grpMaxicode.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Maxicode")); - connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_primary())); - connect(m_optionWidget->findChild("txtMaxiPrimary"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MICROQR) + { + QFile file(":/grpMQR.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Micro QR Code")); + connect(m_optionWidget->findChild("radMQRAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radMQRSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radMQRECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CHANNEL) - { - QFile file(":/grpChannel.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Channel Code")); - connect(m_optionWidget->findChild("cmbChannel"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_GRIDMATRIX) + { + QFile file(":/grpGrid.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Grid Matrix")); + connect(m_optionWidget->findChild("radGridAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radGridSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radGridECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbGridSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbGridECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODEONE) - { - QFile file(":/grpCodeOne.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code One")); - connect(m_optionWidget->findChild("cmbC1Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC1GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MAXICODE) + { + QFile file(":/grpMaxicode.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Maxicode")); + connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_primary())); + connect(m_optionWidget->findChild("txtMaxiPrimary"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE49) - { - QFile file(":/grpC49.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 49")); - connect(m_optionWidget->findChild("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CHANNEL) + { + QFile file(":/grpChannel.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Channel Code")); + connect(m_optionWidget->findChild("cmbChannel"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + } - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_RSS_EXPSTACK) - { - QFile file(":/grpDBExtend.ui"); - if (!file.open(QIODevice::ReadOnly)) - return; - m_optionWidget=uiload.load(&file); - file.close(); - tabMain->insertTab(1,m_optionWidget,tr("GS1 DataBar Stacked")); - connect(m_optionWidget->findChild("cmbCols"), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); - } + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODEONE) + { + QFile file(":/grpCodeOne.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Code One")); + connect(m_optionWidget->findChild("cmbC1Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(m_optionWidget->findChild("radC1GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); + } - switch(metaObject()->enumerator(0).value(bstyle->currentIndex())) - { - case BARCODE_CODE128: - case BARCODE_EANX: - case BARCODE_UPCA: - case BARCODE_UPCE: - case BARCODE_RSS14: - case BARCODE_RSS_LTD: - case BARCODE_RSS_EXP: - case BARCODE_RSS14STACK: - case BARCODE_RSS14STACK_OMNI: - case BARCODE_RSS_EXPSTACK: - grpComposite->show(); - break; - default: - chkComposite->setChecked(false); - grpComposite->hide(); - break; - } - tabMain->setCurrentIndex(0); + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE49) + { + QFile file(":/grpC49.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("Code 49")); + connect(m_optionWidget->findChild("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); + } + + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_RSS_EXPSTACK) + { + QFile file(":/grpDBExtend.ui"); + if (!file.open(QIODevice::ReadOnly)) + return; + m_optionWidget=uiload.load(&file); + file.close(); + tabMain->insertTab(1,m_optionWidget,tr("GS1 DataBar Stacked")); + connect(m_optionWidget->findChild("cmbCols"), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); + } + + switch(metaObject()->enumerator(0).value(bstyle->currentIndex())) + { + case BARCODE_CODE128: + case BARCODE_EANX: + case BARCODE_UPCA: + case BARCODE_UPCE: + case BARCODE_RSS14: + case BARCODE_RSS_LTD: + case BARCODE_RSS_EXP: + case BARCODE_RSS14STACK: + case BARCODE_RSS14STACK_OMNI: + case BARCODE_RSS_EXPSTACK: + grpComposite->show(); + break; + default: + chkComposite->setChecked(false); + grpComposite->hide(); + break; + } + tabMain->setCurrentIndex(0); } void MainWindow::composite_enable() { - if(chkComposite->isChecked() == true) - { - lblCompType->setEnabled(true); - cmbCompType->setEnabled(true); - lblComposite->setEnabled(true); - txtComposite->setEnabled(true); - if (metaObject()->enumerator(0).value(bstyle->currentIndex())==BARCODE_CODE128) - m_optionWidget->findChild("radC128EAN")->setChecked(true); - } - else - { - lblCompType->setEnabled(false); - cmbCompType->setEnabled(false); - lblComposite->setEnabled(false); - txtComposite->setEnabled(false); - } + if(chkComposite->isChecked() == true) + { + lblCompType->setEnabled(true); + cmbCompType->setEnabled(true); + lblComposite->setEnabled(true); + txtComposite->setEnabled(true); + if (metaObject()->enumerator(0).value(bstyle->currentIndex())==BARCODE_CODE128) + m_optionWidget->findChild("radC128EAN")->setChecked(true); + } + else + { + lblCompType->setEnabled(false); + cmbCompType->setEnabled(false); + lblComposite->setEnabled(false); + txtComposite->setEnabled(false); + } } void MainWindow::composite_ean_check() { - if (metaObject()->enumerator(0).value(bstyle->currentIndex())!=BARCODE_CODE128) - return; - if(!m_optionWidget->findChild("radC128EAN")->isChecked()) - chkComposite->setChecked(false); + if (metaObject()->enumerator(0).value(bstyle->currentIndex())!=BARCODE_CODE128) + return; + if(!m_optionWidget->findChild("radC128EAN")->isChecked()) + chkComposite->setChecked(false); } void MainWindow::maxi_primary() { - if (metaObject()->enumerator(0).value(bstyle->currentIndex())!=BARCODE_MAXICODE) - return; - if(m_optionWidget->findChild("cmbMaxiMode")->currentIndex() == 0) { - m_optionWidget->findChild("lblMaxiPrimary")->setEnabled(true); - m_optionWidget->findChild("txtMaxiPrimary")->setEnabled(true); - } else { - m_optionWidget->findChild("lblMaxiPrimary")->setEnabled(false); - m_optionWidget->findChild("txtMaxiPrimary")->setEnabled(false); - } + if (metaObject()->enumerator(0).value(bstyle->currentIndex())!=BARCODE_MAXICODE) + return; + if(m_optionWidget->findChild("cmbMaxiMode")->currentIndex() == 0) { + m_optionWidget->findChild("lblMaxiPrimary")->setEnabled(true); + m_optionWidget->findChild("txtMaxiPrimary")->setEnabled(true); + } else { + m_optionWidget->findChild("lblMaxiPrimary")->setEnabled(false); + m_optionWidget->findChild("txtMaxiPrimary")->setEnabled(false); + } } void MainWindow::update_preview() { - int width = view->geometry().width(); - int height = view->geometry().height(); + int width = view->geometry().width(); + int height = view->geometry().height(); - //m_bc.ar=(Zint::QZint::AspectRatioMode)1; - if(chkComposite->isChecked() == true) { - m_bc.bc.setPrimaryMessage(txtData->text()); - m_bc.bc.setText(txtComposite->toPlainText()); - } else { - m_bc.bc.setText(txtData->text()); - /*m_bc.bc.setPrimaryMessage(txtComposite->text());*/ - } - m_bc.bc.setSecurityLevel(0); - m_bc.bc.setWidth(0); - m_bc.bc.setInputMode(UNICODE_MODE); - m_bc.bc.setHideText(0); - if(chkHRTHide->isChecked() == false) { - m_bc.bc.setHideText(1); - } - switch(metaObject()->enumerator(0).value(bstyle->currentIndex())) - { - case BARCODE_CODE128: - if(m_optionWidget->findChild("radC128Stand")->isChecked()) - m_bc.bc.setSymbol(BARCODE_CODE128); + //m_bc.ar=(Zint::QZint::AspectRatioMode)1; + if(chkComposite->isChecked() == true) { + m_bc.bc.setPrimaryMessage(txtData->text()); + m_bc.bc.setText(txtComposite->toPlainText()); + } else { + m_bc.bc.setText(txtData->text()); + } + m_bc.bc.setSecurityLevel(0); + m_bc.bc.setWidth(0); + m_bc.bc.setInputMode(UNICODE_MODE); + m_bc.bc.setHideText(0); + if(chkHRTHide->isChecked() == false) { + m_bc.bc.setHideText(1); + } + switch(metaObject()->enumerator(0).value(bstyle->currentIndex())) + { + case BARCODE_CODE128: + if(m_optionWidget->findChild("radC128Stand")->isChecked()) + m_bc.bc.setSymbol(BARCODE_CODE128); - if(m_optionWidget->findChild("radC128CSup")->isChecked()) - m_bc.bc.setSymbol(BARCODE_CODE128B); + if(m_optionWidget->findChild("radC128CSup")->isChecked()) + m_bc.bc.setSymbol(BARCODE_CODE128B); - if(m_optionWidget->findChild("radC128EAN")->isChecked()) - { - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_EAN128_CC); - else - m_bc.bc.setSymbol(BARCODE_EAN128); - } + if(m_optionWidget->findChild("radC128EAN")->isChecked()) + { + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_EAN128_CC); + else + m_bc.bc.setSymbol(BARCODE_EAN128); + } - if(m_optionWidget->findChild("radC128HIBC")->isChecked()) - m_bc.bc.setSymbol(BARCODE_HIBC_128); - break; + if(m_optionWidget->findChild("radC128HIBC")->isChecked()) + m_bc.bc.setSymbol(BARCODE_HIBC_128); + break; - case BARCODE_EANX: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_EANX_CC); - else - m_bc.bc.setSymbol(BARCODE_EANX); - break; + case BARCODE_EANX: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_EANX_CC); + else + m_bc.bc.setSymbol(BARCODE_EANX); + break; - case BARCODE_UPCA: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_UPCA_CC); - else - m_bc.bc.setSymbol(BARCODE_UPCA); - break; + case BARCODE_UPCA: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_UPCA_CC); + else + m_bc.bc.setSymbol(BARCODE_UPCA); + break; - case BARCODE_UPCE: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_UPCE_CC); - else - m_bc.bc.setSymbol(BARCODE_UPCE); - break; + case BARCODE_UPCE: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_UPCE_CC); + else + m_bc.bc.setSymbol(BARCODE_UPCE); + break; - case BARCODE_RSS14: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_RSS14_CC); - else - m_bc.bc.setSymbol(BARCODE_RSS14); - break; + case BARCODE_RSS14: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_RSS14_CC); + else + m_bc.bc.setSymbol(BARCODE_RSS14); + break; - case BARCODE_RSS_LTD: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_RSS_LTD_CC); - else - m_bc.bc.setSymbol(BARCODE_RSS_LTD); - break; + case BARCODE_RSS_LTD: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_RSS_LTD_CC); + else + m_bc.bc.setSymbol(BARCODE_RSS_LTD); + break; - case BARCODE_RSS_EXP: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_RSS_EXP_CC); - else - m_bc.bc.setSymbol(BARCODE_RSS_EXP); - break; + case BARCODE_RSS_EXP: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_RSS_EXP_CC); + else + m_bc.bc.setSymbol(BARCODE_RSS_EXP); + break; - case BARCODE_RSS14STACK: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_RSS14STACK_CC); - else - m_bc.bc.setSymbol(BARCODE_RSS14STACK); - break; + case BARCODE_RSS14STACK: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_RSS14STACK_CC); + else + m_bc.bc.setSymbol(BARCODE_RSS14STACK); + break; - case BARCODE_RSS14STACK_OMNI: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_RSS14_OMNI_CC); - else - m_bc.bc.setSymbol(BARCODE_RSS14STACK_OMNI); - break; + case BARCODE_RSS14STACK_OMNI: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_RSS14_OMNI_CC); + else + m_bc.bc.setSymbol(BARCODE_RSS14STACK_OMNI); + break; - case BARCODE_RSS_EXPSTACK: - if(chkComposite->isChecked()) - m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK_CC); - else - m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK); + case BARCODE_RSS_EXPSTACK: + if(chkComposite->isChecked()) + m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK_CC); + else + m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK); - if(m_optionWidget->findChild("cmbCols")->currentIndex() != 0) - m_bc.bc.setWidth(m_optionWidget->findChild("cmbCols")->currentIndex()); - break; + if(m_optionWidget->findChild("cmbCols")->currentIndex() != 0) + m_bc.bc.setWidth(m_optionWidget->findChild("cmbCols")->currentIndex()); + break; - case BARCODE_PDF417: - m_bc.bc.setWidth(m_optionWidget->findChild("cmbPDFCols")->currentIndex()); - m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbPDFECC")->currentIndex()-1); - m_bc.bc.setPdf417CodeWords(m_optionWidget->findChild("codewords")->value()); - if(m_optionWidget->findChild("radPDFStand")->isChecked()) - m_bc.bc.setSymbol(BARCODE_PDF417); + case BARCODE_PDF417: + m_bc.bc.setWidth(m_optionWidget->findChild("cmbPDFCols")->currentIndex()); + m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbPDFECC")->currentIndex()-1); + m_bc.bc.setPdf417CodeWords(m_optionWidget->findChild("codewords")->value()); + if(m_optionWidget->findChild("radPDFStand")->isChecked()) + m_bc.bc.setSymbol(BARCODE_PDF417); - if(m_optionWidget->findChild("radPDFTruncated")->isChecked()) - m_bc.bc.setSymbol(BARCODE_PDF417TRUNC); + if(m_optionWidget->findChild("radPDFTruncated")->isChecked()) + m_bc.bc.setSymbol(BARCODE_PDF417TRUNC); - if(m_optionWidget->findChild("radPDFHIBC")->isChecked()) - m_bc.bc.setSymbol(BARCODE_HIBC_PDF); - break; + if(m_optionWidget->findChild("radPDFHIBC")->isChecked()) + m_bc.bc.setSymbol(BARCODE_HIBC_PDF); + break; - case BARCODE_MICROPDF417: - m_bc.bc.setWidth(m_optionWidget->findChild("cmbMPDFCols")->currentIndex()); - if(m_optionWidget->findChild("radMPDFStand")->isChecked()) - m_bc.bc.setSymbol(BARCODE_MICROPDF417); + case BARCODE_MICROPDF417: + m_bc.bc.setWidth(m_optionWidget->findChild("cmbMPDFCols")->currentIndex()); + if(m_optionWidget->findChild("radMPDFStand")->isChecked()) + m_bc.bc.setSymbol(BARCODE_MICROPDF417); - if(m_optionWidget->findChild("radMPDFHIBC")->isChecked()) - m_bc.bc.setSymbol(BARCODE_HIBC_MICPDF); - break; + if(m_optionWidget->findChild("radMPDFHIBC")->isChecked()) + m_bc.bc.setSymbol(BARCODE_HIBC_MICPDF); + break; case BARCODE_DOTCODE: m_bc.bc.setSymbol(BARCODE_DOTCODE); @@ -876,49 +870,49 @@ void MainWindow::update_preview() m_bc.bc.setDotSize(m_optionWidget->findChild("txtDotSize")->text().toFloat()); break; - case BARCODE_AZTEC: - m_bc.bc.setSymbol(BARCODE_AZTEC); - if(m_optionWidget->findChild("radAztecSize")->isChecked()) - m_bc.bc.setWidth(m_optionWidget->findChild("cmbAztecSize")->currentIndex() + 1); + case BARCODE_AZTEC: + m_bc.bc.setSymbol(BARCODE_AZTEC); + if(m_optionWidget->findChild("radAztecSize")->isChecked()) + m_bc.bc.setWidth(m_optionWidget->findChild("cmbAztecSize")->currentIndex() + 1); - if(m_optionWidget->findChild("radAztecECC")->isChecked()) - m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbAztecECC")->currentIndex() + 1); + if(m_optionWidget->findChild("radAztecECC")->isChecked()) + m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbAztecECC")->currentIndex() + 1); - if(m_optionWidget->findChild("radAztecGS1")->isChecked()) - m_bc.bc.setInputMode(GS1_MODE); - if(m_optionWidget->findChild("radAztecHIBC")->isChecked()) - m_bc.bc.setSymbol(BARCODE_HIBC_AZTEC); - break; + if(m_optionWidget->findChild("radAztecGS1")->isChecked()) + m_bc.bc.setInputMode(GS1_MODE); + if(m_optionWidget->findChild("radAztecHIBC")->isChecked()) + m_bc.bc.setSymbol(BARCODE_HIBC_AZTEC); + break; - case BARCODE_MSI_PLESSEY: - m_bc.bc.setSymbol(BARCODE_MSI_PLESSEY); - m_bc.bc.setWidth(m_optionWidget->findChild("cmbMSICheck")->currentIndex()); - break; + case BARCODE_MSI_PLESSEY: + m_bc.bc.setSymbol(BARCODE_MSI_PLESSEY); + m_bc.bc.setWidth(m_optionWidget->findChild("cmbMSICheck")->currentIndex()); + break; - case BARCODE_CODE39: - if(m_optionWidget->findChild("radC39HIBC")->isChecked()) - m_bc.bc.setSymbol(BARCODE_HIBC_39); - else - { - m_bc.bc.setSymbol(BARCODE_CODE39); - if(m_optionWidget->findChild("radC39Check")->isChecked()) - m_bc.bc.setWidth(1); - } - break; + case BARCODE_CODE39: + if(m_optionWidget->findChild("radC39HIBC")->isChecked()) + m_bc.bc.setSymbol(BARCODE_HIBC_39); + else + { + m_bc.bc.setSymbol(BARCODE_CODE39); + if(m_optionWidget->findChild("radC39Check")->isChecked()) + m_bc.bc.setWidth(1); + } + break; - case BARCODE_EXCODE39: - m_bc.bc.setSymbol(BARCODE_EXCODE39); - if(m_optionWidget->findChild("radC39Check")->isChecked()) - m_bc.bc.setWidth(1); + case BARCODE_EXCODE39: + m_bc.bc.setSymbol(BARCODE_EXCODE39); + if(m_optionWidget->findChild("radC39Check")->isChecked()) + m_bc.bc.setWidth(1); - break; - case BARCODE_CODE16K: - m_bc.bc.setSymbol(BARCODE_CODE16K); - if(m_optionWidget->findChild("radC16kStand")->isChecked()) - m_bc.bc.setInputMode(UNICODE_MODE); - else - m_bc.bc.setInputMode(GS1_MODE); - break; + break; + case BARCODE_CODE16K: + m_bc.bc.setSymbol(BARCODE_CODE16K); + if(m_optionWidget->findChild("radC16kStand")->isChecked()) + m_bc.bc.setInputMode(UNICODE_MODE); + else + m_bc.bc.setInputMode(GS1_MODE); + break; case BARCODE_CODABLOCKF: m_bc.bc.setSymbol(BARCODE_CODABLOCKF); @@ -929,133 +923,132 @@ void MainWindow::update_preview() m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbCbfHeight")->currentIndex() + 1); break; - case BARCODE_DATAMATRIX: - m_bc.bc.setSecurityLevel(1); - if(m_optionWidget->findChild("radDM200HIBC")->isChecked()) - m_bc.bc.setSymbol(BARCODE_HIBC_DM); - else - m_bc.bc.setSymbol(BARCODE_DATAMATRIX); + case BARCODE_DATAMATRIX: + m_bc.bc.setSecurityLevel(1); + if(m_optionWidget->findChild("radDM200HIBC")->isChecked()) + m_bc.bc.setSymbol(BARCODE_HIBC_DM); + else + m_bc.bc.setSymbol(BARCODE_DATAMATRIX); - if(m_optionWidget->findChild("radDM200GS1")->isChecked()) - m_bc.bc.setInputMode(GS1_MODE); + if(m_optionWidget->findChild("radDM200GS1")->isChecked()) + m_bc.bc.setInputMode(GS1_MODE); - m_bc.bc.setWidth(m_optionWidget->findChild("cmbDM200Size")->currentIndex()); - - if (m_optionWidget->findChild("cmbDM200Size")->currentIndex() == 0) { - // Supressing rectangles or allowing DMRE only makes sense if in automatic size mode - findChild("chkDMRectangle")->setEnabled(true); - findChild("chkDMRE")->setEnabled(true); - if(m_optionWidget->findChild("chkDMRectangle")->isChecked()) - m_bc.bc.setOption3(DM_SQUARE); - else { - if(m_optionWidget->findChild("chkDMRE")->isChecked()) - m_bc.bc.setOption3(DM_DMRE); - else - m_bc.bc.setOption3(0); - } - } else { - findChild("chkDMRectangle")->setEnabled(false); - findChild("chkDMRE")->setEnabled(false); - m_bc.bc.setOption3(0); - } - break; + m_bc.bc.setWidth(m_optionWidget->findChild("cmbDM200Size")->currentIndex()); - case BARCODE_QRCODE: - if(m_optionWidget->findChild("radQRHIBC")->isChecked()) - m_bc.bc.setSymbol(BARCODE_HIBC_QR); - else - m_bc.bc.setSymbol(BARCODE_QRCODE); + if (m_optionWidget->findChild("cmbDM200Size")->currentIndex() == 0) { + // Supressing rectangles or allowing DMRE only makes sense if in automatic size mode + findChild("chkDMRectangle")->setEnabled(true); + findChild("chkDMRE")->setEnabled(true); + if(m_optionWidget->findChild("chkDMRectangle")->isChecked()) + m_bc.bc.setOption3(DM_SQUARE); + else { + if(m_optionWidget->findChild("chkDMRE")->isChecked()) + m_bc.bc.setOption3(DM_DMRE); + else + m_bc.bc.setOption3(0); + } + } else { + findChild("chkDMRectangle")->setEnabled(false); + findChild("chkDMRE")->setEnabled(false); + m_bc.bc.setOption3(0); + } + break; - if(m_optionWidget->findChild("radQRGS1")->isChecked()) - m_bc.bc.setInputMode(GS1_MODE); + case BARCODE_QRCODE: + if(m_optionWidget->findChild("radQRHIBC")->isChecked()) + m_bc.bc.setSymbol(BARCODE_HIBC_QR); + else + m_bc.bc.setSymbol(BARCODE_QRCODE); - if(m_optionWidget->findChild("radQRSize")->isChecked()) - m_bc.bc.setWidth(m_optionWidget->findChild("cmbQRSize")->currentIndex() + 1); + if(m_optionWidget->findChild("radQRGS1")->isChecked()) + m_bc.bc.setInputMode(GS1_MODE); - if(m_optionWidget->findChild("radQRECC")->isChecked()) - m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbQRECC")->currentIndex() + 1); - break; + if(m_optionWidget->findChild("radQRSize")->isChecked()) + m_bc.bc.setWidth(m_optionWidget->findChild("cmbQRSize")->currentIndex() + 1); - case BARCODE_MICROQR: - m_bc.bc.setSymbol(BARCODE_MICROQR); - if(m_optionWidget->findChild("radMQRSize")->isChecked()) - m_bc.bc.setWidth(m_optionWidget->findChild("cmbMQRSize")->currentIndex() + 1); + if(m_optionWidget->findChild("radQRECC")->isChecked()) + m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbQRECC")->currentIndex() + 1); + break; - if(m_optionWidget->findChild("radMQRECC")->isChecked()) - m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbMQRECC")->currentIndex() + 1); - break; + case BARCODE_MICROQR: + m_bc.bc.setSymbol(BARCODE_MICROQR); + if(m_optionWidget->findChild("radMQRSize")->isChecked()) + m_bc.bc.setWidth(m_optionWidget->findChild("cmbMQRSize")->currentIndex() + 1); - case BARCODE_GRIDMATRIX: - m_bc.bc.setSymbol(BARCODE_GRIDMATRIX); - if(m_optionWidget->findChild("radGridSize")->isChecked()) - m_bc.bc.setWidth(m_optionWidget->findChild("cmbGridSize")->currentIndex() + 1); + if(m_optionWidget->findChild("radMQRECC")->isChecked()) + m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbMQRECC")->currentIndex() + 1); + break; - if(m_optionWidget->findChild("radGridECC")->isChecked()) - m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbGridECC")->currentIndex() + 1); - break; + case BARCODE_GRIDMATRIX: + m_bc.bc.setSymbol(BARCODE_GRIDMATRIX); + if(m_optionWidget->findChild("radGridSize")->isChecked()) + m_bc.bc.setWidth(m_optionWidget->findChild("cmbGridSize")->currentIndex() + 1); - case BARCODE_MAXICODE: - m_bc.bc.setSymbol(BARCODE_MAXICODE); - if(m_optionWidget->findChild("cmbMaxiMode")->currentIndex() == 0) - { - m_bc.bc.setSecurityLevel(2); - m_bc.bc.setPrimaryMessage(m_optionWidget->findChild("txtMaxiPrimary")->text()); - } - else - m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbMaxiMode")->currentIndex() + 3); - break; + if(m_optionWidget->findChild("radGridECC")->isChecked()) + m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbGridECC")->currentIndex() + 1); + break; - case BARCODE_CHANNEL: - m_bc.bc.setSymbol(BARCODE_CHANNEL); - if(m_optionWidget->findChild("cmbChannel")->currentIndex() == 0) - m_bc.bc.setWidth(0); - else - m_bc.bc.setWidth(m_optionWidget->findChild("cmbChannel")->currentIndex() + 2); - break; + case BARCODE_MAXICODE: + m_bc.bc.setSymbol(BARCODE_MAXICODE); + if(m_optionWidget->findChild("cmbMaxiMode")->currentIndex() == 0) + { + m_bc.bc.setSecurityLevel(2); + m_bc.bc.setPrimaryMessage(m_optionWidget->findChild("txtMaxiPrimary")->text()); + } + else + m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbMaxiMode")->currentIndex() + 3); + break; - case BARCODE_CODEONE: - m_bc.bc.setSymbol(BARCODE_CODEONE); - if(m_optionWidget->findChild("radC1GS1")->isChecked()) - m_bc.bc.setInputMode(GS1_MODE); - m_bc.bc.setWidth(m_optionWidget->findChild("cmbC1Size")->currentIndex()); - break; + case BARCODE_CHANNEL: + m_bc.bc.setSymbol(BARCODE_CHANNEL); + if(m_optionWidget->findChild("cmbChannel")->currentIndex() == 0) + m_bc.bc.setWidth(0); + else + m_bc.bc.setWidth(m_optionWidget->findChild("cmbChannel")->currentIndex() + 2); + break; - case BARCODE_CODE49: - m_bc.bc.setSymbol(BARCODE_CODE49); - if(m_optionWidget->findChild("radC49GS1")->isChecked()) - m_bc.bc.setInputMode(GS1_MODE); - break; + case BARCODE_CODEONE: + m_bc.bc.setSymbol(BARCODE_CODEONE); + if(m_optionWidget->findChild("radC1GS1")->isChecked()) + m_bc.bc.setInputMode(GS1_MODE); + m_bc.bc.setWidth(m_optionWidget->findChild("cmbC1Size")->currentIndex()); + break; - case BARCODE_HANXIN: - m_bc.bc.setSymbol(BARCODE_HANXIN); - if(m_optionWidget->findChild("radHXSize")->isChecked()) - m_bc.bc.setWidth(m_optionWidget->findChild("cmbHXSize")->currentIndex() + 1); + case BARCODE_CODE49: + m_bc.bc.setSymbol(BARCODE_CODE49); + if(m_optionWidget->findChild("radC49GS1")->isChecked()) + m_bc.bc.setInputMode(GS1_MODE); + break; - if(m_optionWidget->findChild("radHXECC")->isChecked()) - m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbHXECC")->currentIndex() + 1); - break; + case BARCODE_HANXIN: + m_bc.bc.setSymbol(BARCODE_HANXIN); + if(m_optionWidget->findChild("radHXSize")->isChecked()) + m_bc.bc.setWidth(m_optionWidget->findChild("cmbHXSize")->currentIndex() + 1); - default: - m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex())); - break; - } + if(m_optionWidget->findChild("radHXECC")->isChecked()) + m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbHXECC")->currentIndex() + 1); + break; - if(chkComposite->isChecked()) - m_bc.bc.setSecurityLevel(cmbCompType->currentIndex()); + default: + m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex())); + break; + } - m_bc.bc.setBorderType((Zint::QZint::BorderType)(btype->currentIndex()*2)); - m_bc.bc.setBorderWidth(bwidth->value()); + if(chkComposite->isChecked()) + m_bc.bc.setSecurityLevel(cmbCompType->currentIndex()); + + m_bc.bc.setBorderType((Zint::QZint::BorderType)(btype->currentIndex()*2)); + m_bc.bc.setBorderWidth(bwidth->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); - m_bc.setSize(width - 10, height - 10); - m_bc.update(); - scene->setSceneRect(0, 0, width - 10, height - 10); - scene->update(); + m_bc.bc.setWhitespace(spnWhitespace->value()); + m_bc.bc.setFgColor(m_fgcolor); + m_bc.bc.setBgColor(m_bgcolor); + m_bc.setSize(width - 10, height - 10); + m_bc.update(); + scene->setSceneRect(0, 0, width - 10, height - 10); + scene->update(); } - diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index e54aa3cb..0da976d4 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by BogDan Vatra * - * Copyright (C) 2009-2016 by Robin Stuart * + * Copyright (C) 2009-2019 by Robin Stuart * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -32,125 +32,116 @@ class QMenu; class MainWindow : public QWidget, private Ui::mainWindow { - Q_OBJECT + Q_OBJECT - Q_ENUMS(BarcodeTypes) + Q_ENUMS(BarcodeTypes) public: - enum BarcodeTypes - { - AUSREDIRECT =68, - AUSREPLY =66, - AUSROUTE =67, - AUSPOST =63, - AZTEC =92, - AZRUNE =128, - CHANNEL =140, - CODABAR =18, - CODABLOCK =74, - CODE11 =1, - CODE128 =20, - CODE16K =23, - C25LOGIC =6, - C25IATA =4, - C25IND =7, - C25INTER =3, - C25MATRIX =2, - CODE32 =129, - CODE39 =8, - EXCODE39 =9, - CODE49 =24, - CODE93 =25, - CODE_ONE =141, - DATAMATRIX =71, - DPIDENT =22, - DPLEIT =21, - DOTCODE =115, - KIX =90, - EAN14 =72, - EANX =13, - FIM =49, - FLAT =28, - GRIDMATRIX =142, - RSS_EXP =31, - RSS_EXPSTACK =81, - RSS_LTD =30, - RSS14 =29, - RSS14STACK =79, - RSS14STACK_OMNI =80, - HANXIN =116, - ITF14 =89, - ISBNX =69, - JAPANPOST =76, - KOREAPOST =77, - LOGMARS =50, - MAXICODE =57, - MICROPDF417 =84, - MICROQR =97, - MSI_PLESSEY =47, - NVE18 =75, - PDF417 =55, - PHARMA =51, - PHARMA_TWO =53, - PZN =52, - PLANET =82, - POSTNET =40, - QRCODE =58, - RM4SCC =70, - MAILMARK =121, - TELEPEN =32, - TELEPEN_NUM =87, - PLESSEY =86, - UPNQR =143, - UPCA =34, - UPCE =37, - ONECODE =85 - }; + enum BarcodeTypes + { + AUSREDIRECT = 68, + AUSREPLY = 66, + AUSROUTE = 67, + AUSPOST = 63, + AZTEC = 92, + AZRUNE = 128, + CHANNEL = 140, + CODABAR = 18, + CODABLOCK = 74, + CODE11 = 1, + CODE128 = 20, + CODE16K = 23, + C25LOGIC = 6, + C25IATA = 4, + C25IND = 7, + C25INTER = 3, + C25MATRIX = 2, + CODE32 = 129, + CODE39 = 8, + EXCODE39 = 9, + CODE49 = 24, + CODE93 = 25, + CODE_ONE = 141, + DATAMATRIX = 71, + DPIDENT = 22, + DPLEIT = 21, + DOTCODE = 115, + KIX = 90, + EAN14 = 72, + EANX = 13, + FIM = 49, + FLAT = 28, + GRIDMATRIX = 142, + RSS_EXP = 31, + RSS_EXPSTACK = 81, + RSS_LTD = 30, + RSS14 = 29, + RSS14STACK = 79, + RSS14STACK_OMNI = 80, + HANXIN = 116, + ITF14 = 89, + ISBNX = 69, + JAPANPOST = 76, + KOREAPOST = 77, + LOGMARS = 50, + MAXICODE = 57, + MICROPDF417 = 84, + MICROQR = 97, + MSI_PLESSEY = 47, + NVE18 = 75, + PDF417 = 55, + PHARMA = 51, + PHARMA_TWO = 53, + PZN = 52, + PLANET = 82, + POSTNET = 40, + QRCODE = 58, + RMQR = 145, + RM4SCC = 70, + MAILMARK = 121, + TELEPEN = 32, + TELEPEN_NUM = 87, + PLESSEY = 86, + UPNQR = 143, + UPCA = 34, + UPCE = 37, + ONECODE = 85 + }; public: - MainWindow(QWidget* parent = 0, Qt::WindowFlags fl = 0); - ~MainWindow(); + MainWindow(QWidget* parent = 0, Qt::WindowFlags fl = 0); + ~MainWindow(); public slots: - void update_preview(); - void change_options(); - void on_fgcolor_clicked(); - void on_bgcolor_clicked(); - void composite_enable(); - void composite_ean_check(); - void maxi_primary(); - void change_print_scale(); - void autoheight_clicked(); + void update_preview(); + void change_options(); + void on_fgcolor_clicked(); + void on_bgcolor_clicked(); + void composite_enable(); + void composite_ean_check(); + void maxi_primary(); + void change_print_scale(); + void autoheight_clicked(); protected: void resizeEvent(QResizeEvent *event); private slots: - bool save(); - void about(); - void quit_now(); - void reset_view(); - int open_data_dialog(); - int open_sequence_dialog(); + bool save(); + void about(); + void quit_now(); + void reset_view(); + int open_data_dialog(); + int open_sequence_dialog(); void copy_to_clipboard_svg(); void copy_to_clipboard_bmp(); private: -/* void createActions(); - void createMenus(); */ - - QColor m_fgcolor,m_bgcolor; - BarcodeItem m_bc; - QWidget *m_optionWidget; - QGraphicsScene *scene; -/* QMenu *fileMenu; - QMenu *helpMenu; - QAction *saveAct; - QAction *aboutQtAct; */ + QColor m_fgcolor,m_bgcolor; + BarcodeItem m_bc; + QWidget *m_optionWidget; + QGraphicsScene *scene; }; #endif - - -