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(); QByteArray bgcol = bg_colour_hash.right(6).toLatin1();
strcpy(m_zintSymbol->fgcolour, fgcol.data()); strcpy(m_zintSymbol->fgcolour, fgcol.data());
strcpy(m_zintSymbol->bgcolour, bgcol.data()); strcpy(m_zintSymbol->bgcolour, bgcol.data());
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length()); int error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length(), 0);
if (error > ZINT_WARN_INVALID_OPTION) if (error > ZINT_WARN_INVALID_OPTION) {
m_lastError = m_zintSymbol->errtxt;
error = ZBarcode_Print(m_zintSymbol, 0);
if (error > ZINT_WARN_INVALID_OPTION)
m_lastError = m_zintSymbol->errtxt; m_lastError = m_zintSymbol->errtxt;
}
if (error == 0) { if (error == 0) {
return true; return true;
} else { } else {

View File

@ -80,6 +80,7 @@ void ExportWindow::process()
QString fileName; QString fileName;
QString dataString; QString dataString;
QString suffix; QString suffix;
QString Feedback;
int lines, i, j, inputpos, datalen; int lines, i, j, inputpos, datalen;
lines = output_data.count(QChar('\n'), Qt::CaseInsensitive); lines = output_data.count(QChar('\n'), Qt::CaseInsensitive);
@ -105,6 +106,8 @@ void ExportWindow::process()
case 7: suffix = ".tif"; break; case 7: suffix = ".tif"; break;
#endif #endif
} }
txtFeedback->clear();
Feedback = "";
for(i = 0; i < lines; i++) { for(i = 0; i < lines; i++) {
datalen = 0; datalen = 0;
@ -161,7 +164,16 @@ void ExportWindow::process()
} }
barcode->bc.setText(dataString.toLatin1().data()); 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; inputpos += datalen + 1;
} }
close();
} }

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>450</width> <width>450</width>
<height>170</height> <height>505</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -19,13 +19,13 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>450</width> <width>450</width>
<height>170</height> <height>505</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>450</width> <width>450</width>
<height>170</height> <height>505</height>
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -218,7 +218,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Cancel</string> <string>Close</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="btnOK"> <widget class="QPushButton" name="btnOK">
@ -231,7 +231,30 @@
</rect> </rect>
</property> </property>
<property name="text"> <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> </property>
</widget> </widget>
</widget> </widget>