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

View File

@ -112,7 +112,7 @@ void PosPrinter::printTest()
std::stringstream commandStream; std::stringstream commandStream;
commandStream << Command::ENCODING; commandStream << Command::ENCODING;
commandStream << "Der Drucker kann von KIMA2\nangesprochen werden.\n\n" 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; commandStream << Command::FEED;
printHeader(); printHeader();
write(commandStream.str()); write(commandStream.str());