Using QLatin1String instead of QLatin1Literal.

QLatin1Literal is just a typedef of QLatin1String lefter for compatibility with
Qt 4.x.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-07-20 11:39:15 +03:00
parent f477904ef3
commit 1bffa92127
24 changed files with 71 additions and 71 deletions

View File

@ -2002,7 +2002,7 @@ void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString
SCASSERT(table != nullptr);
QString header = table->horizontalHeaderItem(column)->text();
const int index = header.indexOf(QLatin1Literal("("));
const int index = header.indexOf(QLatin1String("("));
if (index != -1)
{
header.remove(index-1, 100);
@ -2026,7 +2026,7 @@ void TMainWindow::SetCurrentFile(const QString &fileName)
if (curFile.isEmpty())
{
shownName = tr("untitled");
mType == MeasurementsType::Standard ? shownName += QLatin1Literal(".vst") : shownName += QLatin1Literal(".vit");
mType == MeasurementsType::Standard ? shownName += QLatin1String(".vst") : shownName += QLatin1String(".vit");
ui->lineEditPathToFile->setText(tr("<Empty>"));
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
ui->lineEditPathToFile->setCursorPosition(0);
@ -2055,7 +2055,7 @@ void TMainWindow::SetCurrentFile(const QString &fileName)
#if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QApplication::applicationDirPath() +
QLatin1Literal("/../Resources/measurements.icns"));
QLatin1String("/../Resources/measurements.icns"));
QIcon icon;
if (not curFile.isEmpty())
{

View File

@ -43,11 +43,11 @@
//must be the same order as PaperSizeTemplate constants
const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames =
DialogLayoutSettings::FormatsVector () << QLatin1Literal("A0")
<< QLatin1Literal("A1")
<< QLatin1Literal("A2")
<< QLatin1Literal("A3")
<< QLatin1Literal("A4")
DialogLayoutSettings::FormatsVector () << QLatin1String("A0")
<< QLatin1String("A1")
<< QLatin1String("A2")
<< QLatin1String("A3")
<< QLatin1String("A4")
<< QApplication::translate("DialogLayoutSettings", "Letter")
<< QApplication::translate("DialogLayoutSettings", "Legal")
<< QApplication::translate("DialogLayoutSettings", "Roll 24in")

View File

@ -67,7 +67,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
ui->lineEditFileName->setValidator( new QRegExpValidator(QRegExp(baseFilenameRegExp), this));
#endif
const QString mask = fileName+QLatin1Literal("_");
const QString mask = fileName+QLatin1String("_");
if (VApplication::IsGUIMode())
{
ui->lineEditFileName->setText(mask);
@ -299,15 +299,15 @@ bool DialogSaveLayout::TestPdf()
QVector<std::pair<QString, QString>> DialogSaveLayout::InitAvailFormats()
{
QVector<std::pair<QString, QString>> list;
list.append(std::make_pair(tr("Svg files (*.svg)"), QLatin1Literal(".svg")));
list.append(std::make_pair(tr("PDF files (*.pdf)"), QLatin1Literal(".pdf")));
list.append(std::make_pair(tr("Images (*.png)"), QLatin1Literal(".png")));
list.append(std::make_pair(tr("Wavefront OBJ (*.obj)"), QLatin1Literal(".obj")));
list.append(std::make_pair(tr("Svg files (*.svg)"), QLatin1String(".svg")));
list.append(std::make_pair(tr("PDF files (*.pdf)"), QLatin1String(".pdf")));
list.append(std::make_pair(tr("Images (*.png)"), QLatin1String(".png")));
list.append(std::make_pair(tr("Wavefront OBJ (*.obj)"), QLatin1String(".obj")));
if (SupportPSTest())
{
list.append(std::make_pair(tr("PS files (*.ps)"), QLatin1Literal(".ps")));
list.append(std::make_pair(tr("EPS files (*.eps)"), QLatin1Literal(".eps")));
list.append(std::make_pair(tr("PS files (*.ps)"), QLatin1String(".ps")));
list.append(std::make_pair(tr("EPS files (*.eps)"), QLatin1String(".eps")));
}
list.append(std::make_pair(tr("DXF files (*.dxf)"), QLatin1Literal(".dxf")));
list.append(std::make_pair(tr("DXF files (*.dxf)"), QLatin1String(".dxf")));
return list;
}

View File

@ -3020,7 +3020,7 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error)
const bool result = doc->SaveDocument(fileName, error);
if (result)
{
if (tempInfo.suffix() != QLatin1Literal("autosave"))
if (tempInfo.suffix() != QLatin1String("autosave"))
{
setCurrentFile(fileName);
helpLabel->setText(tr("File saved"));
@ -4419,7 +4419,7 @@ QString MainWindow::GetPatternFileName()
{
shownName = StrippedName(curFile);
}
shownName += QLatin1Literal("[*]");
shownName += QLatin1String("[*]");
return shownName;
}
@ -4437,10 +4437,10 @@ QString MainWindow::GetMeasurementFileName()
if(mChanges)
{
shownName += QLatin1Literal("*");
shownName += QLatin1String("*");
}
shownName += QLatin1Literal("]");
shownName += QLatin1String("]");
return shownName;
}
}
@ -4460,7 +4460,7 @@ void MainWindow::UpdateWindowTitle()
#if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QApplication::applicationDirPath() +
QLatin1Literal("/../Resources/Valentina.icns"));
QLatin1String("/../Resources/Valentina.icns"));
QIcon icon;
if (not curFile.isEmpty())
{

View File

@ -958,7 +958,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
#ifdef Q_OS_WIN
printer->setOutputFileName(outputFileName);
#else
printer->setOutputFileName(outputFileName + QLatin1Literal(".pdf"));
printer->setOutputFileName(outputFileName + QLatin1String(".pdf"));
#endif
#ifdef Q_OS_MAC

View File

@ -333,7 +333,7 @@ bool VPattern::SaveDocument(const QString &fileName, QString &error) const
}
const bool saved = VAbstractPattern::SaveDocument(fileName, error);
if (saved && QFileInfo(fileName).suffix() != QLatin1Literal("autosave"))
if (saved && QFileInfo(fileName).suffix() != QLatin1String("autosave"))
{
modified = false;
}

