From 670242a3fe7e8fbc39ddeb68aab55ea7f3a301d3 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Fri, 11 Aug 2017 22:36:40 +0100 Subject: [PATCH] Feed back results of batch process to user in Studio --- backend_qt/qzint.cpp | 8 +++----- frontend_qt/exportwindow.cpp | 18 +++++++++++++++--- frontend_qt/extExport.ui | 33 ++++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index 212f7966..7866fd3e 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -275,12 +275,10 @@ namespace Zint { QByteArray bgcol = bg_colour_hash.right(6).toLatin1(); strcpy(m_zintSymbol->fgcolour, fgcol.data()); strcpy(m_zintSymbol->bgcolour, bgcol.data()); - int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length()); - if (error > ZINT_WARN_INVALID_OPTION) - m_lastError = m_zintSymbol->errtxt; - error = ZBarcode_Print(m_zintSymbol, 0); - if (error > ZINT_WARN_INVALID_OPTION) + int error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length(), 0); + if (error > ZINT_WARN_INVALID_OPTION) { m_lastError = m_zintSymbol->errtxt; + } if (error == 0) { return true; } else { diff --git a/frontend_qt/exportwindow.cpp b/frontend_qt/exportwindow.cpp index 5112eea1..6fe40ee1 100644 --- a/frontend_qt/exportwindow.cpp +++ b/frontend_qt/exportwindow.cpp @@ -80,6 +80,7 @@ void ExportWindow::process() QString fileName; QString dataString; QString suffix; + QString Feedback; int lines, i, j, inputpos, datalen; lines = output_data.count(QChar('\n'), Qt::CaseInsensitive); @@ -105,7 +106,9 @@ void ExportWindow::process() case 7: suffix = ".tif"; break; #endif } - + txtFeedback->clear(); + Feedback = ""; + for(i = 0; i < lines; i++) { datalen = 0; for(j = inputpos; ((j < output_data.length()) && (output_data[j] != '\n') ); j++) { @@ -160,8 +163,17 @@ void ExportWindow::process() break; } barcode->bc.setText(dataString.toLatin1().data()); - barcode->bc.save_to_file(fileName.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; } - close(); } diff --git a/frontend_qt/extExport.ui b/frontend_qt/extExport.ui index 4cd671aa..cbdb5054 100644 --- a/frontend_qt/extExport.ui +++ b/frontend_qt/extExport.ui @@ -7,7 +7,7 @@ 0 0 450 - 170 + 505 @@ -19,13 +19,13 @@ 450 - 170 + 505 450 - 170 + 505 @@ -218,7 +218,7 @@ - Cancel + Close @@ -231,7 +231,30 @@ - OK + Export + + + + + + 0 + 180 + 441 + 321 + + + + + + + 0 + 160 + 101 + 17 + + + + Export Results: