Simplify temporary JSON Objects
This commit is contained in:
parent
580bbdfdbb
commit
126940f8ea
2 changed files with 5 additions and 13 deletions
|
@ -102,22 +102,15 @@ QJsonValue IppMsg::consume_value(quint8 tag, Bytestream& data)
|
|||
{
|
||||
qint32 x, y;
|
||||
qint8 units;
|
||||
QJsonObject tmp_res;
|
||||
data >> tmp_len >> x >> y >> units;
|
||||
tmp_res.insert("x", x);
|
||||
tmp_res.insert("y", y);
|
||||
tmp_res.insert("units", units);
|
||||
value = tmp_res;
|
||||
value = QJsonObject {{"x", x}, {"y", y}, {"units", units}};
|
||||
break;
|
||||
}
|
||||
case IntegerRange:
|
||||
{
|
||||
qint32 low, high;
|
||||
data >> tmp_len >> low >> high;
|
||||
QJsonObject tmp_range;
|
||||
tmp_range.insert("low", low);
|
||||
tmp_range.insert("high", high);
|
||||
value = tmp_range;
|
||||
value = QJsonObject {{"low", low}, {"high", high}};
|
||||
break;
|
||||
}
|
||||
case OctetStringUnknown:
|
||||
|
|
|
@ -434,10 +434,9 @@ void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysUseMediaC
|
|||
|
||||
if(attrs.contains("printer-resolution"))
|
||||
{
|
||||
QJsonObject tmpObj;
|
||||
tmpObj["units"] = PrinterResolutionRef.toObject()["units"];
|
||||
tmpObj["x"] = (int)HwResX;
|
||||
tmpObj["y"] = (int)HwResY;
|
||||
QJsonObject tmpObj {{"units", PrinterResolutionRef.toObject()["units"]},
|
||||
{"x", (int)HwResX},
|
||||
{"y", (int)HwResY}};
|
||||
attrs["printer-resolution"] = QJsonObject { {"tag", IppMsg::Resolution}, {"value", tmpObj} };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue