more on printer

This commit is contained in:
Martin Brodbeck 2018-08-06 13:39:12 +02:00
parent a34fd9aefd
commit e8d839eccb
2 changed files with 15 additions and 9 deletions

View File

@ -3,6 +3,8 @@
#include <database.h>
#include <posprinter.h>
#include <exception>
#include <QMessageBox>
#include <QSettings>
@ -21,10 +23,16 @@ SettingsDialog::SettingsDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(par
ui_.feePercentSpinBox->setValue(feeInPercent);
ui_.maxFeeSpinBox->setValue(maxFeeInEuro);
connect(ui_.testPosPrinterButton, &QPushButton::clicked, this, [](){
//PosPrinter::initialize({0, 0});
PosPrinter printer;
printer.printTest();
connect(ui_.testPosPrinterButton, &QPushButton::clicked, this, [=]() {
using namespace std::string_literals;
try {
PosPrinter printer;
printer.printTest();
} catch (std::runtime_error& err) {
QMessageBox(QMessageBox::Icon::Warning, "Bondrucker Fehler",
QString("Test schlug fehl: ") + err.what(), QMessageBox::StandardButton::Ok, this)
.exec();
}
});
}
@ -52,10 +60,8 @@ void SettingsDialog::accept()
} catch (std::exception& ex) {
std::string errMsg("Das Ändern der Kassen-Nr. ist fehlgeschlagen: ");
errMsg.append(ex.what());
QMessageBox(QMessageBox::Icon::Critical, "Fehler",
errMsg.c_str(),
QMessageBox::StandardButton::Ok,
this)
QMessageBox(QMessageBox::Icon::Critical, "Fehler", errMsg.c_str(),
QMessageBox::StandardButton::Ok, this)
.exec();
QDialog::accept();
return;

View File

@ -112,7 +112,7 @@ void PosPrinter::printTest()
std::stringstream commandStream;
commandStream << Command::ENCODING;
commandStream << "Der Drucker kann von KIMA2\nangesprochen werden.\n\n"
<< "Beachten Sie, dass nicht\nalle Modelle Strichcodes\nausdrucken können.";
<< u8"Beachten Sie, dass nicht\nalle Modelle Strichcodes\nausdrucken können.";
commandStream << Command::FEED;
printHeader();
write(commandStream.str());