Add Identify-Printer
This commit is contained in:
parent
b4aaa85a2d
commit
ff2eae04cf
12 changed files with 67 additions and 1 deletions
|
@ -12,6 +12,17 @@ Page {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
contentHeight: col.height
|
contentHeight: col.height
|
||||||
|
|
||||||
|
PullDownMenu {
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
id: identifyLabel
|
||||||
|
text: qsTr("Identify printer")
|
||||||
|
visible: printer.attrs.hasOwnProperty("identify-actions-supported")
|
||||||
|
onClicked: printer.identify()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: col
|
id: col
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,8 @@ public:
|
||||||
RestartJob = 0x000E,
|
RestartJob = 0x000E,
|
||||||
PausePrinter = 0x0010,
|
PausePrinter = 0x0010,
|
||||||
ResumePrinter = 0x0011,
|
ResumePrinter = 0x0011,
|
||||||
PurgeJobs = 0x0012
|
PurgeJobs = 0x0012,
|
||||||
|
IdentifyPrinter = 0x003C
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit IppMsg();
|
explicit IppMsg();
|
||||||
|
|
|
@ -17,6 +17,7 @@ IppPrinter::IppPrinter() : _worker(this)
|
||||||
connect(this, &IppPrinter::doDoGetPrinterAttributes, &_worker, &PrinterWorker::getPrinterAttributes);
|
connect(this, &IppPrinter::doDoGetPrinterAttributes, &_worker, &PrinterWorker::getPrinterAttributes);
|
||||||
connect(this, &IppPrinter::doGetJobs, &_worker, &PrinterWorker::getJobs);
|
connect(this, &IppPrinter::doGetJobs, &_worker, &PrinterWorker::getJobs);
|
||||||
connect(this, &IppPrinter::doCancelJob, &_worker, &PrinterWorker::cancelJob);
|
connect(this, &IppPrinter::doCancelJob, &_worker, &PrinterWorker::cancelJob);
|
||||||
|
connect(this, &IppPrinter::doIdentify, &_worker, &PrinterWorker::identify);
|
||||||
connect(this, &IppPrinter::doJustUpload, &_worker, &PrinterWorker::justUpload);
|
connect(this, &IppPrinter::doJustUpload, &_worker, &PrinterWorker::justUpload);
|
||||||
connect(this, &IppPrinter::doFixupPlaintext, &_worker, &PrinterWorker::fixupPlaintext);
|
connect(this, &IppPrinter::doFixupPlaintext, &_worker, &PrinterWorker::fixupPlaintext);
|
||||||
connect(this, &IppPrinter::doFixupJpeg, &_worker, &PrinterWorker::fixupJpeg);
|
connect(this, &IppPrinter::doFixupJpeg, &_worker, &PrinterWorker::fixupJpeg);
|
||||||
|
@ -294,6 +295,11 @@ void IppPrinter::cancelJobFinished(CURLcode res, Bytestream data)
|
||||||
getJobs();
|
getJobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IppPrinter::identifyFinished(CURLcode /*res*/, Bytestream /*data*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void IppPrinter::getStringsFinished(CURLcode res, Bytestream data)
|
void IppPrinter::getStringsFinished(CURLcode res, Bytestream data)
|
||||||
{
|
{
|
||||||
qDebug() << res << data.size();
|
qDebug() << res << data.size();
|
||||||
|
@ -760,6 +766,19 @@ bool IppPrinter::cancelJob(qint32 jobId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IppPrinter::identify() {
|
||||||
|
|
||||||
|
qDebug() << "identifying";
|
||||||
|
|
||||||
|
QJsonObject o = opAttrs();
|
||||||
|
|
||||||
|
IppMsg job = IppMsg(o, QJsonObject());
|
||||||
|
|
||||||
|
emit doCancelJob(job.encode(IppMsg::IdentifyPrinter));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool IppPrinter::correctSuffix()
|
bool IppPrinter::correctSuffix()
|
||||||
{
|
{
|
||||||
foreach(QJsonValue u, _attrs["printer-uri-supported"].toObject()["value"].toArray())
|
foreach(QJsonValue u, _attrs["printer-uri-supported"].toObject()["value"].toArray())
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE bool getJobs();
|
Q_INVOKABLE bool getJobs();
|
||||||
Q_INVOKABLE bool cancelJob(qint32 jobId);
|
Q_INVOKABLE bool cancelJob(qint32 jobId);
|
||||||
|
Q_INVOKABLE bool identify();
|
||||||
|
|
||||||
bool correctSuffix();
|
bool correctSuffix();
|
||||||
QStringList suffixes();
|
QStringList suffixes();
|
||||||
|
@ -57,6 +58,7 @@ signals:
|
||||||
void doDoGetPrinterAttributes(Bytestream msg);
|
void doDoGetPrinterAttributes(Bytestream msg);
|
||||||
void doGetJobs(Bytestream msg);
|
void doGetJobs(Bytestream msg);
|
||||||
void doCancelJob(Bytestream msg);
|
void doCancelJob(Bytestream msg);
|
||||||
|
void doIdentify(Bytestream msg);
|
||||||
|
|
||||||
void doJustUpload(QString filename, Bytestream header);
|
void doJustUpload(QString filename, Bytestream header);
|
||||||
void doFixupPlaintext(QString filename, Bytestream header);
|
void doFixupPlaintext(QString filename, Bytestream header);
|
||||||
|
@ -89,6 +91,7 @@ public slots:
|
||||||
void printRequestFinished(CURLcode res, Bytestream data);
|
void printRequestFinished(CURLcode res, Bytestream data);
|
||||||
void getJobsRequestFinished(CURLcode res, Bytestream data);
|
void getJobsRequestFinished(CURLcode res, Bytestream data);
|
||||||
void cancelJobFinished(CURLcode res, Bytestream data);
|
void cancelJobFinished(CURLcode res, Bytestream data);
|
||||||
|
void identifyFinished(CURLcode res, Bytestream data);
|
||||||
|
|
||||||
void getStringsFinished(CURLcode res, Bytestream data);
|
void getStringsFinished(CURLcode res, Bytestream data);
|
||||||
void getImageFinished(CURLcode res, Bytestream data);
|
void getImageFinished(CURLcode res, Bytestream data);
|
||||||
|
|
|
@ -56,6 +56,13 @@ void PrinterWorker::cancelJob(Bytestream msg)
|
||||||
cr.write((char*)msg.raw(), msg.size());
|
cr.write((char*)msg.raw(), msg.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrinterWorker::identify(Bytestream msg)
|
||||||
|
{
|
||||||
|
CurlRequester cr(_printer->httpUrl());
|
||||||
|
connect(&cr, &CurlRequester::done, _printer, &IppPrinter::identifyFinished);
|
||||||
|
cr.write((char*)msg.raw(), msg.size());
|
||||||
|
}
|
||||||
|
|
||||||
void PrinterWorker::justUpload(QString filename, Bytestream header)
|
void PrinterWorker::justUpload(QString filename, Bytestream header)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -36,6 +36,7 @@ public slots:
|
||||||
void getPrinterAttributes(Bytestream msg);
|
void getPrinterAttributes(Bytestream msg);
|
||||||
void getJobs(Bytestream msg);
|
void getJobs(Bytestream msg);
|
||||||
void cancelJob(Bytestream msg);
|
void cancelJob(Bytestream msg);
|
||||||
|
void identify(Bytestream msg);
|
||||||
|
|
||||||
void justUpload(QString filename, Bytestream header);
|
void justUpload(QString filename, Bytestream header);
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,10 @@
|
||||||
<source>pages/min (color)</source>
|
<source>pages/min (color)</source>
|
||||||
<translation>Farbseiten/Min</translation>
|
<translation>Farbseiten/Min</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Identify printer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FirstPage</name>
|
<name>FirstPage</name>
|
||||||
|
|
|
@ -217,6 +217,10 @@
|
||||||
<source>pages/min (color)</source>
|
<source>pages/min (color)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Identify printer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FirstPage</name>
|
<name>FirstPage</name>
|
||||||
|
|
|
@ -217,6 +217,10 @@
|
||||||
<source>pages/min (color)</source>
|
<source>pages/min (color)</source>
|
||||||
<translation>pages/min (couleur)</translation>
|
<translation>pages/min (couleur)</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Identify printer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FirstPage</name>
|
<name>FirstPage</name>
|
||||||
|
|
|
@ -217,6 +217,10 @@
|
||||||
<source>pages/min (color)</source>
|
<source>pages/min (color)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Identify printer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FirstPage</name>
|
<name>FirstPage</name>
|
||||||
|
|
|
@ -217,6 +217,10 @@
|
||||||
<source>pages/min (color)</source>
|
<source>pages/min (color)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Identify printer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FirstPage</name>
|
<name>FirstPage</name>
|
||||||
|
|
|
@ -217,6 +217,10 @@
|
||||||
<source>pages/min (color)</source>
|
<source>pages/min (color)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Identify printer</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FirstPage</name>
|
<name>FirstPage</name>
|
||||||
|
|
Loading…
Reference in a new issue