View File

@ -339,13 +339,13 @@ bool FvUpdater::xmlParseFeed()
if (m_xml.isStartElement())
{
if (m_xml.name() == QLatin1Literal("item"))
if (m_xml.name() == QLatin1String("item"))
{
xmlEnclosureUrl.clear();
xmlEnclosureVersion.clear();
xmlEnclosurePlatform.clear();
}
else if (m_xml.name() == QLatin1Literal("enclosure"))
else if (m_xml.name() == QLatin1String("enclosure"))
{
const QXmlStreamAttributes attribs = m_xml.attributes();
const QString fervorPlatform = QStringLiteral("fervor:platform");
@ -381,7 +381,7 @@ bool FvUpdater::xmlParseFeed()
}
else if (m_xml.isEndElement())
{
if (m_xml.name() == QLatin1Literal("item"))
if (m_xml.name() == QLatin1String("item"))
{
// That's it - we have analyzed a single <item> and we'll stop
// here (because the topmost is the most recent one, and thus

View File

@ -57,7 +57,7 @@ void VAbstractConverter::Convert()
}
QString error;
const QString backupFileName = fileName + QLatin1Literal(".backup");
const QString backupFileName = fileName + QLatin1String(".backup");
if (SafeCopy(fileName, backupFileName, error) == false)
{
const QString errorMsg(tr("Error creating a backup file: %1.").arg(error));

View File

@ -149,7 +149,7 @@ QStringList VAbstractPattern::ListMeasurements() const
const QList<QString> tValues = tokens.values();
for (int j = 0; j < tValues.size(); ++j)
{
if (tValues.at(j) == QLatin1Literal("-"))
if (tValues.at(j) == QLatin1String("-"))
{
continue;
}
@ -1126,11 +1126,11 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
element = createElement(TagGradation);
QDomElement heights = createElement(TagHeights);
heights.setAttribute(AttrAll, QLatin1Literal("true"));
heights.setAttribute(AttrAll, QLatin1String("true"));
element.appendChild(heights);
QDomElement sizes = createElement(TagSizes);
sizes.setAttribute(AttrAll, QLatin1Literal("true"));
sizes.setAttribute(AttrAll, QLatin1String("true"));
element.appendChild(sizes);
break;
}

View File

@ -771,7 +771,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/
QTemporaryFile destFile(destination + QLatin1Literal(".XXXXXX"));
QTemporaryFile destFile(destination + QLatin1String(".XXXXXX"));
destFile.setAutoRemove(false);
if (not destFile.open())
{

View File

@ -179,7 +179,7 @@ void VPatternConverter::ApplyPatches()
catch (VException &e)
{
QString error;
const QString backupFileName = fileName + QLatin1Literal(".backup");
const QString backupFileName = fileName + QLatin1String(".backup");
if (SafeCopy(backupFileName, fileName, error) == false)
{
const QString errorMsg(tr("Error restoring backup file: %1.").arg(error));
@ -894,7 +894,7 @@ void VPatternConverter::ParseModelingToV0_2_4(const QDomElement &modeling)
QDomElement node = modeling.firstChild().toElement();
while (not node.isNull())
{
if (node.tagName() == QLatin1Literal("tools"))
if (node.tagName() == QLatin1String("tools"))
{
const quint32 toolId = node.attribute(QStringLiteral("id")).toUInt();
QVector<quint32> children;

View File

@ -110,7 +110,7 @@ void VVITConverter::ApplyPatches()
catch (VException &e)
{
QString error;
const QString backupFileName = fileName + QLatin1Literal(".backup");
const QString backupFileName = fileName + QLatin1String(".backup");
if (SafeCopy(backupFileName, fileName, error) == false)
{
const QString errorMsg(tr("Error restoring backup file: %1.").arg(error));

View File

@ -104,7 +104,7 @@ void VVSTConverter::ApplyPatches()
catch (VException &e)
{
QString error;
const QString backupFileName = fileName + QLatin1Literal(".backup");
const QString backupFileName = fileName + QLatin1String(".backup");
if (SafeCopy(backupFileName, fileName, error) == false)
{
const QString errorMsg(tr("Error restoring backup file: %1.").arg(error));

View File

@ -44,13 +44,13 @@ QString compilerString()
#if defined(Q_CC_INTEL) // must be before GNU, Clang and MSVC because ICC/ICL claim to be them
QString iccCompact;
#ifdef __INTEL_CLANG_COMPILER
iccCompact = QLatin1Literal("Clang");
iccCompact = QLatin1String("Clang");
#elif defined(__INTEL_MS_COMPAT_LEVEL)
iccCompact = QLatin1Literal("Microsoft");
iccCompact = QLatin1String("Microsoft");
#elif defined(__GNUC__)
iccCompact = QLatin1Literal("GCC");
iccCompact = QLatin1String("GCC");
#else
iccCompact = QLatin1Literal("no");
iccCompact = QLatin1String("no");
#endif
QString iccVersion;
if (__INTEL_COMPILER >= 1300)

View File

@ -102,12 +102,12 @@ QString VAbstractApplication::translationsPath(const QString &locale) const
QString mainPath;
if (locale.isEmpty())
{
mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath;
mainPath = QApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath;
}
else
{
mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath + QLatin1Literal("/")
+ locale + QLatin1Literal(".lproj");
mainPath = QApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath + QLatin1String("/")
+ locale + QLatin1String(".lproj");
}
QDir dirBundle(mainPath);
if (dirBundle.exists())

View File

@ -156,10 +156,10 @@ bool VLockGuard<Guarded>::TryLock(const QString &lockName, int stale, int timeou
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
lockFile = lockName + QLatin1Literal(".lock");
lockFile = lockName + QLatin1String(".lock");
#if defined(Q_OS_UNIX)
QFileInfo info(lockFile);
lockFile = info.absolutePath() + QLatin1Literal("/.") + info.fileName();
lockFile = info.absolutePath() + QLatin1String("/.") + info.fileName();
#endif
lock.reset(new QLockFile(lockFile));

View File

@ -179,7 +179,7 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
line->RefreshGeometry();
if (buildMidpoint)
{
SetFormula(currentLength + QLatin1Literal("/2"));
SetFormula(currentLength + QLatin1String("/2"));
}
prepare = true;
this->setModal(true);

View File

@ -508,7 +508,7 @@ bool DialogDetail::DetailIsValid() const
QByteArray byteArray;
QBuffer buffer(&byteArray);
pixmap.save(&buffer, "PNG");
QString url = QString("<img src=\"data:image/png;base64,") + byteArray.toBase64() + QLatin1Literal("\"/> ");
QString url = QString("<img src=\"data:image/png;base64,") + byteArray.toBase64() + QLatin1String("\"/> ");
if(CreateDetail().ContourPoints(data).count() < 3)
{

View File

@ -934,6 +934,6 @@ void DialogSplinePath::ShowPointIssue(const QString &pName)
}
else
{
item->setText(pName + QLatin1Literal("(!)"));
item->setText(pName + QLatin1String("(!)"));
}
}

View File

@ -55,7 +55,7 @@ QString AbstractTest::ValentinaPath() const
{
const QString path = QStringLiteral("/../../../app/valentina/bin/valentina");
#ifdef Q_OS_WIN
return QApplication::applicationDirPath() + path + QLatin1Literal(".exe");
return QApplication::applicationDirPath() + path + QLatin1String(".exe");
#else
return QApplication::applicationDirPath() + path;
#endif
@ -66,7 +66,7 @@ QString AbstractTest::TapePath() const
{
const QString path = QStringLiteral("/../../../app/tape/bin/tape");
#ifdef Q_OS_WIN
return QApplication::applicationDirPath() + path + QLatin1Literal(".exe");
return QApplication::applicationDirPath() + path + QLatin1String(".exe");
#else
return QApplication::applicationDirPath() + path;
#endif

View File

@ -431,7 +431,7 @@ int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const
const QString path = TranslationsPath();
const QString file = QString("measurements_%1_%2.qm").arg(checkedSystem).arg(checkedLocale);
if (QFileInfo(path+QLatin1Literal("/")+file).size() <= 34)
if (QFileInfo(path+QLatin1String("/")+file).size() <= 34)
{
const QString message = QString("Translation for system = %1 and locale = %2 is empty. \nFull path: %3/%4")
.arg(checkedSystem)
@ -482,7 +482,7 @@ int TST_MeasurementRegExp::LoadVariables(const QString &checkedLocale)
const QString path = TranslationsPath();
const QString file = QString("valentina_%1.qm").arg(checkedLocale);
if (QFileInfo(path+QLatin1Literal("/")+file).size() <= 34)
if (QFileInfo(path+QLatin1String("/")+file).size() <= 34)
{
const QString message = QString("Translation variables for locale = %1 is empty. \nFull path: %2/%3")
.arg(checkedLocale)
@ -660,7 +660,7 @@ void TST_MeasurementRegExp::CheckUnderlineExists() const
while (i != data.constEnd())
{
const QString translated = trMs->InternalVarToUser(i.key());
if ((translated.right(1) == QLatin1Literal("_")) != i.value())
if ((translated.right(1) == QLatin1String("_")) != i.value())
{
const QString message = QString("String '%1' doesn't contain underline. Original string is '%2'")
.arg(translated).arg(i.key());
@ -676,11 +676,11 @@ void TST_MeasurementRegExp::CheckInternalVaribleRegExp() const
const QString regex = QStringLiteral("(.){1,}_(.){1,}$");
foreach(const QString &var, builInVariables)
{
const QString sourceRegex = QLatin1Literal("^") + var + regex;
const QString sourceRegex = QLatin1String("^") + var + regex;
const QRegularExpression sourceRe(sourceRegex);
const QString translated = trMs->InternalVarToUser(var);
const QString translationRegex = QLatin1Literal("^") + translated + regex;
const QString translationRegex = QLatin1String("^") + translated + regex;
const QRegularExpression translationRe(translationRegex);
const QStringList originalNames = AllGroupNames() + builInFunctions + builInVariables;

View File

@ -212,6 +212,6 @@ void TST_QmuParserErrorMsg::CheckStrings(int code, bool tok, bool pos)
const QString translated = (*msg)[code];
const QString message = QString("String: '%1'.").arg(translated);
QVERIFY2((translated.indexOf(QLatin1Literal("$TOK$")) != -1) == tok, qUtf8Printable(message));
QVERIFY2((translated.indexOf(QLatin1Literal("$POS$")) != -1) == pos, qUtf8Printable(message));
QVERIFY2((translated.indexOf(QLatin1String("$TOK$")) != -1) == tok, qUtf8Printable(message));
QVERIFY2((translated.indexOf(QLatin1String("$POS$")) != -1) == pos, qUtf8Printable(message));
}

View File

@ -116,7 +116,7 @@ void TST_TSTranslation::CheckEmptyToolButton()
continue;
}
if (source == QLatin1Literal("..."))
if (source == QLatin1String("..."))
{
const QDomElement translationTag = message.firstChildElement(TagTranslation);
if (translationTag.hasAttribute(AttrType))
@ -210,7 +210,7 @@ void TST_TSTranslation::CheckPlaceMarkerExist()
for (int i = 1; i <= 99; ++i)
{
const QString marker = QLatin1Literal("%") + QString().setNum(i);
const QString marker = QLatin1String("%") + QString().setNum(i);
const bool sourceMark = source.indexOf(marker) != -1;
if (sourceMark)
{
@ -218,8 +218,8 @@ void TST_TSTranslation::CheckPlaceMarkerExist()
if (sourceMarkCount != i)
{
const QString message = QString("In source string '%1' was missed place marker ")
.arg(source) + QLatin1Literal("'%") + QString().setNum(sourceMarkCount) +
QLatin1Literal("'.");
.arg(source) + QLatin1String("'%") + QString().setNum(sourceMarkCount) +
QLatin1String("'.");
QFAIL(qUtf8Printable(message));
}
}
@ -231,8 +231,8 @@ void TST_TSTranslation::CheckPlaceMarkerExist()
if (translationMarkCount != i)
{
const QString message = QString("In translation string '%1' was missed place marker ")
.arg(translation) + QLatin1Literal("'%") + QString().setNum(translationMarkCount) +
QLatin1Literal("'.");
.arg(translation) + QLatin1String("'%") + QString().setNum(translationMarkCount) +
QLatin1String("'.");
QFAIL(qUtf8Printable(message));
}
}
@ -241,8 +241,8 @@ void TST_TSTranslation::CheckPlaceMarkerExist()
{
const QString message =
QString("Compare to source string in the translation string '%1' was missed place marker ")
.arg(translation) + QLatin1Literal("'%") + QString().setNum(sourceMarkCount) +
QLatin1Literal("'.");
.arg(translation) + QLatin1String("'%") + QString().setNum(sourceMarkCount) +
QLatin1String("'.");
QFAIL(qUtf8Printable(message));
}
}

View File

@ -51,7 +51,7 @@ void TST_ValentinaCommandLine::init()
}
if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() +
QLatin1Literal("tst_valentina"),
QLatin1String("tst_valentina"),
QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
{
QFAIL("Fail to prepare test files for testing.");
@ -66,7 +66,7 @@ void TST_ValentinaCommandLine::init()
}
if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() +
QLatin1Literal("tst_valentina_collection"),
QLatin1String("tst_valentina_collection"),
QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder))
{
QFAIL("Fail to prepare collection files for testing.");
@ -199,25 +199,25 @@ void TST_ValentinaCommandLine::TestMode_data() const
QTest::newRow("Issue #256. Correct individual measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1Literal("issue_256_correct.vit"))
QLatin1String("issue_256_correct.vit"))
<< true
<< V_EX_OK;
QTest::newRow("Issue #256. Wrong individual measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1Literal("issue_256_wrong.vit"))
QLatin1String("issue_256_wrong.vit"))
<< false
<< V_EX_NOINPUT;
QTest::newRow("Issue #256. Correct standard measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1Literal("issue_256_correct.vst"))
QLatin1String("issue_256_correct.vst"))
<< true
<< V_EX_OK;
QTest::newRow("Issue #256. Wrong standard measurements.")<< "issue_256.val"
<< QString("--test;;-m;;%1").arg(tmp + QDir::separator() +
QLatin1Literal("issue_256_wrong.vst"))
QLatin1String("issue_256_wrong.vst"))
<< false
<< V_EX_NOINPUT;
@ -254,7 +254,7 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const
QTest::addColumn<int>("exitCode");
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1Literal("GOST_man_ru.vst"));
const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst"));
const QString keyTest = QStringLiteral("--test");
QTest::newRow("bra") << "bra.val" << keyTest << true << V_EX_OK;