File format additions, user agent

This commit is contained in:
Anton Thomasson 2020-01-20 20:11:41 +01:00
parent d72382af50
commit 2f973f3d57
3 changed files with 15 additions and 2 deletions

View file

@ -242,7 +242,7 @@ Page {
FilePickerPage { FilePickerPage {
title: fileButton.label title: fileButton.label
showSystemFiles: false showSystemFiles: false
nameFilters: ["*.pdf", "*.jpg", "*.jpeg"] nameFilters: ["*.pdf", "*.jpg", "*.jpeg", "*.pwg", "*.urf"]
onSelectedContentPropertiesChanged: { onSelectedContentPropertiesChanged: {
page.selectedFile = selectedContentProperties.filePath page.selectedFile = selectedContentProperties.filePath

View file

@ -1,4 +1,6 @@
#include "ippdiscovery.h" #include "ippdiscovery.h"
#include <seaprint_version.h>
#define A 1 #define A 1
#define PTR 12 #define PTR 12
#define TXT 16 #define TXT 16
@ -287,7 +289,10 @@ QImage IppDiscovery::requestImage(const QString &id, QSize *size, const QSize &r
url.setHost(_AAs.value(url.host())); url.setHost(_AAs.value(url.host()));
} }
QNetworkReply* reply = nam->get(QNetworkRequest(url)); QNetworkRequest request(url);
request.setHeader(QNetworkRequest::UserAgentHeader, "SeaPrint "SEAPRINT_VERSION);
QNetworkReply* reply = nam->get(request);
QEventLoop el; QEventLoop el;
connect(reply, SIGNAL(finished()),&el,SLOT(quit())); connect(reply, SIGNAL(finished()),&el,SLOT(quit()));

View file

@ -1,4 +1,6 @@
#include "ippprinter.h" #include "ippprinter.h"
#include "ioprepender.h"
#include <seaprint_version.h>
IppPrinter::IppPrinter() IppPrinter::IppPrinter()
{ {
@ -84,6 +86,7 @@ void IppPrinter::refresh() {
request.setUrl(httpUrl()); request.setUrl(httpUrl());
// request.setRawHeader("User-Agent", "MyOwnBrowser 1.0"); // request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp");
request.setHeader(QNetworkRequest::UserAgentHeader, "SeaPrint "SEAPRINT_VERSION);
QJsonObject o = opAttrs(); QJsonObject o = opAttrs();
IppMsg msg = IppMsg(o); IppMsg msg = IppMsg(o);
@ -205,6 +208,7 @@ bool IppPrinter::print(QJsonObject attrs, QString filename){
request.setUrl(httpUrl()); request.setUrl(httpUrl());
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp");
request.setHeader(QNetworkRequest::UserAgentHeader, "SeaPrint "SEAPRINT_VERSION);
QJsonObject o = opAttrs(); QJsonObject o = opAttrs();
o.insert("job-name", QJsonObject {{"tag", IppMsg::NameWithoutLanguage}, {"value", fileinfo.fileName()}}); o.insert("job-name", QJsonObject {{"tag", IppMsg::NameWithoutLanguage}, {"value", fileinfo.fileName()}});
@ -246,6 +250,8 @@ bool IppPrinter::getJobs() {
request.setUrl(httpUrl()); request.setUrl(httpUrl());
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp");
request.setHeader(QNetworkRequest::UserAgentHeader, "SeaPrint "SEAPRINT_VERSION);
_jobs_nam->post(request, contents); _jobs_nam->post(request, contents);
return true; return true;
@ -266,6 +272,8 @@ bool IppPrinter::cancelJob(qint32 jobId) {
request.setUrl(httpUrl()); request.setUrl(httpUrl());
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/ipp");
request.setHeader(QNetworkRequest::UserAgentHeader, "SeaPrint "SEAPRINT_VERSION);
_job_cancel_nam->post(request, contents); _job_cancel_nam->post(request, contents);
return true; return true;