GUI: add CLI equivalent dialog (#163); use spinboxes in Sequence dialog

and restrict sequence to max 10,000, add button icons;
   make Export dialog sizable and show every 100 results, add button icon;
   fix saving CHANNEL option, fix Export painting main window (Windows), fix
   guard descent not-resetting
 qzint: add getAsCLI(), warnLevel(), extra isStackable()/isComposite() etc
 Add ZBarcode_BarcodeName()
 manual: doc above, some fixes, tweaks
This commit is contained in:
gitlost
2021-11-23 19:12:48 +00:00
parent 9d85c425f4
commit 739a64a6ff
34 changed files with 2264 additions and 1199 deletions

View File

@ -6,14 +6,15 @@ project(zint-qt)
set(CMAKE_AUTORCC ON)
set(${PROJECT_NAME}_SRCS barcodeitem.cpp main.cpp mainwindow.cpp datawindow.cpp sequencewindow.cpp exportwindow.cpp)
set(${PROJECT_NAME}_SRCS barcodeitem.cpp main.cpp mainwindow.cpp
cliwindow.cpp datawindow.cpp sequencewindow.cpp exportwindow.cpp)
if(USE_QT6)
qt6_wrap_cpp(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h exportwindow.h)
qt6_wrap_ui(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui)
qt6_wrap_cpp(zint-qt_SRCS mainwindow.h cliwindow.h datawindow.h sequencewindow.h exportwindow.h)
qt6_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extSequence.ui extExport.ui)
else()
qt5_wrap_cpp(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h exportwindow.h)
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui)
qt5_wrap_cpp(zint-qt_SRCS mainwindow.h cliwindow.h datawindow.h sequencewindow.h exportwindow.h)
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extSequence.ui extExport.ui)
endif()
# grpAztec.ui grpC39.ui grpCodablockF.ui grpDotCode.ui grpMaxicode.ui grpQR.ui grpVIN.ui
@ -30,7 +31,9 @@ endif()
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/backend" "${CMAKE_SOURCE_DIR}/backend_qt")
target_link_libraries(${PROJECT_NAME} zint QZint Qt${QT_VERSION_MAJOR}::UiTools Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Core)
target_link_libraries(${PROJECT_NAME} zint QZint
Qt${QT_VERSION_MAJOR}::UiTools Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Core)
install(TARGETS ${PROJECT_NAME} DESTINATION "${BIN_INSTALL_DIR}" RUNTIME)

View File

@ -31,6 +31,7 @@ class BarcodeItem : public QGraphicsItem
public:
BarcodeItem();
~BarcodeItem();
void setSize(int width, int height);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

103
frontend_qt/cliwindow.cpp Normal file
View File

@ -0,0 +1,103 @@
/*
Zint Barcode Generator - the open source barcode generator
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* vim: set ts=4 sw=4 et : */
//#include <QDebug>
#include <QSettings>
#include <QClipboard>
#include <QMimeData>
#include "cliwindow.h"
#include "barcodeitem.h"
#include "mainwindow.h"
// Shorthand
#define QSL QStringLiteral
static const int tempMessageTimeout = 2000;
CLIWindow::CLIWindow(BarcodeItem *bc, const bool autoHeight, const double heightPerRow)
: m_bc(bc), m_autoHeight(autoHeight), m_heightPerRow(heightPerRow)
{
setupUi(this);
QSettings settings;
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
QByteArray geometry = settings.value(QSL("studio/cli/window_geometry")).toByteArray();
restoreGeometry(geometry);
#if _WIN32
const int index = settings.value(QSL("studio/cli/rad_unix_win"), 1).toInt();
#else
const int index = settings.value(QSL("studio/cli/rad_unix_win"), 0).toInt();
#endif
if (index == 1) {
radCLIWin->setChecked(true);
} else {
radCLIUnix->setChecked(true);
}
chkCLILongOpts->setChecked(settings.value(QSL("studio/cli/chk_long_opts"), 0).toInt() ? true : false);
chkCLIBarcodeName->setChecked(settings.value(QSL("studio/cli/chk_barcode_name"), 0).toInt() ? true : false);
QIcon copyIcon(QIcon::fromTheme(QSL("edit-copy"), QIcon(QSL(":res/copy.svg"))));
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
btnCLICopy->setIcon(copyIcon);
btnCLIClose->setIcon(closeIcon);
connect(btnCLIClose, SIGNAL( clicked( bool )), SLOT(close()));
connect(btnCLICopy, SIGNAL( clicked( bool )), SLOT(copy_to_clipboard()));
connect(radCLIUnix, SIGNAL(toggled( bool )), SLOT(generate_cli()));
connect(radCLIWin, SIGNAL(toggled( bool )), SLOT(generate_cli()));
connect(chkCLILongOpts, SIGNAL(toggled( bool )), SLOT(generate_cli()));
connect(chkCLIBarcodeName, SIGNAL(toggled( bool )), SLOT(generate_cli()));
generate_cli();
}
CLIWindow::~CLIWindow()
{
QSettings settings;
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
settings.setValue(QSL("studio/cli/window_geometry"), saveGeometry());
settings.setValue(QSL("studio/cli/rad_unix_win"), radCLIWin->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/cli/chk_long_opts"), chkCLILongOpts->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/cli/chk_barcode_name"), chkCLIBarcodeName->isChecked() ? 1 : 0);
}
void CLIWindow::copy_to_clipboard()
{
QClipboard *clipboard = QGuiApplication::clipboard();
QMimeData *mdata = new QMimeData;
mdata->setData("text/plain", txtCLICmd->toPlainText().toUtf8());
clipboard->setMimeData(mdata, QClipboard::Clipboard);
statusBarCLI->showMessage(tr("Copied to clipboard"), tempMessageTimeout);
}
void CLIWindow::generate_cli()
{
QString cmd = m_bc->bc.getAsCLI(radCLIWin->isChecked(), chkCLILongOpts->isChecked(),
chkCLIBarcodeName->isChecked(), m_autoHeight, m_heightPerRow);
txtCLICmd->setPlainText(cmd);
statusBarCLI->clearMessage();
}

46
frontend_qt/cliwindow.h Normal file
View File

@ -0,0 +1,46 @@
/*
Zint Barcode Generator - the open source barcode generator
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* vim: set ts=4 sw=4 et : */
#ifndef CLIWINDOW_H
#define CLIWINDOW_H
#include "ui_extCLI.h"
class BarcodeItem;
class CLIWindow : public QDialog, private Ui::CLIDialog
{
Q_OBJECT
public:
CLIWindow(BarcodeItem *bc, const bool autoHeight, const double heightPerRow);
virtual ~CLIWindow();
private slots:
void copy_to_clipboard();
void generate_cli();
protected:
BarcodeItem *m_bc;
bool m_autoHeight;
double m_heightPerRow;
};
#endif

View File

@ -27,35 +27,43 @@
#include "datawindow.h"
DataWindow::DataWindow()
// Shorthand
#define QSL QStringLiteral
DataWindow::DataWindow(const QString &input) : Valid(false)
{
setupUi(this);
QSettings settings;
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
}
QByteArray geometry = settings.value(QSL("studio/data/window_geometry")).toByteArray();
restoreGeometry(geometry);
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
QIcon clearIcon(QIcon::fromTheme(QSL("edit-clear"), QIcon(QSL(":res/delete.svg"))));
QIcon okIcon(QIcon(QSL(":res/check.svg")));
btnCancel->setIcon(closeIcon);
btnDataClear->setIcon(clearIcon);
btnOK->setIcon(okIcon);
DataWindow::DataWindow(const QString &input)
{
setupUi(this);
txtDataInput->setPlainText(input);
txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(close()));
connect(btnDataClear, SIGNAL( clicked( bool )), SLOT(clear_data()));
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
connect(btnFromFile, SIGNAL( clicked( bool )), SLOT(from_file()));
}
DataWindow::~DataWindow()
{
}
void DataWindow::quit_now()
{
Valid = 0;
close();
QSettings settings;
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
settings.setValue(QSL("studio/data/window_geometry"), saveGeometry());
}
void DataWindow::clear_data()
@ -65,7 +73,7 @@ void DataWindow::clear_data()
void DataWindow::okay()
{
Valid = 1;
Valid = true;
DataOutput = txtDataInput->toPlainText();
close();
}
@ -93,7 +101,7 @@ void DataWindow::from_file()
}
file.setFileName(filename);
if(!file.open(QIODevice::ReadOnly)) {
if (!file.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, tr("Open Error"), tr("Could not open selected file."));
return;
}

View File

