mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
GUI: Retab data/export/sequencewindow.cpp (no code changes)
This commit is contained in:
parent
d2f86e01e6
commit
6bdd7e8509
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Zint Barcode Generator - the open source barcode generator
|
Zint Barcode Generator - the open source barcode generator
|
||||||
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -16,8 +16,9 @@
|
|||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
#include <QDebug>
|
//#include <QDebug>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QUiLoader>
|
#include <QUiLoader>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -25,27 +26,26 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include "datawindow.h"
|
#include "datawindow.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
DataWindow::DataWindow()
|
DataWindow::DataWindow()
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
||||||
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
|
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
|
||||||
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
|
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DataWindow::DataWindow(const QString &input)
|
DataWindow::DataWindow(const QString &input)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
txtDataInput->setPlainText(input);
|
txtDataInput->setPlainText(input);
|
||||||
txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
|
txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
|
||||||
|
|
||||||
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
||||||
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
|
connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data()));
|
||||||
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
|
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
|
||||||
connect(btnFromFile, SIGNAL( clicked( bool )), SLOT(from_file()));
|
connect(btnFromFile, SIGNAL( clicked( bool )), SLOT(from_file()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DataWindow::~DataWindow()
|
DataWindow::~DataWindow()
|
||||||
@ -54,20 +54,20 @@ DataWindow::~DataWindow()
|
|||||||
|
|
||||||
void DataWindow::quit_now()
|
void DataWindow::quit_now()
|
||||||
{
|
{
|
||||||
Valid = 0;
|
Valid = 0;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataWindow::clear_data()
|
void DataWindow::clear_data()
|
||||||
{
|
{
|
||||||
txtDataInput->clear();
|
txtDataInput->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataWindow::okay()
|
void DataWindow::okay()
|
||||||
{
|
{
|
||||||
Valid = 1;
|
Valid = 1;
|
||||||
DataOutput = txtDataInput->toPlainText();
|
DataOutput = txtDataInput->toPlainText();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataWindow::from_file()
|
void DataWindow::from_file()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Zint Barcode Generator - the open source barcode generator
|
Zint Barcode Generator - the open source barcode generator
|
||||||
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -16,15 +16,15 @@
|
|||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
#include <QDebug>
|
//#include <QDebug>
|
||||||
#include <QUiLoader>
|
#include <QUiLoader>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include "exportwindow.h"
|
#include "exportwindow.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
ExportWindow::ExportWindow()
|
ExportWindow::ExportWindow()
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ ExportWindow::~ExportWindow()
|
|||||||
|
|
||||||
void ExportWindow::quit_now()
|
void ExportWindow::quit_now()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportWindow::get_directory()
|
void ExportWindow::get_directory()
|
||||||
@ -80,103 +80,102 @@ void ExportWindow::get_directory()
|
|||||||
|
|
||||||
void ExportWindow::process()
|
void ExportWindow::process()
|
||||||
{
|
{
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QString dataString;
|
QString dataString;
|
||||||
QString suffix;
|
QString suffix;
|
||||||
QString Feedback;
|
QString Feedback;
|
||||||
int lines, i, j, inputpos;
|
int lines, i, j, inputpos;
|
||||||
|
|
||||||
lines = output_data.count(QChar('\n'), Qt::CaseInsensitive);
|
lines = output_data.count(QChar('\n'), Qt::CaseInsensitive);
|
||||||
inputpos = 0;
|
inputpos = 0;
|
||||||
|
|
||||||
switch(cmbFileFormat->currentIndex()) {
|
switch(cmbFileFormat->currentIndex()) {
|
||||||
#ifdef NO_PNG
|
#ifdef NO_PNG
|
||||||
case 0: suffix = ".eps"; break;
|
case 0: suffix = ".eps"; break;
|
||||||
case 1: suffix = ".gif"; break;
|
case 1: suffix = ".gif"; break;
|
||||||
case 2: suffix = ".svg"; break;
|
case 2: suffix = ".svg"; break;
|
||||||
case 3: suffix = ".bmp"; break;
|
case 3: suffix = ".bmp"; break;
|
||||||
case 4: suffix = ".pcx"; break;
|
case 4: suffix = ".pcx"; break;
|
||||||
case 5: suffix = ".emf"; break;
|
case 5: suffix = ".emf"; break;
|
||||||
case 6: suffix = ".tif"; break;
|
case 6: suffix = ".tif"; break;
|
||||||
#else
|
#else
|
||||||
case 0: suffix = ".png"; break;
|
case 0: suffix = ".png"; break;
|
||||||
case 1: suffix = ".eps"; break;
|
case 1: suffix = ".eps"; break;
|
||||||
case 2: suffix = ".gif"; break;
|
case 2: suffix = ".gif"; break;
|
||||||
case 3: suffix = ".svg"; break;
|
case 3: suffix = ".svg"; break;
|
||||||
case 4: suffix = ".bmp"; break;
|
case 4: suffix = ".bmp"; break;
|
||||||
case 5: suffix = ".pcx"; break;
|
case 5: suffix = ".pcx"; break;
|
||||||
case 6: suffix = ".emf"; break;
|
case 6: suffix = ".emf"; break;
|
||||||
case 7: suffix = ".tif"; break;
|
case 7: suffix = ".tif"; break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
txtFeedback->clear();
|
txtFeedback->clear();
|
||||||
Feedback = "";
|
Feedback = "";
|
||||||
|
|
||||||
for(i = 0; i < lines; i++) {
|
for(i = 0; i < lines; i++) {
|
||||||
int datalen = 0;
|
int datalen = 0;
|
||||||
for(j = inputpos; ((j < output_data.length()) && (output_data[j] != '\n') ); j++) {
|
for(j = inputpos; ((j < output_data.length()) && (output_data[j] != '\n') ); j++) {
|
||||||
datalen++;
|
datalen++;
|
||||||
}
|
}
|
||||||
dataString = output_data.mid(inputpos, datalen);
|
dataString = output_data.mid(inputpos, datalen);
|
||||||
switch(cmbFileName->currentIndex()) {
|
switch(cmbFileName->currentIndex()) {
|
||||||
case 0: { /* Same as Data (URL Escaped) */
|
case 0: { /* Same as Data (URL Escaped) */
|
||||||
QString url_escaped;
|
QString url_escaped;
|
||||||
int m;
|
int m;
|
||||||
QChar name_qchar;
|
QChar name_qchar;
|
||||||
|
|
||||||
for(m = 0; m < dataString.length(); m++) {
|
for(m = 0; m < dataString.length(); m++) {
|
||||||
name_qchar = dataString[m];
|
name_qchar = dataString[m];
|
||||||
char name_char = name_qchar.toLatin1();
|
char name_char = name_qchar.toLatin1();
|
||||||
|
|
||||||
switch(name_char) {
|
switch(name_char) {
|
||||||
case '\\': url_escaped += "%5C"; break;
|
case '\\': url_escaped += "%5C"; break;
|
||||||
case '/': url_escaped += "%2F"; break;
|
case '/': url_escaped += "%2F"; break;
|
||||||
case ':': url_escaped += "%3A"; break;
|
case ':': url_escaped += "%3A"; break;
|
||||||
case '*': url_escaped += "%2A"; break;
|
case '*': url_escaped += "%2A"; break;
|
||||||
case '?': url_escaped += "%3F"; break;
|
case '?': url_escaped += "%3F"; break;
|
||||||
case '"': url_escaped += "%22"; break;
|
case '"': url_escaped += "%22"; break;
|
||||||
case '<': url_escaped += "%3C"; break;
|
case '<': url_escaped += "%3C"; break;
|
||||||
case '>': url_escaped += "%3E"; break;
|
case '>': url_escaped += "%3E"; break;
|
||||||
case '|': url_escaped += "%7C"; break;
|
case '|': url_escaped += "%7C"; break;
|
||||||
case '%': url_escaped += "%25"; break;
|
case '%': url_escaped += "%25"; break;
|
||||||
default: url_escaped += name_qchar; break;
|
default: url_escaped += name_qchar; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fileName = linDestPath->text() + QDir::separator() + linPrefix->text() + url_escaped + suffix;
|
fileName = linDestPath->text() + QDir::separator() + linPrefix->text() + url_escaped + suffix;
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1: { /* Formatted Serial Number */
|
|
||||||
QString biggest, this_val, outnumber;
|
|
||||||
int number_size, val_size, m;
|
|
||||||
|
|
||||||
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');
|
|
||||||
}
|
|
||||||
|
|
||||||
outnumber += this_val;
|
|
||||||
|
|
||||||
fileName = linDestPath->text() + QDir::separator() + linPrefix->text() + outnumber + 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";
|
|
||||||
} else {
|
|
||||||
Feedback += "Success\n";
|
|
||||||
}
|
}
|
||||||
txtFeedback->document()->setPlainText(Feedback);
|
break;
|
||||||
inputpos += datalen + 1;
|
case 1: { /* Formatted Serial Number */
|
||||||
}
|
QString biggest, this_val, outnumber;
|
||||||
}
|
int number_size, val_size, m;
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
|
outnumber += this_val;
|
||||||
|
|
||||||
|
fileName = linDestPath->text() + QDir::separator() + linPrefix->text() + outnumber + 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";
|
||||||
|
} else {
|
||||||
|
Feedback += "Success\n";
|
||||||
|
}
|
||||||
|
txtFeedback->document()->setPlainText(Feedback);
|
||||||
|
inputpos += datalen + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Zint Barcode Generator - the open source barcode generator
|
Zint Barcode Generator - the open source barcode generator
|
||||||
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -16,8 +16,9 @@
|
|||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
#include <QDebug>
|
//#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QUiLoader>
|
#include <QUiLoader>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
@ -26,29 +27,28 @@
|
|||||||
|
|
||||||
#include "sequencewindow.h"
|
#include "sequencewindow.h"
|
||||||
#include "exportwindow.h"
|
#include "exportwindow.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
SequenceWindow::SequenceWindow()
|
SequenceWindow::SequenceWindow()
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setIniCodec("UTF-8");
|
settings.setIniCodec("UTF-8");
|
||||||
QValidator *intvalid = new QIntValidator(this);
|
QValidator *intvalid = new QIntValidator(this);
|
||||||
|
|
||||||
linStartVal->setText(settings.value("studio/sequence/start_value", "1").toString());
|
linStartVal->setText(settings.value("studio/sequence/start_value", "1").toString());
|
||||||
linEndVal->setText(settings.value("studio/sequence/end_value", "10").toString());
|
linEndVal->setText(settings.value("studio/sequence/end_value", "10").toString());
|
||||||
linIncVal->setText(settings.value("studio/sequence/increment", "1").toString());
|
linIncVal->setText(settings.value("studio/sequence/increment", "1").toString());
|
||||||
linFormat->setText(settings.value("studio/sequence/format", "$$$$$$").toString());
|
linFormat->setText(settings.value("studio/sequence/format", "$$$$$$").toString());
|
||||||
|
|
||||||
linStartVal->setValidator(intvalid);
|
linStartVal->setValidator(intvalid);
|
||||||
linEndVal->setValidator(intvalid);
|
linEndVal->setValidator(intvalid);
|
||||||
linIncVal->setValidator(intvalid);
|
linIncVal->setValidator(intvalid);
|
||||||
connect(btnClose, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
connect(btnClose, SIGNAL( clicked( bool )), SLOT(quit_now()));
|
||||||
connect(btnReset, SIGNAL( clicked( bool )), SLOT(reset_preview()));
|
connect(btnReset, SIGNAL( clicked( bool )), SLOT(reset_preview()));
|
||||||
connect(btnCreate, SIGNAL( clicked( bool )), SLOT(create_sequence()));
|
connect(btnCreate, SIGNAL( clicked( bool )), SLOT(create_sequence()));
|
||||||
connect(txtPreview, SIGNAL( textChanged()), SLOT(check_generate()));
|
connect(txtPreview, SIGNAL( textChanged()), SLOT(check_generate()));
|
||||||
connect(btnImport, SIGNAL( clicked( bool )), SLOT(import()));
|
connect(btnImport, SIGNAL( clicked( bool )), SLOT(import()));
|
||||||
connect(btnExport, SIGNAL( clicked( bool )), SLOT(generate_sequence()));
|
connect(btnExport, SIGNAL( clicked( bool )), SLOT(generate_sequence()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SequenceWindow::~SequenceWindow()
|
SequenceWindow::~SequenceWindow()
|
||||||
@ -64,107 +64,107 @@ SequenceWindow::~SequenceWindow()
|
|||||||
|
|
||||||
void SequenceWindow::quit_now()
|
void SequenceWindow::quit_now()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceWindow::reset_preview()
|
void SequenceWindow::reset_preview()
|
||||||
{
|
{
|
||||||
txtPreview->clear();
|
txtPreview->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SequenceWindow::apply_format(QString raw_number)
|
QString SequenceWindow::apply_format(QString raw_number)
|
||||||
{
|
{
|
||||||
QString adjusted, reversed;
|
QString adjusted, reversed;
|
||||||
QString format;
|
QString format;
|
||||||
int format_len, input_len, i, inpos;
|
int format_len, input_len, i, inpos;
|
||||||
QChar format_qchar;
|
QChar format_qchar;
|
||||||
|
|
||||||
format = linFormat->text();
|
format = linFormat->text();
|
||||||
input_len = raw_number.length();
|
input_len = raw_number.length();
|
||||||
format_len = format.length();
|
format_len = format.length();
|
||||||
|
|
||||||
inpos = input_len;
|
inpos = input_len;
|
||||||
|
|
||||||
for(i = format_len; i > 0; i--) {
|
for(i = format_len; i > 0; i--) {
|
||||||
format_qchar = format[i - 1];
|
format_qchar = format[i - 1];
|
||||||
char format_char = format_qchar.toLatin1();
|
char format_char = format_qchar.toLatin1();
|
||||||
switch(format_char) {
|
switch(format_char) {
|
||||||
case '#':
|
case '#':
|
||||||
if (inpos > 0) {
|
if (inpos > 0) {
|
||||||
adjusted += raw_number[inpos - 1];
|
adjusted += raw_number[inpos - 1];
|
||||||
inpos--;
|
inpos--;
|
||||||
} else {
|
} else {
|
||||||
adjusted += ' ';
|
adjusted += ' ';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
if (inpos > 0) {
|
if (inpos > 0) {
|
||||||
adjusted += raw_number[inpos - 1];
|
adjusted += raw_number[inpos - 1];
|
||||||
inpos--;
|
inpos--;
|
||||||
} else {
|
} else {
|
||||||
adjusted += '0';
|
adjusted += '0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '*':
|
case '*':
|
||||||
if (inpos > 0) {
|
if (inpos > 0) {
|
||||||
adjusted += raw_number[inpos - 1];
|
adjusted += raw_number[inpos - 1];
|
||||||
inpos--;
|
inpos--;
|
||||||
} else {
|
} else {
|
||||||
adjusted += '*';
|
adjusted += '*';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
adjusted += format_char;
|
adjusted += format_char;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = format_len; i > 0; i--) {
|
for(i = format_len; i > 0; i--) {
|
||||||
reversed += adjusted[i - 1];
|
reversed += adjusted[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return reversed;
|
return reversed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceWindow::create_sequence()
|
void SequenceWindow::create_sequence()
|
||||||
{
|
{
|
||||||
QString startval, endval, incval, part, outputtext;
|
QString startval, endval, incval, part, outputtext;
|
||||||
int start, stop, step, i;
|
int start, stop, step, i;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
startval = linStartVal->text();
|
startval = linStartVal->text();
|
||||||
endval = linEndVal->text();
|
endval = linEndVal->text();
|
||||||
incval = linIncVal->text();
|
incval = linIncVal->text();
|
||||||
start = startval.toInt(&ok, 10);
|
start = startval.toInt(&ok, 10);
|
||||||
stop = endval.toInt(&ok, 10);
|
stop = endval.toInt(&ok, 10);
|
||||||
step = incval.toInt(&ok, 10);
|
step = incval.toInt(&ok, 10);
|
||||||
|
|
||||||
if((stop <= start) || (step <= 0)) {
|
if((stop <= start) || (step <= 0)) {
|
||||||
QMessageBox::critical(this, tr("Sequence Error"), tr("One or more of the input values is incorrect."));
|
QMessageBox::critical(this, tr("Sequence Error"), tr("One or more of the input values is incorrect."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = start; i <= stop; i += step) {
|
for(i = start; i <= stop; i += step) {
|
||||||
part = apply_format(QString::number(i, 10));
|
part = apply_format(QString::number(i, 10));
|
||||||
part += '\n';
|
part += '\n';
|
||||||
outputtext += part;
|
outputtext += part;
|
||||||
}
|
}
|
||||||
|
|
||||||
txtPreview->setPlainText(outputtext);
|
txtPreview->setPlainText(outputtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceWindow::check_generate()
|
void SequenceWindow::check_generate()
|
||||||
{
|
{
|
||||||
QString preview_copy;
|
QString preview_copy;
|
||||||
|
|
||||||
preview_copy = txtPreview->toPlainText();
|
preview_copy = txtPreview->toPlainText();
|
||||||
if(preview_copy.isEmpty()) {
|
if(preview_copy.isEmpty()) {
|
||||||
btnExport->setEnabled(false);
|
btnExport->setEnabled(false);
|
||||||
lblExport->setEnabled(false);
|
lblExport->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
btnExport->setEnabled(true);
|
btnExport->setEnabled(true);
|
||||||
lblExport->setEnabled(true);
|
lblExport->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceWindow::import()
|
void SequenceWindow::import()
|
||||||
@ -201,9 +201,8 @@ void SequenceWindow::import()
|
|||||||
|
|
||||||
void SequenceWindow::generate_sequence()
|
void SequenceWindow::generate_sequence()
|
||||||
{
|
{
|
||||||
ExportWindow dlg;
|
ExportWindow dlg;
|
||||||
dlg.barcode = barcode;
|
dlg.barcode = barcode;
|
||||||
dlg.output_data = txtPreview->toPlainText();
|
dlg.output_data = txtPreview->toPlainText();
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user