mirror of
https://gitee.com/openharmony/print_print_fwk
synced 2024-11-27 02:50:40 +00:00
!375 print 5.0release:fix quality and media type bug
Merge pull request !375 from 包泽伟/OpenHarmony-5.0-Release
This commit is contained in:
commit
dda0345b5b
@ -96,9 +96,9 @@ bool ConvertDuplexModeCode(const char *src, DuplexModeCode &dst)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ConvertIppAttributesToJsonString(ipp_t *response, const std::string &keyword)
|
||||
std::string ConvertIppAttributesToJsonString(ipp_t *response, const std::string &keyword, ipp_tag_t tag)
|
||||
{
|
||||
ipp_attribute_t *attrPtr = ippFindAttribute(response, keyword.c_str(), IPP_TAG_KEYWORD);
|
||||
ipp_attribute_t *attrPtr = ippFindAttribute(response, keyword.c_str(), tag);
|
||||
if (attrPtr == nullptr) {
|
||||
return "";
|
||||
}
|
||||
@ -377,14 +377,14 @@ void ParseOrientationAttributes(ipp_t *response, PrinterCapability &printerCaps)
|
||||
void ParseOtherAttributes(ipp_t *response, PrinterCapability &printerCaps)
|
||||
{
|
||||
std::string keyword = "media-source-supported";
|
||||
std::string attrString = ConvertIppAttributesToJsonString(response, keyword);
|
||||
std::string attrString = ConvertIppAttributesToJsonString(response, keyword, IPP_TAG_KEYWORD);
|
||||
PRINT_HILOGD("%{public}s: %{public}s", keyword.c_str(), attrString.c_str());
|
||||
if (!attrString.empty()) {
|
||||
printerCaps.SetPrinterAttrNameAndValue(keyword.c_str(), attrString.c_str());
|
||||
}
|
||||
|
||||
keyword = "multiple-document-handling-supported";
|
||||
attrString = ConvertIppAttributesToJsonString(response, keyword);
|
||||
attrString = ConvertIppAttributesToJsonString(response, keyword, IPP_TAG_KEYWORD);
|
||||
PRINT_HILOGD("%{public}s: %{public}s", keyword.c_str(), attrString.c_str());
|
||||
if (!attrString.empty()) {
|
||||
printerCaps.SetPrinterAttrNameAndValue(keyword.c_str(), attrString.c_str());
|
||||
@ -405,7 +405,7 @@ void SetOptionAttribute(ipp_t *response, PrinterCapability &printerCaps)
|
||||
options["printerName"] = ippGetString(attrPtr, 0, NULL);
|
||||
}
|
||||
std::string keyword = "media-type-supported";
|
||||
std::string supportTypes = ConvertIppAttributesToJsonString(response, keyword);
|
||||
std::string supportTypes = ConvertIppAttributesToJsonString(response, keyword, IPP_TAG_ZERO);
|
||||
PRINT_HILOGD("%{public}s: %{public}s", keyword.c_str(), supportTypes.c_str());
|
||||
if (!supportTypes.empty()) {
|
||||
printerCaps.SetPrinterAttrNameAndValue(keyword.c_str(), supportTypes.c_str());
|
||||
|
@ -1267,8 +1267,8 @@ JobParameters* PrintCupsClient::BuildJobParameters(const PrintJob &jobInfo)
|
||||
params->printerAttrsOption_cupsOption = optionJson["cupsOptions"];
|
||||
}
|
||||
UpdateBorderlessJobParameter(optionJson, params);
|
||||
if (optionJson.contains("printQuality") && optionJson["printQuality"].is_number()) {
|
||||
params->printQuality = GetQulityString(optionJson["printQuality"]);
|
||||
if (optionJson.contains("printQuality") && optionJson["printQuality"].is_string()) {
|
||||
params->printQuality = optionJson["printQuality"].get<std::string>();
|
||||
} else {
|
||||
params->printQuality = CUPS_PRINT_QUALITY_NORMAL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user