printerEncoding: check if configured codec is available
This commit is contained in:
parent
539e392c0d
commit
3dac861ca0
@ -98,6 +98,16 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
|
||||
// text encoding for printer
|
||||
this->codec = QTextCodec::codecForName(printerEncoding);
|
||||
|
||||
if (this->codec == nullptr) {
|
||||
printerEncoding = "ISO 8859-1";
|
||||
qCritical() << "ATBDeviceControllerPlugin: ERROR: printer encoding \"" << printerEncoding << "\" is not supported!";
|
||||
qCritical() << " ... use default encoding: " << printerEncoding;
|
||||
this->codec = QTextCodec::codecForName(printerEncoding);
|
||||
}
|
||||
else {
|
||||
qCritical() << "ATBDeviceControllerPlugin: Set printer encoding to " << printerEncoding;
|
||||
}
|
||||
|
||||
this->diag->init(this->hw, this->eventReceiver);
|
||||
|
||||
this->pluginState = PLUGIN_STATE::INITIALIZED;
|
||||
|
Loading…
Reference in New Issue
Block a user