Enable translation of error messages from C++
This commit is contained in:
parent
ef9b222c35
commit
8c22740651
9 changed files with 99 additions and 10 deletions
|
@ -78,14 +78,14 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTempo
|
|||
{
|
||||
qDebug() << "pdftoppm died";
|
||||
tempfile->deleteLater();
|
||||
emit failed();
|
||||
emit failed(tr("Conversion error"));
|
||||
return;
|
||||
}
|
||||
if(!ppm2pwg->waitForStarted())
|
||||
{
|
||||
qDebug() << "ppm2pwg died";
|
||||
tempfile->deleteLater();
|
||||
emit failed();
|
||||
emit failed(tr("Conversion error"));
|
||||
return;
|
||||
}
|
||||
qDebug() << "All started";
|
||||
|
@ -108,7 +108,7 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
|
|||
if(!inImage.load(filename))
|
||||
{
|
||||
qDebug() << "failed to load";
|
||||
emit failed();
|
||||
emit failed(tr("Failed to load image"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
|
|||
{
|
||||
qDebug() << "ppm2pwg died";
|
||||
tempfile->deleteLater();
|
||||
emit failed();
|
||||
emit failed(tr("Conversion error"));
|
||||
return;
|
||||
}
|
||||
qDebug() << "All started";
|
||||
|
|
|
@ -17,7 +17,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void done(QNetworkRequest request, QTemporaryFile* data);
|
||||
void failed();
|
||||
void failed(QString message);
|
||||
};
|
||||
|
||||
#endif // CONVERTWORKER_H
|
||||
|
|
|
@ -97,7 +97,6 @@ void IppPrinter::refresh() {
|
|||
QNetworkRequest request;
|
||||
|
||||
request.setUrl(httpUrl());
|
||||
// request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "SeaPrint "SEAPRINT_VERSION);
|
||||
|
||||
|
@ -220,10 +219,10 @@ void IppPrinter::convertDone(QNetworkRequest request, QTemporaryFile* data)
|
|||
|
||||
}
|
||||
|
||||
void IppPrinter::convertFailed()
|
||||
void IppPrinter::convertFailed(QString message)
|
||||
{
|
||||
_jobAttrs = QJsonObject();
|
||||
_jobAttrs.insert("job-state-message", QJsonObject {{"tag", IppMsg::TextWithoutLanguage}, {"value", "Internal error"}});
|
||||
_jobAttrs.insert("job-state-message", QJsonObject {{"tag", IppMsg::TextWithoutLanguage}, {"value", message}});
|
||||
emit jobAttrsChanged();
|
||||
emit jobFinished(false);
|
||||
}
|
||||
|
@ -235,7 +234,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename){
|
|||
bool file_ok = file.open(QIODevice::ReadOnly);
|
||||
if(!file_ok)
|
||||
{
|
||||
emit jobFinished(false);
|
||||
emit convertFailed(tr("Failed to open file"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public slots:
|
|||
void ignoreKnownSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
|
||||
|
||||
void convertDone(QNetworkRequest request, QTemporaryFile* data);
|
||||
void convertFailed();
|
||||
void convertFailed(QString message);
|
||||
|
||||
private:
|
||||
QUrl _url;
|
||||
|
|
|
@ -118,6 +118,17 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConvertWorker</name>
|
||||
<message>
|
||||
<source>Conversion error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to load image</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -172,6 +183,13 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>IppPrinter</name>
|
||||
<message>
|
||||
<source>Failed to open file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JobsPage</name>
|
||||
<message>
|
||||
|
|
|
@ -118,6 +118,17 @@
|
|||
<translation type="unfinished">Impresión fallida: </translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConvertWorker</name>
|
||||
<message>
|
||||
<source>Conversion error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to load image</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -172,6 +183,13 @@
|
|||
<translation type="unfinished">Elegir archivo</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>IppPrinter</name>
|
||||
<message>
|
||||
<source>Failed to open file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JobsPage</name>
|
||||
<message>
|
||||
|
|
|
@ -118,6 +118,17 @@
|
|||
<translation type="unfinished">Échec de l'impression :</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConvertWorker</name>
|
||||
<message>
|
||||
<source>Conversion error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to load image</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -172,6 +183,13 @@
|
|||
<translation type="unfinished">Choisir un fichier</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>IppPrinter</name>
|
||||
<message>
|
||||
<source>Failed to open file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JobsPage</name>
|
||||
<message>
|
||||
|
|
|
@ -118,6 +118,17 @@
|
|||
<translation type="unfinished">打印失败:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConvertWorker</name>
|
||||
<message>
|
||||
<source>Conversion error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to load image</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -172,6 +183,13 @@
|
|||
<translation type="unfinished">选择文件</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>IppPrinter</name>
|
||||
<message>
|
||||
<source>Failed to open file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JobsPage</name>
|
||||
<message>
|
||||
|
|
|
@ -118,6 +118,17 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConvertWorker</name>
|
||||
<message>
|
||||
<source>Conversion error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to load image</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -172,6 +183,13 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>IppPrinter</name>
|
||||
<message>
|
||||
<source>Failed to open file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JobsPage</name>
|
||||
<message>
|
||||
|
|
Loading…
Reference in a new issue