Optimization. Move literals.
--HG-- branch : develop
This commit is contained in:
parent
2a3948c549
commit
1e5ee0ab8b
|
@ -1635,11 +1635,11 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
||||||
element = createElement(TagGradation);
|
element = createElement(TagGradation);
|
||||||
|
|
||||||
QDomElement heights = createElement(TagHeights);
|
QDomElement heights = createElement(TagHeights);
|
||||||
heights.setAttribute(AttrAll, QLatin1String("true"));
|
heights.setAttribute(AttrAll, trueStr);
|
||||||
element.appendChild(heights);
|
element.appendChild(heights);
|
||||||
|
|
||||||
QDomElement sizes = createElement(TagSizes);
|
QDomElement sizes = createElement(TagSizes);
|
||||||
sizes.setAttribute(AttrAll, QLatin1String("true"));
|
sizes.setAttribute(AttrAll, trueStr);
|
||||||
element.appendChild(sizes);
|
element.appendChild(sizes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,10 +376,7 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
|
||||||
{
|
{
|
||||||
parametr = GetParametrString(domElement, name, defValue);
|
parametr = GetParametrString(domElement, name, defValue);
|
||||||
|
|
||||||
const QStringList bools = QStringList() << QLatin1String("true")
|
const QStringList bools {trueStr, falseStr, QChar('1'), QChar('0')};
|
||||||
<< QLatin1String("false")
|
|
||||||
<< QChar('1')
|
|
||||||
<< QChar('0');
|
|
||||||
switch (bools.indexOf(parametr))
|
switch (bools.indexOf(parametr))
|
||||||
{
|
{
|
||||||
case 0: // true
|
case 0: // true
|
||||||
|
|
|
@ -167,7 +167,7 @@ void VVITConverter::AddNewTagsForV0_3_0()
|
||||||
QDomNode refChild = rootElement.firstChildElement("version");
|
QDomNode refChild = rootElement.firstChildElement("version");
|
||||||
|
|
||||||
QDomElement ro = createElement(QStringLiteral("read-only"));
|
QDomElement ro = createElement(QStringLiteral("read-only"));
|
||||||
const QDomText roNodeText = createTextNode("false");
|
const QDomText roNodeText = createTextNode(falseStr);
|
||||||
ro.appendChild(roNodeText);
|
ro.appendChild(roNodeText);
|
||||||
refChild = rootElement.insertAfter(ro, refChild);
|
refChild = rootElement.insertAfter(ro, refChild);
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ void VVSTConverter::AddNewTagsForV0_4_0()
|
||||||
|
|
||||||
{
|
{
|
||||||
QDomElement ro = createElement(QStringLiteral("read-only"));
|
QDomElement ro = createElement(QStringLiteral("read-only"));
|
||||||
const QDomText roNodeText = createTextNode("false");
|
const QDomText roNodeText = createTextNode(falseStr);
|
||||||
ro.appendChild(roNodeText);
|
ro.appendChild(roNodeText);
|
||||||
refChild = rootElement.insertAfter(ro, refChild);
|
refChild = rootElement.insertAfter(ro, refChild);
|
||||||
}
|
}
|
||||||
|
|
|
@ -695,7 +695,7 @@ void VMeasurements::CreateEmptyMultisizeFile(Unit unit, int baseSize, int baseHe
|
||||||
mElement.appendChild(version);
|
mElement.appendChild(version);
|
||||||
|
|
||||||
QDomElement ro = createElement(TagReadOnly);
|
QDomElement ro = createElement(TagReadOnly);
|
||||||
const QDomText roNodeText = createTextNode("false");
|
const QDomText roNodeText = createTextNode(falseStr);
|
||||||
ro.appendChild(roNodeText);
|
ro.appendChild(roNodeText);
|
||||||
mElement.appendChild(ro);
|
mElement.appendChild(ro);
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
||||||
mElement.appendChild(version);
|
mElement.appendChild(version);
|
||||||
|
|
||||||
QDomElement ro = createElement(TagReadOnly);
|
QDomElement ro = createElement(TagReadOnly);
|
||||||
const QDomText roNodeText = createTextNode("false");
|
const QDomText roNodeText = createTextNode(falseStr);
|
||||||
ro.appendChild(roNodeText);
|
ro.appendChild(roNodeText);
|
||||||
mElement.appendChild(ro);
|
mElement.appendChild(ro);
|
||||||
|
|
||||||
|
|
|
@ -197,12 +197,6 @@ const QStringList labelTemplatePlaceholders = QStringList() << pl_size
|
||||||
const QString cursorArrowOpenHand = QStringLiteral("://cursor/cursor-arrow-openhand.png");
|
const QString cursorArrowOpenHand = QStringLiteral("://cursor/cursor-arrow-openhand.png");
|
||||||
const QString cursorArrowCloseHand = QStringLiteral("://cursor/cursor-arrow-closehand.png");
|
const QString cursorArrowCloseHand = QStringLiteral("://cursor/cursor-arrow-closehand.png");
|
||||||
|
|
||||||
// From documantation: If you use QStringLiteral you should avoid declaring the same literal in multiple places: This
|
|
||||||
// furthermore blows up the binary sizes.
|
|
||||||
const QString degreeSymbol = QStringLiteral("°");
|
|
||||||
const QString trueStr = QStringLiteral("true");
|
|
||||||
const QString falseStr = QStringLiteral("false");
|
|
||||||
|
|
||||||
const QString unitMM = QStringLiteral("mm");
|
const QString unitMM = QStringLiteral("mm");
|
||||||
const QString unitCM = QStringLiteral("cm");
|
const QString unitCM = QStringLiteral("cm");
|
||||||
const QString unitINCH = QStringLiteral("inch");
|
const QString unitINCH = QStringLiteral("inch");
|
||||||
|
|
|
@ -397,10 +397,6 @@ extern const QStringList labelTemplatePlaceholders;
|
||||||
extern const QString cursorArrowOpenHand;
|
extern const QString cursorArrowOpenHand;
|
||||||
extern const QString cursorArrowCloseHand;
|
extern const QString cursorArrowCloseHand;
|
||||||
|
|
||||||
extern const QString degreeSymbol;
|
|
||||||
extern const QString trueStr;
|
|
||||||
extern const QString falseStr;
|
|
||||||
|
|
||||||
extern const QString strOne;
|
extern const QString strOne;
|
||||||
extern const QString strTwo;
|
extern const QString strTwo;
|
||||||
extern const QString strThree;
|
extern const QString strThree;
|
||||||
|
|
|
@ -31,3 +31,6 @@ const QString LONG_OPTION_NO_HDPI_SCALING = QStringLiteral("no-scaling");
|
||||||
|
|
||||||
const QString editDeleteIcon = QStringLiteral("edit-delete");
|
const QString editDeleteIcon = QStringLiteral("edit-delete");
|
||||||
const QString preferencesOtherIcon = QStringLiteral("preferences-other");
|
const QString preferencesOtherIcon = QStringLiteral("preferences-other");
|
||||||
|
const QString degreeSymbol = QStringLiteral("°");
|
||||||
|
const QString trueStr = QStringLiteral("true");
|
||||||
|
const QString falseStr = QStringLiteral("false");
|
||||||
|
|
|
@ -30,9 +30,15 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
// From documantation: If you use QStringLiteral you should avoid declaring the same literal in multiple places: This
|
||||||
|
// furthermore blows up the binary sizes.
|
||||||
|
|
||||||
extern const QString LONG_OPTION_NO_HDPI_SCALING;
|
extern const QString LONG_OPTION_NO_HDPI_SCALING;
|
||||||
|
|
||||||
extern const QString editDeleteIcon;
|
extern const QString editDeleteIcon;
|
||||||
extern const QString preferencesOtherIcon;
|
extern const QString preferencesOtherIcon;
|
||||||
|
extern const QString degreeSymbol;
|
||||||
|
extern const QString trueStr;
|
||||||
|
extern const QString falseStr;
|
||||||
|
|
||||||
#endif // LITERALS_H
|
#endif // LITERALS_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user