@ -1,6 +1,6 @@
/*
Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com>
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
@ -16,6 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* vim: set ts=4 sw=4 et : */
#ifndef DATAWINDOW_H
#define DATAWINDOW_H
@ -24,20 +25,19 @@
class DataWindow : public QDialog, private Ui::DataDialog
{
Q_OBJECT
Q_OBJECT
public:
DataWindow();
explicit DataWindow(const QString &input);
~DataWindow();
int Valid;
QString DataOutput;
DataWindow(const QString &input);
~DataWindow();
bool Valid;
QString DataOutput;
private slots:
void quit_now();
void clear_data();
void okay();
void from_file();
void clear_data();
void okay();
void from_file();
};
#endif

View File

@ -23,24 +23,34 @@
#include <QFileDialog>
#include <QMessageBox>
#include <QSettings>
#include <QStringBuilder>
#include "exportwindow.h"
ExportWindow::ExportWindow()
// Shorthand
#define QSL QStringLiteral
ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data) : m_bc(bc), m_output_data(output_data)
{
setupUi(this);
QSettings settings;
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
setupUi(this);
linDestPath->setText(settings.value("studio/export/destination",
QByteArray geometry = settings.value(QSL("studio/export/window_geometry")).toByteArray();
restoreGeometry(geometry);
linDestPath->setText(settings.value(QSL("studio/export/destination"),
QDir::toNativeSeparators(QDir::homePath())).toString());
linPrefix->setText(settings.value("studio/export/file_prefix", "bcs_").toString());
cmbFileName->setCurrentIndex(settings.value("studio/export/name_format", 0).toInt());
cmbFileFormat->setCurrentIndex(settings.value("studio/export/filetype", 0).toInt());
linPrefix->setText(settings.value(QSL("studio/export/file_prefix"), QSL("bcs_")).toString());
cmbFileName->setCurrentIndex(settings.value(QSL("studio/export/name_format"), 0).toInt());
cmbFileFormat->setCurrentIndex(settings.value(QSL("studio/export/filetype"), 0).toInt());
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
btnCancel->setIcon(closeIcon);
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(close()));
connect(btnOK, SIGNAL( clicked( bool )), SLOT(process()));
connect(btnDestPath, SIGNAL( clicked( bool )), SLOT(get_directory()));
}
@ -51,16 +61,12 @@ ExportWindow::~ExportWindow()
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
settings.setValue(QSL("studio/export/window_geometry"), saveGeometry());
settings.setValue("studio/export/destination", linDestPath->text());
settings.setValue("studio/export/file_prefix", linPrefix->text());
settings.setValue("studio/export/name_format", cmbFileName->currentIndex());
settings.setValue("studio/export/filetype", cmbFileFormat->currentIndex());
}
void ExportWindow::quit_now()
{
close();
settings.setValue(QSL("studio/export/destination"), linDestPath->text());
settings.setValue(QSL("studio/export/file_prefix"), linPrefix->text());
settings.setValue(QSL("studio/export/name_format"), cmbFileName->currentIndex());
settings.setValue(QSL("studio/export/filetype"), cmbFileFormat->currentIndex());
}
void ExportWindow::get_directory()
@ -73,116 +79,148 @@ void ExportWindow::get_directory()
QFileDialog fdialog;
fdialog.setFileMode(QFileDialog::Directory);
fdialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString());
fdialog.setDirectory(settings.value(QSL("studio/default_dir"),
QDir::toNativeSeparators(QDir::homePath())).toString());
if(fdialog.exec()) {
if (fdialog.exec()) {
directory = fdialog.selectedFiles().at(0);
} else {
return;
}
linDestPath->setText(QDir::toNativeSeparators(directory));
settings.setValue("studio/default_dir", directory);
settings.setValue(QSL("studio/default_dir"), directory);
}
void ExportWindow::process()
{
QString fileName;
QString dataString;
const QRegularExpression urlRE(QSL("[\\/:*?\"<>|%]"));
txtFeedback->setPlainText(tr("Processing..."));
txtFeedback->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
QStringList dataList = m_output_data.split('\n');
int lines = dataList.size();
if (lines && dataList[lines - 1].isEmpty()) {
lines--;
}
QString biggest;
bool needUrlEscape = false;
const int fileNameIdx = cmbFileName->currentIndex();
if (fileNameIdx == 1) {
biggest = QString::number(lines + 1);
} else {
needUrlEscape = m_output_data.contains(urlRE);
}
QString suffix;
QString Feedback;
int lines, i, j, inputpos;
lines = output_data.count(QChar('\n'), Qt::CaseInsensitive);
inputpos = 0;
switch(cmbFileFormat->currentIndex()) {
switch (cmbFileFormat->currentIndex()) {
#ifdef NO_PNG
case 0: suffix = ".eps"; break;
case 1: suffix = ".gif"; break;
case 2: suffix = ".svg"; break;
case 3: suffix = ".bmp"; break;
case 4: suffix = ".pcx"; break;
case 5: suffix = ".emf"; break;
case 6: suffix = ".tif"; break;
case 0: suffix = QSL(".eps"); break;
case 1: suffix = QSL(".gif"); break;
case 2: suffix = QSL(".svg"); break;
case 3: suffix = QSL(".bmp"); break;
case 4: suffix = QSL(".pcx"); break;
case 5: suffix = QSL(".emf"); break;
case 6: suffix = QSL(".tif"); break;
#else
case 0: suffix = ".png"; break;
case 1: suffix = ".eps"; break;
case 2: suffix = ".gif"; break;
case 3: suffix = ".svg"; break;
case 4: suffix = ".bmp"; break;
case 5: suffix = ".pcx"; break;
case 6: suffix = ".emf"; break;
case 7: suffix = ".tif"; break;
case 0: suffix = QSL(".png"); break;
case 1: suffix = QSL(".eps"); break;
case 2: suffix = QSL(".gif"); break;
case 3: suffix = QSL(".svg"); break;
case 4: suffix = QSL(".bmp"); break;
case 5: suffix = QSL(".pcx"); break;
case 6: suffix = QSL(".emf"); break;
case 7: suffix = QSL(".tif"); break;
#endif
}
txtFeedback->clear();
Feedback = "";
for(i = 0; i < lines; i++) {
int datalen = 0;
for(j = inputpos; ((j < output_data.length()) && (output_data[j] != '\n') ); j++) {
datalen++;
}
dataString = output_data.mid(inputpos, datalen);
switch(cmbFileName->currentIndex()) {
case 0: { /* Same as Data (URL Escaped) */
QString filePathPrefix = linDestPath->text() % QDir::separator() % linPrefix->text();
QStringList Feedback;
int successCount = 0, errorCount = 0;
for (int i = 0; i < lines; i++) {
const QString &dataString = dataList[i];
QString fileName;
switch (fileNameIdx) {
case 0: /* Same as Data (URL Escaped) */
if (needUrlEscape) {
QString url_escaped;
int m;
QChar name_qchar;
for(m = 0; m < dataString.length(); m++) {
name_qchar = dataString[m];
for (int m = 0; m < dataString.length(); m++) {
QChar name_qchar = dataString[m];
char name_char = name_qchar.toLatin1();
switch(name_char) {
case '\\': url_escaped += "%5C"; break;
case '/': url_escaped += "%2F"; break;
case ':': url_escaped += "%3A"; break;
case '*': url_escaped += "%2A"; break;
case '?': url_escaped += "%3F"; break;
case '"': url_escaped += "%22"; break;
case '<': url_escaped += "%3C"; break;
case '>': url_escaped += "%3E"; break;
case '|': url_escaped += "%7C"; break;
case '%': url_escaped += "%25"; break;
switch (name_char) {
case '\\': url_escaped += QSL("%5C"); break;
case '/': url_escaped += QSL("%2F"); break;
case ':': url_escaped += QSL("%3A"); break;
case '*': url_escaped += QSL("%2A"); break;
case '?': url_escaped += QSL("%3F"); break;
case '"': url_escaped += QSL("%22"); break;
case '<': url_escaped += QSL("%3C"); break;
case '>': url_escaped += QSL("%3E"); break;
case '|': url_escaped += QSL("%7C"); break;
case '%': url_escaped += QSL("%25"); break;
default: url_escaped += name_qchar; break;
}
}
fileName = linDestPath->text() + QDir::separator() + linPrefix->text() + url_escaped + suffix;
fileName = filePathPrefix % url_escaped % suffix;
} else {
fileName = filePathPrefix % dataString % suffix;
}
break;
case 1: { /* Formatted Serial Number */
QString biggest, this_val, outnumber;
int number_size, val_size, m;
QString this_val, pad;
biggest = QString::number(lines + 1);
number_size = biggest.length();
this_val = QString::number(i + 1);
val_size = this_val.length();
for(m = 0; m < (number_size - val_size); m++) {
outnumber += QChar('0');
}
pad.fill('0', biggest.length() - this_val.length());
outnumber += this_val;
fileName = linDestPath->text() + QDir::separator() + linPrefix->text() + outnumber + suffix;
fileName = filePathPrefix % pad % this_val % suffix;
}
break;
}
barcode->bc.setText(dataString.toLatin1().data());
barcode->bc.save_to_file(fileName.toLatin1().data());
Feedback += "Line ";
Feedback += QString::number(i + 1);
Feedback += ": ";
if (barcode->bc.hasErrors()) {
Feedback += barcode->bc.error_message();
Feedback += "\n";
m_bc->bc.setText(dataString);
m_bc->bc.save_to_file(fileName);
if (m_bc->bc.hasErrors()) {
/*: %1 is line number, %2 is error message */
Feedback << tr("Line %1: %2").arg(i + 1).arg(m_bc->bc.error_message());
errorCount++;
} else {
Feedback += "Success\n";
/*: %1 is line number */
Feedback << tr("Line %1: Success").arg(i + 1);
successCount++;
}
if (i && (i % 100 == 0)) {
txtFeedback->appendPlainText(Feedback.join('\n'));
txtFeedback->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
Feedback.clear();
}
txtFeedback->document()->setPlainText(Feedback);
inputpos += datalen + 1;
}
QString summary;
if (errorCount && successCount) {
/*: %1 is total no. of items processed, %2 is no. of failures, %3 is no. of successes */
summary = tr("Total %1, %2 failed, %3 succeeded.").arg(errorCount + successCount).arg(errorCount)
.arg(successCount);
} else if (errorCount) {
/*: %1 is no. of failures */
summary = tr("All %1 failed.").arg(errorCount);
} else if (successCount) {
/*: %1 is no. of successes */
summary = tr("All %1 succeeded.").arg(successCount);
} else {
summary = tr("No items.");
}
if (Feedback.size()) {
txtFeedback->appendPlainText(Feedback.join('\n') + '\n' + summary + '\n');
} else {
txtFeedback->appendPlainText(summary + '\n');
}
txtFeedback->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
}

View File

@ -1,6 +1,6 @@
/*
Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com>
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
@ -16,6 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* vim: set ts=4 sw=4 et : */
#ifndef EXPORTWINDOW_H
#define EXPORTWINDOW_H
@ -25,18 +26,19 @@
class ExportWindow : public QDialog, private Ui::ExportDialog
{
Q_OBJECT
Q_OBJECT
public:
ExportWindow();
~ExportWindow();
BarcodeItem *barcode;
QString output_data;
ExportWindow(BarcodeItem *bc, const QString& output_data);
~ExportWindow();
private slots:
void quit_now();
void process();
void get_directory();
void process();
void get_directory();
protected:
BarcodeItem *m_bc;
QString m_output_data;
};
#endif
#endif

162
frontend_qt/extCLI.ui Normal file
View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CLIDialog</class>
<widget class="QDialog" name="CLIDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>333</height>
</rect>
</property>
<property name="windowTitle">
<string>CLI Equivalent</string>
</property>
<property name="windowIcon">
<iconset resource="resources.qrc">
<normaloff>:res/zint-qt.ico</normaloff>:res/zint-qt.ico</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayoutCLI">
<item>
<widget class="QLabel" name="lblCLICmd">
<property name="text">
<string>Command Line &amp;Equivalent</string>
</property>
<property name="toolTip">
<string>Current GUI settings as CLI equivalent</string>
</property>
<property name="buddy">
<cstring>txtCLICmd</cstring>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="txtCLICmd">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCLIUnixWin">
<property name="title">
<string>Escape Method</string>
</property>
<property name="toolTip">
<string>How to escape data</string>
</property>
<layout class="QGridLayout" name="gridLayoutCLIUnixWin">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="radCLIUnix">
<property name="text">
<string>&amp;Unix</string>
</property>
<property name="toolTip">
<string>Escape for Unix shell</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="radCLIWin">
<property name="text">
<string>&amp;Windows</string>
</property>
<property name="toolTip">
<string>Escape for Windows command prompt</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horzLayoutCLIChks">
<item>
<widget class="QCheckBox" name="chkCLILongOpts">
<property name="text">
<string>&amp;Long Options Only</string>
</property>
<property name="toolTip">
<string>Only use long option names, not short ones</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkCLIBarcodeName">
<property name="text">
<string>&amp;Barcode Name</string>
</property>
<property name="toolTip">
<string>Use name of barcode, not number</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horzLayoutCLIBtns">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QStatusBar" name="statusBarCLI">
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCLICopy">
<property name="toolTip">
<string>Copy to clipboard</string>
</property>
<property name="text">
<string> C&amp;opy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCLIClose">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="toolTip">
<string>Close window</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -27,8 +27,8 @@
<string>&amp;Data</string>
</property>
<property name="toolTip">
<string>Input data. Newlines (Line Feeds (0xA0))
will be converted to spaces</string>
<string>Input data. Line Feeds (0xA0) will
be converted to spaces</string>
</property>
<property name="buddy">
<cstring>txtDataInput</cstring>
@ -70,14 +70,14 @@ will be converted to spaces</string>
&lt;tr&gt;&lt;td&gt;Record Separator (0x1E)&lt;/td&gt;&lt;td&gt;&amp;nbsp;\R&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Backslash (0x5C)&lt;/td&gt;&lt;td&gt;&amp;nbsp;\\&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
Note that newlines (Line Feeds (0x0A)) are &lt;br/&gt;not included</string>
Note that Line Feed (0x0A) is not included</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnReset">
<widget class="QPushButton" name="btnDataClear">
<property name="text">
<string>&amp;Reset</string>
<string> C&amp;lear</string>
</property>
<property name="toolTip">
<string>Clear data window</string>
@ -100,7 +100,7 @@ Note that newlines (Line Feeds (0x0A)) are &lt;br/&gt;not included</string>
<item>
<widget class="QPushButton" name="btnOK">
<property name="text">
<string>&amp;OK</string>
<string> &amp;OK</string>
</property>
<property name="toolTip">
<string>Close window and update input data</string>

View File

@ -10,24 +10,6 @@
<height>505</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<height>505</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>505</height>
</size>
</property>
<property name="windowTitle">
<string>Export Barcodes</string>
</property>
@ -35,258 +17,214 @@
<iconset resource="resources.qrc">
<normaloff>:res/zint-qt.ico</normaloff>:res/zint-qt.ico</iconset>
</property>
<widget class="QLineEdit" name="linDestPath">
<property name="geometry">
<rect>
<x>140</x>
<y>10</y>
<width>261</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Destination folder</string>
</property>
</widget>
<widget class="QLineEdit" name="linPrefix">
<property name="geometry">
<rect>
<x>140</x>
<y>40</y>
<width>301</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>The first part of the filenames</string>
</property>
<property name="text">
<string>bcs_</string>
</property>
</widget>
<widget class="QComboBox" name="cmbFileName">
<property name="geometry">
<rect>
<x>140</x>
<y>70</y>
<width>301</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Set the naming convention used by the files</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutExp">
<item>
<property name="text">
<string>Same as Data</string>
</property>
<layout class="QGridLayout" name="gridLayoutExpFile">
<item row="0" column="0">
<widget class="QLabel" name="lblDestPath">
<property name="text">
<string>&amp;Destination Path:</string>
</property>
<property name="toolTip">
<string>Destination folder</string>
</property>
<property name="buddy">
<cstring>linDestPath</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="linDestPath">
<property name="geometry">
<rect>
<x>140</x>
<y>10</y>
<width>261</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>Destination folder</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="btnDestPath">
<property name="toolTip">
<string>Find a destination for your files</string>
</property>
<property name="text">
<string>&amp;...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblPrefix">
<property name="text">
<string>File Name &amp;Prefix:</string>
</property>
<property name="toolTip">
<string>The first part of the filenames</string>
</property>
<property name="buddy">
<cstring>linPrefix</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="linPrefix">
<property name="toolTip">
<string>The first part of the filenames</string>
</property>
<property name="text">
<string>bcs_</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblFileName">
<property name="text">
<string>File &amp;Name:</string>
</property>
<property name="toolTip">
<string>Set the naming convention used by the files</string>
</property>
<property name="buddy">
<cstring>cmbFileName</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="cmbFileName">
<property name="toolTip">
<string>Set the naming convention used by the files</string>
</property>
<item>
<property name="text">
<string>Same as Data</string>
</property>
</item>
<item>
<property name="text">
<string>Serial Number</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblFileFormat">
<property name="text">
<string>File &amp;Format:</string>
</property>
<property name="toolTip">
<string>The type of file which you want to create</string>
</property>
<property name="buddy">
<cstring>cmbFileFormat</cstring>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="cmbFileFormat">
<property name="toolTip">
<string>The type of file which you want to create</string>
</property>
<item>
<property name="text">
<string>Portable Network Graphic (*.png)</string>
</property>
</item>
<item>
<property name="text">
<string>Encapsulated Post Script (*.eps)</string>
</property>
</item>
<item>
<property name="text">
<string>Graphics Interchange Format (*.gif)</string>
</property>
</item>
<item>
<property name="text">
<string>Scalable Vector Graphic (*.svg)</string>
</property>
</item>
<item>
<property name="text">
<string>Windows Bitmap (*.bmp)</string>
</property>
</item>
<item>
<property name="text">
<string>ZSoft PC Painter Image (*.pcx)</string>
</property>
</item>
<item>
<property name="text">
<string>Extended Metafile (*.emf)</string>
</property>
</item>
<item>
<property name="text">
<string>Tagged Image File Format (*.tif)</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<property name="text">
<string>Serial Number</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="cmbFileFormat">
<property name="geometry">
<rect>
<x>140</x>
<y>100</y>
<width>301</width>
<height>22</height>
</rect>
</property>
<property name="toolTip">
<string>The type of file which you want to create</string>
</property>
<item>
<property name="text">
<string>Portable Network Graphic (*.png)</string>
</property>
<layout class="QHBoxLayout" name="horzLayoutExpBtns">
<item>
<spacer name="horzSpacerExpBtns">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnOK">
<property name="text">
<string>&amp;Export</string>
</property>
<property name="toolTip">
<string>Create files</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCancel">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="toolTip">
<string>Close window</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<property name="text">
<string>Encapsulated Post Script (*.eps)</string>
</property>
<widget class="QLabel" name="lblFeedback">
<property name="text">
<string>Export Results:</string>
</property>
</widget>
</item>
<item>
<property name="text">
<string>Graphics Interchange Format (*.gif)</string>
</property>
<widget class="QPlainTextEdit" name="txtFeedback">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<property name="text">
<string>Scalable Vector Graphic (*.svg)</string>
</property>
</item>
<item>
<property name="text">
<string>Windows Bitmap (*.bmp)</string>
</property>
</item>
<item>
<property name="text">
<string>ZSoft PC Painter Image (*.pcx)</string>
</property>
</item>
<item>
<property name="text">
<string>Extended Metafile (*.emf)</string>
</property>
</item>
<item>
<property name="text">
<string>Tagged Image File Format (*.tif)</string>
</property>
</item>
</widget>
<widget class="QToolButton" name="btnDestPath">
<property name="geometry">
<rect>
<x>410</x>
<y>10</y>
<width>30</width>
<height>25</height>
</rect>
</property>
<property name="toolTip">
<string>Find a destination for your files</string>
</property>
<property name="text">
<string>&amp;...</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&amp;Destination Path:</string>
</property>
<property name="toolTip">
<string>Destination folder</string>
</property>
<property name="buddy">
<cstring>linDestPath</cstring>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>File Name &amp;Prefix:</string>
</property>
<property name="toolTip">
<string>The first part of the filenames</string>
</property>
<property name="buddy">
<cstring>linPrefix</cstring>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>File &amp;Name:</string>
</property>
<property name="toolTip">
<string>Set the naming convention used by the files</string>
</property>
<property name="buddy">
<cstring>cmbFileName</cstring>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>File &amp;Format:</string>
</property>
<property name="toolTip">
<string>The type of file which you want to create</string>
</property>
<property name="buddy">
<cstring>cmbFileFormat</cstring>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>360</x>
<y>130</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>&amp;Close</string>
</property>
<property name="toolTip">
<string>Close window</string>
</property>
</widget>
<widget class="QPushButton" name="btnOK">
<property name="geometry">
<rect>
<x>270</x>
<y>130</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>&amp;Export</string>
</property>
<property name="toolTip">
<string>Create files</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="txtFeedback">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>430</width>
<height>315</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="lblFeedback">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Export Results:</string>
</property>
</widget>
</layout>
</widget>
<resources/>
<connections/>

View File

@ -14,17 +14,17 @@
<string>Sequence Export</string>
</property>
<property name="windowIcon">
<iconset resource="resources.qrc">
<iconset>
<normaloff>:res/zint-qt.ico</normaloff>:res/zint-qt.ico</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<layout class="QVBoxLayout" name="vertLayoutSeq">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<layout class="QHBoxLayout" name="horzLayoutSeq">
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBoxSeqCreate">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -34,155 +34,158 @@
<property name="title">
<string>Create Sequence</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<layout class="QVBoxLayout" name="vertLayoutSeqCreate">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horzLayoutSeqCreate">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="vertLayoutSeqCreateLbls">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="lblSeqStartVal">
<property name="toolTip">
<string>Start sequence at this value</string>
</property>
<property name="text">
<string>&amp;Start Value:</string>
</property>
<property name="buddy">
<cstring>linStartVal</cstring>
</property>
<property name="toolTip">
<string>Start sequence at this value</string>
<cstring>spnSeqStartVal</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="lblSeqEndVal">
<property name="toolTip">
<string>End sequence at this value</string>
</property>
<property name="text">
<string>End &amp;Value:</string>
</property>
<property name="buddy">
<cstring>linEndVal</cstring>
</property>
<property name="toolTip">
<string>End sequence at this value</string>
<cstring>spnSeqEndVal</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblIncrement">
<widget class="QLabel" name="lblSeqIncVal">
<property name="toolTip">
<string>Go from start to end in steps of this amount</string>
</property>
<property name="text">
<string>Increment &amp;By:</string>
</property>
<property name="buddy">
<cstring>linIncVal</cstring>
</property>
<property name="toolTip">
<string>Go from start to end in steps of this amount</string>
<cstring>spnSeqIncVal</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="lblSeqFormat">
<property name="toolTip">
<string>Format sequence using special characters&lt;table cellspacing=&quot;3&quot;&gt;
&lt;tr&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;Number or space&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$&lt;/td&gt;&lt;td&gt;Number or '0'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or '*'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Other&lt;/td&gt;&lt;td&gt;Insert literally&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</string>
</property>
<property name="text">
<string>&amp;Format:</string>
</property>
<property name="buddy">
<cstring>linFormat</cstring>
</property>
<property name="toolTip">
<string>Format sequence using special characters&lt;table cellspacing=&quot;3&quot;&gt;
&lt;tr&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;Number or space&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$&lt;/td&gt;&lt;td&gt;Number or &apos;0&apos;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or &apos;*&apos;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Other&lt;/td&gt;&lt;td&gt;Insert literally&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</string>
<cstring>linSeqFormat</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Sequence:</string>
</property>
<widget class="QLabel" name="lblSeqCreate">
<property name="toolTip">
<string>Create a data sequence</string>
</property>
<property name="text">
<string>Sequence:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Sequence File:</string>
</property>
<widget class="QLabel" name="lblSeqImport">
<property name="toolTip">
<string>Get a data sequence from a file</string>
</property>
<property name="text">
<string>Sequence File:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblExport">
<property name="text">
<string>Generate Bar Codes:</string>
</property>
<widget class="QLabel" name="lblSeqExport">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Save the symbols to files</string>
</property>
<property name="text">
<string>Generate Bar Codes:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="vertLayoutSeqCreateVals">
<item>
<widget class="QLineEdit" name="linStartVal">
<property name="text">
<string>1</string>
<widget class="QSpinBox" name="spnSeqStartVal">
<property name="toolTip">
<string>Start sequence at this value</string>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Start sequence at this value</string>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="linEndVal">
<property name="text">
<string>10</string>
</property>
<widget class="QSpinBox" name="spnSeqEndVal">
<property name="toolTip">
<string>End sequence at this value</string>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="linIncVal">
<property name="text">
<string>1</string>
</property>
<widget class="QSpinBox" name="spnSeqIncVal">
<property name="toolTip">
<string>Go from start to end in steps of this amount</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="linFormat">
<property name="text">
<string>$$$$$$</string>
</property>
<widget class="QLineEdit" name="linSeqFormat">
<property name="toolTip">
<string>Format sequence using special characters&lt;table cellspacing=&quot;3&quot;&gt;
&lt;tr&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;Number or space&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$&lt;/td&gt;&lt;td&gt;Number or &apos;0&apos;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or &apos;*&apos;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$&lt;/td&gt;&lt;td&gt;Number or '0'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or '*'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Other&lt;/td&gt;&lt;td&gt;Insert literally&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</string>
</property>
<property name="text">
<string>$$$$$$</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCreate">
<widget class="QPushButton" name="btnSeqCreate">
<property name="toolTip">
<string>Create a data sequence</string>
</property>
@ -192,7 +195,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="btnImport">
<widget class="QPushButton" name="btnSeqImport">
<property name="toolTip">
<string>Get a data sequence from a file</string>
</property>
@ -202,7 +205,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="btnExport">
<widget class="QPushButton" name="btnSeqExport">
<property name="enabled">
<bool>false</bool>
</property>
@ -222,33 +225,29 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="groupBoxSeqPreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Sequence &amp;Data</string>
</property>
<property name="toolTip">
<string>The data to be encoded, one line per symbol</string>
</property>
<property name="title">
<string>Sequence &amp;Data</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="vertLayoutSeqPreview">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPlainTextEdit" name="txtPreview">
<property name="toolTip">
<string>The data to be encoded, one line per symbol</string>
</property>
</widget>
</item>
</layout>
<widget class="QPlainTextEdit" name="txtSeqPreview">
<property name="toolTip">
<string>The data to be encoded, one line per symbol</string>
</property>
</widget>
</item>
</layout>
</widget>
@ -256,9 +255,9 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<layout class="QHBoxLayout" name="horzLayoutSeqBtns">
<item>
<spacer name="horizontalSpacer_2">
<spacer name="horzSpacerSeqBtns">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -271,23 +270,23 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnReset">
<property name="text">
<string>&amp;Reset</string>
</property>
<widget class="QPushButton" name="btnSeqClear">
<property name="toolTip">
<string>Clear the sequence data</string>
</property>
<property name="text">
<string> C&amp;lear</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnClose">
<property name="text">
<string>&amp;Close</string>
</property>
<widget class="QPushButton" name="btnSeqClose">
<property name="toolTip">
<string>Close window</string>
</property>
<property name="text">
<string>&amp;Close</string>
</property>
</widget>
</item>
</layout>

View File

@ -15,12 +15,14 @@ QT += uitools
# Input
HEADERS += barcodeitem.h \
cliwindow.h \
datawindow.h \
exportwindow.h \
mainwindow.h \
sequencewindow.h
FORMS += extData.ui \
FORMS += extCLI.ui \
extData.ui \
extExport.ui \
extSequence.ui \
grpAztec.ui \
@ -55,12 +57,13 @@ FORMS += extData.ui \
mainWindow.ui
SOURCES += barcodeitem.cpp \
cliwindow.cpp \
datawindow.cpp \
exportwindow.cpp \
main.cpp \
mainwindow.cpp \
sequencewindow.cpp
TRANSLATIONS = frontend_de.ts
RESOURCES += resources.qrc

View File

@ -5,12 +5,14 @@ QT += widgets
# Input
HEADERS += barcodeitem.h \
cliwindow.h \
datawindow.h \
exportwindow.h \
mainwindow.h \
sequencewindow.h
FORMS += extData.ui \
FORMS += extCLI.ui \
extData.ui \
extExport.ui \
extSequence.ui \
grpAztec.ui \
@ -45,6 +47,7 @@ FORMS += extData.ui \
mainWindow.ui
SOURCES += barcodeitem.cpp \
cliwindow.cpp \
datawindow.cpp \
exportwindow.cpp \
main.cpp \

View File

@ -6,20 +6,23 @@ CONFIG += warn_on \
uitools
FORMS = mainWindow.ui \
extSequence.ui \
extCLI.ui \
extSequence.ui \
extExport.ui \
extData.ui
HEADERS = mainwindow.h \
barcodeitem.h \
cliwindow.h \
datawindow.h \
exportwindow.h \
sequencewindow.h \
qzint.h
SOURCES = main.cpp \
SOURCES = main.cpp \
mainwindow.cpp \
barcodeitem.cpp \
cliwindow.cpp \
datawindow.cpp \
exportwindow.cpp \
sequencewindow.cpp
@ -30,5 +33,5 @@ RESOURCES = resources.qrc
INCLUDEPATH += ../backend
RC_FILE = ./res/qtZint.rc
LIBS = QtZint2.lib

View File

@ -34,14 +34,14 @@
#include <QAction>
#include "mainwindow.h"
#include "cliwindow.h"
#include "datawindow.h"
#include "sequencewindow.h"
#include <stdio.h>
// Shorthand
#define QSL QStringLiteral
static const int statusBarTimeout = 0; // Don't timeout
static const int tempMessageTimeout = 2000;
static const QKeySequence quitKeySeq(Qt::CTRL | Qt::Key_Q); // Use on Windows also (i.e. not using QKeySequence::Quit)
@ -430,11 +430,11 @@ bool MainWindow::save()
QString dirname = pathname.mid(0, lastSeparator);
if (dirname.isEmpty()) {
/*: %1 is path saved to */
statusBar->showMessage(tr("Saved as \"%1\"").arg(pathname), statusBarTimeout);
statusBar->showMessage(tr("Saved as \"%1\"").arg(pathname), 0 /*No timeout*/);
} else {
QString filename = pathname.right(pathname.length() - (lastSeparator + 1));
/*: %1 is base filename saved to, %2 is directory saved in */
statusBar->showMessage(tr("Saved as \"%1\" in \"%2\"").arg(filename).arg(dirname), statusBarTimeout);
statusBar->showMessage(tr("Saved as \"%1\" in \"%2\"").arg(filename).arg(dirname), 0 /*No timeout*/);
}
settings.setValue(QSL("studio/default_dir"), dirname);
@ -476,21 +476,35 @@ void MainWindow::help()
QDesktopServices::openUrl(QSL("https://zint.org.uk/manual")); // TODO: manual.md
}
int MainWindow::open_data_dialog()
void MainWindow::open_data_dialog()
{
int retval;
DataWindow dlg(txtData->text());
retval = dlg.exec();
if (dlg.Valid == 1)
(void) dlg.exec();
if (dlg.Valid) {
const bool updated = txtData->text() != dlg.DataOutput;
txtData->setText(dlg.DataOutput);
return retval;
if (updated) {
statusBar->showMessage(tr("Updated data"), tempMessageTimeout);
}
}
}
int MainWindow::open_sequence_dialog()
void MainWindow::open_sequence_dialog()
{
SequenceWindow dlg;
dlg.barcode = &m_bc;
return dlg.exec();
SequenceWindow dlg(&m_bc);
(void) dlg.exec();
#ifdef _WIN32
// Windows causes BarcodeItem to paint on closing dialog so need to re-paint with our (non-Export) values
update_preview();
#endif
}
void MainWindow::open_cli_dialog()
{
CLIWindow dlg(&m_bc, chkAutoHeight->isEnabled() && chkAutoHeight->isChecked(),
m_spnHeightPerRow && m_spnHeightPerRow->isEnabled() ? m_spnHeightPerRow->value() : 0.0);
(void) dlg.exec();
}
void MainWindow::on_fgcolor_clicked()
@ -527,7 +541,7 @@ void MainWindow::autoheight_ui_set()
if (enabled && m_spnHeightPerRow->value()) {
lblHeight->setEnabled(!enabled);
heightb->setEnabled(!enabled);
statusBar->showMessage(tr("Using \"Row Height\""), statusBarTimeout);
statusBar->showMessage(tr("Using \"Row Height\""), 0 /*No timeout*/);
} else {
statusBar->clearMessage();
}
@ -650,6 +664,9 @@ void MainWindow::structapp_ui_set()
void MainWindow::on_encoded()
{
if (QApplication::activeModalWidget() != nullptr) { // Protect against encode in popup dialog
return;
}
this->setMinimumHeight(m_bc.bc.getError() ? 455 : 435);
enableActions(true);
errtxtBar_set(false /*isError*/);
@ -663,6 +680,9 @@ void MainWindow::on_encoded()
void MainWindow::on_errored()
{
if (QApplication::activeModalWidget() != nullptr) { // Protect against error in popup dialog (Sequence Export)
return;
}
this->setMinimumHeight(455);
enableActions(false);
errtxtBar_set(true /*isError*/);
@ -795,7 +815,7 @@ void MainWindow::copy_to_clipboard_errtxt()
QMimeData *mdata = new QMimeData;
mdata->setText(m_bc.bc.lastError());
clipboard->setMimeData(mdata, QClipboard::Clipboard);
statusBar->showMessage(tr("Copied message to clipboard"), statusBarTimeout);
statusBar->showMessage(tr("Copied message to clipboard"), 0 /*No timeout*/);
}
}
@ -879,6 +899,8 @@ void MainWindow::view_context_menu(const QPoint &pos)
menu.addAction(m_copySVGAct);
menu.addAction(m_copyTIFAct);
menu.addSeparator();
menu.addAction(m_CLIAct);
menu.addSeparator();
menu.addAction(m_saveAsAct);
menu.exec(get_context_menu_pos(pos, view));
@ -1698,6 +1720,7 @@ void MainWindow::update_preview()
m_bc.bc.setGSSep(false);
m_bc.bc.setNoQuietZones(false);
m_bc.bc.setDotSize(0.4f / 0.5f);
m_bc.bc.setGuardDescent(5.0f);
m_bc.bc.clearStructApp();
switch (symbology) {
@ -2253,6 +2276,7 @@ void MainWindow::createActions()
// MIT license - see site and "frontend_qt/res/LICENSE_feathericons"
QIcon menuIcon(QSL(":res/menu.svg"));
QIcon copyIcon(QIcon::fromTheme(QSL("edit-copy"), QIcon(QSL(":res/copy.svg"))));
QIcon cliIcon(QSL(":res/zint_black.ico"));
QIcon saveIcon(QIcon::fromTheme(QSL("document-save"), QIcon(QSL(":res/download.svg"))));
QIcon aboutIcon(QSL(":res/zint-qt.ico"));
QIcon helpIcon(QIcon::fromTheme(QSL("help-contents"), QIcon(QSL(":res/help-circle.svg"))));
@ -2302,6 +2326,10 @@ void MainWindow::createActions()
m_copyTIFAct->setStatusTip(tr("Copy to clipboard as TIF"));
connect(m_copyTIFAct, SIGNAL(triggered()), this, SLOT(copy_to_clipboard_tif()));
m_CLIAct = new QAction(cliIcon, tr("C&LI equivalent..."), this);
m_CLIAct->setStatusTip(tr("Generate CLI equivalent"));
connect(m_CLIAct, SIGNAL(triggered()), this, SLOT(open_cli_dialog()));
m_saveAsAct = new QAction(saveIcon, tr("&Save As..."), this);
m_saveAsAct->setStatusTip(tr("Output image to file"));
m_saveAsAct->setShortcut(QKeySequence::Save);
@ -2346,6 +2374,8 @@ void MainWindow::createMenu()
m_menu->addAction(m_copyTIFAct);
m_menu->addSeparator();
m_menu->addAction(m_CLIAct);
m_menu->addSeparator();
m_menu->addAction(m_saveAsAct);
m_menu->addSeparator();
m_menu->addAction(m_helpAct);
@ -2374,6 +2404,7 @@ void MainWindow::enableActions(bool enabled)
#endif
m_copySVGAct->setEnabled(enabled);
m_copyTIFAct->setEnabled(enabled);
m_CLIAct->setEnabled(enabled);
m_saveAsAct->setEnabled(enabled);
m_saveAsShortcut->setEnabled(enabled);
@ -2397,13 +2428,13 @@ void MainWindow::copy_to_clipboard(const QString &filename, const QString& name,
file.close();
clipboard->setMimeData(mdata, QClipboard::Clipboard);
/*: %1 is format (BMP/EMF etc) */
statusBar->showMessage(tr("Copied to clipboard as %1").arg(name), statusBarTimeout);
statusBar->showMessage(tr("Copied to clipboard as %1").arg(name), 0 /*No timeout*/);
}
} else {
mdata->setImageData(QImage(filename));
clipboard->setMimeData(mdata, QClipboard::Clipboard);
/*: %1 is format (BMP/EMF etc) */
statusBar->showMessage(tr("Copied to clipboard as %1").arg(name), statusBarTimeout);
statusBar->showMessage(tr("Copied to clipboard as %1").arg(name), 0 /*No timeout*/);
}
QFile::remove(filename);
@ -2456,172 +2487,59 @@ QWidget *MainWindow::get_widget(const QString &name)
}
/* Return settings subsection name for a symbol */
const QString &MainWindow::get_setting_name(int symbology)
QString MainWindow::get_setting_name(int symbology)
{
struct item {
const QString name;
int define;
int val;
};
static const struct item ndata[] = {
{ QSL(""), -1, 0 },
{ QSL("code11"), BARCODE_CODE11, 1 },
{ QSL("c25standard"), BARCODE_C25STANDARD, 2 },
{ QSL("c25inter"), BARCODE_C25INTER, 3 },
{ QSL("c25iata"), BARCODE_C25IATA, 4 },
{ QSL(""), -1, 5 },
{ QSL("c25logic"), BARCODE_C25LOGIC, 6 },
{ QSL("c25ind"), BARCODE_C25IND, 7 },
{ QSL("code39"), BARCODE_CODE39, 8 },
{ QSL("excode39"), BARCODE_EXCODE39, 9 },
{ QSL(""), -1, 10 },
{ QSL(""), -1, 11 },
{ QSL(""), -1, 12 },
{ QSL("eanx"), BARCODE_EANX, 13 },
{ QSL("eanx"), BARCODE_EANX_CHK, 14 },
{ QSL(""), -1, 15 },
{ QSL("code128"), BARCODE_GS1_128, 16 },
{ QSL(""), -1, 17 },
{ QSL("codabar"), BARCODE_CODABAR, 18 },
{ QSL(""), -1, 19 },
{ QSL("code128"), BARCODE_CODE128, 20 },
{ QSL("dpleit"), BARCODE_DPLEIT, 21 },
{ QSL("dpident"), BARCODE_DPIDENT, 22 },
{ QSL("code16k"), BARCODE_CODE16K, 23 },
{ QSL("code49"), BARCODE_CODE49, 24 },
{ QSL("code93"), BARCODE_CODE93, 25 },
{ QSL(""), -1, 26 },
{ QSL(""), -1, 27 },
{ QSL("flat"), BARCODE_FLAT, 28 },
{ QSL("dbar_omn"), BARCODE_DBAR_OMN, 29 },
{ QSL("dbar_ltd"), BARCODE_DBAR_LTD, 30 },
{ QSL("dbar_exp"), BARCODE_DBAR_EXP, 31 },
{ QSL("telepen"), BARCODE_TELEPEN, 32 },
{ QSL(""), -1, 33 },
{ QSL("upca"), BARCODE_UPCA, 34 },
{ QSL("upca"), BARCODE_UPCA_CHK, 35 },
{ QSL(""), -1, 36 },
{ QSL("upce"), BARCODE_UPCE, 37 },
{ QSL("upce"), BARCODE_UPCE_CHK, 38 },
{ QSL(""), -1, 39 },
{ QSL("postnet"), BARCODE_POSTNET, 40 },
{ QSL(""), -1, 41 },
{ QSL(""), -1, 42 },
{ QSL(""), -1, 43 },
{ QSL(""), -1, 44 },
{ QSL(""), -1, 45 },
{ QSL(""), -1, 46 },
{ QSL("msi_plessey"), BARCODE_MSI_PLESSEY, 47 },
{ QSL(""), -1, 48 },
{ QSL("fim"), BARCODE_FIM, 49 },
{ QSL("logmars"), BARCODE_LOGMARS, 50 },
{ QSL("pharma"), BARCODE_PHARMA, 51 },
{ QSL("pzn"), BARCODE_PZN, 52 },
{ QSL("pharma_two"), BARCODE_PHARMA_TWO, 53 },
{ QSL(""), -1, 54 },
{ QSL("pdf417"), BARCODE_PDF417, 55 },
{ QSL("pdf417"), BARCODE_PDF417COMP, 56 },
{ QSL("maxicode"), BARCODE_MAXICODE, 57 },
{ QSL("qrcode"), BARCODE_QRCODE, 58 },
{ QSL(""), -1, 59 },
{ QSL("code128"), BARCODE_CODE128B, 60 },
{ QSL(""), -1, 61 },
{ QSL(""), -1, 62 },
{ QSL("auspost"), BARCODE_AUSPOST, 63 },
{ QSL(""), -1, 64 },
{ QSL(""), -1, 65 },
{ QSL("ausreply"), BARCODE_AUSREPLY, 66 },
{ QSL("ausroute"), BARCODE_AUSROUTE, 67 },
{ QSL("ausredirect"), BARCODE_AUSREDIRECT, 68 },
{ QSL("isbnx"), BARCODE_ISBNX, 69 },
{ QSL("rm4scc"), BARCODE_RM4SCC, 70 },
{ QSL("datamatrix"), BARCODE_DATAMATRIX, 71 },
{ QSL("ean14"), BARCODE_EAN14, 72 },
{ QSL("vin"), BARCODE_VIN, 73 },
{ QSL("codablockf"), BARCODE_CODABLOCKF, 74 },
{ QSL("nve18"), BARCODE_NVE18, 75 },
{ QSL("japanpost"), BARCODE_JAPANPOST, 76 },
{ QSL("koreapost"), BARCODE_KOREAPOST, 77 },
{ QSL(""), -1, 78 },
{ QSL("dbar_stk"), BARCODE_DBAR_STK, 79 },
{ QSL("dbar_omnstk"), BARCODE_DBAR_OMNSTK, 80 },
{ QSL("dbar_expstk"), BARCODE_DBAR_EXPSTK, 81 },
{ QSL("planet"), BARCODE_PLANET, 82 },
{ QSL(""), -1, 83 },
{ QSL("micropdf417"), BARCODE_MICROPDF417, 84 },
{ QSL("usps_imail"), BARCODE_USPS_IMAIL, 85 },
{ QSL("plessey"), BARCODE_PLESSEY, 86 },
{ QSL("telepen_num"), BARCODE_TELEPEN_NUM, 87 },
{ QSL(""), -1, 88 },
{ QSL("itf14"), BARCODE_ITF14, 89 },
{ QSL("kix"), BARCODE_KIX, 90 },
{ QSL(""), -1, 91 },
{ QSL("aztec"), BARCODE_AZTEC, 92 },
{ QSL("daft"), BARCODE_DAFT, 93 },
{ QSL(""), -1, 94 },
{ QSL(""), -1, 95 },
{ QSL("dpd"), BARCODE_DPD, 96 },
{ QSL("microqr"), BARCODE_MICROQR, 97 },
{ QSL("code128"), BARCODE_HIBC_128, 98 },
{ QSL("code39"), BARCODE_HIBC_39, 99 },
{ QSL(""), -1, 100 },
{ QSL(""), -1, 101 },
{ QSL("datamatrix"), BARCODE_HIBC_DM, 102 },
{ QSL(""), -1, 103 },
{ QSL("qrcode"), BARCODE_HIBC_QR, 104 },
{ QSL(""), -1, 105 },
{ QSL("pdf417"), BARCODE_HIBC_PDF, 106 },
{ QSL(""), -1, 107 },
{ QSL("micropdf417"), BARCODE_HIBC_MICPDF, 108 },
{ QSL(""), -1, 109 },
{ QSL("codablockf"), BARCODE_HIBC_BLOCKF, 110 },
{ QSL(""), -1, 111 },
{ QSL("aztec"), BARCODE_HIBC_AZTEC, 112 },
{ QSL(""), -1, 113 },
{ QSL(""), -1, 114 },
{ QSL("dotcode"), BARCODE_DOTCODE, 115 },
{ QSL("hanxin"), BARCODE_HANXIN, 116 },
{ QSL(""), -1, 117 },
{ QSL(""), -1, 118 },
{ QSL(""), -1, 119 },
{ QSL(""), -1, 120 },
{ QSL("mailmark"), BARCODE_MAILMARK, 121 },
{ QSL(""), -1, 122 },
{ QSL(""), -1, 123 },
{ QSL(""), -1, 124 },
{ QSL(""), -1, 125 },
{ QSL(""), -1, 126 },
{ QSL(""), -1, 127 },
{ QSL("azrune"), BARCODE_AZRUNE, 128 },
{ QSL("code32"), BARCODE_CODE32, 129 },
{ QSL("eanx"), BARCODE_EANX_CC, 130 },
{ QSL("code128"), BARCODE_GS1_128_CC, 131 },
{ QSL("dbar_omn"), BARCODE_DBAR_OMN_CC, 132 },
{ QSL("dbar_ltd"), BARCODE_DBAR_LTD_CC, 133 },
{ QSL("dbar_exp"), BARCODE_DBAR_EXP_CC, 134 },
{ QSL("upca"), BARCODE_UPCA_CC, 135 },
{ QSL("upce"), BARCODE_UPCE_CC, 136 },
{ QSL("dbar_stk"), BARCODE_DBAR_STK_CC, 137 },
{ QSL("dbar_omnstk"), BARCODE_DBAR_OMNSTK_CC, 138 },
{ QSL("dbar_expstk"), BARCODE_DBAR_EXPSTK_CC, 139 },
{ QSL("channel"), BARCODE_CHANNEL, 140 },
{ QSL("codeone"), BARCODE_CODEONE, 141 },
{ QSL("gridmatrix"), BARCODE_GRIDMATRIX, 142 },
{ QSL("upnqr"), BARCODE_UPNQR, 143 },
{ QSL("ultra"), BARCODE_ULTRA, 144 },
{ QSL("rmqr"), BARCODE_RMQR, 145 },
};
static const int data_size = sizeof(ndata) / sizeof(struct item);
if (symbology < 0 || symbology >= data_size) {
return ndata[0].name; // ""
char name_buf[32];
switch (symbology) {
case BARCODE_CODE128B:
case BARCODE_GS1_128:
case BARCODE_GS1_128_CC:
case BARCODE_HIBC_128:
symbology = BARCODE_CODE128;
break;
case BARCODE_PDF417COMP:
case BARCODE_HIBC_PDF:
symbology = BARCODE_PDF417;
break;
case BARCODE_HIBC_MICPDF:
symbology = BARCODE_MICROPDF417;
break;
case BARCODE_HIBC_AZTEC:
symbology = BARCODE_AZTEC;
break;
case BARCODE_HIBC_39:
symbology = BARCODE_CODE39;
break;
case BARCODE_HIBC_BLOCKF:
symbology = BARCODE_CODABLOCKF;
break;
case BARCODE_HIBC_DM:
symbology = BARCODE_DATAMATRIX;
break;
case BARCODE_HIBC_QR:
symbology = BARCODE_QRCODE;
break;
case BARCODE_DBAR_EXPSTK_CC:
symbology = BARCODE_DBAR_EXPSTK;
break;
case BARCODE_UPCA_CHK:
case BARCODE_UPCA_CC:
symbology = BARCODE_UPCA;
break;
case BARCODE_EANX_CHK:
case BARCODE_EANX_CC:
symbology = BARCODE_EANX;
break;
case BARCODE_UPCE_CHK:
case BARCODE_UPCE_CC:
symbology = BARCODE_UPCE;
break;
}
if (ndata[symbology].val != symbology ||
(ndata[symbology].define != -1 && ndata[symbology].define != symbology)) { // Self-check
fprintf(stderr, "MainWindow::get_setting_name: ndata table out of sync (%d)\n", symbology);
return ndata[0].name; // ""
if (ZBarcode_BarcodeName(symbology, name_buf) != 0) {
return QSL("");
}
return ndata[symbology].name;
QString name(name_buf + 8); // Strip "BARCODE_" prefix
return name.toLower();
}
/* Helper to return index of selected radio button in group, checking for NULL */
@ -2752,7 +2670,7 @@ void MainWindow::set_spn_from_setting(QSettings &settings, const QString &settin
/* Save settings for an individual symbol */
void MainWindow::save_sub_settings(QSettings &settings, int symbology)
{
const QString &name = get_setting_name(symbology);
QString name = get_setting_name(symbology);
if (!name.isEmpty()) {
settings.setValue(QSL("studio/bc/%1/data").arg(name), txtData->text());
if (!grpComposite->isHidden()) {
@ -3020,6 +2938,10 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
settings.setValue(QSL("studio/bc/maxicode/structapp_index"), get_cmb_index(QSL("cmbMaxiStructAppIndex")));
break;
case BARCODE_CHANNEL:
settings.setValue(QSL("studio/bc/channel/channel"), get_cmb_index(QSL("cmbChannel")));
break;
case BARCODE_CODEONE:
settings.setValue(QSL("studio/bc/codeone/size"), get_cmb_index(QSL("cmbC1Size")));
settings.setValue(QSL("studio/bc/codeone/encoding_mode"), get_rad_grp_index(
@ -3105,7 +3027,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
/* Load settings for an individual symbol */
void MainWindow::load_sub_settings(QSettings &settings, int symbology)
{
const QString &name = get_setting_name(symbology);
QString name = get_setting_name(symbology);
if (!name.isEmpty()) {
const QString &tdata = settings.value(QSL("studio/bc/%1/data").arg(name), QSL("")).toString();
if (!tdata.isEmpty()) {
@ -3391,6 +3313,10 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
set_cmb_from_setting(settings, QSL("studio/bc/maxicode/structapp_index"), QSL("cmbMaxiStructAppIndex"));
break;
case BARCODE_CHANNEL:
set_cmb_from_setting(settings, QSL("studio/bc/channel/channel"), QSL("cmbChannel"));
break;
case BARCODE_CODEONE:
set_cmb_from_setting(settings, QSL("studio/bc/codeone/size"), QSL("cmbC1Size"));
set_rad_from_setting(settings, QSL("studio/bc/codeone/encoding_mode"),

View File

@ -69,8 +69,9 @@ public slots:
void menu();
void reset_colours();
int open_data_dialog();
int open_sequence_dialog();
void open_data_dialog();
void open_sequence_dialog();
void open_cli_dialog();
void copy_to_clipboard_bmp();
void copy_to_clipboard_emf();
@ -118,7 +119,7 @@ protected:
QWidget *get_widget(const QString &name);
const QString &get_setting_name(int symbology);
static QString get_setting_name(int symbology);
int get_rad_grp_index(const QStringList &names);
void set_rad_from_setting(QSettings &settings, const QString &setting, const QStringList &names,
@ -161,6 +162,7 @@ private:
QAction *m_copyPNGAct;
QAction *m_copySVGAct;
QAction *m_copyTIFAct;
QAction *m_CLIAct;
QAction *m_saveAsAct;
QAction *m_aboutAct;
QAction *m_helpAct;

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>

After

Width:  |  Height:  |  Size: 262 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-delete"><path d="M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"></path><line x1="18" y1="9" x2="12" y2="15"></line><line x1="12" y1="9" x2="18" y2="15"></line></svg>

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -32,7 +32,10 @@
<file>grpUPCEAN.ui</file>
<file>grpVIN.ui</file>
<file>res/zint-qt.ico</file>
<file>res/zint_black.ico</file>
<file>res/check.svg</file>
<file>res/copy.svg</file>
<file>res/delete.svg</file>
<file>res/download.svg</file>
<file>res/help-circle.svg</file>
<file>res/menu.svg</file>

View File

@ -28,29 +28,36 @@
#include "sequencewindow.h"
#include "exportwindow.h"
SequenceWindow::SequenceWindow()
// Shorthand
#define QSL QStringLiteral
SequenceWindow::SequenceWindow(BarcodeItem *bc) : m_bc(bc)
{
setupUi(this);
QSettings settings;
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
QValidator *intvalid = new QIntValidator(this);
linStartVal->setText(settings.value("studio/sequence/start_value", "1").toString());
linEndVal->setText(settings.value("studio/sequence/end_value", "10").toString());
linIncVal->setText(settings.value("studio/sequence/increment", "1").toString());
linFormat->setText(settings.value("studio/sequence/format", "$$$$$$").toString());
QByteArray geometry = settings.value(QSL("studio/sequence/window_geometry")).toByteArray();
restoreGeometry(geometry);
linStartVal->setValidator(intvalid);
linEndVal->setValidator(intvalid);
linIncVal->setValidator(intvalid);
connect(btnClose, SIGNAL( clicked( bool )), SLOT(quit_now()));
connect(btnReset, SIGNAL( clicked( bool )), SLOT(reset_preview()));
connect(btnCreate, SIGNAL( clicked( bool )), SLOT(create_sequence()));
connect(txtPreview, SIGNAL( textChanged()), SLOT(check_generate()));
connect(btnImport, SIGNAL( clicked( bool )), SLOT(import()));
connect(btnExport, SIGNAL( clicked( bool )), SLOT(generate_sequence()));
spnSeqStartVal->setValue(settings.value(QSL("studio/sequence/start_value"), 1).toInt());
spnSeqEndVal->setValue(settings.value(QSL("studio/sequence/end_value"), 10).toInt());
spnSeqIncVal->setValue(settings.value(QSL("studio/sequence/increment"), 1).toInt());
linSeqFormat->setText(settings.value(QSL("studio/sequence/format"), QSL("$$$$$$")).toString());
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
QIcon clearIcon(QIcon::fromTheme(QSL("edit-clear"), QIcon(QSL(":res/delete.svg"))));
btnSeqClose->setIcon(closeIcon);
btnSeqClear->setIcon(clearIcon);
connect(btnSeqClose, SIGNAL( clicked( bool )), SLOT(close()));
connect(btnSeqClear, SIGNAL( clicked( bool )), SLOT(clear_preview()));
connect(btnSeqCreate, SIGNAL( clicked( bool )), SLOT(create_sequence()));
connect(txtSeqPreview, SIGNAL( textChanged()), SLOT(check_generate()));
connect(btnSeqImport, SIGNAL( clicked( bool )), SLOT(import()));
connect(btnSeqExport, SIGNAL( clicked( bool )), SLOT(generate_sequence()));
}
SequenceWindow::~SequenceWindow()
@ -59,40 +66,36 @@ SequenceWindow::~SequenceWindow()
#if QT_VERSION < 0x60000
settings.setIniCodec("UTF-8");
#endif
settings.setValue(QSL("studio/sequence/window_geometry"), saveGeometry());
settings.setValue("studio/sequence/start_value", linStartVal->text());
settings.setValue("studio/sequence/end_value", linEndVal->text());
settings.setValue("studio/sequence/increment", linIncVal->text());
settings.setValue("studio/sequence/format", linFormat->text());
settings.setValue(QSL("studio/sequence/start_value"), spnSeqStartVal->value());
settings.setValue(QSL("studio/sequence/end_value"), spnSeqEndVal->value());
settings.setValue(QSL("studio/sequence/increment"), spnSeqIncVal->value());
settings.setValue(QSL("studio/sequence/format"), linSeqFormat->text());
}
void SequenceWindow::quit_now()
void SequenceWindow::clear_preview()
{
close();
txtSeqPreview->clear();
}
void SequenceWindow::reset_preview()
{
txtPreview->clear();
}
QString SequenceWindow::apply_format(QString raw_number)
QString SequenceWindow::apply_format(const QString& raw_number)
{
QString adjusted, reversed;
QString format;
int format_len, input_len, i, inpos;
QChar format_qchar;
format = linFormat->text();
format = linSeqFormat->text();
input_len = raw_number.length();
format_len = format.length();
inpos = input_len;
for(i = format_len; i > 0; i--) {
for (i = format_len; i > 0; i--) {
format_qchar = format[i - 1];
char format_char = format_qchar.toLatin1();
switch(format_char) {
switch (format_char) {
case '#':
if (inpos > 0) {
adjusted += raw_number[inpos - 1];
@ -132,42 +135,41 @@ QString SequenceWindow::apply_format(QString raw_number)
void SequenceWindow::create_sequence()
{
QString startval, endval, incval, part, outputtext;
QStringList outputtext;
int start, stop, step, i;
bool ok;
startval = linStartVal->text();
endval = linEndVal->text();
incval = linIncVal->text();
start = startval.toInt(&ok, 10);
stop = endval.toInt(&ok, 10);
step = incval.toInt(&ok, 10);
start = spnSeqStartVal->value();
stop = spnSeqEndVal->value();
step = spnSeqIncVal->value();
if((stop <= start) || (step <= 0)) {
QMessageBox::critical(this, tr("Sequence Error"), tr("One or more of the input values is incorrect."));
if (stop < start) {
QMessageBox::critical(this, tr("Sequence Error"),
tr("End Value must be greater than or equal to Start Value."));
return;
}
if ((stop - start) / step > 10000) {
QMessageBox::critical(this, tr("Sequence Error"), tr("The maximum sequence allowed is 10,000 items."));
return;
}
for(i = start; i <= stop; i += step) {
part = apply_format(QString::number(i, 10));
part += '\n';
outputtext += part;
for (i = start; i <= stop; i += step) {
outputtext << apply_format(QString::number(i, 10));
}
txtPreview->setPlainText(outputtext);
txtSeqPreview->setPlainText(outputtext.join('\n'));
}
void SequenceWindow::check_generate()
{
QString preview_copy;
preview_copy = txtPreview->toPlainText();
if(preview_copy.isEmpty()) {
btnExport->setEnabled(false);
lblExport->setEnabled(false);
preview_copy = txtSeqPreview->toPlainText();
if (preview_copy.isEmpty()) {
btnSeqExport->setEnabled(false);
lblSeqExport->setEnabled(false);
} else {
btnExport->setEnabled(true);
lblExport->setEnabled(true);
btnSeqExport->setEnabled(true);
lblSeqExport->setEnabled(true);
}
}
@ -182,8 +184,8 @@ void SequenceWindow::import()
QFile file;
QByteArray outstream;
import_dialog.setWindowTitle("Import File");
import_dialog.setDirectory(settings.value("studio/default_dir",
import_dialog.setWindowTitle(tr("Import File"));
import_dialog.setDirectory(settings.value(QSL("studio/default_dir"),
QDir::toNativeSeparators(QDir::homePath())).toString());
if (import_dialog.exec()) {
@ -193,23 +195,21 @@ void SequenceWindow::import()
}
file.setFileName(filename);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::critical(this, tr("Open Error"), tr("Could not open selected file."));
return;
}
outstream = file.readAll();
txtPreview->setPlainText(QString(outstream));
txtSeqPreview->setPlainText(QString(outstream));
file.close();
settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator())));
settings.setValue(QSL("studio/default_dir"), filename.mid(0, filename.lastIndexOf(QDir::separator())));
}
void SequenceWindow::generate_sequence()
{
ExportWindow dlg;
dlg.barcode = barcode;
dlg.output_data = txtPreview->toPlainText();
ExportWindow dlg(m_bc, txtSeqPreview->toPlainText());
dlg.exec();
}

View File

@ -1,6 +1,6 @@
/*
Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com>
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
@ -16,6 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* vim: set ts=4 sw=4 et : */
#ifndef SEQUENCEWINDOW_H
#define SEQUENCEWINDOW_H
@ -25,23 +26,24 @@
class SequenceWindow : public QDialog, private Ui::SequenceDialog
{
Q_OBJECT
Q_OBJECT
public:
SequenceWindow();
~SequenceWindow();
BarcodeItem *barcode;
SequenceWindow(BarcodeItem *bc);
~SequenceWindow();
private:
QString apply_format(QString raw_number);
QString apply_format(const QString &raw_number);
private slots:
void quit_now();
void reset_preview();
void create_sequence();
void check_generate();
void import();
void generate_sequence();
void clear_preview();
void create_sequence();
void check_generate();
void import();
void generate_sequence();
protected:
BarcodeItem *m_bc;
};
#endif