Printsupport: stop using QL1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: Ia186ed178239796bdf19db5b35a36ea606baf937 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
87762234a7
commit
24d2a00ce2
|
|
@ -251,7 +251,7 @@ void QCupsPrintEnginePrivate::closePrintDevice()
|
|||
|
||||
// Print the file
|
||||
// Cups expect the printer original name without instance, the full name is used only to retrieve the configuration
|
||||
const auto parts = QStringView{printerName}.split(QLatin1Char('/'));
|
||||
const auto parts = QStringView{printerName}.split(u'/');
|
||||
const auto printerOriginalName = parts.at(0);
|
||||
cups_option_t* optPtr = cupsOptStruct.size() ? &cupsOptStruct.first() : 0;
|
||||
cupsPrintFile(printerOriginalName.toLocal8Bit().constData(), tempFile.toLocal8Bit().constData(),
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ QStringList QCupsPrinterSupport::availablePrintDeviceIds() const
|
|||
for (int i = 0; i < count; ++i) {
|
||||
QString printerId = QString::fromLocal8Bit(dests[i].name);
|
||||
if (dests[i].instance)
|
||||
printerId += QLatin1Char('/') + QString::fromLocal8Bit(dests[i].instance);
|
||||
printerId += u'/' + QString::fromLocal8Bit(dests[i].instance);
|
||||
list.append(printerId);
|
||||
}
|
||||
cupsFreeDests(count, dests);
|
||||
|
|
@ -187,7 +187,7 @@ QString QCupsPrinterSupport::staticDefaultPrintDeviceId()
|
|||
if (dests[i].is_default) {
|
||||
printerId = QString::fromLocal8Bit(dests[i].name);
|
||||
if (dests[i].instance) {
|
||||
printerId += QLatin1Char('/') + QString::fromLocal8Bit(dests[i].instance);
|
||||
printerId += u'/' + QString::fromLocal8Bit(dests[i].instance);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ QPpdPrintDevice::QPpdPrintDevice(const QString &id)
|
|||
if (!id.isEmpty()) {
|
||||
|
||||
// TODO For now each dest is an individual device
|
||||
const auto parts = QStringView{id}.split(QLatin1Char('/'));
|
||||
const auto parts = QStringView{id}.split(u'/');
|
||||
m_cupsName = parts.at(0).toUtf8();
|
||||
if (parts.size() > 1)
|
||||
m_cupsInstance = parts.at(1).toUtf8();
|
||||
|
|
|
|||
|
|
@ -1356,12 +1356,12 @@ QUnixPrintWidget::QUnixPrintWidget(QPrinter *printer, QWidget *parent)
|
|||
if (printer->outputFileName().isEmpty()) {
|
||||
QString home = QDir::homePath();
|
||||
QString cur = QDir::currentPath();
|
||||
if (!home.endsWith(QLatin1Char('/')))
|
||||
home += QLatin1Char('/');
|
||||
if (!home.endsWith(u'/'))
|
||||
home += u'/';
|
||||
if (!cur.startsWith(home))
|
||||
cur = home;
|
||||
else if (!cur.endsWith(QLatin1Char('/')))
|
||||
cur += QLatin1Char('/');
|
||||
else if (!cur.endsWith(u'/'))
|
||||
cur += u'/';
|
||||
if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
|
||||
if (printer->docName().isEmpty()) {
|
||||
cur += QStringLiteral("print.pdf");
|
||||
|
|
|
|||
|
|
@ -94,13 +94,13 @@ public:
|
|||
State validate(QString &input, int &pos) const override
|
||||
{
|
||||
bool replacePercent = false;
|
||||
if (input.endsWith(QLatin1Char('%'))) {
|
||||
if (input.endsWith(u'%')) {
|
||||
input = input.left(input.length() - 1);
|
||||
replacePercent = true;
|
||||
}
|
||||
State state = QDoubleValidator::validate(input, pos);
|
||||
if (replacePercent)
|
||||
input += QLatin1Char('%');
|
||||
input += u'%';
|
||||
const int num_size = 4;
|
||||
if (state == Intermediate) {
|
||||
int i = input.indexOf(QLocale::system().decimalPoint());
|
||||
|
|
@ -486,7 +486,7 @@ void QPrintPreviewDialogPrivate::updatePageNumLabel()
|
|||
int numPages = preview->pageCount();
|
||||
int maxChars = QString::number(numPages).length();
|
||||
pageNumLabel->setText(QString::fromLatin1("/ %1").arg(numPages));
|
||||
int cyphersWidth = q->fontMetrics().horizontalAdvance(QString().fill(QLatin1Char('8'), maxChars));
|
||||
int cyphersWidth = q->fontMetrics().horizontalAdvance(QString().fill(u'8', maxChars));
|
||||
int maxWidth = pageNumEdit->minimumSizeHint().width() + cyphersWidth;
|
||||
pageNumEdit->setMinimumWidth(maxWidth);
|
||||
pageNumEdit->setMaximumWidth(maxWidth);
|
||||
|
|
@ -577,8 +577,7 @@ void QPrintPreviewDialogPrivate::_q_print()
|
|||
QString suffix = QLatin1String(".pdf");
|
||||
QString fileName;
|
||||
#if QT_CONFIG(filedialog)
|
||||
fileName = QFileDialog::getSaveFileName(q, title, printer->outputFileName(),
|
||||
QLatin1Char('*') + suffix);
|
||||
fileName = QFileDialog::getSaveFileName(q, title, printer->outputFileName(), u'*' + suffix);
|
||||
#endif
|
||||
if (!fileName.isEmpty()) {
|
||||
if (QFileInfo(fileName).suffix().isEmpty())
|
||||
|
|
@ -630,7 +629,7 @@ void QPrintPreviewDialogPrivate::_q_zoomFactorChanged()
|
|||
{
|
||||
QString text = zoomFactor->lineEdit()->text();
|
||||
bool ok;
|
||||
qreal factor = text.remove(QLatin1Char('%')).toFloat(&ok);
|
||||
qreal factor = text.remove(u'%').toFloat(&ok);
|
||||
factor = qMax(qreal(1.0), qMin(qreal(1000.0), factor));
|
||||
if (ok) {
|
||||
preview->setZoomFactor(factor/100.0);
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ QCUPSSupport::JobSheets QCUPSSupport::parseJobSheets(const QString &jobSheets)
|
|||
{
|
||||
JobSheets result;
|
||||
|
||||
const QStringList parts = jobSheets.split(QLatin1Char(','));
|
||||
const QStringList parts = jobSheets.split(u',');
|
||||
if (parts.count() == 2) {
|
||||
result.startBannerPage = stringToBannerPage(parts[0]);
|
||||
result.endBannerPage = stringToBannerPage(parts[1]);
|
||||
|
|
@ -245,7 +245,7 @@ void QCUPSSupport::setBannerPages(QPrinter *printer, const BannerPage startBanne
|
|||
const QString startBanner = bannerPageToString(startBannerPage);
|
||||
const QString endBanner = bannerPageToString(endBannerPage);
|
||||
|
||||
setCupsOption(printer, QStringLiteral("job-sheets"), startBanner + QLatin1Char(',') + endBanner);
|
||||
setCupsOption(printer, QStringLiteral("job-sheets"), startBanner + u',' + endBanner);
|
||||
}
|
||||
|
||||
void QCUPSSupport::setPageSet(QPrinter *printer, const PageSet pageSet)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ extern QPrinter::PaperSize mapDevmodePaperSize(int s);
|
|||
// QString output = QString::fromWCharArray(buffer);
|
||||
// if (output != noPrinters) {
|
||||
// // Filter out the name of the printer, which should be everything before a comma.
|
||||
// QString printerName = output.split(QLatin1Char(',')).value(0);
|
||||
// QString printerName = output.split(u',').value(0);
|
||||
// QPrinterInfo printerInfo(printerName);
|
||||
// printerInfo.d_ptr->isDefault = true;
|
||||
// return printerInfo;
|
||||
|
|
|
|||
Loading…
Reference in New Issue