mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
GUI Overhaul
This commit is contained in:
parent
f567430fea
commit
8a5b33a9cb
@ -33,8 +33,8 @@ QZint::QZint()
|
||||
m_fgColor=Qt::black;
|
||||
m_bgColor=Qt::white;
|
||||
m_zintSymbol=0;
|
||||
m_excode39SymbologyNumber=m_code39SymbologyNumber=m_msiSymbologyNumber=0;
|
||||
m_error=0;
|
||||
m_input_mode = UNICODE_MODE;
|
||||
}
|
||||
|
||||
QZint::~QZint()
|
||||
@ -57,24 +57,8 @@ void QZint::encode()
|
||||
m_zintSymbol->whitespace_width=0;
|
||||
m_zintSymbol->border_width=m_boderWidth;
|
||||
m_zintSymbol->option_1=m_securityLevel;
|
||||
switch (m_symbol)
|
||||
{
|
||||
case BARCODE_MSI_PLESSEY:
|
||||
m_zintSymbol->option_2=m_msiSymbologyNumber;
|
||||
break;
|
||||
|
||||
case BARCODE_CODE39:
|
||||
m_zintSymbol->option_2=m_code39SymbologyNumber;
|
||||
break;
|
||||
|
||||
case BARCODE_EXCODE39:
|
||||
m_zintSymbol->option_2=m_excode39SymbologyNumber;
|
||||
break;
|
||||
|
||||
default:
|
||||
m_zintSymbol->option_2=m_width;
|
||||
break;
|
||||
}
|
||||
m_zintSymbol->input_mode = m_input_mode;
|
||||
m_zintSymbol->option_2=m_width;
|
||||
m_zintSymbol->option_3=m_pdf417CodeWords;
|
||||
QByteArray bstr=m_text.toAscii();
|
||||
QByteArray pstr=m_primaryMessage.left(99).toAscii();
|
||||
@ -96,6 +80,11 @@ void QZint::setSymbol(int symbol)
|
||||
m_symbol=symbol;
|
||||
}
|
||||
|
||||
void QZint::setInputMode(int input_mode)
|
||||
{
|
||||
m_input_mode = input_mode;
|
||||
}
|
||||
|
||||
QString QZint::text()
|
||||
{
|
||||
return m_text;
|
||||
@ -201,33 +190,6 @@ void QZint::setMode(int securityLevel)
|
||||
m_securityLevel=securityLevel;
|
||||
}
|
||||
|
||||
int QZint::msiExtraSymbology()
|
||||
{
|
||||
return m_msiSymbologyNumber;
|
||||
}
|
||||
void QZint::setMsiExtraSymbology(int msiSymbologyNumber)
|
||||
{
|
||||
m_msiSymbologyNumber=msiSymbologyNumber;
|
||||
}
|
||||
|
||||
int QZint::code39ExtraSymbology()
|
||||
{
|
||||
return m_code39SymbologyNumber;
|
||||
}
|
||||
void QZint::setCode39ExtraSymbology(int m_code39SymbologyNumber)
|
||||
{
|
||||
m_code39SymbologyNumber=m_code39SymbologyNumber;
|
||||
}
|
||||
|
||||
int QZint::excode39ExtraSymbology()
|
||||
{
|
||||
return m_excode39SymbologyNumber;
|
||||
}
|
||||
void QZint::setExcode39ExtraSymbology(int excode39SymbologyNumber)
|
||||
{
|
||||
m_excode39SymbologyNumber=excode39SymbologyNumber;
|
||||
}
|
||||
|
||||
void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode)
|
||||
{
|
||||
encode();
|
||||
|
@ -72,14 +72,7 @@ public:
|
||||
int mode();
|
||||
void setMode(int securityLevel);
|
||||
|
||||
int msiExtraSymbology();
|
||||
void setMsiExtraSymbology(int msiSymbologyNumber);
|
||||
|
||||
int code39ExtraSymbology();
|
||||
void setCode39ExtraSymbology(int m_code39SymbologyNumber);
|
||||
|
||||
int excode39ExtraSymbology();
|
||||
void setExcode39ExtraSymbology(int excode39SymbologyNumber);
|
||||
void setInputMode(int input_mode);
|
||||
|
||||
void render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode=IgnoreAspectRatio);
|
||||
|
||||
@ -98,9 +91,7 @@ private:
|
||||
int m_width;
|
||||
int m_securityLevel;
|
||||
int m_pdf417CodeWords;
|
||||
int m_msiSymbologyNumber;
|
||||
int m_code39SymbologyNumber;
|
||||
int m_excode39SymbologyNumber;
|
||||
int m_input_mode;
|
||||
QColor m_fgColor;
|
||||
QColor m_bgColor;
|
||||
QString m_lastError;
|
||||
|
@ -20,8 +20,8 @@
|
||||
BarcodeItem::BarcodeItem()
|
||||
: QGraphicsItem()
|
||||
{
|
||||
w=400;
|
||||
h=400;
|
||||
w=550;
|
||||
h=230;
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by BogDan Vatra *
|
||||
* bogdan@licentia.eu *
|
||||
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
|
||||
* Copyright (C) 2009 by Robin Stuart <robin@zint.org.uk> *
|
||||
* *
|
||||
* 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 *
|
||||
@ -21,30 +21,70 @@
|
||||
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include <stdio.h>
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
||||
: QWidget(parent, fl)
|
||||
{
|
||||
char bstyle_text[][40] = {
|
||||
"Code 11", "Code 2 of 5 Matrix", "Code 2 of 5 Interleaved", "IATA Code 2 of 5",
|
||||
"Code 2 of 5 Data Logic", "Code 2 of 5 Industrial", "Code 39", "Extended Code 39",
|
||||
"EAN", "EAN-128", "Codabar", "Code 128", "DP Leitcode", "DP Identcode",
|
||||
"Code 16k", "Code 93", "Flattermarken", "Databar",
|
||||
"Databar Limited", "Databar Expanded", "Telepen", "UPC-A", "UPC-E",
|
||||
"Postnet", "MSI Plessey", "FIM", "LOGMARS", "Pharmacode", "PZN",
|
||||
"Pharmacode 2-track", "PDF417", "PDF417 Truncated", "Maxicode",
|
||||
"QR Code", "Code 128 Subset B", "Auspost Standard", "Auspost Reply",
|
||||
"Auspost Route", "Auspost Redirect", "ISBN", "Royal Mail 4-state",
|
||||
"Data Matrix", "EAN-14", "Codablock-F", "NVE-18", "Korea Post", "Databar Stacked",
|
||||
"Databar Stacked Omni", "Databar Expanded Stacked", "PLANET",
|
||||
"MicroPDF417", "USPS One Code", "UK Plessey", "Telepen Numeric",
|
||||
"ITF-14", "Dutch Post KIX", "Aztec Code", "Micro QR Code",
|
||||
"HIBC Code 128", "HIBC Code 39", "HIBC Data Matrix", "HIBC QR Code",
|
||||
"HIBC PDF417", "HIBC MicroPDF417", "HIBC Codablock-F", "Aztec Runes",
|
||||
"Code 32", "Composite EAN", "Composite EAN-128", "Composite Databar",
|
||||
"Composite Databar Limited", "Composite Databar Expanded",
|
||||
"Composite UPC-A", "Composite UPC-E", "Composite Databar Stacked",
|
||||
"Composite Databar Stacked Omni", "Composite Databar Expanded Stacked"
|
||||
char bstyle_text[][50] = {
|
||||
"Australia Post Standard Customer",
|
||||
"Australia Post Reply-Paid",
|
||||
"Australia Post Routing Code",
|
||||
"Australia Post Redirect Code",
|
||||
"Aztec Code",
|
||||
"Aztec Runes",
|
||||
"Code 11",
|
||||
"Code 128",
|
||||
"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",
|
||||
"Code 39 Extended",
|
||||
"Code 93",
|
||||
"Codabar",
|
||||
"Codablock-F",
|
||||
"Databar",
|
||||
"Databar Expanded",
|
||||
"Databar Expanded Stacked",
|
||||
"Databar Limited",
|
||||
"Databar Stacked",
|
||||
"Databar Stacked Omnidirectional",
|
||||
"Data Matrix",
|
||||
"Deutsche Post Identcode",
|
||||
"Deutsche Post Leitcode",
|
||||
"Dutch Post KIX",
|
||||
"EAN-14",
|
||||
"European Article Number (EAN)",
|
||||
"FIM",
|
||||
"Flattermarken",
|
||||
"ITF-14",
|
||||
"International Standard Book Number (ISBN)",
|
||||
"Japanese Postal Barcode",
|
||||
"Korean Postal Barcode",
|
||||
"LOGMARS",
|
||||
"Maxicode",
|
||||
"MicroPDF417",
|
||||
"Micro QR Code",
|
||||
"MSI Plessey",
|
||||
"NVE-18",
|
||||
"PDF417",
|
||||
"Pharmacode",
|
||||
"Pharmacode 2-track",
|
||||
"Pharma Zentralnummer (PZN)",
|
||||
"PLANET",
|
||||
"Postnet",
|
||||
"QR Code",
|
||||
"Royal Mail 4-state Barcode",
|
||||
"Telepen",
|
||||
"Telepen Numeric",
|
||||
"UK Plessey",
|
||||
"UPC-A",
|
||||
"UPC-E",
|
||||
"USPS One Code"
|
||||
};
|
||||
setupUi(this);
|
||||
view->setScene(new QGraphicsScene);
|
||||
@ -54,22 +94,74 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
||||
bstyle->addItem(metaObject()->enumerator(0).key(i));
|
||||
bstyle->setItemText(i,bstyle_text[i]);
|
||||
}
|
||||
bstyle->setCurrentIndex(11);
|
||||
on_generate_clicked();
|
||||
bstyle->setCurrentIndex(7);
|
||||
change_options();
|
||||
update_preview();
|
||||
view->scene()->addItem(&m_bc);
|
||||
connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(heightb, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(widthb, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(security, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(bwidth, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(codewords, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(iwidth, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(iheight, SIGNAL(valueChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
||||
connect(primary, SIGNAL(textChanged( const QString& )), SLOT(on_generate_clicked()));
|
||||
connect(text, SIGNAL(textChanged()), SLOT(on_generate_clicked()));
|
||||
connect(aspectRatio, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
||||
|
||||
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(codewords, 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(radC128EAN, SIGNAL(toggled( bool )), SLOT(composite_ean_check()));
|
||||
connect(radC128Stand, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radC128CSup, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radC128EAN, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radC128HIBC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(cmbPDFECC, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbPDFCols, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(radPDFTruncated, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radPDFStand, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radPDFHIBC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radAztecSize, SIGNAL(toggled( bool )), SLOT(aztec_size()));
|
||||
connect(radAztecECC, SIGNAL(toggled( bool )), SLOT(aztec_errorcorrect()));
|
||||
connect(radAztecAuto, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radAztecSize, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radAztecECC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(cmbAztecSize, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbAztecECC, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(chkAztecMode, SIGNAL(stateChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbMSICheck, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(radC39Stand, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radC39Check, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radC39HIBC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(cmbMPDFCols, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(radMPDFStand, SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(radC16kStand, SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(radCodaStand, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radCodaGS1, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radCodaHIBC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(cmbDMMode, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbDMMode, SIGNAL(currentIndexChanged( int )), SLOT(datamatrix_options()));
|
||||
connect(radDM200Stand, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radDM200GS1, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radDM200HIBC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(cmbDM200Size, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbDMNon200Size, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(radQRAuto, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radQRSize, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radQRECC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radQRSize, SIGNAL(toggled( bool )), SLOT(qr_size()));
|
||||
connect(radQRECC, SIGNAL(toggled( bool )), SLOT(qr_errorcorrect()));
|
||||
connect(cmbQRSize, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbQRECC, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(chkQRHIBC, SIGNAL(stateChanged( int )), SLOT(update_preview()));
|
||||
connect(radMQRAuto, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radMQRSize, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radMQRECC, SIGNAL(clicked( bool )), SLOT(update_preview()));
|
||||
connect(radMQRSize, SIGNAL(toggled( bool )), SLOT(mqr_size()));
|
||||
connect(radMQRECC, SIGNAL(toggled( bool )), SLOT(mqr_errorcorrect()));
|
||||
connect(cmbMQRSize, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbMQRECC, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbMaxiMode, SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(cmbMaxiMode, SIGNAL(currentIndexChanged( int )), SLOT(maxi_primary()));
|
||||
connect(txtMaxiPrimary, SIGNAL(textChanged( const QString& )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -79,67 +171,491 @@ MainWindow::~MainWindow()
|
||||
void MainWindow::on_fgcolor_clicked()
|
||||
{
|
||||
m_fgcolor=QColorDialog::getColor(m_fgcolor,this);
|
||||
on_generate_clicked();
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::on_bgcolor_clicked()
|
||||
{
|
||||
m_bgcolor=QColorDialog::getColor(m_bgcolor,this);
|
||||
on_generate_clicked();
|
||||
update_preview();
|
||||
}
|
||||
|
||||
void MainWindow::on_generate_clicked()
|
||||
void MainWindow::change_options()
|
||||
{
|
||||
bool options;
|
||||
|
||||
options = false;
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE128)
|
||||
{
|
||||
options = true;
|
||||
grpC128->show();
|
||||
chkComposite->setText(tr("Add 2D Component (GS1-128 only)"));
|
||||
} else {
|
||||
grpC128->hide();
|
||||
chkComposite->setText(tr("Add 2D Component"));
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_PDF417)
|
||||
{
|
||||
options = true;
|
||||
grpPDF417->show();
|
||||
} else {
|
||||
grpPDF417->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MICROPDF417)
|
||||
{
|
||||
options = true;
|
||||
grpMicroPDF->show();
|
||||
} else {
|
||||
grpMicroPDF->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_AZTEC)
|
||||
{
|
||||
options = true;
|
||||
grpAztec->show();
|
||||
} else {
|
||||
grpAztec->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MSI_PLESSEY)
|
||||
{
|
||||
options = true;
|
||||
grpMSICheck->show();
|
||||
} else {
|
||||
grpMSICheck->hide();
|
||||
}
|
||||
|
||||
if((metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE39) ||
|
||||
(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39))
|
||||
{
|
||||
options = true;
|
||||
grpC39->show();
|
||||
} else {
|
||||
grpC39->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39) {
|
||||
if(radC39HIBC->isChecked() == true) {
|
||||
radC39HIBC->setChecked(false);
|
||||
radC39Stand->setChecked(true);
|
||||
}
|
||||
radC39HIBC->setEnabled(false);
|
||||
} else {
|
||||
radC39HIBC->setEnabled(true);
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODABLOCKF)
|
||||
{
|
||||
options = true;
|
||||
grpCodablock->show();
|
||||
} else {
|
||||
grpCodablock->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODE16K)
|
||||
{
|
||||
options = true;
|
||||
grpC16k->show();
|
||||
} else {
|
||||
grpC16k->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_DATAMATRIX)
|
||||
{
|
||||
options = true;
|
||||
datamatrix_options();
|
||||
grpDM->show();
|
||||
} else {
|
||||
grpDM->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_QRCODE)
|
||||
{
|
||||
options = true;
|
||||
grpQR->show();
|
||||
} else {
|
||||
grpQR->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MICROQR)
|
||||
{
|
||||
options = true;
|
||||
grpMQR->show();
|
||||
} else {
|
||||
grpMQR->hide();
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MAXICODE)
|
||||
{
|
||||
grpMaxiCode->show();
|
||||
} else {
|
||||
grpMaxiCode->hide();
|
||||
}
|
||||
|
||||
|
||||
if(options == true) {
|
||||
lblNoOption->hide();
|
||||
} else {
|
||||
lblNoOption->show();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::composite_enable()
|
||||
{
|
||||
if(chkComposite->isChecked() == true) {
|
||||
lblCompType->setEnabled(true);
|
||||
cmbCompType->setEnabled(true);
|
||||
lblComposite->setEnabled(true);
|
||||
txtComposite->setEnabled(true);
|
||||
radC128EAN->setChecked(true);
|
||||
} else {
|
||||
lblCompType->setEnabled(false);
|
||||
cmbCompType->setEnabled(false);
|
||||
lblComposite->setEnabled(false);
|
||||
txtComposite->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::composite_ean_check()
|
||||
{
|
||||
if(radC128EAN->isChecked() == false) {
|
||||
chkComposite->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::aztec_size()
|
||||
{
|
||||
if(radAztecSize->isChecked() == true) {
|
||||
cmbAztecSize->setEnabled(true);
|
||||
} else {
|
||||
cmbAztecSize->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::aztec_errorcorrect()
|
||||
{
|
||||
if(radAztecECC->isChecked() == true) {
|
||||
cmbAztecECC->setEnabled(true);
|
||||
} else {
|
||||
cmbAztecECC->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::qr_size()
|
||||
{
|
||||
if(radQRSize->isChecked() == true) {
|
||||
cmbQRSize->setEnabled(true);
|
||||
} else {
|
||||
cmbQRSize->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::mqr_errorcorrect()
|
||||
{
|
||||
if(radMQRECC->isChecked() == true) {
|
||||
cmbMQRECC->setEnabled(true);
|
||||
} else {
|
||||
cmbMQRECC->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::mqr_size()
|
||||
{
|
||||
if(radMQRSize->isChecked() == true) {
|
||||
cmbMQRSize->setEnabled(true);
|
||||
} else {
|
||||
cmbMQRSize->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::qr_errorcorrect()
|
||||
{
|
||||
if(radQRECC->isChecked() == true) {
|
||||
cmbQRECC->setEnabled(true);
|
||||
} else {
|
||||
cmbQRECC->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::datamatrix_options()
|
||||
{
|
||||
if(cmbDMMode->currentIndex() == 0) {
|
||||
grpDMNon200->hide();
|
||||
grpDM200->show();
|
||||
} else {
|
||||
grpDM200->hide();
|
||||
grpDMNon200->show();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::maxi_primary()
|
||||
{
|
||||
if(cmbMaxiMode->currentIndex() == 0) {
|
||||
lblMaxiPrimary->setEnabled(true);
|
||||
txtMaxiPrimary->setEnabled(true);
|
||||
} else {
|
||||
lblMaxiPrimary->setEnabled(false);
|
||||
txtMaxiPrimary->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::update_preview()
|
||||
{
|
||||
QString error;
|
||||
m_bc.w=iwidth->value();
|
||||
m_bc.h=iheight->value();
|
||||
m_bc.ar=(Zint::QZint::AspectRatioMode)aspectRatio->currentIndex();
|
||||
m_bc.bc.setText(text->toPlainText());
|
||||
m_bc.bc.setPrimaryMessage(primary->text());
|
||||
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex()));
|
||||
switch(m_bc.bc.symbol())
|
||||
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);
|
||||
switch(metaObject()->enumerator(0).value(bstyle->currentIndex()))
|
||||
{
|
||||
case BARCODE_MSI_PLESSEY:
|
||||
m_bc.bc.setMsiExtraSymbology(msiPlessey->currentIndex());
|
||||
case BARCODE_CODE128:
|
||||
if(radC128Stand->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_CODE128);
|
||||
}
|
||||
if(radC128CSup->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_CODE128B);
|
||||
}
|
||||
if(radC128EAN->isChecked() == true) {
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_EAN128_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_EAN128);
|
||||
}
|
||||
}
|
||||
if(radC128HIBC->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_128);
|
||||
}
|
||||
break;
|
||||
case BARCODE_CODE39:
|
||||
m_bc.bc.setCode39ExtraSymbology(code39->currentIndex());
|
||||
case BARCODE_EANX:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_EANX_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_EANX);
|
||||
}
|
||||
break;
|
||||
case BARCODE_EXCODE39:
|
||||
m_bc.bc.setExcode39ExtraSymbology(code39->currentIndex());
|
||||
case BARCODE_UPCA:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_UPCA_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_UPCA);
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCE:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_UPCE_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_UPCE);
|
||||
}
|
||||
break;
|
||||
case BARCODE_RSS14:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS14_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS14);
|
||||
}
|
||||
break;
|
||||
case BARCODE_RSS_LTD:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS_LTD_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS_LTD);
|
||||
}
|
||||
break;
|
||||
case BARCODE_RSS_EXP:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS_EXP_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS_EXP);
|
||||
}
|
||||
break;
|
||||
case BARCODE_RSS14STACK:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS14STACK_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS14STACK);
|
||||
}
|
||||
break;
|
||||
case BARCODE_RSS14STACK_OMNI:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS14_OMNI_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS14STACK_OMNI);
|
||||
}
|
||||
break;
|
||||
case BARCODE_RSS_EXPSTACK:
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK_CC);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK);
|
||||
}
|
||||
break;
|
||||
case BARCODE_PDF417:
|
||||
m_bc.bc.setWidth(cmbPDFCols->currentIndex());
|
||||
m_bc.bc.setSecurityLevel(cmbPDFECC->currentIndex() - 1);
|
||||
m_bc.bc.setPdf417CodeWords(codewords->value());
|
||||
if(radPDFStand->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_PDF417);
|
||||
}
|
||||
if(radPDFTruncated->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_PDF417TRUNC);
|
||||
}
|
||||
if(radPDFHIBC->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_PDF);
|
||||
}
|
||||
break;
|
||||
case BARCODE_MICROPDF417:
|
||||
m_bc.bc.setWidth(cmbMPDFCols->currentIndex());
|
||||
if(radMPDFStand->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_MICROPDF417);
|
||||
}
|
||||
if(radMPDFHIBC->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_MICPDF);
|
||||
}
|
||||
break;
|
||||
case BARCODE_AZTEC:
|
||||
m_bc.bc.setSymbol(BARCODE_AZTEC);
|
||||
if(radAztecSize->isChecked() == true) {
|
||||
m_bc.bc.setWidth(cmbAztecSize->currentIndex() + 1);
|
||||
}
|
||||
if(radAztecECC->isChecked() == true) {
|
||||
m_bc.bc.setSecurityLevel(cmbAztecECC->currentIndex() + 1);
|
||||
}
|
||||
if(chkAztecMode->isChecked() == true) {
|
||||
m_bc.bc.setInputMode(GS1_MODE);
|
||||
}
|
||||
break;
|
||||
case MSI_PLESSEY:
|
||||
m_bc.bc.setSymbol(BARCODE_MSI_PLESSEY);
|
||||
m_bc.bc.setWidth(cmbMSICheck->currentIndex());
|
||||
break;
|
||||
case BARCODE_CODE39:
|
||||
if(radC39HIBC->isChecked() == false) {
|
||||
m_bc.bc.setSymbol(BARCODE_CODE39);
|
||||
if(radC39Check->isChecked() == true) {
|
||||
m_bc.bc.setWidth(1);
|
||||
}
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_39);
|
||||
}
|
||||
break;
|
||||
case BARCODE_EXCODE39:
|
||||
m_bc.bc.setSymbol(BARCODE_EXCODE39);
|
||||
if(radC39Check->isChecked() == true) {
|
||||
m_bc.bc.setWidth(1);
|
||||
}
|
||||
break;
|
||||
case BARCODE_CODE16K:
|
||||
m_bc.bc.setSymbol(BARCODE_CODE16K);
|
||||
if(radC16kStand->isChecked() == true) {
|
||||
m_bc.bc.setInputMode(UNICODE_MODE);
|
||||
} else {
|
||||
m_bc.bc.setInputMode(GS1_MODE);
|
||||
}
|
||||
break;
|
||||
case BARCODE_CODABLOCKF:
|
||||
if(radCodaGS1->isChecked() == true) {
|
||||
m_bc.bc.setInputMode(GS1_MODE);
|
||||
}
|
||||
if(radCodaHIBC->isChecked() == false) {
|
||||
m_bc.bc.setSymbol(BARCODE_CODABLOCKF);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_BLOCKF);
|
||||
}
|
||||
break;
|
||||
case BARCODE_DATAMATRIX:
|
||||
m_bc.bc.setSecurityLevel(cmbDMMode->currentIndex() + 1);
|
||||
if(cmbDMMode->currentIndex() == 0) {
|
||||
/* ECC 200 */
|
||||
if(radDM200HIBC->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_DM);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_DATAMATRIX);
|
||||
}
|
||||
if(radDM200GS1->isChecked() == true) {
|
||||
m_bc.bc.setInputMode(GS1_MODE);
|
||||
}
|
||||
m_bc.bc.setWidth(cmbDM200Size->currentIndex());
|
||||
} else {
|
||||
/* Not ECC 200 */
|
||||
m_bc.bc.setSymbol(BARCODE_DATAMATRIX);
|
||||
m_bc.bc.setWidth(cmbDMNon200Size->currentIndex());
|
||||
}
|
||||
break;
|
||||
case BARCODE_QRCODE:
|
||||
if(chkQRHIBC->isChecked() == true) {
|
||||
m_bc.bc.setSymbol(BARCODE_HIBC_QR);
|
||||
} else {
|
||||
m_bc.bc.setSymbol(BARCODE_QRCODE);
|
||||
}
|
||||
if(radQRSize->isChecked() == true) {
|
||||
m_bc.bc.setWidth(cmbQRSize->currentIndex() + 1);
|
||||
}
|
||||
if(radQRECC->isChecked() == true) {
|
||||
m_bc.bc.setSecurityLevel(cmbQRECC->currentIndex() + 1);
|
||||
}
|
||||
break;
|
||||
case BARCODE_MICROQR:
|
||||
m_bc.bc.setSymbol(BARCODE_MICROQR);
|
||||
if(radMQRSize->isChecked() == true) {
|
||||
m_bc.bc.setWidth(cmbMQRSize->currentIndex() + 1);
|
||||
}
|
||||
if(radMQRECC->isChecked() == true) {
|
||||
m_bc.bc.setSecurityLevel(cmbMQRECC->currentIndex() + 1);
|
||||
}
|
||||
break;
|
||||
case BARCODE_MAXICODE:
|
||||
m_bc.bc.setSymbol(BARCODE_MAXICODE);
|
||||
if(cmbMaxiMode->currentIndex() == 0) {
|
||||
m_bc.bc.setSecurityLevel(2);
|
||||
m_bc.bc.setPrimaryMessage(txtMaxiPrimary->text());
|
||||
} else {
|
||||
m_bc.bc.setSecurityLevel(cmbMaxiMode->currentIndex() + 3);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex()));
|
||||
break;
|
||||
}
|
||||
if(chkComposite->isChecked() == true) {
|
||||
m_bc.bc.setSecurityLevel(cmbCompType->currentIndex());
|
||||
}
|
||||
m_bc.bc.setBorderType((Zint::QZint::BorderType)(btype->currentIndex()*2));
|
||||
m_bc.bc.setBorderWidth(bwidth->value());
|
||||
m_bc.bc.setHeight(heightb->value());
|
||||
m_bc.bc.setWidth(widthb->value());
|
||||
m_bc.bc.setSecurityLevel(security->value());
|
||||
m_bc.bc.setPdf417CodeWords(codewords->value());
|
||||
m_bc.bc.setFgColor(m_fgcolor);
|
||||
m_bc.bc.setBgColor(m_bgcolor);
|
||||
m_bc.update();
|
||||
view->scene()->update();
|
||||
}
|
||||
|
||||
void MainWindow::on_zoomIn_clicked()
|
||||
{
|
||||
view->scale(1.2,1.2);
|
||||
}
|
||||
|
||||
void MainWindow::on_zoomOut_clicked()
|
||||
{
|
||||
view->scale(0.9,0.9);
|
||||
}
|
||||
|
||||
void MainWindow::on_rotateAc_clicked()
|
||||
{
|
||||
view->rotate(-5);
|
||||
}
|
||||
void MainWindow::on_rotateC_clicked()
|
||||
{
|
||||
view->rotate(5);
|
||||
}
|
||||
void MainWindow::on_reset_clicked()
|
||||
{
|
||||
view->resetTransform();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by BogDan Vatra *
|
||||
* bogdan@licentia.eu *
|
||||
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
|
||||
* Copyright (C) 2009 by Robin Stuart <robin@zint.org.uk> *
|
||||
* *
|
||||
* 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,89 +32,64 @@ class MainWindow : public QWidget, private Ui::mainWindow
|
||||
public:
|
||||
enum BarcodeTypes
|
||||
{
|
||||
CODE11 =1,
|
||||
C25MATRIX =2,
|
||||
C25INTER =3,
|
||||
C25IATA =4,
|
||||
C25LOGIC =6,
|
||||
C25IND =7,
|
||||
CODE39 =8,
|
||||
EXCODE39 =9,
|
||||
EANX =13,
|
||||
EAN128 =16,
|
||||
CODABAR =18,
|
||||
CODE128 =20,
|
||||
DPLEIT =21,
|
||||
DPIDENT =22,
|
||||
CODE16K =23,
|
||||
CODE93 =25,
|
||||
FLAT =28,
|
||||
RSS14 =29,
|
||||
RSS_LTD =30,
|
||||
RSS_EXP =31,
|
||||
TELEPEN =32,
|
||||
UPCA =34,
|
||||
UPCE =37,
|
||||
POSTNET =40,
|
||||
MSI_PLESSEY =47,
|
||||
FIM =49,
|
||||
LOGMARS =50,
|
||||
PHARMA =51,
|
||||
PZN =52,
|
||||
PHARMA_TWO =53,
|
||||
PDF417 =55,
|
||||
PDF417TRUNC =56,
|
||||
MAXICODE =57,
|
||||
QRCODE =58,
|
||||
CODE128B =60,
|
||||
AUSPOST =63,
|
||||
AUSREPLY =66,
|
||||
AUSROUTE =67,
|
||||
AUSREDIRECT =68,
|
||||
ISBNX =69,
|
||||
RM4SCC =70,
|
||||
DATAMATRIX =71,
|
||||
EAN14 =72,
|
||||
AZTEC =92,
|
||||
AZRUNE =128,
|
||||
CODE11 =1,
|
||||
CODE128 =20,
|
||||
CODE16K =23,
|
||||
C25LOGIC =6,
|
||||
C25IATA =4,
|
||||
C25IND =7,
|
||||
C25INTER =3,
|
||||
C25MATRIX =2,
|
||||
CODE32 =129,
|
||||
CODE39 =8,
|
||||
EXCODE39 =9,
|
||||
CODE93 =25,
|
||||
CODABAR =18,
|
||||
CODABLOCKF =74,
|
||||
NVE18 =75,
|
||||
KOREAPOST =77,
|
||||
RSS14 =29,
|
||||
RSS_EXP =31,
|
||||
RSS_EXPSTACK =81,
|
||||
RSS_LTD =30,
|
||||
RSS14STACK =79,
|
||||
RSS14STACK_OMNI =80,
|
||||
RSS_EXPSTACK =81,
|
||||
PLANET =82,
|
||||
MICROPDF417 =84,
|
||||
ONECODE =85,
|
||||
PLESSEY =86,
|
||||
|
||||
/* Tbarcode 8 codes */
|
||||
TELEPEN_NUM =87,
|
||||
ITF14 =89,
|
||||
DATAMATRIX =71,
|
||||
DPIDENT =22,
|
||||
DPLEIT =21,
|
||||
KIX =90,
|
||||
AZTEC =92,
|
||||
EAN14 =72,
|
||||
EANX =13,
|
||||
FIM =49,
|
||||
FLAT =28,
|
||||
ITF14 =89,
|
||||
ISBNX =69,
|
||||
JAPANPOST =76,
|
||||
KOREAPOST =77,
|
||||
LOGMARS =50,
|
||||
MAXICODE =57,
|
||||
MICROPDF417 =84,
|
||||
MICROQR =97,
|
||||
|
||||
/* Tbarcode 9 codes */
|
||||
HIBC_128 =98,
|
||||
HIBC_39 =99,
|
||||
HIBC_DM =102,
|
||||
HIBC_QR =104,
|
||||
HIBC_PDF =106,
|
||||
HIBC_MICPDF =108,
|
||||
HIBC_BLOCKF =110,
|
||||
|
||||
/* Zint specific */
|
||||
AZRUNE =128,
|
||||
CODE32 =129,
|
||||
EANX_CC =130,
|
||||
EAN128_CC =131,
|
||||
RSS14_CC =132,
|
||||
RSS_LTD_CC =133,
|
||||
RSS_EXP_CC =134,
|
||||
UPCA_CC =135,
|
||||
UPCE_CC =136,
|
||||
RSS14STACK_CC =137,
|
||||
RSS14_OMNI_CC =138,
|
||||
RSS_EXPSTACK_CC =139
|
||||
MSI_PLESSEY =47,
|
||||
NVE18 =75,
|
||||
PDF417 =55,
|
||||
PHARMA =51,
|
||||
PHARMA_TWO =53,
|
||||
PZN =52,
|
||||
PLANET =82,
|
||||
POSTNET =40,
|
||||
QRCODE =58,
|
||||
RM4SCC =70,
|
||||
TELEPEN =32,
|
||||
TELEPEN_NUM =87,
|
||||
PLESSEY =86,
|
||||
UPCA =34,
|
||||
UPCE =37,
|
||||
ONECODE =85
|
||||
};
|
||||
|
||||
public:
|
||||
@ -122,14 +97,20 @@ public:
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void on_generate_clicked();
|
||||
void update_preview();
|
||||
void change_options();
|
||||
void on_fgcolor_clicked();
|
||||
void on_bgcolor_clicked();
|
||||
void on_zoomIn_clicked();
|
||||
void on_zoomOut_clicked();
|
||||
void on_rotateAc_clicked();
|
||||
void on_rotateC_clicked();
|
||||
void on_reset_clicked();
|
||||
void composite_enable();
|
||||
void composite_ean_check();
|
||||
void aztec_size();
|
||||
void aztec_errorcorrect();
|
||||
void datamatrix_options();
|
||||
void qr_size();
|
||||
void qr_errorcorrect();
|
||||
void mqr_size();
|
||||
void mqr_errorcorrect();
|
||||
void maxi_primary();
|
||||
|
||||
private:
|
||||
QColor m_fgcolor,m_bgcolor;
|
||||
|
Loading…
Reference in New Issue
Block a user