Feed back results of batch process to user in Studio

This commit is contained in:
Robin Stuart 2017-08-11 22:36:40 +01:00
parent 1ca01e9322
commit 670242a3fe
3 changed files with 46 additions and 13 deletions

View File

@ -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 {

View File

@ -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();
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>450</width>
<height>170</height>
<height>505</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,13 +19,13 @@
<property name="minimumSize">
<size>
<width>450</width>
<height>170</height>
<height>505</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>170</height>
<height>505</height>
</size>
</property>
<property name="windowTitle">
@ -218,7 +218,7 @@
</rect>
</property>
<property name="text">
<string>Cancel</string>
<string>Close</string>
</property>
</widget>
<widget class="QPushButton" name="btnOK">
@ -231,7 +231,30 @@
</rect>
</property>
<property name="text">
<string>OK</string>
<string>Export</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="txtFeedback">
<property name="geometry">
<rect>
<x>0</x>
<y>180</y>
<width>441</width>
<height>321</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="lblFeedback">
<property name="geometry">
<rect>
<x>0</x>
<y>160</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Export Results:</string>
</property>
</widget>
</widget>