Start using string literal operators for Qt types.

This commit is contained in:
Roman Telezhynskyi 2023-10-07 18:56:39 +03:00
parent 8f23d057f4
commit e9f42bda30
155 changed files with 2712 additions and 2017 deletions

View File

@ -42,6 +42,12 @@
#include <QMenu>
#include <QPainter>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -308,5 +314,5 @@ auto VPCarrousel::GetSheetName(const VPCarrouselSheet &sheet) -> QString
return QStringLiteral("--> %1 %2 <--").arg(tr("Pieces of"), sheet.name);
}
return tr("Pieces of") + ' ' + sheet.name;
return tr("Pieces of") + ' '_L1 + sheet.name;
}

View File

@ -37,6 +37,12 @@
#include <QPushButton>
#include <QShowEvent>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
DialogPuzzlePreferences::DialogPuzzlePreferences(QWidget *parent)
: QDialog(parent),
@ -155,7 +161,7 @@ void DialogPuzzlePreferences::Apply()
{
const QString text =
tr("Followed %n option(s) require restart to take effect: %1.", "", static_cast<int>(preferences.size()))
.arg(preferences.join(QStringLiteral(", ")));
.arg(preferences.join(", "_L1));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -38,15 +38,21 @@
#include <QShowEvent>
#include <QtDebug>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
#ifndef Q_OS_WIN
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\/]+$"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, ("^[^\\/]+$"_L1)) // NOLINT
#else
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\:?\"*|\\/<>]+$"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, ("^[^\\:?\"*|\\/<>]+$"_L1)) // NOLINT
#endif
QT_WARNING_POP
@ -475,7 +481,7 @@ void DialogSaveManualLayout::ShowExample()
QString example;
if (m_count > 1)
{
example = tr("Example:") + FileName() + QLatin1Char('1') + VLayoutExporter::ExportFormatSuffix(currentFormat);
example = tr("Example:") + FileName() + '1'_L1 + VLayoutExporter::ExportFormatSuffix(currentFormat);
}
else
{

View File

@ -44,6 +44,12 @@
#define BUILD_REVISION VCS_REPO_STATE_REVISION
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VPDialogAbout::VPDialogAbout(QWidget *parent)
: QDialog(parent),
@ -136,7 +142,7 @@ void VPDialogAbout::RetranslateUi()
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(QStringLiteral(BUILD_REVISION)));
ui->label_QT_Version->setText(buildCompatibilityString());
const QDate date = QLocale::c().toDate(QStringLiteral(__DATE__).simplified(), QStringLiteral("MMM d yyyy"));
const QDate date = QLocale::c().toDate(QStringLiteral(__DATE__).simplified(), "MMM d yyyy"_L1);
ui->label_Puzzle_Built->setText(tr("Built on %1 at %2").arg(date.toString(), QStringLiteral(__TIME__)));
ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",

View File

@ -31,6 +31,12 @@
#include <QString>
#include <QStringList>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
auto GrainlineTypeToStr(GrainlineType type) -> QString
{
@ -38,14 +44,14 @@ auto GrainlineTypeToStr(GrainlineType type) -> QString
switch (type)
{
case GrainlineType::Horizontal:
result = QStringLiteral("horizontal");
result = "horizontal"_L1;
break;
case GrainlineType::Vertical:
result = QStringLiteral("vertical");
result = "vertical"_L1;
break;
case GrainlineType::NotFixed:
default:
result = QStringLiteral("notFixed");
result = "notFixed"_L1;
break;
}
return result;
@ -54,8 +60,7 @@ auto GrainlineTypeToStr(GrainlineType type) -> QString
//---------------------------------------------------------------------------------------------------------------------
auto StrToGrainlineType(const QString &string) -> GrainlineType
{
const QStringList types
{
const QStringList types{
QStringLiteral("horizontal"), // 0
QStringLiteral("vertical"), // 1
QStringLiteral("notFixed") // 2
@ -64,13 +69,13 @@ auto StrToGrainlineType(const QString &string) -> GrainlineType
GrainlineType type = GrainlineType::NotFixed;
switch (types.indexOf(string))
{
case 0:// horizontal
case 0: // horizontal
type = GrainlineType::Horizontal;
break;
case 2:// vertical
case 2: // vertical
type = GrainlineType::Vertical;
break;
case 3:// notFixed
case 3: // notFixed
default:
type = GrainlineType::NotFixed;
break;
@ -78,7 +83,6 @@ auto StrToGrainlineType(const QString &string) -> GrainlineType
return type;
}
//---------------------------------------------------------------------------------------------------------------------
auto VPTransformationOrigon::operator==(const VPTransformationOrigon &origin) const -> bool
{

View File

@ -39,6 +39,12 @@
#include <QPixmapCache>
#include <QUndoStack>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -179,7 +185,7 @@ auto VPLayout::WatermarkData() const -> VWatermarkData
data.invalidFile = true;
data.opacity = 20;
data.showImage = true;
data.path = QStringLiteral("fake.png");
data.path = "fake.png"_L1;
data.showText = false;
return data;
}

View File

@ -50,6 +50,12 @@
#include <QPixmapCache>
#include <QStyleFactory>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -430,7 +436,7 @@ void VPApplication::InitOptions()
[]()
{
QString country = VGAnalytics::CountryCode();
if (country == QLatin1String("ru") || country == QLatin1String("by"))
if (country == "ru"_L1 || country == "by"_L1)
{
qFatal("contry not detected");
}

View File

@ -102,6 +102,12 @@ using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
@ -1649,18 +1655,18 @@ void VPMainWindow::UpdateWindowTitle()
}
}
showName += QLatin1String("[*]");
showName += "[*]"_L1;
if (IsLayoutReadOnly())
{
showName += QStringLiteral(" (") + tr("read only") + QChar(')');
showName += " ("_L1 + tr("read only") + ')'_L1;
}
setWindowTitle(showName);
setWindowFilePath(curFile);
#if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/layout.icns"));
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/layout.icns"_L1);
QIcon icon;
if (not curFile.isEmpty())
{
@ -1783,10 +1789,10 @@ void VPMainWindow::CreateWindowMenu(QMenu *menu)
VPMainWindow *window = windows.at(i);
QString title = QStringLiteral("%1. %2").arg(i + 1).arg(window->windowTitle());
const vsizetype index = title.lastIndexOf(QLatin1String("[*]"));
const vsizetype index = title.lastIndexOf("[*]"_L1);
if (index != -1)
{
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
window->isWindowModified() ? title.replace(index, 3, '*'_L1) : title.replace(index, 3, QString());
}
QAction *action = menu->addAction(title, this, &VPMainWindow::ShowWindow);
@ -3510,7 +3516,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
{
QString filters = tr("Layout files") + QStringLiteral(" (*.vlt)");
QString suffix = QStringLiteral("vlt");
QString fName = tr("layout") + QChar('.') + suffix;
QString fName = tr("layout") + '.'_L1 + suffix;
QString dir;
if (curFile.isEmpty())
@ -3522,7 +3528,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
dir = QFileInfo(curFile).absolutePath();
}
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + fName, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
@ -3533,7 +3539,7 @@ auto VPMainWindow::on_actionSaveAs_triggered() -> bool
QFileInfo f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += QChar('.') + suffix;
fileName += '.'_L1 + suffix;
}
if (curFile.isEmpty())

View File

@ -30,46 +30,47 @@
#include <QMarginsF>
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, (QLatin1String("dockWidget/properties")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPropertiesActive, ("dockWidget/properties"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, (QLatin1String("dockWidget/contents")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnit, (QLatin1String("layout/unit"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockPropertiesContentsActive, ("dockWidget/contents"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnit, ("layout/unit"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperWidth, (QLatin1String("layout/sheetPaperWidth")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperWidth, ("layout/sheetPaperWidth"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperHeight, (QLatin1String("layout/sheetPaperHeight")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetPaperHeight, ("layout/sheetPaperHeight"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperWidth, (QLatin1String("layout/tilePaperWidth")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperWidth, ("layout/tilePaperWidth"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperHeight, (QLatin1String("layout/tilePaperHeight")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetMargins, (QLatin1String("layout/sheetMargins"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileMargins, (QLatin1String("layout/tileMargins"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTilePaperHeight, ("layout/tilePaperHeight"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetMargins, ("layout/sheetMargins"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileMargins, ("layout/tileMargins"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetIgnoreMargins, (QLatin1String("layout/sheetIgnoreMargins")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSheetIgnoreMargins, ("layout/sheetIgnoreMargins"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileIgnoreMargins, (QLatin1String("layout/tileIgnoreMargins")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowTiles, (QLatin1String("layout/tileShowTiles"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileIgnoreMargins, ("layout/tileIgnoreMargins"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowTiles, ("layout/tileShowTiles"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowWatermark, (QLatin1String("layout/tileShowWatermark")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutTileShowWatermark, ("layout/tileShowWatermark"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesSuperposition,
(QLatin1String("layout/warningPiecesSuperposition")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutStickyEdges, (QLatin1String("layout/stickyEdges"))) // NOLINT
("layout/warningPiecesSuperposition"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutStickyEdges, ("layout/stickyEdges"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesOutOfBound,
(QLatin1String("layout/warningPiecesOutOfBound")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesOutOfBound, ("layout/warningPiecesOutOfBound"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, (QLatin1String("layout/pieceGap"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, (QLatin1String("layout/exportFormat"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, (QLatin1String("layout/lineWidth"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, ("layout/followGrainline"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, ("layout/pieceGap"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, ("layout/lineWidth"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, ("layout/showGrainline"_L1)) // NOLINT
QT_WARNING_POP

View File

@ -12,6 +12,8 @@
#include "layout/vpsheet.h"
#include "theme/vtheme.h"
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
@ -610,12 +612,11 @@ void VPTileFactory::DrawTextInformation(QPainter *painter, int row, int col, int
const QString tileColorStr =
QStringLiteral("%1,%2,%3").arg(tileColor->red()).arg(tileColor->green()).arg(tileColor->blue());
td.setHtml(QString("<table width='100%' style='color:rgb(%1);'>"
"<tr>"
"<td align='center'>%2</td>"
"</tr>"
"</table>")
.arg(tileColorStr, grid));
td.setHtml(u"<table width='100%' style='color:rgb(%1);'>"
"<tr>"
"<td align='center'>%2</td>"
"</tr>"
"</table>"_s.arg(tileColorStr, grid));
painter->setPen(PenTileInfos());
painter->save();
painter->translate(QPointF(UnitConvertor(1, Unit::Cm, Unit::Px), m_drawingAreaHeight - tileStripeWidth / 1.3));
@ -780,8 +781,7 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
}
QPixmap watermark;
if (f.suffix() == QLatin1String("png") || f.suffix() == QLatin1String("jpg") ||
f.suffix() == QLatin1String("jpeg") || f.suffix() == QLatin1String("bmp"))
if (f.suffix() == "png"_L1 || f.suffix() == "jpg"_L1 || f.suffix() == "jpeg"_L1 || f.suffix() == "bmp"_L1)
{
QString error;
watermark = WatermarkImageFromCache(watermarkData, watermarkPath, xScale, yScale, error);

View File

@ -49,6 +49,8 @@
#include <ciso646> // and, not, or
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -1061,7 +1063,7 @@ auto VPLayoutFileReader::ReadAttributeDouble(const QXmlStreamAttributes &attribs
try
{
QString parametr = ReadAttributeString(attribs, name, defValue);
param = parametr.replace(QChar(','), QChar('.')).toDouble(&ok);
param = parametr.replace(','_L1, '.'_L1).toDouble(&ok);
if (not ok)
{
throw VExceptionConversionError(message, name);
@ -1087,7 +1089,7 @@ auto VPLayoutFileReader::ReadAttributeUInt(const QXmlStreamAttributes &attribs,
try
{
QString parametr = ReadAttributeString(attribs, name, defValue);
param = parametr.replace(QChar(','), QChar('.')).toUInt(&ok);
param = parametr.replace(','_L1, '.'_L1).toUInt(&ok);
if (not ok)
{
throw VExceptionConversionError(message, name);
@ -1113,7 +1115,7 @@ auto VPLayoutFileReader::ReadAttributeInt(const QXmlStreamAttributes &attribs, c
try
{
QString parametr = ReadAttributeString(attribs, name, defValue);
param = parametr.replace(QChar(','), QChar('.')).toInt(&ok);
param = parametr.replace(','_L1, '.'_L1).toInt(&ok);
if (not ok)
{
throw VExceptionConversionError(message, name);

View File

@ -27,6 +27,12 @@
*************************************************************************/
#include "vplayoutliterals.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace ML // Manual layout
{
const QString TagLayout = QStringLiteral("layout"); // NOLINT(cert-err58-cpp)
@ -129,8 +135,8 @@ const QString threeWaysUpDownRightStr = QStringLiteral("threeWaysUpDownRight");
const QString threeWaysUpLeftRightStr = QStringLiteral("threeWaysUpLeftRight"); // NOLINT(cert-err58-cpp)
const QString threeWaysDownLeftRightStr = QStringLiteral("threeWaysDownLeftRight"); // NOLINT(cert-err58-cpp)
const QChar groupSep = QLatin1Char(';');
const QChar coordintatesSep = QLatin1Char(',');
const QChar pointsSep = QLatin1Char(' ');
const QChar itemsSep = QLatin1Char('*');
const QChar groupSep = ';'_L1;
const QChar coordintatesSep = ','_L1;
const QChar pointsSep = ' '_L1;
const QChar itemsSep = '*'_L1;
} // namespace ML

View File

@ -31,12 +31,17 @@
#include "../vpatterndb/measurements.h"
#include "ui_dialogmdatabase.h"
#include <QKeyEvent>
#include <QMenu>
#include <QSvgRenderer>
#include <QtSvg>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
DialogMDataBase::DialogMDataBase(const QStringList &list, QWidget *parent)
: QDialog(parent),
@ -513,12 +518,11 @@ auto DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showImage)
imgTag = ImgTag(number);
}
const QString text = QString("<p align=\"center\" style=\"font-variant: normal; font-style: normal; font-weight: "
"normal\"> %1 <br clear=\"left\"><b>%2</b>. <i>%3</i></p>"
"<p align=\"left\" style=\"font-variant: normal; font-style: normal; font-weight: "
"normal\">%4</p>")
.arg(imgTag, number, VAbstractApplication::VApp()->TrVars()->GuiText(name),
VAbstractApplication::VApp()->TrVars()->Description(name));
const QString text = u"<p align=\"center\" style=\"font-variant: normal; font-style: normal; font-weight: "
"normal\"> %1 <br clear=\"left\"><b>%2</b>. <i>%3</i></p>"
"<p align=\"left\" style=\"font-variant: normal; font-style: normal; font-weight: "
"normal\">%4</p>"_s.arg(imgTag, number, VAbstractApplication::VApp()->TrVars()->GuiText(name),
VAbstractApplication::VApp()->TrVars()->Description(name));
return text;
}

View File

@ -37,6 +37,12 @@
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
@ -187,7 +193,7 @@ void DialogRestrictDimension::changeEvent(QEvent *event)
{
MeasurementDimension_p dimension = m_dimensions.at(index);
name->setText(dimension->Name() + QChar(':'));
name->setText(dimension->Name() + ':'_L1);
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_fullCircumference));
InitDimensionGradation(dimension, control);
@ -366,7 +372,7 @@ void DialogRestrictDimension::CellContextMenu(QPoint pos)
}
columnValue = m_dimensions.at(0)->ValidBases().at(item->column());
coordinates = QChar('0');
coordinates = '0'_L1;
}
else if (m_restrictionType == RestrictDimension::Second)
{
@ -451,7 +457,7 @@ void DialogRestrictDimension::InitDimensionsBaseValues()
if (m_dimensions.size() > index)
{
MeasurementDimension_p dimension = m_dimensions.at(index);
name->setText(dimension->Name() + QChar(':'));
name->setText(dimension->Name() + ':'_L1);
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_fullCircumference));
InitDimensionGradation(dimension, control);

View File

@ -69,6 +69,12 @@
#include "../vmisc/appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -82,19 +88,19 @@ namespace
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_DIMENSION_A, (QLatin1String("dimensionA"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_A, (QChar('a'))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_DIMENSION_A, ("dimensionA"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_A, ('a'_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_DIMENSION_B, (QLatin1String("dimensionB"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_B, (QChar('b'))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_DIMENSION_B, ("dimensionB"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_B, ('b'_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_DIMENSION_C, (QLatin1String("dimensionC"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_C, (QChar('c'))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_DIMENSION_C, ("dimensionC"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_DIMENSION_C, ('c'_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_UNITS, (QLatin1String("units"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_UNITS, (QChar('u'))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_UNITS, ("units"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SINGLE_OPTION_UNITS, ('u'_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_TEST, (QLatin1String("test"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LONG_OPTION_TEST, ("test"_L1)) // NOLINT
QT_WARNING_POP
} // namespace
@ -473,7 +479,7 @@ void MApplication::InitOptions()
[]()
{
QString country = VGAnalytics::CountryCode();
if (country == QLatin1String("ru") || country == QLatin1String("by"))
if (country == "ru"_L1 || country == "by"_L1)
{
qFatal("contry not detected");
}

View File

@ -102,6 +102,8 @@ using namespace bpstd::literals::chrono_literals;
#include <QMimeData>
#endif // defined(Q_OS_MAC)
using namespace Qt::Literals::StringLiterals;
constexpr int DIALOG_MAX_FORMULA_HEIGHT = 64;
QT_WARNING_PUSH
@ -1021,7 +1023,7 @@ auto TMainWindow::FileSaveAs() -> bool
suffix = QStringLiteral("vst");
}
fName += QChar('.') + suffix;
fName += '.'_L1 + suffix;
const QString dir = SaveDirPath(m_curFile, m_mType);
@ -1030,7 +1032,7 @@ auto TMainWindow::FileSaveAs() -> bool
fName = StrippedName(m_curFile);
}
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + fName, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
@ -1041,7 +1043,7 @@ auto TMainWindow::FileSaveAs() -> bool
QFileInfo f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += QChar('.') + suffix;
fileName += '.'_L1 + suffix;
}
if (m_curFile.isEmpty())
@ -1162,7 +1164,7 @@ void TMainWindow::ImportDataFromCSV()
QFileInfo f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += QChar('.') + suffix;
fileName += '.'_L1 + suffix;
}
DialogExportToCSV dialog(this);
@ -1973,9 +1975,9 @@ void TMainWindow::ShowMDiagram(const QString &name)
}
else
{
ui->labelDiagram->setText(QString("<html><head/><body><p align=\"center\">%1</p>"
"<p align=\"center\"><b>%2</b>. <i>%3</i></p></body></html>")
.arg(DialogMDataBase::ImgTag(number), number, trv->GuiText(name)));
ui->labelDiagram->setText(u"<html><head/><body><p align=\"center\">%1</p>"
"<p align=\"center\"><b>%2</b>. <i>%3</i></p></body></html>"_s.arg(
DialogMDataBase::ImgTag(number), number, trv->GuiText(name)));
}
}
@ -2049,7 +2051,7 @@ void TMainWindow::SaveMName(const QString &text)
QString name = newName;
do
{
name = name + QChar('_') + QString::number(num);
name = name + '_'_L1 + QString::number(num);
num++;
} while (not m_data->IsUnique(name));
newName = name;
@ -2418,7 +2420,7 @@ void TMainWindow::ExportToIndividual()
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
QString fName = tr("measurements.vit");
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName, filters,
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + '/'_L1 + fName, filters,
nullptr, VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
@ -2430,7 +2432,7 @@ void TMainWindow::ExportToIndividual()
QFileInfo f(fileName);
if (f.suffix().isEmpty() && f.suffix() != suffix)
{
fileName += QChar('.') + suffix;
fileName += '.'_L1 + suffix;
}
if (m_curFile.isEmpty())
@ -2834,7 +2836,7 @@ void TMainWindow::InitWindow()
ui->comboBoxPMSystem->setEnabled(true);
ui->comboBoxPMSystem->clear();
InitPMSystems(ui->comboBoxPMSystem);
const qint32 index = ui->comboBoxPMSystem->findData(QLatin1Char('p') + m_m->PMSystem());
const qint32 index = ui->comboBoxPMSystem->findData('p'_L1 + m_m->PMSystem());
ui->comboBoxPMSystem->setCurrentIndex(index);
connect(ui->comboBoxPMSystem, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&TMainWindow::SavePMSystem);
@ -2946,7 +2948,7 @@ void TMainWindow::InitDimensionsBaseValue()
if (dimensions.size() > index)
{
const MeasurementDimension_p &dimension = dimensions.at(index);
name->setText(dimension->Name() + QChar(':'));
name->setText(dimension->Name() + ':'_L1);
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_m->IsFullCircumference()));
DimesionLabels labels = dimension->Labels();
@ -3057,11 +3059,11 @@ void TMainWindow::InitDimensionControls()
if (name == nullptr)
{
name = new QLabel(dimension->Name() + QChar(':'));
name = new QLabel(dimension->Name() + ':'_L1);
}
else
{
name->setText(dimension->Name() + QChar(':'));
name->setText(dimension->Name() + ':'_L1);
}
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_m->IsFullCircumference()));
@ -3148,7 +3150,7 @@ void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString
SCASSERT(table != nullptr)
QString header = table->horizontalHeaderItem(column)->text();
const auto index = header.indexOf(QLatin1String("("));
const auto index = header.indexOf('('_L1);
if (index != -1)
{
header.remove(index - 1, 100);
@ -3170,7 +3172,7 @@ void TMainWindow::SetCurrentFile(const QString &fileName)
m_curFile = fileName;
if (m_curFile.isEmpty())
{
ui->lineEditPathToFile->setText(QChar('<') + tr("Empty") + QChar('>'));
ui->lineEditPathToFile->setText('<'_L1 + tr("Empty") + '>'_L1);
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
ui->lineEditPathToFile->setCursorPosition(0);
ui->pushButtonShowInExplorer->setEnabled(false);
@ -3563,22 +3565,21 @@ void TMainWindow::UpdateWindowTitle()
{
showName = tr("untitled");
}
m_mType == MeasurementsType::Multisize ? showName += QLatin1String(".vst") : showName += QLatin1String(".vit");
m_mType == MeasurementsType::Multisize ? showName += ".vst"_L1 : showName += ".vit"_L1;
}
showName += QLatin1String("[*]");
showName += "[*]"_L1;
if (m_mIsReadOnly || not isFileWritable)
{
showName += QStringLiteral(" (") + tr("read only") + QChar(')');
showName += QStringLiteral(" (") + tr("read only") + ')'_L1;
}
setWindowTitle(showName);
setWindowFilePath(m_curFile);
#if defined(Q_OS_MAC)
static QIcon fileIcon =
QIcon(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/measurements.icns"));
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/measurements.icns"_L1);
QIcon icon;
if (not m_curFile.isEmpty())
{
@ -3910,10 +3911,10 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
TMainWindow *window = windows.at(i);
QString title = QStringLiteral("%1. %2").arg(i + 1).arg(window->windowTitle());
const auto index = title.lastIndexOf(QLatin1String("[*]"));
const auto index = title.lastIndexOf("[*]"_L1);
if (index != -1)
{
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
window->isWindowModified() ? title.replace(index, 3, '*'_L1) : title.replace(index, 3, QString());
}
QAction *action = menu->addAction(title, this, &TMainWindow::ShowWindow);
@ -4760,7 +4761,7 @@ void TMainWindow::UpdateSearchControlsTooltips()
{
auto UpdateToolTip = [](QAbstractButton *button)
{
if (button->toolTip().contains(QLatin1String("%1")))
if (button->toolTip().contains("%1"_L1))
{
button->setToolTip(button->toolTip().arg(button->shortcut().toString(QKeySequence::NativeText)));
}

View File

@ -32,27 +32,31 @@
#include <QGlobalStatic>
#include <QVariant>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, (QLatin1String("paths/templates"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsTemplates, ("paths/templates"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, (QLatin1String("database/geometry"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryTape, (QLatin1String("searchHistory/tape"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, ("database/geometry"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryTape, ("searchHistory/tape"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeUseUnicodeProperties,
(QLatin1String("searchOptions/tapeUseUnicodeProperties")))
("searchOptions/tapeUseUnicodeProperties"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeWholeWord,
(QLatin1String("searchOptions/tapeWholeWord")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeWholeWord, ("searchOptions/tapeWholeWord"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeRegexp, (QLatin1String("searchOptions/tapeRegexp")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeRegexp, ("searchOptions/tapeRegexp"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeMatchCase,
(QLatin1String("searchOptions/tapeMatchCase")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsTapeMatchCase, ("searchOptions/tapeMatchCase"_L1))
QT_WARNING_POP
} // namespace

View File

@ -77,6 +77,12 @@
#include <QScopeGuard>
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -685,7 +691,7 @@ void VApplication::InitOptions()
[]()
{
QString country = VGAnalytics::CountryCode();
if (country == QLatin1String("ru") || country == QLatin1String("by"))
if (country == "ru"_L1 || country == "by"_L1)
{
qFatal("contry not detected");
}

View File

@ -94,14 +94,20 @@
#include <QRegularExpression>
#include <QScrollArea>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrHold, (QLatin1String("hold"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrVisible, (QLatin1String("visible"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrOpacity, (QLatin1String("opacity"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrHold, ("hold"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrVisible, ("visible"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrOpacity, ("opacity"_L1)) // NOLINT
QT_WARNING_POP
} // namespace
@ -4379,7 +4385,7 @@ auto VToolOptionsPropertyBrowser::PropertiesList() -> QStringList
{
static QStringList attr{
AttrName, /* 0 */
QLatin1String("position"), /* 1 */
"position"_L1, /* 1 */
AttrBasePoint, /* 2 */
AttrTypeLine, /* 3 */
AttrLength, /* 4 */

View File

@ -38,6 +38,12 @@
#include <QMenu>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
constexpr int DIALOG_MAX_FORMULA_HEIGHT = 64;
//---------------------------------------------------------------------------------------------------------------------
@ -251,7 +257,7 @@ void DialogFinalMeasurements::Add()
VFinalMeasurement m;
m.name = tr("measurement");
m.formula = QLatin1Char('0');
m.formula = '0'_L1;
m_measurements.append(m);
@ -902,7 +908,7 @@ void DialogFinalMeasurements::UpdateSearchControlsTooltips()
{
auto UpdateToolTip = [](QAbstractButton *button)
{
if (button->toolTip().contains(QLatin1String("%1")))
if (button->toolTip().contains("%1"_L1))
{
button->setToolTip(button->toolTip().arg(button->shortcut().toString(QKeySequence::NativeText)));
}

View File

@ -45,6 +45,12 @@
#include <QtConcurrent>
#include <functional>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
@ -780,7 +786,7 @@ void DialogHistory::UpdateSearchControlsTooltips()
{
auto UpdateToolTip = [](QAbstractButton *button)
{
if (button->toolTip().contains(QLatin1String("%1")))
if (button->toolTip().contains("%1"_L1))
{
button->setToolTip(button->toolTip().arg(button->shortcut().toString(QKeySequence::NativeText)));
}

View File

@ -56,6 +56,12 @@
#include <QTableWidgetItem>
#include <QtNumeric>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
constexpr int DIALOG_MAX_FORMULA_HEIGHT = 64;
namespace
@ -1191,7 +1197,7 @@ void DialogIncrements::UpdateSearchControlsTooltips()
{
auto UpdateToolTip = [](QAbstractButton *button)
{
if (button->toolTip().contains(QLatin1String("%1")))
if (button->toolTip().contains("%1"_L1))
{
button->setToolTip(button->toolTip().arg(button->shortcut().toString(QKeySequence::NativeText)));
}

View File

@ -39,6 +39,12 @@
#include <QPrinterInfo>
#include <QPushButton>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
: VAbstractLayoutDialog(parent),
@ -821,11 +827,11 @@ auto DialogLayoutSettings::MakeHelpTemplateList() -> QString
if (i < VAbstractLayoutDialog::PageFormatNames().size() - 2)
{
out += QLatin1String(",\n");
out += ",\n"_L1;
}
else
{
out += QLatin1String(".\n");
out += ".\n"_L1;
}
}
}
@ -843,11 +849,11 @@ auto DialogLayoutSettings::MakeHelpTiledPdfTemplateList() -> QString
if (i < static_cast<int>(PaperSizeTemplate::Tabloid))
{
out += QLatin1String(",\n");
out += ",\n"_L1;
}
else
{
out += QLatin1String(".\n");
out += ".\n"_L1;
}
}
return out;

View File

@ -53,6 +53,12 @@
#include "../ifc/xml/vpatternimage.h"
#include "../qmuparser/qmudef.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent)
: QDialog(parent),
@ -514,7 +520,7 @@ void DialogPatternProperties::BrowseLabelPath()
path = settings->GetPathLabelTemplate();
}
QString filters(tr("Label template") + QLatin1String("(*.xml)"));
QString filters(tr("Label template") + "(*.xml)"_L1);
const QString filePath = QFileDialog::getOpenFileName(this, tr("Label template"), path, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());

View File

@ -45,15 +45,21 @@
#include <QRegularExpression>
#include <QtDebug>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
#ifndef Q_OS_WIN
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\/]+$"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, ("^[^\\/]+$"_L1)) // NOLINT
#else
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, (QLatin1String("^[^\\:?\"*|\\/<>]+$"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, baseFilenameRegExp, ("^[^\\:?\"*|\\/<>]+$"_L1)) // NOLINT
#endif
QT_WARNING_POP
@ -297,11 +303,11 @@ auto DialogSaveLayout::MakeHelpFormatList() -> QString
if (i < formats.size() - 1)
{
out += QLatin1String(",\n");
out += ",\n"_L1;
}
else
{
out += QLatin1String(".\n");
out += ".\n"_L1;
}
}
return out;
@ -424,7 +430,7 @@ void DialogSaveLayout::PathChanged(const QString &text)
void DialogSaveLayout::ShowExample()
{
const LayoutExportFormats currentFormat = Format();
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1Char('1') +
ui->labelExample->setText(tr("Example:") + FileName() + '1'_L1 +
VLayoutExporter::ExportFormatSuffix(currentFormat));
ui->groupBoxPaperFormat->setEnabled(false);

View File

@ -236,6 +236,12 @@ using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -249,7 +255,7 @@ namespace
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, autosavePrefix, (QLatin1String(".autosave"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, autosavePrefix, (".autosave"_L1)) // NOLINT
QT_WARNING_POP
@ -779,11 +785,11 @@ void MainWindow::ReadMeasurements(qreal baseA, qreal baseB, qreal baseC)
if (name == nullptr)
{
name = new QLabel(dimension->Name() + QChar(':'));
name = new QLabel(dimension->Name() + ':'_L1);
}
else
{
name->setText(dimension->Name() + QChar(':'));
name->setText(dimension->Name() + ':'_L1);
}
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_m->IsFullCircumference()));
@ -850,7 +856,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
if (qApp->devicePixelRatio() >= 2) // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
{
// Try to load HiDPI versions of the cursors if availible
auto hiDPICursor = QString(cursor).replace(QLatin1String(".png"), QLatin1String("@2x.png"));
auto hiDPICursor = QString(cursor).replace(".png"_L1, "@2x.png"_L1);
auto cursorHiDPIResource = VTheme::GetResourceName(resource, hiDPICursor);
if (QFileInfo::exists(cursorHiDPIResource))
{
@ -2324,7 +2330,7 @@ void MainWindow::StoreMultisizeMDimensions()
{
if (not m_dimensionALabel.isNull())
{
m_dimensionALabel->setText(dimensions.at(0)->Name() + QChar(':'));
m_dimensionALabel->setText(dimensions.at(0)->Name() + ':'_L1);
}
}
@ -2332,7 +2338,7 @@ void MainWindow::StoreMultisizeMDimensions()
{
if (not m_dimensionBLabel.isNull())
{
m_dimensionBLabel->setText(dimensions.at(1)->Name() + QChar(':'));
m_dimensionBLabel->setText(dimensions.at(1)->Name() + ':'_L1);
}
}
@ -2340,7 +2346,7 @@ void MainWindow::StoreMultisizeMDimensions()
{
if (not m_dimensionCLabel.isNull())
{
m_dimensionCLabel->setText(dimensions.at(2)->Name() + QChar(':'));
m_dimensionCLabel->setText(dimensions.at(2)->Name() + ':'_L1);
}
}
@ -4087,8 +4093,8 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool
}
QString filters(tr("Pattern files") + QStringLiteral("(*.val)"));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + newFileName, filters,
nullptr, VAbstractApplication::VApp()->NativeFileDialog());
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + newFileName, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
{
@ -4096,9 +4102,9 @@ auto MainWindow::on_actionSaveAs_triggered() -> bool
}
QFileInfo f(fileName);
if (f.suffix().isEmpty() && f.suffix() != QLatin1String("val"))
if (f.suffix().isEmpty() && f.suffix() != "val"_L1)
{
fileName += QLatin1String(".val");
fileName += ".val"_L1;
}
if (patternPath.isEmpty())
@ -5240,11 +5246,11 @@ void MainWindow::InitDimensionControls()
if (name.isNull())
{
name = new QLabel(dimension->Name() + QChar(':'));
name = new QLabel(dimension->Name() + ':'_L1);
}
else
{
name->setText(dimension->Name() + QChar(':'));
name->setText(dimension->Name() + ':'_L1);
}
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m_m->IsFullCircumference()));
@ -5527,7 +5533,7 @@ auto MainWindow::SavePattern(const QString &fileName, QString &error) -> bool
const bool result = doc->SaveDocument(fileName, error);
if (result)
{
if (tempInfo.suffix() != QLatin1String("autosave"))
if (tempInfo.suffix() != "autosave"_L1)
{
setCurrentFile(fileName);
statusBar()->showMessage(tr("File saved"), 5000);
@ -6243,7 +6249,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
QFileInfo info(fileName);
if (info.exists() && info.isRelative())
{
fileName = QFileInfo(QDir::currentPath() + QLatin1Char('/') + fileName).canonicalFilePath();
fileName = QFileInfo(QDir::currentPath() + '/'_L1 + fileName).canonicalFilePath();
}
}
@ -6646,7 +6652,7 @@ void MainWindow::CreateMeasurements()
QStringList arguments;
if (isNoScaling)
{
arguments.append(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING);
arguments.append("--"_L1 + LONG_OPTION_NO_HDPI_SCALING);
}
QProcess::startDetached(tape, arguments, workingDirectory);
@ -6659,7 +6665,7 @@ void MainWindow::ExportDrawAs()
auto Uncheck = qScopeGuard([this] { ui->actionExportDraw->setChecked(false); });
QString filters(tr("Scalable Vector Graphics files") + QStringLiteral("(*.svg)"));
QString dir = QDir::homePath() + QChar('/') + FileName() + QStringLiteral(".svg");
QString dir = QDir::homePath() + '/'_L1 + FileName() + QStringLiteral(".svg");
QString fileName = QFileDialog::getSaveFileName(this, tr("Save draw"), dir, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -6669,9 +6675,9 @@ void MainWindow::ExportDrawAs()
}
QFileInfo f(fileName);
if (f.suffix().isEmpty() || f.suffix() != QLatin1String("svg"))
if (f.suffix().isEmpty() || f.suffix() != "svg"_L1)
{
fileName += QLatin1String(".svg");
fileName += ".svg"_L1;
}
ExportDraw(fileName);
@ -6867,7 +6873,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri
}
MeasurementsType patternType;
if (table.suffix() == QLatin1String("vst"))
if (table.suffix() == "vst"_L1)
{
patternType = MeasurementsType::Multisize;
}
@ -7194,7 +7200,7 @@ auto MainWindow::DoFMExport(const VCommandLinePtr &expParams) -> bool
QFileInfo info(filePath);
if (info.isRelative())
{
filePath = QDir::currentPath() + QLatin1Char('/') + filePath;
filePath = QDir::currentPath() + '/'_L1 + filePath;
}
const QString codecName = expParams->OptCSVCodecName();
@ -7429,7 +7435,7 @@ auto MainWindow::GetPatternFileName() -> QString
{
shownName = StrippedName(VAbstractValApplication::VApp()->GetPatternPath());
}
shownName += QLatin1String("[*]");
shownName += "[*]"_L1;
return shownName;
}
@ -7446,10 +7452,10 @@ auto MainWindow::GetMeasurementFileName() -> QString
if (m_mChanges)
{
shownName += QChar('*');
shownName += '*'_L1;
}
shownName += QChar(']');
shownName += ']'_L1;
return shownName;
}
@ -7474,14 +7480,12 @@ void MainWindow::UpdateWindowTitle()
}
else
{
setWindowTitle(GetPatternFileName() + GetMeasurementFileName() + QStringLiteral(" (") + tr("read only") +
QChar(')'));
setWindowTitle(GetPatternFileName() + GetMeasurementFileName() + " ("_L1 + tr("read only") + ')'_L1);
}
setWindowFilePath(VAbstractValApplication::VApp()->GetPatternPath());
#if defined(Q_OS_MAC)
static QIcon fileIcon =
QIcon(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/Valentina.icns"));
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/Valentina.icns"_L1);
QIcon icon;
if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{

View File

@ -76,6 +76,8 @@
#include <QWinTaskbarProgress>
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
@ -555,7 +557,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList<QGraphicsScene *> &scenes, c
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
{
const QString name = path + '/' + m_dialogSaveLayout->FileName() + QChar('1');
const QString name = path + '/'_L1 + m_dialogSaveLayout->FileName() + '1'_L1;
PdfTiledFile(name);
}
else

View File

@ -132,6 +132,8 @@ using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
using namespace Qt::Literals::StringLiterals;
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly"); // NOLINT(cert-err58-cpp)
const QString VPattern::AttrLabelPrefix = QStringLiteral("labelPrefix"); // NOLINT(cert-err58-cpp)
@ -471,7 +473,7 @@ auto VPattern::SaveDocument(const QString &fileName, QString &error) -> bool
}
const bool saved = VAbstractPattern::SaveDocument(fileName, error);
if (saved && QFileInfo(fileName).suffix() != QLatin1String("autosave"))
if (saved && QFileInfo(fileName).suffix() != "autosave"_L1)
{
modified = false;
}
@ -1500,52 +1502,52 @@ auto VPattern::GetLabelBase(quint32 index) const -> QString
case 0: // de
{
const QString al = QStringLiteral("A,Ä,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Ö,P,Q,R,S,ß,T,U,Ü,V,W,X,Y,Z");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
case 2: // fr
{
const QString al = QStringLiteral("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
case 3: // ru
{
const QString al = QStringLiteral("А,Б,В,Г,Д,Е,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
case 4: // uk
{
const QString al = QStringLiteral("А,Б,В,Г,Д,Е,Ж,З,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Є,Ю,Я");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
case 5: // hr
case 7: // bs
{
const QString al = QStringLiteral("A,B,C,Č,Ć,D,Dž,Ð,E,F,G,H,I,J,K,L,Lj,M,N,Nj,O,P,R,S,Š,T,U,V,Z,Ž");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
case 6: // sr
{
const QString al = QStringLiteral("А,Б,В,Г,Д,Ђ,Е,Ж,З,И,Ј,К,Л,Љ,М,Н,Њ,О,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
case 8: // cs
{
const QString al = QStringLiteral("a,á,b,c,č,d,ď,e,é,ě,f,g,h,ch,i,í,j,k,l,m,n,ň,o,ó,p,q,r,ř,s,š,t,ť,u,ú,ů,"
"v,w,x,y,ý,z,ž");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
case 1: // en
default: // en
{
const QString al = QStringLiteral("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
alphabet = al.split(QChar(','));
alphabet = al.split(','_L1);
break;
}
}
@ -1640,7 +1642,7 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of end line"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -1690,7 +1692,7 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point along line"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -1735,7 +1737,7 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of shoulder"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -1780,7 +1782,7 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of normal"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -1825,7 +1827,7 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of bisector"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -1901,7 +1903,7 @@ void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &d
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of contact"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2061,7 +2063,7 @@ void VPattern::ParsePlaceLabel(QDomElement &domElement, const Document &parse)
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating place label"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2197,7 +2199,7 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating cut spline point"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2242,7 +2244,7 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating cut spline path point"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2287,7 +2289,7 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating cut arc point"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2334,7 +2336,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of intersection line and axis"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2387,7 +2389,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating point of intersection curve and axis"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2746,7 +2748,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating simple interactive spline"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -2966,7 +2968,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating interactive spline path"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -3179,7 +3181,7 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -3239,7 +3241,7 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating simple elliptical arc"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -3370,7 +3372,7 @@ void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &do
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -3416,7 +3418,7 @@ void VPattern::ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElem
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating operation of rotation"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}
@ -3532,7 +3534,7 @@ void VPattern::ParseToolMove(VMainGraphicsScene *scene, QDomElement &domElement,
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating operation of moving"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n" + "Expression: " + e.GetExpr()));
excep.AddMoreInformation("Message: "_L1 + e.GetMsg() + '\n'_L1 + "Expression: "_L1 + e.GetExpr());
throw excep;
}
}

View File

@ -49,17 +49,21 @@
#include "fvavailableupdate.h"
#include "fvupdatewindow.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL,
(QLatin1String("https://valentinaproject.bitbucket.io/Appcast.xml")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defaultFeedURL, ("https://valentinaproject.bitbucket.io/Appcast.xml"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL,
(QLatin1String("https://valentinaproject.bitbucket.io/Appcast_testing.xml")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL, ("https://valentinaproject.bitbucket.io/Appcast_testing.xml"_L1))
QT_WARNING_POP
} // namespace
@ -416,13 +420,13 @@ auto FvUpdater::xmlParseFeed() -> bool
if (m_xml.isStartElement())
{
if (m_xml.name() == QLatin1String("item"))
if (m_xml.name() == "item"_L1)
{
xmlEnclosureUrl.clear();
xmlEnclosureVersion.clear();
xmlEnclosurePlatform.clear();
}
else if (m_xml.name() == QLatin1String("enclosure"))
else if (m_xml.name() == "enclosure"_L1)
{
const QXmlStreamAttributes attribs = m_xml.attributes();
const QString fervorPlatform = QStringLiteral("fervor:platform");
@ -458,7 +462,7 @@ auto FvUpdater::xmlParseFeed() -> bool
}
else if (m_xml.isEndElement())
{
if (m_xml.name() == QLatin1String("item"))
if (m_xml.name() == "item"_L1)
{
// 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

@ -30,14 +30,24 @@
#include "vexception.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VExceptionBadId exception bad id
* @param error string with error
* @param id id
*/
VExceptionBadId::VExceptionBadId(const QString &error, const quint32 &id) V_NOEXCEPT_EXPR (true)
:VException(error), id(id), key(QString()){}
VExceptionBadId::VExceptionBadId(const QString &error, const quint32 &id) V_NOEXCEPT_EXPR(true)
: VException(error),
id(id),
key(QString())
{
}
//---------------------------------------------------------------------------------------------------------------------
/**
@ -45,21 +55,29 @@ VExceptionBadId::VExceptionBadId(const QString &error, const quint32 &id) V_NOEX
* @param error string with error
* @param key string key
*/
VExceptionBadId::VExceptionBadId(const QString &error, const QString &key) V_NOEXCEPT_EXPR (true)
:VException(error), id(NULL_ID), key(key){}
VExceptionBadId::VExceptionBadId(const QString &error, const QString &key) V_NOEXCEPT_EXPR(true)
: VException(error),
id(NULL_ID),
key(key)
{
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VExceptionBadId copy constructor
* @param e exception
*/
VExceptionBadId::VExceptionBadId(const VExceptionBadId &e) V_NOEXCEPT_EXPR (true)
:VException(e), id(e.BadId()), key(e.BadKey()){}
VExceptionBadId::VExceptionBadId(const VExceptionBadId &e) V_NOEXCEPT_EXPR(true)
: VException(e),
id(e.BadId()),
key(e.BadKey())
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VExceptionBadId::operator=(const VExceptionBadId &e) V_NOEXCEPT_EXPR(true) -> VExceptionBadId &
{
if ( &e == this )
if (&e == this)
{
return *this;
}
@ -79,11 +97,11 @@ auto VExceptionBadId::ErrorMessage() const -> QString
QString error;
if (key.isEmpty())
{
error = QString("ExceptionBadId: %1, id = %2").arg(this->error).arg(id);
error = u"ExceptionBadId: %1, id = %2"_s.arg(this->error).arg(id);
}
else
{
error = QString("ExceptionBadId: %1, id = %2").arg(this->error, key);
error = u"ExceptionBadId: %1, id = %2"_s.arg(this->error, key);
}
return error;
}

View File

@ -32,14 +32,21 @@
#include "vexception.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VExceptionConversionError exception conversion error
* @param error string with error
* @param str string, where happend error
*/
VExceptionConversionError::VExceptionConversionError(const QString &error, const QString &str) V_NOEXCEPT_EXPR (true)
:VException(error), str(str)
VExceptionConversionError::VExceptionConversionError(const QString &error, const QString &str) V_NOEXCEPT_EXPR(true)
: VException(error),
str(str)
{
Q_ASSERT_X(not str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty");
}
@ -49,15 +56,17 @@ VExceptionConversionError::VExceptionConversionError(const QString &error, const
* @brief VExceptionConversionError copy constructor
* @param e exception
*/
VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true)
:VException(e), str(e.String())
{}
VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e) V_NOEXCEPT_EXPR(true)
: VException(e),
str(e.String())
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VExceptionConversionError::operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR(true)
-> VExceptionConversionError &
{
if ( &e == this )
if (&e == this)
{
return *this;
}
@ -73,5 +82,5 @@ auto VExceptionConversionError::operator=(const VExceptionConversionError &e) V_
*/
auto VExceptionConversionError::ErrorMessage() const -> QString
{
return QString("ExceptionConversionError: %1 \"%2\"").arg(error, str);
return u"ExceptionConversionError: %1 \"%2\""_s.arg(error, str);
}

View File

@ -33,6 +33,12 @@
#include "vexception.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VExceptionEmptyParameter exception empty parameter
@ -41,8 +47,12 @@
* @param domElement dom element
*/
VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name,
const QDomElement &domElement) V_NOEXCEPT_EXPR (true)
: VException(what), name(name), tagText(QString()), tagName(QString()), lineNumber(-1)
const QDomElement &domElement) V_NOEXCEPT_EXPR(true)
: VException(what),
name(name),
tagText(QString()),
tagName(QString()),
lineNumber(-1)
{
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty");
@ -57,15 +67,20 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS
* @brief VExceptionEmptyParameter copy constructor
* @param e exception
*/
VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR (true)
:VException(e), name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber())
{}
VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR(true)
: VException(e),
name(e.Name()),
tagText(e.TagText()),
tagName(e.TagName()),
lineNumber(e.LineNumber())
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VExceptionEmptyParameter::operator=(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR(true)
-> VExceptionEmptyParameter &
{
if ( &e == this )
if (&e == this)
{
return *this;
}
@ -84,7 +99,7 @@ auto VExceptionEmptyParameter::operator=(const VExceptionEmptyParameter &e) V_NO
*/
auto VExceptionEmptyParameter::ErrorMessage() const -> QString
{
return QString("ExceptionEmptyParameter: %1 %2").arg(error, name);
return u"ExceptionEmptyParameter: %1 %2"_s.arg(error, name);
}
//---------------------------------------------------------------------------------------------------------------------
@ -94,5 +109,5 @@ auto VExceptionEmptyParameter::ErrorMessage() const -> QString
*/
auto VExceptionEmptyParameter::DetailedInformation() const -> QString
{
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));
return MoreInfo(u"tag: %1 in line %2\nFull tag:\n%3"_s.arg(tagName).arg(lineNumber).arg(tagText));
}

View File

@ -33,14 +33,23 @@
#include "vexception.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VExceptionObjectError exception object error
* @param what string with error
* @param domElement dom element
*/
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR (true)
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR(true)
: VException(what),
tagText(QString()),
tagName(QString()),
lineNumber(-1)
{
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
QTextStream stream(&tagText);
@ -50,23 +59,31 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElem
}
//---------------------------------------------------------------------------------------------------------------------
VExceptionObjectError::VExceptionObjectError(const QString &what) V_NOEXCEPT_EXPR (true)
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
{}
VExceptionObjectError::VExceptionObjectError(const QString &what) V_NOEXCEPT_EXPR(true)
: VException(what),
tagText(QString()),
tagName(QString()),
lineNumber(-1)
{
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VExceptionObjectError copy constructor
* @param e exception
*/
VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e) V_NOEXCEPT_EXPR (true)
:VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber())
{}
VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e) V_NOEXCEPT_EXPR(true)
: VException(e),
tagText(e.TagText()),
tagName(e.TagName()),
lineNumber(e.LineNumber())
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VExceptionObjectError::operator=(const VExceptionObjectError &e) V_NOEXCEPT_EXPR(true) -> VExceptionObjectError &
{
if ( &e == this )
if (&e == this)
{
return *this;
}
@ -84,7 +101,7 @@ auto VExceptionObjectError::operator=(const VExceptionObjectError &e) V_NOEXCEPT
*/
auto VExceptionObjectError::ErrorMessage() const -> QString
{
return QString("ExceptionObjectError: %1").arg(error);
return u"ExceptionObjectError: %1"_s.arg(error);
}
//---------------------------------------------------------------------------------------------------------------------
@ -94,5 +111,5 @@ auto VExceptionObjectError::ErrorMessage() const -> QString
*/
auto VExceptionObjectError::DetailedInformation() const -> QString
{
return MoreInfo(QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText));
return MoreInfo(u"tag: %1 in line %2\n%3"_s.arg(tagName).arg(lineNumber).arg(tagText));
}

View File

@ -33,14 +33,23 @@
#include "vexception.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VExceptionWrongId exception wrong parameter id
* @param what string with error
* @param domElement som element
*/
VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR (true)
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR(true)
: VException(what),
tagText(QString()),
tagName(QString()),
lineNumber(-1)
{
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
QTextStream stream(&tagText);
@ -54,14 +63,18 @@ VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &dom
* @brief VExceptionWrongId copy constructor
* @param e exception
*/
VExceptionWrongId::VExceptionWrongId(const VExceptionWrongId &e) V_NOEXCEPT_EXPR (true)
:VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber())
{}
VExceptionWrongId::VExceptionWrongId(const VExceptionWrongId &e) V_NOEXCEPT_EXPR(true)
: VException(e),
tagText(e.TagText()),
tagName(e.TagName()),
lineNumber(e.LineNumber())
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VExceptionWrongId::operator=(const VExceptionWrongId &e) V_NOEXCEPT_EXPR(true) -> VExceptionWrongId &
{
if ( &e == this )
if (&e == this)
{
return *this;
}
@ -79,7 +92,7 @@ auto VExceptionWrongId::operator=(const VExceptionWrongId &e) V_NOEXCEPT_EXPR(tr
*/
auto VExceptionWrongId::ErrorMessage() const -> QString
{
return QString("ExceptionWrongId: %1").arg(error);
return u"ExceptionWrongId: %1"_s.arg(error);
}
//---------------------------------------------------------------------------------------------------------------------
@ -89,5 +102,5 @@ auto VExceptionWrongId::ErrorMessage() const -> QString
*/
auto VExceptionWrongId::DetailedInformation() const -> QString
{
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));
return MoreInfo(u"tag: %1 in line %2\nFull tag:\n%3"_s.arg(tagName).arg(lineNumber).arg(tagText));
}

View File

@ -35,6 +35,12 @@
#include <QPen>
#include <QPixmap>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
const QString CustomMSign = QStringLiteral("@");
const QString CustomIncrSign = QStringLiteral("#");
@ -282,8 +288,8 @@ const QString elarc_ = QStringLiteral(ELARC_);
const QString splPath = QStringLiteral("SplPath");
const QString radius_V = QStringLiteral("Radius");
const QString radiusArc_ = radius_V + arc_;
const QString radius1ElArc_ = radius_V + QLatin1Char('1') + elarc_;
const QString radius2ElArc_ = radius_V + QLatin1Char('2') + elarc_;
const QString radius1ElArc_ = radius_V + '1'_L1 + elarc_;
const QString radius2ElArc_ = radius_V + '2'_L1 + elarc_;
const QString angle1_V = QStringLiteral("Angle1");
const QString angle2_V = QStringLiteral("Angle2");
const QString c1Length_V = QStringLiteral("C1Length");

View File

@ -30,8 +30,8 @@
#include "vparsererrorhandler.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#else
#include <QXmlSchema>
#include <QXmlSchemaValidator>
@ -54,13 +54,19 @@
#include "../exception/vexception.h"
#include "vdomdocument.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VAbstractConverter::VAbstractConverter(const QString &fileName)
: m_ver(0x0),
m_originalFileName(fileName),
m_convertedFileName(fileName)
: m_ver(0x0),
m_originalFileName(fileName),
m_convertedFileName(fileName)
{
setXMLContent(m_convertedFileName);// Throw an exception on error
setXMLContent(m_convertedFileName); // Throw an exception on error
}
//---------------------------------------------------------------------------------------------------------------------
@ -99,21 +105,21 @@ auto VAbstractConverter::GetCurrentFormatVersion() const -> unsigned
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::ReserveFile() const
{
//It's not possible in all cases make conversion without lose data.
//For such cases we will store old version in a reserve file.
// It's not possible in all cases make conversion without lose data.
// For such cases we will store old version in a reserve file.
QString error;
QFileInfo info(m_convertedFileName);
const QString reserveFileName = QString("%1/%2(v%3).%4.bak")
.arg(info.absoluteDir().absolutePath(), info.baseName(), GetFormatVersionStr(), info.completeSuffix());
const QString reserveFileName = u"%1/%2(v%3).%4.bak"_s.arg(info.absoluteDir().absolutePath(), info.baseName(),
GetFormatVersionStr(), info.completeSuffix());
if (not SafeCopy(m_convertedFileName, reserveFileName, error))
{
//#ifdef Q_OS_WIN32
// qt_ntfs_permission_lookup++; // turn checking on
//#endif /*Q_OS_WIN32*/
// #ifdef Q_OS_WIN32
// qt_ntfs_permission_lookup++; // turn checking on
// #endif /*Q_OS_WIN32*/
const bool isFileWritable = info.isWritable();
//#ifdef Q_OS_WIN32
// qt_ntfs_permission_lookup--; // turn it off again
//#endif /*Q_OS_WIN32*/
// #ifdef Q_OS_WIN32
// qt_ntfs_permission_lookup--; // turn it off again
// #endif /*Q_OS_WIN32*/
if (not IsReadOnly() && isFileWritable)
{
const QString errorMsg(tr("Error creating a reserv copy: %1.").arg(error));
@ -136,7 +142,7 @@ void VAbstractConverter::CorrectionsPositions(vsizetype position, vsizetype bias
{
if (bias == 0)
{
return;// Nothing to correct;
return; // Nothing to correct;
}
BiasTokens(position, bias, tokens);
@ -149,13 +155,13 @@ void VAbstractConverter::BiasTokens(vsizetype position, vsizetype bias, QMap<vsi
QMap<vsizetype, QString>::const_iterator i = tokens.constBegin();
while (i != tokens.constEnd())
{
if (i.key()<= position)
if (i.key() <= position)
{ // Tokens before position "position" did not change his positions.
newTokens.insert(i.key(), i.value());
}
else
{
newTokens.insert(i.key()-bias, i.value());
newTokens.insert(i.key() - bias, i.value());
}
++i;
}
@ -185,15 +191,12 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
domParser.setErrorHandler(&parserErrorHandler);
QByteArray data = fileSchema.readAll();
const char* schemaData = data.constData();
const char *schemaData = data.constData();
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> grammarSource(
new XERCES_CPP_NAMESPACE::MemBufInputSource(reinterpret_cast<const XMLByte*>(schemaData),
strlen(schemaData), "schema"));
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> grammarSource(new XERCES_CPP_NAMESPACE::MemBufInputSource(
reinterpret_cast<const XMLByte *>(schemaData), strlen(schemaData), "schema"));
if (domParser.loadGrammar(
*grammarSource,
XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr)
if (domParser.loadGrammar(*grammarSource, XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr)
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
@ -205,8 +208,10 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
if (parserErrorHandler.HasError())
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Schema file %3 invalid in line %1 column %2").arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column()).arg(fileSchema.fileName()));
e.AddMoreInformation(tr("Schema file %3 invalid in line %1 column %2")
.arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column())
.arg(fileSchema.fileName()));
throw e;
}
@ -225,19 +230,20 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
}
QByteArray patternFileData = pattern.readAll();
const char* patternData = patternFileData.constData();
const char *patternData = patternFileData.constData();
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> patternSource(
new XERCES_CPP_NAMESPACE::MemBufInputSource(reinterpret_cast<const XMLByte*>(patternData),
strlen(patternData), "pattern"));
QScopedPointer<XERCES_CPP_NAMESPACE::InputSource> patternSource(new XERCES_CPP_NAMESPACE::MemBufInputSource(
reinterpret_cast<const XMLByte *>(patternData), strlen(patternData), "pattern"));
domParser.parse(*patternSource);
if (domParser.getErrorCount() > 0)
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column()).arg(m_originalFileName));
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2")
.arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column())
.arg(m_originalFileName));
throw e;
}
#else
@ -250,7 +256,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
QXmlSchema sch;
sch.setMessageHandler(&parserErrorHandler);
if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()))==false)
if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName())) == false)
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
@ -275,8 +281,10 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
if (errorOccurred)
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column()).arg(m_originalFileName));
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2")
.arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column())
.arg(m_originalFileName));
throw e;
}
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -309,7 +317,7 @@ void VAbstractConverter::ValidateInputFile(const QString &currentSchema) const
{
schema = XSDSchema(m_ver);
}
catch(const VException &e)
catch (const VException &e)
{
if (m_ver < MinVer())
{ // Version less than minimally supported version. Can't do anything.
@ -322,7 +330,7 @@ void VAbstractConverter::ValidateInputFile(const QString &currentSchema) const
{ // Try to open like the current version.
ValidateXML(currentSchema);
}
catch(const VException &exp)
catch (const VException &exp)
{ // Nope, we can't.
Q_UNUSED(exp)
throw e;
@ -342,7 +350,7 @@ void VAbstractConverter::ValidateInputFile(const QString &currentSchema) const
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::Save()
{
m_tmpFile.resize(0);//clear previous content
m_tmpFile.resize(0); // clear previous content
const int indent = 4;
QTextStream out(&m_tmpFile);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -371,7 +379,7 @@ void VAbstractConverter::SetVersion(const QString &version)
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractConverter::XSDSchema(unsigned int ver) const -> QString
{
const QHash <unsigned, QString> schemas = Schemas();
const QHash<unsigned, QString> schemas = Schemas();
if (schemas.contains(ver))
{
return schemas.value(ver);

View File

@ -59,6 +59,8 @@
#include "vtoolrecord.h"
#include "vvalentinasettings.h"
using namespace Qt::Literals::StringLiterals;
class QDomElement;
const QString VAbstractPattern::TagPattern = QStringLiteral("pattern");
@ -176,7 +178,7 @@ namespace
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, dimensionDefValue, (QLatin1String("-1"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, dimensionDefValue, ("-1"_L1)) // NOLINT
QT_WARNING_POP
@ -256,13 +258,13 @@ auto PrepareGroupTags(QStringList tags) -> QString
tag = tag.simplified();
}
return ConvertToStringList(ConvertToSet<QString>(tags)).join(',');
return ConvertToStringList(ConvertToSet<QString>(tags)).join(','_L1);
}
//---------------------------------------------------------------------------------------------------------------------
auto StringToTransfrom(const QString &matrix) -> QTransform
{
QStringList elements = matrix.split(QChar(';'));
QStringList elements = matrix.split(';'_L1);
if (elements.count() == 9)
{
qreal m11 = elements.at(0).toDouble();
@ -293,7 +295,7 @@ auto TransformToString(const QTransform &m) -> QString
QStringList matrix{NumberToString(m.m11()), NumberToString(m.m12()), NumberToString(m.m13()),
NumberToString(m.m21()), NumberToString(m.m22()), NumberToString(m.m23()),
NumberToString(m.m31()), NumberToString(m.m32()), NumberToString(m.m33())};
return matrix.join(QChar(';'));
return matrix.join(';'_L1);
}
} // namespace
@ -334,7 +336,7 @@ auto VAbstractPattern::ListMeasurements() const -> QStringList
for (const auto &token : tokens)
{
if (token == QChar('-') || measurements.contains(token) || others.contains(token))
if (token == '-'_L1 || measurements.contains(token) || others.contains(token))
{
continue;
}
@ -342,7 +344,7 @@ auto VAbstractPattern::ListMeasurements() const -> QStringList
IsVariable(token) || IsFunction(token) ? others.insert(token) : measurements.insert(token);
}
return QStringList(measurements.values());
return {measurements.values()};
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -70,6 +70,12 @@
#include <unistd.h>
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
@ -606,7 +612,7 @@ auto VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStrin
try
{
QString parametr = GetParametrString(domElement, name, defValue);
param = parametr.replace(QChar(','), QChar('.')).toDouble(&ok);
param = parametr.replace(','_L1, '.'_L1).toDouble(&ok);
if (ok == false)
{
throw VExceptionConversionError(QObject::tr("Can't convert toDouble parameter"), name);
@ -827,7 +833,7 @@ auto VDomDocument::SaveDocument(const QString &fileName, QString &error) -> bool
auto VDomDocument::Major() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split(QChar('.'));
QStringList v = version.split('.'_L1);
return v.at(0);
}
@ -836,7 +842,7 @@ auto VDomDocument::Major() const -> QString
auto VDomDocument::Minor() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split(QChar('.'));
QStringList v = version.split('.'_L1);
return v.at(1);
}
@ -845,7 +851,7 @@ auto VDomDocument::Minor() const -> QString
auto VDomDocument::Patch() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split(QChar('.'));
QStringList v = version.split('.'_L1);
return v.at(2);
}
@ -882,7 +888,7 @@ auto VDomDocument::GetFormatVersion(const QString &version) -> unsigned
{
ValidateVersion(version);
const QStringList ver = version.split(QChar('.'));
const QStringList ver = version.split('.'_L1);
bool ok = false;
const unsigned major = ver.at(0).toUInt(&ok);
@ -1029,7 +1035,7 @@ auto VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
// qt_ntfs_permission_lookup++; // turn checking on
// #endif /*Q_OS_WIN32*/
QTemporaryFile destFile(destination + QLatin1String(".XXXXXX"));
QTemporaryFile destFile(destination + ".XXXXXX"_L1);
destFile.setAutoRemove(false); // Will be renamed to be destination file
if (not destFile.open())
{
@ -1151,7 +1157,7 @@ void VDomDocument::ValidateVersion(const QString &version)
throw VException(errorMsg);
}
if (version == QLatin1String("0.0.0"))
if (version == "0.0.0"_L1)
{
const QString errorMsg(tr("Version \"0.0.0\" invalid."));
throw VException(errorMsg);

View File

@ -30,6 +30,12 @@
#include "../ifcdef.h"
#include "../vlayout/vlayoutpoint.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
/*
* Version rules:
* 1. Version have three parts "major.minor.patch";
@ -52,28 +58,28 @@ QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
// The list of all string we use for conversion
// Better to use global variables because repeating QStringLiteral blows up code size
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamLineTag, (QLatin1String("seamLine"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamAllowanceTag, (QLatin1String("seamAllowance"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strInternalPathTag, (QLatin1String("internalPath"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMarkerTag, (QLatin1String("marker"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointTag, (QLatin1String("point"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPieceTag, (QLatin1String("piece"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGrainlineTag, (QLatin1String("grainline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrX, (QLatin1String("x"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrY, (QLatin1String("y"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrTurnPoint, (QLatin1String("turnPoint"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrCurvePoint, (QLatin1String("curvePoint"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrId, (QLatin1String("id"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrUId, (QLatin1String("uid"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrAngle, (QLatin1String("angle"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrArrowDirection, (QLatin1String("arrowDirection"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamLineTag, ("seamLine"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamAllowanceTag, ("seamAllowance"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strInternalPathTag, ("internalPath"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMarkerTag, ("marker"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointTag, ("point"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPieceTag, ("piece"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGrainlineTag, ("grainline"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrX, ("x"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrY, ("y"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrTurnPoint, ("turnPoint"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrCurvePoint, ("curvePoint"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrId, ("id"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrUId, ("uid"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrAngle, ("angle"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrArrowDirection, ("arrowDirection"_L1)) // NOLINT
QT_WARNING_POP
const QChar groupSep = QLatin1Char(';');
const QChar coordintatesSep = QLatin1Char(',');
const QChar pointsSep = QLatin1Char(' ');
// const QChar itemsSep = QLatin1Char('*');
const QChar groupSep = ';'_L1;
const QChar coordintatesSep = ','_L1;
const QChar pointsSep = ' '_L1;
// const QChar itemsSep = '*'_L1;
//---------------------------------------------------------------------------------------------------------------------
auto StringV0_1_2ToPoint(const QString &point) -> QPointF
@ -307,17 +313,17 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
switch (arrows.indexOf(arrowDirection))
{
case 0: // at front
SetAttribute(node, *strAttrArrowDirection, QLatin1String("oneWayUp"));
SetAttribute(node, *strAttrArrowDirection, "oneWayUp"_L1);
break;
case 1: // at rear
SetAttribute(node, *strAttrArrowDirection, QLatin1String("oneWayDown"));
SetAttribute(node, *strAttrArrowDirection, "oneWayDown"_L1);
break;
case 2: // at four way
SetAttribute(node, *strAttrArrowDirection, QLatin1String("fourWays"));
SetAttribute(node, *strAttrArrowDirection, "fourWays"_L1);
break;
case 3: // at both
default:
SetAttribute(node, *strAttrArrowDirection, QLatin1String("twoWaysUpDown"));
SetAttribute(node, *strAttrArrowDirection, "twoWaysUpDown"_L1);
break;
}
}

View File

@ -46,6 +46,12 @@
#include "../qmuparser/qmutokenparser.h"
#include "../vmisc/def.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
class QDomElement;
/*
@ -70,111 +76,111 @@ QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
// The list of all string we use for conversion
// Better to use global variables because repeating QStringLiteral blows up code size
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUnit, (QLatin1String("unit"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVersion, (QLatin1String("version"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strName, (QLatin1String("name"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBase, (QLatin1String("base"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFormula, (QLatin1String("formula"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strId, (QLatin1String("id"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKGrowth, (QLatin1String("kgrowth"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKSize, (QLatin1String("ksize"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPoint, (QLatin1String("point"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLength, (QLatin1String("length"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle, (QLatin1String("angle"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strC1Radius, (QLatin1String("c1Radius"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strC2Radius, (QLatin1String("c2Radius"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCRadius, (QLatin1String("cRadius"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strArc, (QLatin1String("arc"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle1, (QLatin1String("angle1"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle2, (QLatin1String("angle2"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strRadius, (QLatin1String("radius"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPathPoint, (QLatin1String("pathPoint"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKAsm1, (QLatin1String("kAsm1"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKAsm2, (QLatin1String("kAsm2"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPath, (QLatin1String("path"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strType, (QLatin1String("type"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutArc, (QLatin1String("cutArc"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSpline, (QLatin1String("spline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSplinePath, (QLatin1String("splinePath"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutSpline, (QLatin1String("cutSpline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutSplinePath, (QLatin1String("cutSplinePath"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strColor, (QLatin1String("color"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMeasurements, (QLatin1String("measurements"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIncrement, (QLatin1String("increment"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIncrements, (QLatin1String("increments"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPreviewCalculations, (QLatin1String("previewCalculations"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModeling, (QLatin1String("modeling"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTools, (QLatin1String("tools"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdTool, (QLatin1String("idTool"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdObject, (QLatin1String("idObject"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChildren, (QLatin1String("children"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChild, (QLatin1String("child"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUnit, ("unit"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVersion, ("version"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strName, ("name"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBase, ("base"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFormula, ("formula"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strId, ("id"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKGrowth, ("kgrowth"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKSize, ("ksize"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPoint, ("point"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLength, ("length"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle, ("angle"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strC1Radius, ("c1Radius"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strC2Radius, ("c2Radius"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCRadius, ("cRadius"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strArc, ("arc"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle1, ("angle1"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAngle2, ("angle2"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strRadius, ("radius"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPathPoint, ("pathPoint"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKAsm1, ("kAsm1"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strKAsm2, ("kAsm2"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPath, ("path"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strType, ("type"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutArc, ("cutArc"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSpline, ("spline"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSplinePath, ("splinePath"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutSpline, ("cutSpline"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutSplinePath, ("cutSplinePath"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strColor, ("color"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMeasurements, ("measurements"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIncrement, ("increment"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIncrements, ("increments"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPreviewCalculations, ("previewCalculations"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModeling, ("modeling"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTools, ("tools"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdTool, ("idTool"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strIdObject, ("idObject"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChildren, ("children"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strChild, ("child"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionCurves, (QLatin1String("pointOfIntersectionCurves")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurveIntersectAxis, (QLatin1String("curveIntersectAxis"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve, (QLatin1String("curve"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve1, (QLatin1String("curve1"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve2, (QLatin1String("curve2"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingPath, (QLatin1String("modelingPath"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingSpline, (QLatin1String("modelingSpline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointFromArcAndTangent, (QLatin1String("pointFromArcAndTangent"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionCurves, ("pointOfIntersectionCurves"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurveIntersectAxis, ("curveIntersectAxis"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve, ("curve"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve1, ("curve1"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCurve2, ("curve2"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingPath, ("modelingPath"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strModelingSpline, ("modelingSpline"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointFromArcAndTangent, ("pointFromArcAndTangent"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionArcs, (QLatin1String("pointOfIntersectionArcs")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstArc, (QLatin1String("firstArc"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSecondArc, (QLatin1String("secondArc"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDetail, (QLatin1String("detail"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSupplement, (QLatin1String("supplement"))) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strClosed, (QLatin1String("closed"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strWidth, (QLatin1String("width"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strHeight, (QLatin1String("height"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNode, (QLatin1String("node"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNodes, (QLatin1String("nodes"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strData, (QLatin1String("data"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternInfo, (QLatin1String("patternInfo"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGrainline, (QLatin1String("grainline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strReverse, (QLatin1String("reverse"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMx, (QLatin1String("mx"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMy, (QLatin1String("my"))) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strForbidFlipping, (QLatin1String("forbidFlipping"))) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strInLayout, (QLatin1String("inLayout"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamAllowance, (QLatin1String("seamAllowance"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUUID, (QLatin1String("uuid"))) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNodeType, (QLatin1String("nodeType"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDet, (QLatin1String("det"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTypeObject, (QLatin1String("typeObject"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strReadOnly, (QLatin1String("readOnly"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternLabel, (QLatin1String("patternLabel"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strImage, (QLatin1String("image"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAuthor, (QLatin1String("author"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDescription, (QLatin1String("description"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNotes, (QLatin1String("notes"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGradation, (QLatin1String("gradation"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternName, (QLatin1String("patternName"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternNum, (QLatin1String("patternNumber"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCompanyName, (QLatin1String("company"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomerName, (QLatin1String("customer"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLine, (QLatin1String("line"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strText, (QLatin1String("text"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBold, (QLatin1String("bold"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strItalic, (QLatin1String("italic"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAlignment, (QLatin1String("alignment"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFSIncrement, (QLatin1String("sfIncrement"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strShowDate, (QLatin1String("showDate"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strShowMeasurements, (QLatin1String("showMeasurements"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSize, (QLatin1String("size"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMCP, (QLatin1String("mcp"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLetter, (QLatin1String("letter"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMaterial, (QLatin1String("material"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUserDefined, (QLatin1String("userDef"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPlacement, (QLatin1String("placement"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutNumber, (QLatin1String("cutNumber"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strQuantity, (QLatin1String("quantity"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strExtension, (QLatin1String("extension"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strContentType, (QLatin1String("contentType"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToCountour, (QLatin1String("firstToCountour"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToContour, (QLatin1String("firstToContour"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToCountour, (QLatin1String("lastToCountour"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToContour, (QLatin1String("lastToContour"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPointOfIntersectionArcs, ("pointOfIntersectionArcs"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstArc, ("firstArc"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSecondArc, ("secondArc"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDetail, ("detail"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSupplement, ("supplement"_L1)) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strClosed, ("closed"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strWidth, ("width"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strHeight, ("height"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNode, ("node"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNodes, ("nodes"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strData, ("data"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternInfo, ("patternInfo"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGrainline, ("grainline"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strReverse, ("reverse"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMx, ("mx"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMy, ("my"_L1)) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strForbidFlipping, ("forbidFlipping"_L1)) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strInLayout, ("inLayout"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamAllowance, ("seamAllowance"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUUID, ("uuid"_L1)) // NOLINT
// Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNodeType, ("nodeType"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDet, ("det"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTypeObject, ("typeObject"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strReadOnly, ("readOnly"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternLabel, ("patternLabel"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strImage, ("image"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAuthor, ("author"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDescription, ("description"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNotes, ("notes"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGradation, ("gradation"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternName, ("patternName"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPatternNum, ("patternNumber"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCompanyName, ("company"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomerName, ("customer"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLine, ("line"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strText, ("text"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBold, ("bold"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strItalic, ("italic"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAlignment, ("alignment"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFSIncrement, ("sfIncrement"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strShowDate, ("showDate"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strShowMeasurements, ("showMeasurements"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSize, ("size"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMCP, ("mcp"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLetter, ("letter"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMaterial, ("material"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUserDefined, ("userDef"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPlacement, ("placement"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCutNumber, ("cutNumber"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strQuantity, ("quantity"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strExtension, ("extension"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strContentType, ("contentType"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToCountour, ("firstToCountour"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFirstToContour, ("firstToContour"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToCountour, ("lastToCountour"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strLastToContour, ("lastToContour"_L1)) // NOLINT
QT_WARNING_POP
} // anonymous namespace
@ -629,7 +635,7 @@ auto VPatternConverter::FixIncrementsToV0_2_0() -> QSet<QString>
{
const QString name = GetParametrString(domElement, *strName);
names.insert(name);
domElement.setAttribute(*strName, QLatin1String("#") + name);
domElement.setAttribute(*strName, '#'_L1 + name);
const QString base = GetParametrString(domElement, *strBase);
domElement.setAttribute(*strFormula, base);

View File

@ -40,6 +40,12 @@
#include "vabstractmconverter.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
/*
* Version rules:
* 1. Version have three parts "major.minor.patch";
@ -62,11 +68,11 @@ QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
// The list of all string we use for conversion
// Better to use global variables because repeating QStringLiteral blows up code size
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGivenName, (QLatin1String("given-name"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFamilyName, (QLatin1String("family-name"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomer, (QLatin1String("customer"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPersonal, (QLatin1String("personal"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, ("read-only"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strGivenName, ("given-name"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strFamilyName, ("family-name"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCustomer, ("customer"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strPersonal, ("personal"_L1)) // NOLINT
QT_WARNING_POP
} // namespace
@ -330,7 +336,7 @@ void VVITConverter::ConverCustomerNameToV0_4_0()
QString customerName;
if (not givenName.isEmpty() && not familyName.isEmpty())
{
customerName = givenName + QLatin1Char(' ') + familyName;
customerName = givenName + ' '_L1 + familyName;
}
else if (not givenName.isEmpty() && familyName.isEmpty())
{

View File

@ -41,6 +41,12 @@
#include "../vmisc/def.h"
#include "vabstractmconverter.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
/*
* Version rules:
* 1. Version have three parts "major.minor.patch";
@ -61,10 +67,10 @@ namespace
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, (QLatin1String("read-only"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrCircumference, (QLatin1String("circumference"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrMeasurement, (QLatin1String("measurement"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagDimension, (QLatin1String("dimension"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagRead_Only, ("read-only"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrCircumference, ("circumference"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strAttrMeasurement, ("measurement"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTagDimension, ("dimension"_L1)) // NOLINT
QT_WARNING_POP
} // namespace

View File

@ -39,7 +39,7 @@
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
enum class MeasurementDimension: qint8
enum class MeasurementDimension : qint8
{
X = 0, // height
Y = 1, // size (chest half circumference)
@ -112,13 +112,14 @@ template <typename T> inline auto VFuzzyValue(const QMap<qreal, T> &c, qreal val
class VAbstartMeasurementDimension
{
Q_DECLARE_TR_FUNCTIONS(VAbstartMeasurementDimension) // NOLINT
public:
VAbstartMeasurementDimension() =default;
VAbstartMeasurementDimension() = default;
explicit VAbstartMeasurementDimension(Unit units);
VAbstartMeasurementDimension(Unit units, qreal min, qreal max, qreal step);
virtual ~VAbstartMeasurementDimension() =default;
virtual ~VAbstartMeasurementDimension() = default;
virtual auto Type() const -> MeasurementDimension =0;
virtual auto Type() const -> MeasurementDimension = 0;
auto IsValid() -> bool;
@ -144,7 +145,7 @@ public:
auto RangeMin() const -> int;
auto RangeMax() const -> int;
virtual auto Axis() const -> QChar =0;
virtual auto Axis() const -> QChar = 0;
auto Name() const -> QString;
@ -171,15 +172,15 @@ protected:
private:
Q_DISABLE_COPY_MOVE(VAbstartMeasurementDimension) // NOLINT
Unit m_units{Unit::Cm};
qreal m_minValue{0};
qreal m_maxValue{0};
qreal m_step{-1};
qreal m_baseValue{0};
Unit m_units{Unit::Cm};
qreal m_minValue{0};
qreal m_maxValue{0};
qreal m_step{-1};
qreal m_baseValue{0};
mutable QString m_error{};
DimesionLabels m_labels{};
bool m_measurement{true};
QString m_customName{};
DimesionLabels m_labels{};
bool m_measurement{true};
QString m_customName{};
};
//---------------------------------------------------------------------------------------------------------------------
@ -283,10 +284,10 @@ inline void VAbstartMeasurementDimension::SetCustomName(const QString &newCustom
class VXMeasurementDimension : public VAbstartMeasurementDimension
{
public:
VXMeasurementDimension() =default;
VXMeasurementDimension() = default;
explicit VXMeasurementDimension(Unit units);
VXMeasurementDimension(Unit units, qreal min, qreal max, qreal step);
~VXMeasurementDimension() override =default;
~VXMeasurementDimension() override = default;
auto Type() const -> MeasurementDimension override;
@ -305,7 +306,7 @@ inline auto VXMeasurementDimension::Type() const -> MeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
inline auto VXMeasurementDimension::Axis() const -> QChar
{
return QChar('X');
return QLatin1Char('X');
}
// VYMeasurementDimension
@ -313,10 +314,10 @@ inline auto VXMeasurementDimension::Axis() const -> QChar
class VYMeasurementDimension : public VAbstartMeasurementDimension
{
public:
VYMeasurementDimension() =default;
VYMeasurementDimension() = default;
explicit VYMeasurementDimension(Unit units);
VYMeasurementDimension(Unit units, qreal min, qreal max, qreal step);
~VYMeasurementDimension() override =default;
~VYMeasurementDimension() override = default;
auto Type() const -> MeasurementDimension override;
@ -335,7 +336,7 @@ inline auto VYMeasurementDimension::Type() const -> MeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
inline auto VYMeasurementDimension::Axis() const -> QChar
{
return QChar('Y');
return QLatin1Char('Y');
}
// VWMeasurementDimension
@ -343,10 +344,10 @@ inline auto VYMeasurementDimension::Axis() const -> QChar
class VWMeasurementDimension : public VAbstartMeasurementDimension
{
public:
VWMeasurementDimension() =default;
VWMeasurementDimension() = default;
explicit VWMeasurementDimension(Unit units);
VWMeasurementDimension(Unit units, qreal min, qreal max, qreal step);
~VWMeasurementDimension() override =default;
~VWMeasurementDimension() override = default;
auto Type() const -> MeasurementDimension override;
@ -365,7 +366,7 @@ inline auto VWMeasurementDimension::Type() const -> MeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
inline auto VWMeasurementDimension::Axis() const -> QChar
{
return QChar('W');
return QLatin1Char('W');
}
// VZMeasurementDimension
@ -373,10 +374,10 @@ inline auto VWMeasurementDimension::Axis() const -> QChar
class VZMeasurementDimension : public VAbstartMeasurementDimension
{
public:
VZMeasurementDimension() =default;
VZMeasurementDimension() = default;
explicit VZMeasurementDimension(Unit units);
VZMeasurementDimension(Unit units, qreal min, qreal max, qreal step);
~VZMeasurementDimension() override =default;
~VZMeasurementDimension() override = default;
auto Type() const -> MeasurementDimension override;
@ -395,7 +396,7 @@ inline auto VZMeasurementDimension::Type() const -> MeasurementDimension
//---------------------------------------------------------------------------------------------------------------------
inline auto VZMeasurementDimension::Axis() const -> QChar
{
return QChar('Z');
return QLatin1Char('Z');
}
class VDimensionRestriction
@ -415,6 +416,7 @@ public:
void SetExcludeValues(const QSet<qreal> &exclude);
auto GetExcludeValues() const -> QSet<qreal>;
private:
qreal m_min{0};
qreal m_max{0};

View File

@ -54,6 +54,12 @@
#include "../vpatterndb/vcontainer.h"
#include "def.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
const QString VMeasurements::TagVST = QStringLiteral("vst");
const QString VMeasurements::TagVIT = QStringLiteral("vit");
const QString VMeasurements::TagBodyMeasurements = QStringLiteral("body-measurements");
@ -111,14 +117,14 @@ namespace
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, ("1800-01-01"_L1)) // NOLINT
QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
auto FileComment() -> QString
{
return QString("Measurements created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(AppVersionStr());
return u"Measurements created with Valentina v%1 (https://smart-pattern.com.ua/)."_s.arg(AppVersionStr());
}
} // namespace
@ -1295,7 +1301,7 @@ auto VMeasurements::UniqueTagAttr(const QString &tag, const QString &attr, qreal
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
return GetParametrDouble(domElement, attr, QString("%1").arg(defVal));
return GetParametrDouble(domElement, attr, u"%1"_s.arg(defVal));
}
}
}
@ -1476,7 +1482,7 @@ auto VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool *
auto VMeasurements::ClearPMCode(const QString &code) const -> QString
{
QString clear = code;
const vsizetype index = clear.indexOf(QLatin1Char('p'));
const vsizetype index = clear.indexOf('p'_L1);
if (index == 0)
{
clear.remove(0, 1);

View File

@ -75,6 +75,12 @@
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
#include "../vtools/tools/drawTools/vtoolline.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
#define TagStep QStringLiteral("step")
@ -496,11 +502,10 @@ auto VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm, const VContai
const qreal result = cal->EvalFormula(data.DataVariables(), fm.formula);
if (qIsInf(result) || qIsNaN(result))
{
const QString errorMsg = QString("%1\n\n%1")
.arg(tr("Reading final measurements error."),
tr("Value for final measurtement '%1' is infinite or NaN. "
"Please, check your calculations.")
.arg(fm.name));
const QString errorMsg = u"%1\n\n%1"_s.arg(tr("Reading final measurements error."),
tr("Value for final measurtement '%1' is infinite or NaN. "
"Please, check your calculations.")
.arg(fm.name));
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;

View File

@ -31,6 +31,8 @@
#include "../vmisc/compatibility.h"
#include "../vmisc/projectversion.h"
using namespace Qt::Literals::StringLiterals;
const QString VWatermark::TagWatermark = QStringLiteral("watermark");
const QString VWatermark::TagText = QStringLiteral("text");
const QString VWatermark::TagImage = QStringLiteral("image");
@ -47,7 +49,7 @@ namespace
//---------------------------------------------------------------------------------------------------------------------
auto FileComment() -> QString
{
return QString("Watermark created with Valentina v%1 (https://smart-pattern.com.ua/).").arg(AppVersionStr());
return u"Watermark created with Valentina v%1 (https://smart-pattern.com.ua/)."_s.arg(AppVersionStr());
}
} // namespace

View File

@ -68,6 +68,12 @@ using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
@ -179,7 +185,7 @@ auto VGAnalytics::RepoRevision() const -> QString
//---------------------------------------------------------------------------------------------------------------------
void VGAnalytics::SetGUILanguage(const QString &language)
{
d->m_guiLanguage = language.toLower().replace(QChar('_'), QChar('-'));
d->m_guiLanguage = language.toLower().replace('_'_L1, '-'_L1);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -39,6 +39,12 @@
#include <QJsonDocument>
#include <QJsonObject>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
const QLatin1String VGAnalyticsWorker::dateTimeFormat("yyyy,MM,dd-hh:mm::ss:zzz");
namespace
@ -56,7 +62,7 @@ VGAnalyticsWorker::VGAnalyticsWorker(QObject *parent)
m_request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json; charset=utf-8");
m_request.setHeader(QNetworkRequest::UserAgentHeader, GetUserAgent());
m_guiLanguage = QLocale::system().name().toLower().replace(QChar('_'), QChar('-'));
m_guiLanguage = QLocale::system().name().toLower().replace('_'_L1, '-'_L1);
m_screensNumber = QString::number(QGuiApplication::screens().size());
@ -212,7 +218,7 @@ auto VGAnalyticsWorker::PostMessage() -> QNetworkReply *
QString connection = QStringLiteral("close");
if (m_messageQueue.count() > 1)
{
connection = QLatin1String("keep-alive");
connection = "keep-alive"_L1;
}
QueryBuffer buffer = m_messageQueue.head();

View File

@ -32,23 +32,29 @@
#include <QPainterPath>
#include <QtDebug>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.h"
#include "../ifc/exception/vexception.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/def.h"
#include "vabstractapplication.h"
#include "vpointf.h"
#include "vspline.h"
#include "vabstractapplication.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VAbstractCubicBezierPath::VAbstractCubicBezierPath(const GOType &type, const quint32 &idObject, const Draw &mode)
: VAbstractBezier(type, idObject, mode)
: VAbstractBezier(type, idObject, mode)
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractCubicBezierPath::operator=(const VAbstractCubicBezierPath &curve) -> VAbstractCubicBezierPath &
{
if ( &curve == this )
if (&curve == this)
{
return *this;
}
@ -162,15 +168,15 @@ auto VAbstractCubicBezierPath::Segment(const QPointF &p) const -> int
* @return cutting point.
*/
auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3,
QPointF &spl2p2, QPointF &spl2p3,
const QString &pointName) const -> QPointF
QPointF &spl2p2, QPointF &spl2p3, const QString &pointName) const
-> QPointF
{
if (CountSubSpl() < 1)
{
throw VException(tr("Can't cut this spline"));
}
//Always need return two spline paths, so we must correct wrong length.
// Always need return two spline paths, so we must correct wrong length.
qreal fullLength = GetLength();
if (fullLength <= minLength)
@ -179,8 +185,9 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
spl1p2 = spl1p3 = spl2p2 = spl2p3 = QPointF();
const QString errorMsg = tr("Unable to cut curve '%1'. The curve is too short.").arg(name());
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
return {};
}
@ -195,15 +202,16 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
if (not pointName.isEmpty())
{
errorMsg = tr("Curve '%1'. Length of a cut segment (%2) is too small. Optimize it to minimal value.")
.arg(name(), pointName);
.arg(name(), pointName);
}
else
{
errorMsg = tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.")
.arg(name());
errorMsg =
tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.").arg(name());
}
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
}
else if (length > maxLength)
{
@ -213,15 +221,15 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
if (not pointName.isEmpty())
{
errorMsg = tr("Curve '%1'. Length of a cut segment (%2) is too big. Optimize it to maximal value.")
.arg(name(), pointName);
.arg(name(), pointName);
}
else
{
errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.")
.arg(name());
errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.").arg(name());
}
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
}
fullLength = 0;
@ -232,10 +240,10 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
fullLength += splLength;
if (fullLength > length)
{
p1 = i-1;
p1 = i - 1;
p2 = i;
const QPointF point = spl.CutSpline(length - (fullLength - splLength), spl1p2, spl1p3, spl2p2, spl2p3,
pointName);
const QPointF point =
spl.CutSpline(length - (fullLength - splLength), spl1p2, spl1p3, spl2p2, spl2p3, pointName);
const QVector<VSplinePoint> points = GetSplinePath();
@ -248,7 +256,7 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
spl1p2.rx() += ToPixel(0.1, Unit::Mm);
QLineF line(splP1.P().toQPointF(), spl1p2);
line.setLength(ToPixel(0.1, Unit::Mm));
line.setAngle(splP1.Angle1()+180);
line.setAngle(splP1.Angle1() + 180);
spl1p2 = line.p2();
}
}
@ -261,7 +269,7 @@ auto VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32 &p
{
spl2p3.rx() += ToPixel(0.1, Unit::Mm);
QLineF line(splP2.P().toQPointF(), spl2p3);
line.setAngle(splP2.Angle2()+180);
line.setAngle(splP2.Angle2() + 180);
spl2p3 = line.p2();
}
}
@ -285,15 +293,15 @@ auto VAbstractCubicBezierPath::NameForHistory(const QString &toolName) const ->
QString name = toolName;
if (CountPoints() > 0)
{
name += QString(" %1").arg(FirstPoint().name());
name += u" %1"_s.arg(FirstPoint().name());
if (CountSubSpl() >= 1)
{
name += QString("_%1").arg(LastPoint().name());
name += u"_%1"_s.arg(LastPoint().name());
}
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
name += u"_%1"_s.arg(GetDuplicate());
}
}
@ -301,10 +309,10 @@ auto VAbstractCubicBezierPath::NameForHistory(const QString &toolName) const ->
if (not GetAliasSuffix().isEmpty())
{
alias = QString("%1 %2").arg(toolName, GetAliasSuffix());
alias = u"%1 %2"_s.arg(toolName, GetAliasSuffix());
}
return not alias.isEmpty() ? QString("%1 (%2)").arg(alias, name) : name;
return not alias.isEmpty() ? u"%1 (%2)"_s.arg(alias, name) : name;
}
//---------------------------------------------------------------------------------------------------------------------
@ -314,14 +322,14 @@ void VAbstractCubicBezierPath::CreateName()
if (CountPoints() > 0)
{
name = splPath;
name.append(QString("_%1").arg(FirstPoint().name()));
name.append(u"_%1"_s.arg(FirstPoint().name()));
if (CountSubSpl() >= 1)
{
name.append(QString("_%1").arg(LastPoint().name()));
name.append(u"_%1"_s.arg(LastPoint().name()));
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
name += u"_%1"_s.arg(GetDuplicate());
}
}
}

View File

@ -29,13 +29,19 @@
#include "vgeometrydef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h"
#include "../vmisc/vdatastreamenum.h"
#endif
#include "../ifc/exception/vexception.h"
#include <QCoreApplication>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
const quint32 VLayoutPassmark::streamHeader = 0x943E2759; // CRC-32Q string "VLayoutPassmark"
const quint16 VLayoutPassmark::classVersion = 2;
@ -59,8 +65,8 @@ auto operator>>(QDataStream &dataStream, VLayoutPassmark &data) -> QDataStream &
{
QString message = QCoreApplication::tr("VLayoutPassmark prefix mismatch error: actualStreamHeader = 0x%1 and "
"streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(VLayoutPassmark::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, '0'_L1)
.arg(VLayoutPassmark::streamHeader, 8, 0x10, '0'_L1);
throw VException(message);
}
@ -71,7 +77,8 @@ auto operator>>(QDataStream &dataStream, VLayoutPassmark &data) -> QDataStream &
{
QString message = QCoreApplication::tr("VLayoutPassmark compatibility error: actualClassVersion = %1 and "
"classVersion = %2")
.arg(actualClassVersion).arg(VLayoutPassmark::classVersion);
.arg(actualClassVersion)
.arg(VLayoutPassmark::classVersion);
throw VException(message);
}

View File

@ -28,28 +28,35 @@
#include "vlayoutplacelabel.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h"
#include "../vmisc/vdatastreamenum.h"
#endif
#include "../ifc/exception/vexception.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr quint32 VLayoutPlaceLabel::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint16 VLayoutPlaceLabel::classVersion; // NOLINT(readability-redundant-declaration)
#if __cplusplus < 201703L // C++17
constexpr quint32 VLayoutPlaceLabel::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint16 VLayoutPlaceLabel::classVersion; // NOLINT(readability-redundant-declaration)
#endif
//---------------------------------------------------------------------------------------------------------------------
VLayoutPlaceLabel::VLayoutPlaceLabel(const VPlaceLabelItem &item)
: m_center(item.toQPointF()),
m_type(item.GetLabelType()),
m_rotationMatrix(item.RotationMatrix()),
m_box(item.Box())
{}
: m_center(item.toQPointF()),
m_type(item.GetLabelType()),
m_rotationMatrix(item.RotationMatrix()),
m_box(item.Box())
{
}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
auto operator<<(QDataStream &dataStream, const VLayoutPlaceLabel &data) -> QDataStream&
auto operator<<(QDataStream &dataStream, const VLayoutPlaceLabel &data) -> QDataStream &
{
dataStream << VLayoutPlaceLabel::streamHeader << VLayoutPlaceLabel::classVersion;
@ -65,7 +72,7 @@ auto operator<<(QDataStream &dataStream, const VLayoutPlaceLabel &data) -> QData
}
//---------------------------------------------------------------------------------------------------------------------
auto operator>>(QDataStream &dataStream, VLayoutPlaceLabel &data) -> QDataStream&
auto operator>>(QDataStream &dataStream, VLayoutPlaceLabel &data) -> QDataStream &
{
quint32 actualStreamHeader = 0;
dataStream >> actualStreamHeader;
@ -74,8 +81,8 @@ auto operator>>(QDataStream &dataStream, VLayoutPlaceLabel &data) -> QDataStream
{
QString message = QCoreApplication::tr("VLayoutPlaceLabel prefix mismatch error: actualStreamHeader = 0x%1 and "
"streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(VLayoutPlaceLabel::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, '0'_L1)
.arg(VLayoutPlaceLabel::streamHeader, 8, 0x10, '0'_L1);
throw VException(message);
}
@ -86,7 +93,8 @@ auto operator>>(QDataStream &dataStream, VLayoutPlaceLabel &data) -> QDataStream
{
QString message = QCoreApplication::tr("VLayoutPlaceLabel compatibility error: actualClassVersion = %1 and "
"classVersion = %2")
.arg(actualClassVersion).arg(VLayoutPlaceLabel::classVersion);
.arg(actualClassVersion)
.arg(VLayoutPlaceLabel::classVersion);
throw VException(message);
}

View File

@ -34,6 +34,12 @@
#include <QString>
#include <QTransform>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VPointF creat empty point
@ -258,11 +264,11 @@ void VPointF::SetShowLabel(bool hide)
auto VPointF::ToJson() const -> QJsonObject
{
QJsonObject object = VGObject::ToJson();
object[QLatin1String("x")] = x();
object[QLatin1String("y")] = y();
object[QLatin1String("name")] = name();
object[QLatin1String("mx")] = mx();
object[QLatin1String("my")] = my();
object["x"_L1] = x();
object["y"_L1] = y();
object["name"_L1] = name();
object["mx"_L1] = mx();
object["my"_L1] = my();
return object;
}

View File

@ -35,6 +35,12 @@
#include "vabstractcurve.h"
#include "vspline_p.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VSpline default constructor
@ -585,17 +591,17 @@ auto VSpline::ParamT(const QPointF &pBt) const -> qreal
auto VSpline::ToJson() const -> QJsonObject
{
QJsonObject object = VAbstractCubicBezier::ToJson();
object[QLatin1String("aScale")] = GetApproximationScale();
object[QLatin1String("p1")] = GetP1().ToJson();
object[QLatin1String("p4")] = GetP4().ToJson();
object[QLatin1String("angle1")] = GetStartAngle();
object[QLatin1String("angle1Formula")] = GetStartAngleFormula();
object[QLatin1String("angle2")] = GetEndAngle();
object[QLatin1String("angle2Formula")] = GetEndAngleFormula();
object[QLatin1String("c1Length")] = GetC1Length();
object[QLatin1String("c1LengthFormula")] = GetC1LengthFormula();
object[QLatin1String("c2Length")] = GetC2Length();
object[QLatin1String("c2LengthFormula")] = GetC2LengthFormula();
object["aScale"_L1] = GetApproximationScale();
object["p1"_L1] = GetP1().ToJson();
object["p4"_L1] = GetP4().ToJson();
object["angle1"_L1] = GetStartAngle();
object["angle1Formula"_L1] = GetStartAngleFormula();
object["angle2"_L1] = GetEndAngle();
object["angle2Formula"_L1] = GetEndAngleFormula();
object["c1Length"_L1] = GetC1Length();
object["c1LengthFormula"_L1] = GetC1LengthFormula();
object["c2Length"_L1] = GetC2Length();
object["c2LengthFormula"_L1] = GetC2LengthFormula();
return object;
}

View File

@ -36,6 +36,12 @@
#include "vabstractcurve.h"
#include "vsplinepath_p.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VSplinePath constructor.
@ -349,14 +355,14 @@ auto VSplinePath::at(vsizetype indx) const -> const VSplinePoint &
auto VSplinePath::ToJson() const -> QJsonObject
{
QJsonObject object = VAbstractCubicBezierPath::ToJson();
object[QLatin1String("aScale")] = GetApproximationScale();
object["aScale"_L1] = GetApproximationScale();
QJsonArray nodesArray;
for (const auto &node : d->path)
{
nodesArray.append(node.ToJson());
}
object[QLatin1String("nodes")] = nodesArray;
object["nodes"_L1] = nodesArray;
return object;
}

View File

@ -49,6 +49,12 @@
#include <QLine>
#include <QtMath>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
const qreal accuracyPointOnLine{0.99};
@ -57,15 +63,15 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
// mnemonics
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mIN, (QLatin1String("IN"))) // NOLINT initialize set instruction
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPU, (QLatin1String("PU"))) // NOLINT pen up
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPD, (QLatin1String("PD"))) // NOLINT pen down
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mLT, (QLatin1String("LT"))) // NOLINT line type
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mSP, (QLatin1String("SP"))) // NOLINT select pen
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPG, (QLatin1String("PG"))) // NOLINT page feed
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPA, (QLatin1String("PA"))) // NOLINT plot absolute
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPW, (QLatin1String("PW"))) // NOLINT pen width
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mLA, (QLatin1String("LA"))) // NOLINT line attributes
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mIN, ("IN"_L1)) // NOLINT initialize set instruction
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPU, ("PU"_L1)) // NOLINT pen up
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPD, ("PD"_L1)) // NOLINT pen down
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mLT, ("LT"_L1)) // NOLINT line type
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mSP, ("SP"_L1)) // NOLINT select pen
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPG, ("PG"_L1)) // NOLINT page feed
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPA, ("PA"_L1)) // NOLINT plot absolute
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mPW, ("PW"_L1)) // NOLINT pen width
Q_GLOBAL_STATIC_WITH_ARGS(const QString, mLA, ("LA"_L1)) // NOLINT line attributes
QT_WARNING_POP

View File

@ -32,6 +32,12 @@
#include <QApplication>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VAbstractLayoutDialog::VAbstractLayoutDialog(QWidget *parent)
: QDialog(parent)
@ -42,8 +48,8 @@ VAbstractLayoutDialog::VAbstractLayoutDialog(QWidget *parent)
void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
{
SCASSERT(comboBoxTemplates != nullptr)
const QIcon icoPaper(QLatin1String("://icon/16x16/template.png"));
const QIcon icoRoll(QLatin1String("://icon/16x16/roll.png"));
const QIcon icoPaper("://icon/16x16/template.png"_L1);
const QIcon icoRoll("://icon/16x16/roll.png"_L1);
const QString pdi = QStringLiteral("(%1ppi)").arg(PrintDPI);
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);

View File

@ -49,6 +49,12 @@
#include "../vmisc/vabstractapplication.h"
#include "../vpropertyexplorer/checkablemessagebox.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent)
: QMainWindow(parent),
@ -97,7 +103,7 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent)
connect(ui->pushButtonBrowse, &QPushButton::clicked, this,
[this]()
{
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
const QString filter = tr("Images") + " (*.png *.jpg *.jpeg *.bmp)"_L1;
const QString fileName =
QFileDialog::getOpenFileName(this, tr("Watermark image"), QString(), filter, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());
@ -305,7 +311,7 @@ void WatermarkWindow::on_actionNew_triggered()
//---------------------------------------------------------------------------------------------------------------------
auto WatermarkWindow::on_actionSaveAs_triggered() -> bool
{
QString filters(tr("Watermark files") + QLatin1String("(*.vwm)"));
QString filters(tr("Watermark files") + "(*.vwm)"_L1);
QString dir;
if (m_curFile.isEmpty())
{
@ -316,8 +322,7 @@ auto WatermarkWindow::on_actionSaveAs_triggered() -> bool
dir = QFileInfo(m_curFile).absolutePath();
}
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("watermark") + QLatin1String(".vwm"),
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + '/'_L1 + tr("watermark") + ".vwm"_L1,
filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
@ -326,9 +331,9 @@ auto WatermarkWindow::on_actionSaveAs_triggered() -> bool
}
QFileInfo f(fileName);
if (f.suffix().isEmpty() && f.suffix() != QLatin1String("vwm"))
if (f.suffix().isEmpty() && f.suffix() != "vwm"_L1)
{
fileName += QLatin1String(".vwm");
fileName += ".vwm"_L1;
}
if (f.exists() && m_curFile != fileName)
@ -461,7 +466,7 @@ auto WatermarkWindow::on_actionSave_triggered() -> bool
void WatermarkWindow::on_actionOpen_triggered()
{
qDebug("Openning new watermark file.");
const QString filter(tr("Watermark files") + QLatin1String(" (*.vwm)"));
const QString filter(tr("Watermark files") + " (*.vwm)"_L1);
QString dir = QDir::homePath();
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
@ -540,13 +545,12 @@ void WatermarkWindow::UpdateWindowTitle()
}
else
{
setWindowTitle(GetWatermarkFileName() + QLatin1String(" (") + tr("read only") + QLatin1String(")"));
setWindowTitle(GetWatermarkFileName() + " ("_L1 + tr("read only") + ')'_L1);
}
setWindowFilePath(m_curFile);
#if defined(Q_OS_MAC)
static QIcon fileIcon =
QIcon(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/Valentina.icns"));
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/Valentina.icns"_L1);
QIcon icon;
if (not m_curFile.isEmpty())
{
@ -577,7 +581,7 @@ auto WatermarkWindow::GetWatermarkFileName() -> QString
{
shownName = StrippedName(m_curFile);
}
shownName += QLatin1String("[*]");
shownName += "[*]"_L1;
return shownName;
}

View File

@ -52,6 +52,8 @@
#include <QVector>
#include <QtMath>
using namespace Qt::Literals::StringLiterals;
const qreal maxL = 3.5;
namespace
@ -1536,43 +1538,43 @@ auto VAbstractPiece::GetUniqueID() const -> QString
auto VSAPoint::toJson() const -> QJsonObject
{
QJsonObject pointObject = VLayoutPoint::toJson();
pointObject[QLatin1String("type")] = "VSAPoint";
pointObject["type"_L1] = "VSAPoint";
if (not VFuzzyComparePossibleNulls(m_before, -1))
{
pointObject[QLatin1String("saBefore")] = m_before;
pointObject["saBefore"_L1] = m_before;
}
if (not VFuzzyComparePossibleNulls(m_after, -1))
{
pointObject[QLatin1String("saAfter")] = m_after;
pointObject["saAfter"_L1] = m_after;
}
if (m_angle != PieceNodeAngle::ByLength)
{
pointObject[QLatin1String("angle")] = static_cast<int>(m_angle);
pointObject["angle"_L1] = static_cast<int>(m_angle);
}
if (m_manualPassmarkLength)
{
pointObject[QLatin1String("manualPassmarkLength")] = m_manualPassmarkLength;
pointObject[QLatin1String("passmarkLength")] = m_passmarkLength;
pointObject["manualPassmarkLength"_L1] = m_manualPassmarkLength;
pointObject["passmarkLength"_L1] = m_passmarkLength;
}
if (m_manualPassmarkWidth)
{
pointObject[QLatin1String("manualPassmarkWidth")] = m_manualPassmarkWidth;
pointObject[QLatin1String("passmarkWidth")] = m_passmarkWidth;
pointObject["manualPassmarkWidth"_L1] = m_manualPassmarkWidth;
pointObject["passmarkWidth"_L1] = m_passmarkWidth;
}
else
{
pointObject[QLatin1String("passmarkClockwiseOpening")] = m_passmarkClockwiseOpening;
pointObject["passmarkClockwiseOpening"_L1] = m_passmarkClockwiseOpening;
}
if (m_manualPassmarkAngle)
{
pointObject[QLatin1String("manualPassmarkAngle")] = m_manualPassmarkAngle;
pointObject[QLatin1String("passmarkAngle")] = m_passmarkAngle;
pointObject["manualPassmarkAngle"_L1] = m_manualPassmarkAngle;
pointObject["passmarkAngle"_L1] = m_passmarkAngle;
}
return pointObject;

View File

@ -125,8 +125,8 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD
{
QString message = QCoreApplication::tr("VAbstractPieceData prefix mismatch error: actualStreamHeader = 0x%1 "
"and streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(VAbstractPieceData::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, QLatin1Char('0'))
.arg(VAbstractPieceData::streamHeader, 8, 0x10, QLatin1Char('0'));
throw VException(message);
}

View File

@ -52,15 +52,21 @@
#include "vprintlayout.h"
#include "vrawlayout.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
#ifdef Q_OS_WIN
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PDFTOPS, (QLatin1String("pdftops.exe"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PDFTOPS, ("pdftops.exe"_L1)) // NOLINT
#else
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PDFTOPS, (QLatin1String("pdftops"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PDFTOPS, ("pdftops"_L1)) // NOLINT
#endif
QT_WARNING_POP
@ -425,14 +431,14 @@ auto VLayoutExporter::SupportPDFConversion() -> bool
#if defined(Q_OS_OSX)
// Seek pdftops in app bundle
bool found = Test(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS);
bool found = Test(qApp->applicationDirPath() + '/'_L1 + *PDFTOPS);
if (not found)
{
found = Test(*PDFTOPS);
}
return found;
#elif defined(Q_OS_WIN)
return Test(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS);
return Test(qApp->applicationDirPath() + '/'_L1 + *PDFTOPS);
#else
return Test(*PDFTOPS);
#endif
@ -452,9 +458,9 @@ void VLayoutExporter::PdfToPs(const QStringList &params)
QProcess proc;
#if defined(Q_OS_MAC)
if (QFileInfo::exists(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS))
if (QFileInfo::exists(qApp->applicationDirPath() + '/'_L1 + *PDFTOPS))
{
proc.start(qApp->applicationDirPath() + QLatin1String("/") + *PDFTOPS, params);
proc.start(qApp->applicationDirPath() + '/'_L1 + *PDFTOPS, params);
}
else
{

View File

@ -69,6 +69,8 @@
#include "vlayoutpiece_p.h"
#include "vtextmanager.h"
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
@ -509,7 +511,7 @@ auto ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString lin
auto TestDimension = [per, placeholders, line](const QString &placeholder, const QString &errorMsg)
{
if (line.contains(per + placeholder + per) && placeholders.value(placeholder) == QChar('0'))
if (line.contains(per + placeholder + per) && placeholders.value(placeholder) == '0'_L1)
{
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)

View File

@ -169,8 +169,8 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPieceData &piece) -> QDat
{
QString message = QCoreApplication::tr("VLayoutPieceData prefix mismatch error: actualStreamHeader = 0x%1 and "
"streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(VLayoutPieceData::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, QLatin1Char('0'))
.arg(VLayoutPieceData::streamHeader, 8, 0x10, QLatin1Char('0'));
throw VException(message);
}

View File

@ -111,8 +111,8 @@ auto operator>>(QDataStream &dataStream, VLayoutPiecePathData &path) -> QDataStr
{
QString message = QCoreApplication::tr("VLayoutPiecePathData prefix mismatch error: actualStreamHeader = 0x%1 "
"and streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(VLayoutPiecePathData::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, QLatin1Char('0'))
.arg(VLayoutPiecePathData::streamHeader, 8, 0x10, QLatin1Char('0'));
throw VException(message);
}

View File

@ -30,22 +30,28 @@
#include <QJsonObject>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutPoint::toJson() const -> QJsonObject
{
QJsonObject pointObject;
pointObject[QLatin1String("type")] = "VLayoutPoint";
pointObject[QLatin1String("x")] = x();
pointObject[QLatin1String("y")] = y();
pointObject["type"_L1] = "VLayoutPoint";
pointObject["x"_L1] = x();
pointObject["y"_L1] = y();
if (m_turnPoint)
{
pointObject[QLatin1String("turnPoint")] = m_turnPoint;
pointObject["turnPoint"_L1] = m_turnPoint;
}
if (m_curvePoint)
{
pointObject[QLatin1String("curvePoint")] = m_curvePoint;
pointObject["curvePoint"_L1] = m_curvePoint;
}
return pointObject;

View File

@ -50,6 +50,8 @@
#include "../vmisc/def.h"
#include "../vmisc/vabstractvalapplication.h"
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
@ -254,12 +256,11 @@ auto VPoster::Borders(QGraphicsItem *parent, const PosterData &img, vsizetype sh
sheet = QCoreApplication::translate("VPoster", "Sheet %1 of %2").arg(img.index + 1).arg(sheets);
}
labels->setHtml(QString("<table width='100%'>"
"<tr>"
"<td>%1</td><td align='center'>%2</td><td align='right'>%3</td>"
"</tr>"
"</table>")
.arg(grid, page, sheet));
labels->setHtml(u"<table width='100%'>"
"<tr>"
"<td>%1</td><td align='center'>%2</td><td align='right'>%3</td>"
"</tr>"
"</table>"_s.arg(grid, page, sheet));
data.append(labels);
@ -317,7 +318,7 @@ auto VPoster::ImageWatermark(QGraphicsItem *parent, const PosterData &img, const
if (watermark.isNull())
{
const QString errorMsg =
QCoreApplication::translate("VPoster", "Cannot open the watermark image.") + QChar(' ') + error;
QCoreApplication::translate("VPoster", "Cannot open the watermark image.") + ' '_L1 + error;
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;

View File

@ -28,9 +28,9 @@
#include "vrawlayout.h"
#include <QDataStream>
#include <QIODevice>
#include <QDebug>
#include <QFile>
#include <QIODevice>
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
@ -38,10 +38,16 @@
#include <QScopeGuard>
#endif
#include "../vmisc/def.h"
#include "../ifc/exception/vexception.h"
#include "../vmisc/def.h"
const QByteArray VRawLayout::fileHeaderByteArray = QByteArray("RLD!...");
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
const QByteArray VRawLayout::fileHeaderByteArray = "RLD!..."_ba;
const quint16 VRawLayout::fileVersion = 1;
const quint32 VRawLayoutData::streamHeader = 0x8B0E8A27; // CRC-32Q string "VRawLayoutData"
@ -70,8 +76,8 @@ auto operator>>(QDataStream &dataStream, VRawLayoutData &data) -> QDataStream &
{
QString message = QCoreApplication::tr("VRawLayoutData prefix mismatch error: actualStreamHeader = 0x%1 and "
"streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(VRawLayoutData::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, '0'_L1)
.arg(VRawLayoutData::streamHeader, 8, 0x10, '0'_L1);
throw VException(message);
}
@ -82,23 +88,25 @@ auto operator>>(QDataStream &dataStream, VRawLayoutData &data) -> QDataStream &
{
QString message = QCoreApplication::tr("VRawLayoutData compatibility error: actualClassVersion = %1 and "
"classVersion = %2")
.arg( actualClassVersion ).arg(VRawLayoutData::classVersion);
.arg(actualClassVersion)
.arg(VRawLayoutData::classVersion);
throw VException(message);
}
dataStream >> data.pieces;
// if (actualClassVersion >= 2)
// {
// // read value in version 2
// }
// if (actualClassVersion >= 2)
// {
// // read value in version 2
// }
return dataStream;
}
//---------------------------------------------------------------------------------------------------------------------
VRawLayout::VRawLayout()
{}
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VRawLayout::WriteFile(QIODevice *ioDevice, const VRawLayoutData &data) -> bool
@ -141,13 +149,14 @@ auto VRawLayout::ReadFile(QIODevice *ioDevice, VRawLayoutData &data) -> bool
if (wasOpen || ioDevice->open(QIODevice::ReadOnly))
{
auto CloseFile = qScopeGuard([wasOpen, ioDevice]()
{
if (not wasOpen) // Only close this if it was opened by this function.
{
ioDevice->close();
}
});
auto CloseFile = qScopeGuard(
[wasOpen, ioDevice]()
{
if (not wasOpen) // Only close this if it was opened by this function.
{
ioDevice->close();
}
});
QDataStream dataStream(ioDevice);
dataStream.setVersion(QDataStream::Qt_5_4);
@ -157,8 +166,8 @@ auto VRawLayout::ReadFile(QIODevice *ioDevice, VRawLayoutData &data) -> bool
// a large amount of memory if the wrong file type was read. Instead, we'll just read the
// same number of bytes that are in the array we are comparing it to. No size was written.
const int len = static_cast<int>(fileHeaderByteArray.size());
QByteArray actualFileHeaderByteArray( len, '\0' );
dataStream.readRawData( actualFileHeaderByteArray.data(), len );
QByteArray actualFileHeaderByteArray(len, '\0');
dataStream.readRawData(actualFileHeaderByteArray.data(), len);
if (actualFileHeaderByteArray != fileHeaderByteArray)
{
@ -174,8 +183,9 @@ auto VRawLayout::ReadFile(QIODevice *ioDevice, VRawLayoutData &data) -> bool
{
// file is from a future version that we don't know how to load
m_errorString = tr("VRawLayout::ReadFile() failed.\n"
"Raw layout format compatibility error: actualFileVersion = %1 and fileVersion = %2" )
.arg(actualFileVersion).arg(fileVersion);
"Raw layout format compatibility error: actualFileVersion = %1 and fileVersion = %2")
.arg(actualFileVersion)
.arg(fileVersion);
return false;
}
@ -185,7 +195,7 @@ auto VRawLayout::ReadFile(QIODevice *ioDevice, VRawLayoutData &data) -> bool
// For example, if this file is from a future version of this code.
dataStream >> data;
}
catch (const VException& e)
catch (const VException &e)
{
qCritical() << e.ErrorMessage();
@ -208,11 +218,12 @@ auto VRawLayout::WriteFile(const QString &filePath, const VRawLayoutData &data)
QFile file(filePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
auto CloseFile = qScopeGuard([&file]()
{
file.flush();
file.close();
});
auto CloseFile = qScopeGuard(
[&file]()
{
file.flush();
file.close();
});
return WriteFile(&file, data);
}
@ -226,15 +237,15 @@ auto VRawLayout::ReadFile(const QString &filePath, VRawLayoutData &data) -> bool
QFile file(filePath);
if (file.open(QIODevice::ReadOnly))
{
auto CloseFile = qScopeGuard([&file]()
{
file.flush();
file.close();
});
auto CloseFile = qScopeGuard(
[&file]()
{
file.flush();
file.close();
});
return ReadFile(&file, data);
}
m_errorString = file.errorString();
return false;
}

View File

@ -30,14 +30,20 @@
#include <QJsonObject>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
auto VRawSAPoint::toJson() const -> QJsonObject
{
QJsonObject pointObject = VLayoutPoint::toJson();
pointObject[QLatin1String("type")] = "VRawSAPoint";
pointObject[QLatin1String("loopPoint")] = m_loopPoint;
pointObject[QLatin1String("primary")] = m_primary;
pointObject["type"_L1] = "VRawSAPoint";
pointObject["loopPoint"_L1] = m_loopPoint;
pointObject["primary"_L1] = m_primary;
return pointObject;
}

View File

@ -55,6 +55,8 @@
#include "../vpatterndb/vcontainer.h"
#include "vtextmanager.h"
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
@ -179,8 +181,8 @@ auto operator>>(QDataStream &dataStream, TextLine &data) -> QDataStream &
{
QString message = QCoreApplication::tr("TextLine prefix mismatch error: actualStreamHeader = 0x%1 and "
"streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(TextLine::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, '0'_L1)
.arg(TextLine::streamHeader, 8, 0x10, '0'_L1);
throw VException(message);
}
@ -240,8 +242,8 @@ auto operator>>(QDataStream &dataStream, VTextManager &data) -> QDataStream &
{
QString message = QCoreApplication::tr("VTextManager prefix mismatch error: actualStreamHeader = 0x%1 and "
"streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(VTextManager::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, '0'_L1)
.arg(VTextManager::streamHeader, 8, 0x10, '0'_L1);
throw VException(message);
}
@ -495,7 +497,7 @@ auto ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString lin
auto TestDimension = [per, placeholders, line](const QString &placeholder, const QString &errorMsg)
{
if (line.contains(per + placeholder + per) && placeholders.value(placeholder) == QChar('0'))
if (line.contains(per + placeholder + per) && placeholders.value(placeholder) == '0'_L1)
{
VAbstractApplication::VApp()->IsPedantic()
? throw VException(errorMsg)
@ -866,7 +868,7 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const QFont &font, in
{
if (!currentLine.isEmpty())
{
currentLine += QChar(' ');
currentLine += ' '_L1;
}
currentLine += word;
currentLineWidth = totalWidth;
@ -966,7 +968,7 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const VSvgFont &font,
{
if (!currentLine.isEmpty())
{
currentLine += QChar(' ');
currentLine += ' '_L1;
}
currentLine += word;
currentLineWidth = totalWidth;

View File

@ -54,6 +54,43 @@
class QPointF;
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
namespace Qt
{
inline namespace Literals
{
inline namespace StringLiterals
{
//---------------------------------------------------------------------------------------------------------------------
constexpr inline auto operator"" _L1(char ch) noexcept -> QLatin1Char
{
return QLatin1Char(ch);
}
//---------------------------------------------------------------------------------------------------------------------
constexpr inline auto operator"" _L1(const char *str, size_t size) noexcept -> QLatin1String
{
return QLatin1String(str, static_cast<vsizetype>(size));
}
//---------------------------------------------------------------------------------------------------------------------
inline auto operator"" _ba(const char *str, size_t size) noexcept -> QByteArray
{
return {str, static_cast<vsizetype>(size)};
}
//---------------------------------------------------------------------------------------------------------------------
inline auto operator"" _s(const char16_t *str, size_t size) noexcept -> QString
{
return QString::fromUtf16(str, static_cast<vsizetype>(size));
}
} // namespace StringLiterals
} // namespace Literals
} // namespace Qt
#endif
// Contains helpful methods to hide version dependent code. It can be deprecation of method or change in API
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
@ -328,6 +365,8 @@ inline auto Front(const QString &str) -> QChar
//---------------------------------------------------------------------------------------------------------------------
inline auto FontFromString(const QString &descrip) -> QFont
{
using namespace Qt::Literals::StringLiterals;
QFont font;
if (!descrip.isEmpty())
@ -337,7 +376,7 @@ inline auto FontFromString(const QString &descrip) -> QFont
// Qt 5's QFont::fromString expects a value with 11 fields, e.g.
// Ubuntu,10,-1,5,50,0,0,0,0,0
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const auto l = descrip.split(QLatin1Char(','));
const auto l = descrip.split(','_L1);
// Qt5's QFont::fromString() isn't compatible with Qt6's QFont::toString().
// If we were built with Qt5, don't try to process a font preference that
// was created by Qt6.

View File

@ -61,6 +61,12 @@
#include "../ifc/exception/vexception.h"
#include "literals.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
@ -100,7 +106,7 @@ void InitLanguageList(QComboBox *combobox)
locale.truncate(locale.lastIndexOf('.')); // "valentina_de_De"
locale.remove(0, locale.indexOf('_') + 1); // "de_De"
if (locale.startsWith(QLatin1String("ru")))
if (locale.startsWith("ru"_L1))
{
continue;
}
@ -114,11 +120,11 @@ void InitLanguageList(QComboBox *combobox)
QString lang = loc.nativeLanguageName();
// Since Qt 5.12 country names have spaces
QString country = QLocale::countryToString(loc.country()).remove(' ');
if (country == QLatin1String("Czechia"))
if (country == "Czechia"_L1)
{
country = QLatin1String("CzechRepublic");
country = "CzechRepublic"_L1;
}
QIcon ico(QString("://flags/%1.png").arg(country));
QIcon ico(u"://flags/%1.png"_s.arg(country));
combobox->addItem(ico, lang, locale);
}
@ -127,7 +133,7 @@ void InitLanguageList(QComboBox *combobox)
{
// English language is internal and doens't have own *.qm file.
// Since Qt 5.12 country names have spaces
QIcon ico(QString("://flags/%1.png").arg(QLocale::countryToString(QLocale::UnitedStates).remove(' ')));
QIcon ico(u"://flags/%1.png"_s.arg(QLocale::countryToString(QLocale::UnitedStates).remove(' ')));
QString lang = QLocale(en_US).nativeLanguageName();
combobox->addItem(ico, lang, en_US);
}
@ -332,12 +338,12 @@ void MacosEnableLayerBacking()
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTMark, (QLatin1String("tMark"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, (QLatin1String("vMark"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark2, (QLatin1String("vMark2"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUMark, (QLatin1String("uMark"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBoxMark, (QLatin1String("boxMark"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCheckMark, (QLatin1String("checkMark"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTMark, ("tMark"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, ("vMark"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark2, ("vMark2"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUMark, ("uMark"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBoxMark, ("boxMark"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCheckMark, ("checkMark"_L1)) // NOLINT
QT_WARNING_POP
@ -567,8 +573,8 @@ auto operator>>(QDataStream &in, CustomSARecord &record) -> QDataStream &
{
QString message = QCoreApplication::tr("CustomSARecord prefix mismatch error: actualStreamHeader = 0x%1 "
"and streamHeader = 0x%2")
.arg(actualStreamHeader, 8, 0x10, QChar('0'))
.arg(CustomSARecord::streamHeader, 8, 0x10, QChar('0'));
.arg(actualStreamHeader, 8, 0x10, '0'_L1)
.arg(CustomSARecord::streamHeader, 8, 0x10, '0'_L1);
throw VException(message);
}

View File

@ -47,6 +47,12 @@
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
DialogExportToCSV::DialogExportToCSV(QWidget *parent)
: QDialog(parent),
@ -149,20 +155,20 @@ auto DialogExportToCSV::GetSeparator() const -> QChar
{
if (ui->radioButtonTab->isChecked())
{
return QChar('\t');
return '\t'_L1;
}
if (ui->radioButtonSemicolon->isChecked())
{
return QChar(';');
return ';'_L1;
}
else if (ui->radioButtonSpace->isChecked())
{
return QChar(' ');
}
else
{
return VCommonSettings::GetDefCSVSeparator();
return ' '_L1;
}
return VCommonSettings::GetDefCSVSeparator();
}
//---------------------------------------------------------------------------------------------------------------------
@ -295,7 +301,7 @@ auto DialogExportToCSV::MakeHelpCodecsList() -> QString
if (VTextCodec *codec = VTextCodec::codecForMib(list.at(i)))
{
out += QStringLiteral("\t* ") + codec->name();
out += i < list.size() - 1 ? QLatin1String(",\n") : QLatin1String(".\n");
out += i < list.size() - 1 ? ",\n"_L1 : ".\n"_L1;
}
else
{
@ -308,10 +314,10 @@ auto DialogExportToCSV::MakeHelpCodecsList() -> QString
//---------------------------------------------------------------------------------------------------------------------
auto DialogExportToCSV::MakeHelpSeparatorList() -> QString
{
QString out = QStringLiteral("\n");
out += QLatin1String("\t* 'Tab',\n");
out += QLatin1String("\t* ';',\n");
out += QLatin1String("\t* 'Space',\n");
out += QLatin1String("\t* ','.\n");
QString out = "\n"_L1;
out += "\t* 'Tab',\n"_L1;
out += "\t* ';',\n"_L1;
out += "\t* 'Space',\n"_L1;
out += "\t* ','.\n"_L1;
return out;
}

View File

@ -41,6 +41,12 @@
#define LATEST_TAG_DISTANCE VCS_REPO_STATE_DISTANCE
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
auto AppVersionStr() -> const QString &
{
@ -55,13 +61,13 @@ auto compilerString() -> QString
#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 = QLatin1String("Clang");
iccCompact = "Clang"_L1;
#elif defined(__INTEL_MS_COMPAT_LEVEL)
iccCompact = QLatin1String("Microsoft");
iccCompact = "Microsoft"_L1;
#elif defined(__GNUC__)
iccCompact = QLatin1String("GCC");
iccCompact = Q "GCC"_L1;
#else
iccCompact = QLatin1String("no");
iccCompact = "no"_L1;
#endif
QString iccVersion;
if (__INTEL_COMPILER >= 1300)
@ -73,34 +79,31 @@ auto compilerString() -> QString
iccVersion = QLatin1String(__INTEL_COMPILER);
}
#ifdef __INTEL_COMPILER_UPDATE
return QLatin1String("Intel(R) C++ ") + iccVersion + QChar('.') + QLatin1String(__INTEL_COMPILER_UPDATE) +
QLatin1String(" build ") + QLatin1String(__INTEL_COMPILER_BUILD_DATE) + QLatin1String(" [") +
QLatin1String(iccCompact) + QLatin1String(" compatibility]");
return "Intel(R) C++ "_L1 + iccVersion + '.'_L1 + QLatin1String(__INTEL_COMPILER_UPDATE) + " build "_L1 +
QLatin1String(__INTEL_COMPILER_BUILD_DATE) + " ["_L1 + QLatin1String(iccCompact) + " compatibility]"_L1;
#else
return QLatin1String("Intel(R) C++ ") + iccVersion + QLatin1String(" build ") +
QLatin1String(__INTEL_COMPILER_BUILD_DATE) + QLatin1String(" [") + iccCompact +
QLatin1String(" compatibility]");
return "Intel(R) C++ "_L1 + iccVersion + " build "_L1 + QLatin1String(__INTEL_COMPILER_BUILD_DATE) + " ["_L1 +
iccCompact + " compatibility]"_L1;
#endif
#elif defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
// cppcheck-suppress unassignedVariable
QString isAppleString;
#if defined(__apple_build_version__) // Apple clang has other version numbers
isAppleString = QLatin1String(" (Apple)");
isAppleString = " (Apple)"_L1;
#endif
return QLatin1String("Clang ") + QString::number(__clang_major__) + QLatin1Char('.') +
QString::number(__clang_minor__) + isAppleString;
return "Clang "_L1 + QString::number(__clang_major__) + '.'_L1 + QString::number(__clang_minor__) + isAppleString;
#elif defined(Q_CC_GNU)
return QLatin1String("GCC ") + QLatin1String(__VERSION__);
return "GCC "_L1 + QLatin1String(__VERSION__);
#elif defined(Q_CC_MSVC)
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
{
return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
return "MSVC "_L1 + QString::number(2008 + ((_MSC_VER / 100) - 13));
}
if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
{
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
return "MSVC "_L1 + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
}
return QLatin1String("MSVC <unknown version>");
return "MSVC <unknown version>"_L1;
#else
return QStringLiteral("<unknown compiler>");
#endif

View File

@ -50,6 +50,12 @@
#include "backport/text.h"
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
class QxtCsvModelPrivate : public QxtPrivate<QxtCsvModel>
{
public:

View File

@ -31,6 +31,12 @@
#include <QChar>
#include <QString>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
auto LatinWritingSystem(QChar c) -> bool
{
@ -1569,13 +1575,13 @@ auto WritingSystemSample(SVGFontWritingSystem writingSystem) -> QString
{
case SVGFontWritingSystem::Any:
case SVGFontWritingSystem::Symbol:
sample += QLatin1String("AaBbzZ");
sample += "AaBbzZ"_L1;
break;
case SVGFontWritingSystem::Latin:
sample = QLatin1String("Aa");
sample = "Aa"_L1;
sample += QChar(0x00C3);
sample += QChar(0x00E1);
sample += QLatin1String("Zz");
sample += "Zz"_L1;
break;
case SVGFontWritingSystem::Greek:
sample += QChar(0x0393);

View File

@ -38,6 +38,12 @@
#include "vsvgfontengine.h"
#include "vsvgfontreader.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
@ -199,7 +205,7 @@ auto VSvgFontDatabase::SystemSVGFontPath() -> QString
#ifdef Q_OS_WIN
return QCoreApplication::applicationDirPath() + fontPath;
#elif defined(Q_OS_MAC)
QDir dirBundle(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + fontPath);
QDir dirBundle(QCoreApplication::applicationDirPath() + "/../Resources"_L1 + fontPath);
if (dirBundle.exists())
{
return dirBundle.absolutePath();

View File

@ -40,6 +40,8 @@
#include <QRegion>
#include <QSet>
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VSvgFontEngine::VSvgFontEngine()
: d(new VSvgFontEngineData())
@ -388,7 +390,7 @@ auto VSvgFontEngine::ElidedText(const QString &text, SVGTextElideMode mode, int
}
else
{
ellipsis = QLatin1String("...");
ellipsis = "..."_L1;
}
}

View File

@ -38,22 +38,28 @@
#include <QPainterPath>
#include <QtDebug>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
//---------------------------------------------------------------------------------------------------------------------
auto ParseFontStyle(const QString &fontStyle) -> SVGFontStyle
{
if (fontStyle == QLatin1String("normal"))
if (fontStyle == "normal"_L1)
{
return SVGFontStyle::Normal;
}
if (fontStyle == QLatin1String("italic"))
if (fontStyle == "italic"_L1)
{
return SVGFontStyle::Italic;
}
if (fontStyle == QLatin1String("oblique"))
if (fontStyle == "oblique"_L1)
{
return SVGFontStyle::Oblique;
}
@ -99,12 +105,12 @@ auto ParseFontWeight(const QString &fontWeight) -> SVGFontWeight
else
{
QString fontWeightLower = fontWeight.toLower();
if (fontWeightLower == QLatin1String("normal"))
if (fontWeightLower == "normal"_L1)
{
return SVGFontWeight::Normal;
}
if (fontWeightLower == QLatin1String("bold"))
if (fontWeightLower == "bold"_L1)
{
return SVGFontWeight::Bold;
}
@ -115,13 +121,13 @@ auto ParseFontWeight(const QString &fontWeight) -> SVGFontWeight
//---------------------------------------------------------------------------------------------------------------------
auto InitFont(const QXmlStreamAttributes &fontAttr) -> VSvgFont
{
const auto hax = fontAttr.value(QLatin1String("horiz-adv-x"));
const auto hax = fontAttr.value("horiz-adv-x"_L1);
qreal horizAdvX = hax.toDouble();
QString id = fontAttr.value(QLatin1String("id")).toString();
QString id = fontAttr.value("id"_L1).toString();
if (id.isEmpty())
{
id = fontAttr.value(QLatin1String("xml:id")).toString();
id = fontAttr.value("xml:id"_L1).toString();
}
VSvgFont font(horizAdvX);
@ -141,11 +147,11 @@ auto VSvgFontReader::ReadSvgFontHeader(QFile *file) -> VSvgFont
{
if (readNextStartElement())
{
if (name() == QLatin1String("svg"))
if (name() == "svg"_L1)
{
while (readNextStartElement())
{
if (name() == QLatin1String("defs"))
if (name() == "defs"_L1)
{
return ReadFontHeader();
}
@ -185,11 +191,11 @@ auto VSvgFontReader::ReadSvgFont(QFile *file) -> VSvgFontEngine
{
if (readNextStartElement())
{
if (name() == QLatin1String("svg"))
if (name() == "svg"_L1)
{
while (readNextStartElement())
{
if (name() == QLatin1String("defs"))
if (name() == "defs"_L1)
{
return ReadFontData();
}
@ -221,11 +227,11 @@ auto VSvgFontReader::ReadSvgFont(QFile *file) -> VSvgFontEngine
//---------------------------------------------------------------------------------------------------------------------
auto VSvgFontReader::ReadFontHeader() -> VSvgFont
{
AssertRootTag(QLatin1String("defs"));
AssertRootTag("defs"_L1);
while (readNextStartElement())
{
if (name() == QLatin1String("font"))
if (name() == "font"_L1)
{
return ReadFontFace();
}
@ -238,13 +244,13 @@ auto VSvgFontReader::ReadFontHeader() -> VSvgFont
//---------------------------------------------------------------------------------------------------------------------
auto VSvgFontReader::ReadFontFace() -> VSvgFont
{
AssertRootTag(QLatin1String("font"));
AssertRootTag("font"_L1);
VSvgFont font = InitFont(attributes());
while (readNextStartElement())
{
if (name() == QLatin1String("font-face"))
if (name() == "font-face"_L1)
{
SetFontFace(&font);
return font;
@ -259,11 +265,11 @@ auto VSvgFontReader::ReadFontFace() -> VSvgFont
//---------------------------------------------------------------------------------------------------------------------
auto VSvgFontReader::ReadFontData() -> VSvgFontEngine
{
AssertRootTag(QLatin1String("defs"));
AssertRootTag("defs"_L1);
while (readNextStartElement())
{
if (name() == QLatin1String("font"))
if (name() == "font"_L1)
{
return ReadFont();
}
@ -279,7 +285,7 @@ auto VSvgFontReader::ReadFontData() -> VSvgFontEngine
//---------------------------------------------------------------------------------------------------------------------
auto VSvgFontReader::ReadFont() -> VSvgFontEngine
{
AssertRootTag(QLatin1String("font"));
AssertRootTag("font"_L1);
VSvgFont font = InitFont(attributes());
@ -287,7 +293,7 @@ auto VSvgFontReader::ReadFont() -> VSvgFontEngine
while (readNextStartElement())
{
if (name() == QLatin1String("font-face"))
if (name() == "font-face"_L1)
{
SetFontFace(&font);
engine = VSvgFontEngine(font);
@ -300,7 +306,7 @@ auto VSvgFontReader::ReadFont() -> VSvgFontEngine
while (readNextStartElement())
{
if (name() == QLatin1String("missing-glyph") || name() == QLatin1String("glyph"))
if (name() == "missing-glyph"_L1 || name() == "glyph"_L1)
{
ParseSvgGlyph(&engine, attributes());
}
@ -331,8 +337,8 @@ void VSvgFontReader::AssertRootTag(const QString &tag) const
void VSvgFontReader::SetFontFace(VSvgFont *font)
{
QXmlStreamAttributes fontFaceAttr = attributes();
QString fontFamily = fontFaceAttr.value(QLatin1String("font-family")).toString();
const auto unitsPerEmStr = fontFaceAttr.value(QLatin1String("units-per-em"));
QString fontFamily = fontFaceAttr.value("font-family"_L1).toString();
const auto unitsPerEmStr = fontFaceAttr.value("units-per-em"_L1);
qreal unitsPerEm = unitsPerEmStr.toDouble();
if (qFuzzyIsNull(unitsPerEm))
@ -340,33 +346,33 @@ void VSvgFontReader::SetFontFace(VSvgFont *font)
unitsPerEm = 1000;
}
const auto ascentStr = fontFaceAttr.value(QLatin1String("ascent"));
const auto ascentStr = fontFaceAttr.value("ascent"_L1);
qreal ascent = ascentStr.toDouble();
if (qFuzzyIsNull(ascent))
{
ascent = 800;
}
const auto descentStr = fontFaceAttr.value(QLatin1String("descent"));
const auto descentStr = fontFaceAttr.value("descent"_L1);
qreal descent = descentStr.toDouble();
if (qFuzzyIsNull(descent))
{
descent = -200;
}
QString fontStyle = fontFaceAttr.value(QLatin1String("font-style")).toString();
QString fontWeight = fontFaceAttr.value(QLatin1String("font-weight")).toString();
QString fontStyle = fontFaceAttr.value("font-style"_L1).toString();
QString fontWeight = fontFaceAttr.value("font-weight"_L1).toString();
QString fontName;
while (readNextStartElement())
{
if (name() == QLatin1String("font-face-src"))
if (name() == "font-face-src"_L1)
{
while (readNextStartElement())
{
if (name() == QLatin1String("font-face-name"))
if (name() == "font-face-name"_L1)
{
fontName = attributes().value(QLatin1String("name")).toString();
fontName = attributes().value("name"_L1).toString();
}
else
{
@ -392,9 +398,9 @@ void VSvgFontReader::SetFontFace(VSvgFont *font)
//---------------------------------------------------------------------------------------------------------------------
void VSvgFontReader::ParseSvgGlyph(VSvgFontEngine *engine, const QXmlStreamAttributes &glyphAttr)
{
auto uncStr = glyphAttr.value(QLatin1String("unicode"));
auto havStr = glyphAttr.value(QLatin1String("horiz-adv-x"));
auto pathStr = glyphAttr.value(QLatin1String("d"));
auto uncStr = glyphAttr.value("unicode"_L1);
auto havStr = glyphAttr.value("horiz-adv-x"_L1);
auto pathStr = glyphAttr.value("d"_L1);
QChar unicode = (uncStr.isEmpty()) ? u'\0' : uncStr.at(0);
qreal havx = (havStr.isEmpty()) ? -1 : havStr.toDouble();

View File

@ -34,6 +34,8 @@
#include "../compatibility.h"
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
@ -410,7 +412,7 @@ void VSVGPathTokenizer::Command_m(QPainterPath &path) const
// As per 1.2 spec 8.3.2 The "moveto" commands
// If a 'moveto' is followed by multiple pairs of coordinates without explicit commands,
// the subsequent pairs shall be treated as implicit 'lineto' commands.
m_pathElem = QLatin1Char('l');
m_pathElem = 'l'_L1;
}
//---------------------------------------------------------------------------------------------------------------------
@ -430,7 +432,7 @@ void VSVGPathTokenizer::Command_M(QPainterPath &path) const
// As per 1.2 spec 8.3.2 The "moveto" commands
// If a 'moveto' is followed by multiple pairs of coordinates without explicit commands,
// the subsequent pairs shall be treated as implicit 'lineto' commands.
m_pathElem = QLatin1Char('L');
m_pathElem = 'L'_L1;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -27,20 +27,25 @@
*************************************************************************/
#include "testpath.h"
#include <QVector>
#include <QTemporaryFile>
#include <QJsonObject>
#include <QTextStream>
#include <QJsonDocument>
#include <QJsonObject>
#include <QPointF>
#include <QTemporaryFile>
#include <QTextStream>
#include <QVector>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
#if !defined(V_NO_ASSERT)
// Use for writing tests
auto PointToJson(const QPointF &point) -> QJsonObject
{
QJsonObject pointObject
{
QJsonObject pointObject{
{"type", "QPointF"},
{"x", point.x()},
{"y", point.y()},
@ -52,11 +57,11 @@ auto PointToJson(const QPointF &point) -> QJsonObject
void VectorToJson(const QVector<QPointF> &points, QJsonObject &json)
{
QJsonArray pointsArray;
for (auto point: points)
for (auto point : points)
{
pointsArray.append(PointToJson(point));
}
json[QLatin1String("vector")] = pointsArray;
json["vector"_L1] = pointsArray;
}
#endif // !defined(V_NO_ASSERT)

View File

@ -29,8 +29,8 @@
#define TESTPATH_H
#include <QDir>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QString>
#include <QTemporaryFile>
@ -45,14 +45,12 @@ class VRawSAPoint;
auto PointToJson(const QPointF &point) -> QJsonObject;
void VectorToJson(const QVector<QPointF> &points, QJsonObject &json);
template <class T>
void VectorToJson(const QVector<T> &points, QJsonObject &json);
template <class T> void VectorToJson(const QVector<T> &points, QJsonObject &json);
//---------------------------------------------------------------------------------------------------------------------
template <class T>
void DumpVector(const QVector<T> &points, const QString &templateName=QString())
template <class T> void DumpVector(const QVector<T> &points, const QString &templateName = QString())
{
QTemporaryFile temp; // Go to tmp folder to find dump
QTemporaryFile temp; // Go to tmp folder to find dump
temp.setAutoRemove(false); // Remove dump manually
if (not templateName.isEmpty())
@ -63,14 +61,14 @@ void DumpVector(const QVector<T> &points, const QString &templateName=QString())
if (temp.open())
{
#if defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
// On Linux, QTemporaryFile will attempt to create unnamed temporary
// files. If that succeeds, open() will return true but exists() will be
// false. If you call fileName() or any function that calls it,
// QTemporaryFile will give the file a name, so most applications will
// not see a difference.
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
// On Linux, QTemporaryFile will attempt to create unnamed temporary
// files. If that succeeds, open() will return true but exists() will be
// false. If you call fileName() or any function that calls it,
// QTemporaryFile will give the file a name, so most applications will
// not see a difference.
temp.fileName(); // call to create a file on disk
#endif
#endif
#endif
QJsonObject vectorObject;
VectorToJson(points, vectorObject);
@ -83,11 +81,10 @@ void DumpVector(const QVector<T> &points, const QString &templateName=QString())
}
//---------------------------------------------------------------------------------------------------------------------
template <class T>
void VectorToJson(const QVector<T> &points, QJsonObject &json)
template <class T> void VectorToJson(const QVector<T> &points, QJsonObject &json)
{
QJsonArray pointsArray;
for (auto point: points)
for (auto point : points)
{
pointsArray.append(point.toJson());
}

View File

@ -34,6 +34,12 @@
#include "vtheme.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
auto StandardIconPaths() -> QHash<QStyle::StandardPixmap, QString>
@ -239,7 +245,7 @@ auto VApplicationStyle::layoutSpacing(QSizePolicy::ControlType control1, QSizePo
auto VApplicationStyle::StyleIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
-> QIcon
{
if (VTheme::ThemeStylesheet() == QLatin1String("native"))
if (VTheme::ThemeStylesheet() == "native"_L1)
{
return m_style->standardIcon(standardIcon, option, widget);
}

View File

@ -30,31 +30,35 @@
#include <QJsonObject>
#include <QJsonValue>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ManualLayoutStyleNodeVar, (QLatin1String("ManualLayoutStyle"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetBorderColorVar, (QLatin1String("SheetBorderColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetMarginColorVar, (QLatin1String("SheetMarginColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetGridColorVar, (QLatin1String("SheetGridColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetTileGridColorVar, (QLatin1String("SheetTileGridColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetTileNumberColorVar, (QLatin1String("SheetTileNumberColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceOkColorVar, (QLatin1String("PieceOkColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceErrorColorVar, (QLatin1String("PieceErrorColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceHoverColorVar, (QLatin1String("PieceHoverColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceHandleColorVar, (QLatin1String("PieceHandleColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceHandleHoverColorVar, (QLatin1String("PieceHandleHoverColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceColorVar, (QLatin1String("CarrouselPieceColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ManualLayoutStyleNodeVar, ("ManualLayoutStyle"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetBorderColorVar, ("SheetBorderColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetMarginColorVar, ("SheetMarginColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetGridColorVar, ("SheetGridColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetTileGridColorVar, ("SheetTileGridColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, SheetTileNumberColorVar, ("SheetTileNumberColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceOkColorVar, ("PieceOkColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceErrorColorVar, ("PieceErrorColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceHoverColorVar, ("PieceHoverColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceHandleColorVar, ("PieceHandleColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceHandleHoverColorVar, ("PieceHandleHoverColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceColorVar, ("CarrouselPieceColor"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceSelectedColorVar, (QLatin1String("CarrouselPieceSelectedColor")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceSelectedColorVar, ("CarrouselPieceSelectedColor"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceBackgroundColorVar,
(QLatin1String("CarrouselPieceBackgroundColor")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceBackgroundColorVar, ("CarrouselPieceBackgroundColor"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceForegroundColorVar,
(QLatin1String("CarrouselPieceForegroundColor")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, CarrouselPieceForegroundColorVar, ("CarrouselPieceForegroundColor"_L1))
QT_WARNING_POP
} // namespace

View File

@ -29,20 +29,26 @@
#include <QJsonObject>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PatternPieceStyleNodeVar, (QLatin1String("PatternPieceStyle"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceColorVar, (QLatin1String("PieceColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PointColorVar, (QLatin1String("PointColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, NodeLabelColorVar, (QLatin1String("NodeLabelColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, NodeLabelHoverColorVar, (QLatin1String("NodeLabelHoverColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, NodeLabelLineColorVar, (QLatin1String("NodeLabelLineColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelBackgroundColorVar, (QLatin1String("LabelBackgroundColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelTextColorVar, (QLatin1String("LabelTextColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelModeColorVar, (QLatin1String("LabelModeColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PatternPieceStyleNodeVar, ("PatternPieceStyle"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PieceColorVar, ("PieceColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PointColorVar, ("PointColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, NodeLabelColorVar, ("NodeLabelColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, NodeLabelHoverColorVar, ("NodeLabelHoverColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, NodeLabelLineColorVar, ("NodeLabelLineColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelBackgroundColorVar, ("LabelBackgroundColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelTextColorVar, ("LabelTextColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelModeColorVar, ("LabelModeColor"_L1)) // NOLINT
QT_WARNING_POP
} // namespace

View File

@ -33,28 +33,34 @@
#include <algorithm>
#include <vector>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
namespace
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ToolStyleNodeVar, (QLatin1String("ToolStyle"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PatternColorVar, (QLatin1String("PatternColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, DisabledColorVar, (QLatin1String("DisabledColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ColorAdjustmentsVar, (QLatin1String("ColorAdjustments"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PointColorVar, (QLatin1String("PointColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelColorVar, (QLatin1String("LabelColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelHoverColorVar, (QLatin1String("LabelHoverColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelLineColorVar, (QLatin1String("LabelLineColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AccuracyRadiusColorVar, (QLatin1String("AccuracyRadiusColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ControlLineColorVar, (QLatin1String("ControlLineColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ControlPointColorVar, (QLatin1String("ControlPointColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisMainColorVar, (QLatin1String("VisMainColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColorVar, (QLatin1String("VisSupportColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColor2Var, (QLatin1String("VisSupportColor2"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColor3Var, (QLatin1String("VisSupportColor3"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColor4Var, (QLatin1String("VisSupportColor4"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, BasePointColorVar, (QLatin1String("BasePointColor"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ToolStyleNodeVar, ("ToolStyle"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PatternColorVar, ("PatternColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, DisabledColorVar, ("DisabledColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ColorAdjustmentsVar, ("ColorAdjustments"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, PointColorVar, ("PointColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelColorVar, ("LabelColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelHoverColorVar, ("LabelHoverColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, LabelLineColorVar, ("LabelLineColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AccuracyRadiusColorVar, ("AccuracyRadiusColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ControlLineColorVar, ("ControlLineColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, ControlPointColorVar, ("ControlPointColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisMainColorVar, ("VisMainColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColorVar, ("VisSupportColor"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColor2Var, ("VisSupportColor2"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColor3Var, ("VisSupportColor3"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, VisSupportColor4Var, ("VisSupportColor4"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, BasePointColorVar, ("BasePointColor"_L1)) // NOLINT
QT_WARNING_POP

View File

@ -62,6 +62,8 @@
#include "appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
using namespace Qt::Literals::StringLiterals;
namespace
{
auto FilterLocales(const QStringList &locales) -> QStringList
@ -69,7 +71,7 @@ auto FilterLocales(const QStringList &locales) -> QStringList
QStringList filtered;
for (const auto &locale : locales)
{
if (not locale.startsWith(QLatin1String("ru")))
if (not locale.startsWith("ru"_L1))
{
filtered.append(locale);
}
@ -118,17 +120,17 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
#if defined(V_NO_ASSERT)
// Ignore SSL-related warnings
// See issue #528: Error: QSslSocket: cannot resolve SSLv2_client_method.
rules += QLatin1String("qt.network.ssl.warning=false\n");
rules += "qt.network.ssl.warning=false\n"_L1;
// See issue #568: Certificate checking on Mac OS X.
rules += QLatin1String("qt.network.ssl.critical=false\n"
"qt.network.ssl.fatal=false\n");
rules += "qt.network.ssl.critical=false\n"
"qt.network.ssl.fatal=false\n"_L1;
#endif // defined(V_NO_ASSERT)
#if defined(V_NO_ASSERT)
// See issue #992: QXcbConnection: XCB Error.
rules += QLatin1String("qt.qpa*=false\n");
rules += QLatin1String("kf5.kio.core*=false\n");
rules += QLatin1String("qt.gui.icc.warning=false\n");
rules += "qt.qpa*=false\n"_L1;
rules += "kf5.kio.core*=false\n"_L1;
rules += "qt.gui.icc.warning=false\n"_L1;
#endif
if (not rules.isEmpty())
@ -189,12 +191,11 @@ auto VAbstractApplication::translationsPath(const QString &locale) -> QString
QString mainPath;
if (locale.isEmpty())
{
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath;
mainPath = QCoreApplication::applicationDirPath() + "/../Resources"_L1 + trPath;
}
else
{
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath +
QLatin1String("/") + locale + QLatin1String(".lproj");
mainPath = QCoreApplication::applicationDirPath() + "/../Resources"_L1 + trPath + '/'_L1 + locale + ".lproj"_L1;
}
QDir dirBundle(mainPath);
if (dirBundle.exists())
@ -285,7 +286,7 @@ void VAbstractApplication::WinAttachConsole()
//---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::LoadTranslation(QString locale)
{
if (locale.startsWith(QLatin1String("ru")))
if (locale.startsWith("ru"_L1))
{
locale = QString();
}
@ -468,7 +469,7 @@ void VAbstractApplication::CacheTextCodec(QStringConverter::Encoding encoding, V
void VAbstractApplication::CheckSystemLocale()
{
const QString defLocale = QLocale::system().name();
if (defLocale.startsWith(QLatin1String("ru")))
if (defLocale.startsWith("ru"_L1))
{
qFatal("Incompatible locale \"%s\"", qPrintable(defLocale));
}
@ -537,7 +538,7 @@ void VAbstractApplication::InitHighDpiScaling(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/* For more info see: http://doc.qt.io/qt-5/highdpi.html */
if (IsOptionSet(argc, argv, qPrintable(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING)))
if (IsOptionSet(argc, argv, qPrintable("--"_L1 + LONG_OPTION_NO_HDPI_SCALING)))
{
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
}

View File

@ -32,6 +32,12 @@
#include <QTranslator>
#include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VAbstractValApplication::VAbstractValApplication(int &argc, char **argv)
: VAbstractApplication(argc, argv)
@ -95,7 +101,7 @@ auto VAbstractValApplication::GetPlaceholderTranslator() -> QSharedPointer<QTran
pieceLabelLocale = settings->GetLocale();
}
if (pieceLabelLocale.startsWith(QLatin1String("ru")))
if (pieceLabelLocale.startsWith("ru"_L1))
{
return QSharedPointer<QTranslator>(new QTranslator);
}

View File

@ -53,6 +53,8 @@
#include "defglobal.h"
#include "literals.h"
using namespace Qt::Literals::StringLiterals;
const int VCommonSettings::defaultScrollingDuration = 300;
const int VCommonSettings::scrollingDurationMin = 100;
const int VCommonSettings::scrollingDurationMax = 1000;
@ -85,158 +87,142 @@ QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
namespace
{
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements,
(QLatin1String("paths/individual_measurements")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsIndividualMeasurements, ("paths/individual_measurements"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements,
(QLatin1String("paths/standard_measurements")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, (QLatin1String("paths/pattern"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsManualLayouts, (QLatin1String("paths/manualLayouts"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsSVGFonts, (QLatin1String("paths/svgFonts"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsMultisizeMeasurements, ("paths/standard_measurements"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsPattern, ("paths/pattern"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsManualLayouts, ("paths/manualLayouts"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsSVGFonts, ("paths/svgFonts"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsFontCorrections, (QLatin1String("paths/fontCorrections")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsFontCorrections, ("paths/fontCorrections"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, (QLatin1String("configuration/osSeparator")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationOsSeparator, ("configuration/osSeparator"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState,
(QLatin1String("configuration/autosave/state")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveState, ("configuration/autosave/state"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime,
(QLatin1String("configuration/autosave/time")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, (QLatin1String("configuration/locale"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAutosaveTime, ("configuration/autosave/time"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLocale, ("configuration/locale"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationPieceLabelLocale,
(QLatin1String("configuration/pieceLabelLocale")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, (QLatin1String("configuration/pmscode"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUnit, (QLatin1String("configuration/unit"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationPieceLabelLocale, ("configuration/pieceLabelLocale"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, ("configuration/pmscode"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUnit, ("configuration/unit"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion,
(QLatin1String("configuration/confirm_item_deletion")))
("configuration/confirm_item_deletion"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting,
(QLatin1String("configuration/confirm_format_rewriting")))
("configuration/confirm_format_rewriting"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAskContinueIfLayoutStale,
(QLatin1String("configuration/askContinueIfLayoutStale")))
("configuration/askContinueIfLayoutStale"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle,
(QLatin1String("configuration/tool_bar_style")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, ("configuration/tool_bar_style"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolboxIconSizeSmall,
(QLatin1String("configuration/toolboxIconSizeSmall")))
("configuration/toolboxIconSizeSmall"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode,
(QLatin1String("configuration/freeCurveMode")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, ("configuration/freeCurveMode"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP,
(QLatin1String("configuration/doubleClickZoomFitBestCurrentPP")))
("configuration/doubleClickZoomFitBestCurrentPP"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationInteractiveTools,
(QLatin1String("configuration/interactiveTools")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationInteractiveTools, ("configuration/interactiveTools"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog,
(QLatin1String("configuration/dontUseNativeDialog")))
("configuration/dontUseNativeDialog"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, ("pattern/undo"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, ("pattern/forbidFlipping"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, (QLatin1String("pattern/forceFlipping")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForceFlipping, ("pattern/forceFlipping"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSewLineOnDrawing, (QLatin1String("pattern/sewLineOnDrawing")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, (QLatin1String("pattern/hideMainPath"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, (QLatin1String("pattern/doublePassmark"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSewLineOnDrawing, ("pattern/sewLineOnDrawing"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideMainPath, ("pattern/hideMainPath"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDoublePassmark, ("pattern/doublePassmark"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance,
(QLatin1String("pattern/defaultSeamAllowance")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, (QLatin1String("pattern/labelFont"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelSVGFont, (QLatin1String("pattern/labelSVGFont"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternDefaultSeamAllowance, ("pattern/defaultSeamAllowance"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFont, ("pattern/labelFont"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelSVGFont, ("pattern/labelSVGFont"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPieceLabelFontPointSize,
(QLatin1String("pattern/pieceLabelFontPointSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPieceLabelFontPointSize, ("pattern/pieceLabelFontPointSize"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSingleStrokeOutlineFont,
(QLatin1String("pattern/singleStrokeOutlineFont")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSingleStrokeOutlineFont, ("pattern/singleStrokeOutlineFont"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSingleLineFonts, (QLatin1String("pattern/singleLineFonts")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, (QLatin1String("pattern/lineWidth"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternSingleLineFonts, ("pattern/singleLineFonts"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLineWidth, ("pattern/lineWidth"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale,
(QLatin1String("pattern/curveApproximationScale")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternCurveApproximationScale, ("pattern/curveApproximationScale"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, (QLatin1String("pattern/showCurveDetails")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowCurveDetails, ("pattern/showCurveDetails"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath, (QLatin1String("pattern/pieceShowMainPath")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternPieceShowMainPath, ("pattern/pieceShowMainPath"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, (QLatin1String("pattern/labelFontSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, (QLatin1String("pattern/hideLabels"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternLabelFontSize, ("pattern/labelFontSize"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternHideLabels, ("pattern/hideLabels"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowAccuracyRadius,
(QLatin1String("pattern/showAccuracyRadius")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternShowAccuracyRadius, ("pattern/showAccuracyRadius"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, (QLatin1String("pattern/useOpenGLRender")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUseOpenGLRender, ("pattern/useOpenGLRender"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, (QLatin1String("pattern/graphicalOutput")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternGraphicalOutput, ("pattern/graphicalOutput"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsPatternTranslateFormula, (QLatin1String("pattern/translateFormula")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, (QLatin1String("recentFileList"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, (QLatin1String("restoreFileList"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, (QLatin1String("geometry"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, (QLatin1String("toolbarsState"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsPatternTranslateFormula, ("pattern/translateFormula"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRecentFileList, ("recentFileList"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralRestoreFileList, ("restoreFileList"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralGeometry, ("geometry"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingGeneralToolbarsState, ("toolbarsState"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationThemeMode, (QLatin1String("configuration/themeMode")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, (QLatin1String("preferenceDialogSize"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationThemeMode, ("configuration/themeMode"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPreferenceDialogSize, ("preferenceDialogSize"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize,
(QLatin1String("toolSeamAllowanceDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize, ("toolSeamAllowanceDialogSize"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, ("toolIncrementsDialogSize"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, ("formulaWizardDialogSize"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize,
(QLatin1String("finalMeasurementsDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, ("finalMeasurementsDialogSize"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, (QLatin1String("layoutSettingsDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDialogSplinePathSize, (QLatin1String("splinePathDialogSize"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, ("layoutSettingsDialogSize"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDialogSplinePathSize, ("splinePathDialogSize"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, (QLatin1String("automaticallyCheckUpdates")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, ("automaticallyCheckUpdates"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, ("lastestSkippedVersion"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, ("dateOfLastRemind"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVWithHeader, (QLatin1String("csv/withHeader"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVCodec, (QLatin1String("csv/withCodec"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVSeparator, (QLatin1String("csv/withSeparator"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVWithHeader, ("csv/withHeader"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVCodec, ("csv/withCodec"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingCSVSeparator, ("csv/withSeparator"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelDateFormat, (QLatin1String("label/dateFormat"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelDateFormat, ("label/dateFormat"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, (QLatin1String("label/userDateFormats")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, (QLatin1String("label/timeFormat"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserDateFormats, ("label/userDateFormats"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelTimeFormat, ("label/timeFormat"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, (QLatin1String("label/userTimeFormats")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLabelUserTimeFormats, ("label/userTimeFormats"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, ("scrolling/duration"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, ("scrolling/updateInterval"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale,
(QLatin1String("scrolling/sensorMouseScale")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale, ("scrolling/sensorMouseScale"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, ("scrolling/wheelMouseScale"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, ("scrolling/acceleration"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, (QLatin1String("tiledPDF/margins"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, ("tiledPDF/margins"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, ("tiledPDF/orientation"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkEditorSize, (QLatin1String("watermarkEditorSize"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkEditorSize, ("watermarkEditorSize"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkCustomColors, (QLatin1String("watermarkCustomColors")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingWatermarkCustomColors, ("watermarkCustomColors"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictAskCollect, (QLatin1String("askCollect"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictCollect, (QLatin1String("collect"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictClientID, (QLatin1String("clientID"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictAskCollect, ("askCollect"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictCollect, ("collect"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingsStatistictClientID, ("clientID"_L1)) // NOLINT
// Reading settings file is very expensive, cache curve approximation to speed up getting value
qreal curveApproximationCached = -1; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
@ -261,7 +247,7 @@ auto ClearFormats(const QStringList &predefinedFormats, QStringList formats) ->
}
} // namespace
Q_GLOBAL_STATIC_WITH_ARGS(const QString, commonIniFilename, (QLatin1String("common"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, commonIniFilename, ("common"_L1)) // NOLINT
#if !defined(Q_OS_WIN)
const QString VCommonSettings::unixStandardSharePath = QStringLiteral(PKGDATADIR); // NOLINT(cert-err58-cpp)
@ -977,20 +963,20 @@ auto VCommonSettings::GetCSVSeparator() const -> QChar
switch (separator)
{
case 0:
return QChar('\t'); // NOLINT(modernize-return-braced-init-list)
return '\t'_L1;
case 1:
return QChar(';'); // NOLINT(modernize-return-braced-init-list)
return ';'_L1;
case 2:
return QChar(' '); // NOLINT(modernize-return-braced-init-list)
return ' '_L1;
default:
return QChar(','); // NOLINT(modernize-return-braced-init-list)
return ','_L1;
}
}
//---------------------------------------------------------------------------------------------------------------------
auto VCommonSettings::GetDefCSVSeparator() -> QChar
{
return QChar(','); // NOLINT(modernize-return-braced-init-list)
return ','_L1;
}
//---------------------------------------------------------------------------------------------------------------------
@ -1029,7 +1015,7 @@ auto VCommonSettings::GetDefaultSeamAllowance() -> double
if (not ok)
{
qDebug() << "Could not convert value" << value(*settingPatternDefaultSeamAllowance, 0)
<< "to real. Return default value for default seam allowance is " << defaultValue << QChar('.');
<< "to real. Return default value for default seam allowance is " << defaultValue << '.'_L1;
val = defaultValue;
}

View File

@ -1,7 +1,7 @@
import qbs.Utilities
VLib {
Depends { name: "Qt"; submodules: ["core", "printsupport"] }
Depends { name: "Qt"; submodules: ["core", "printsupport", "gui"] }
name: "VMiscLib"
files: {

View File

@ -29,11 +29,17 @@
#include <QKeySequence>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VModifierKey::VModifierKey(int key)
: m_nativeText(QKeySequence(static_cast<int>(key)).toString(QKeySequence::NativeText))
: m_nativeText(QKeySequence(static_cast<int>(key)).toString(QKeySequence::NativeText))
{
if (m_nativeText.endsWith(QLatin1Char('+')))
if (m_nativeText.endsWith('+'_L1))
{
m_nativeText.chop(1);
}
@ -41,14 +47,14 @@ VModifierKey::VModifierKey(int key)
//---------------------------------------------------------------------------------------------------------------------
VModifierKey::VModifierKey(Qt::KeyboardModifiers keys)
: VModifierKey(static_cast<int>(keys))
: VModifierKey(static_cast<int>(keys))
{
// nothing else
}
//---------------------------------------------------------------------------------------------------------------------
VModifierKey::VModifierKey(Qt::Key key)
: VModifierKey(static_cast<int>(key))
: VModifierKey(static_cast<int>(key))
{
// nothing else
}

View File

@ -43,6 +43,8 @@
#include "def.h"
#include "qglobal.h"
using namespace Qt::Literals::StringLiterals;
#ifndef QPRINTENGINE_H
Q_DECLARE_METATYPE(QMarginsF) // NOLINT
#endif
@ -53,138 +55,128 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wunused-member-function")
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
(QLatin1String("configuration/label_language")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage, ("configuration/label_language"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolPointerMode,
(QLatin1String("configuration/toolPointerMode")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolPointerMode, ("configuration/toolPointerMode"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUseToolGroups,
(QLatin1String("configuration/useToolGroups")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUseToolGroups, ("configuration/useToolGroups"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
(QLatin1String("configuration/autoRefreshPatternMessage")))
("configuration/autoRefreshPatternMessage"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, (QLatin1String("paths/labels"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, ("paths/layout"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLabelTemplate, ("paths/labels"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, ("pattern/knownMaterials"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, ("pattern/rememberMaterials"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternBackgroundImageDefOpacity,
(QLatin1String("pattern/backgroundImageDefOpacity")))
("pattern/backgroundImageDefOpacity"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, ("layout/width"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, ("layout/sorting"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, ("layout/paperHeight"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, ("layout/paperWidth"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, ("layout/followGrainline"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutManualPriority, (QLatin1String("layout/manualPriority")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutNestQuantity, (QLatin1String("layout/nestQuantity"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutManualPriority, ("layout/manualPriority"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutNestQuantity, ("layout/nestQuantity"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropLength, (QLatin1String("layout/autoCropLength")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropWidth, (QLatin1String("layout/autoCropWidth"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropLength, ("layout/autoCropLength"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCropWidth, ("layout/autoCropWidth"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, ("layout/saveLength"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPreferOneSheetSolution,
(QLatin1String("layout/preferOneSheetSolution")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, (QLatin1String("layout/ignoreFields"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPreferOneSheetSolution, ("layout/preferOneSheetSolution"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, ("layout/unitePages"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, ("layout/showGrainline"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, ("layout/fields"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, ("layout/ignoreFields"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingMultiplier, (QLatin1String("layout/multiplier"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTextAsPaths, (QLatin1String("layout/textAsPaths"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingNestingTime, (QLatin1String("layout/time"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, ("layout/stripOptimization"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingMultiplier, ("layout/multiplier"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTextAsPaths, ("layout/textAsPaths"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingNestingTime, ("layout/time"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingEfficiencyCoefficient, (QLatin1String("layout/efficiencyCoefficient")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, (QLatin1String("layout/exportFormat"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDetailExportFormat, (QLatin1String("detail/exportFormat"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingEfficiencyCoefficient, ("layout/efficiencyCoefficient"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDetailExportFormat, ("detail/exportFormat"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, ("tiledPDF/paperHeight"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, ("tiledPDF/paperWidth"_L1)) // NOLINT
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingdockWidgetGroupsActive, (QLatin1String("dockWidget/groupsActive")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingdockWidgetGroupsActive, ("dockWidget/groupsActive"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetToolOptionsActive,
(QLatin1String("dockWidget/toolOptionsActive")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetToolOptionsActive, ("dockWidget/toolOptionsActive"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPatternMessagesActive,
(QLatin1String("dockWidget/patternMessagesActive")))
("dockWidget/patternMessagesActive"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetBackgroundImagesActive,
(QLatin1String("dockWidget/backgroundImagesActive")))
("dockWidget/backgroundImagesActive"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternMessagesFontSize, (QLatin1String("font/patternMessagesSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternMessagesFontSize, ("font/patternMessagesSize"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryHistory, (QLatin1String("searchHistory/history")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryHistory, ("searchHistory/history"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryIncrements, (QLatin1String("searchHistory/increments")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryIncrements, ("searchHistory/increments"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryPreviewCalculations,
(QLatin1String("searchHistory/previewCalculations")))
("searchHistory/previewCalculations"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryFinalMeasurements,
(QLatin1String("searchHistory/finalMeasurements")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchHistoryFinalMeasurements, ("searchHistory/finalMeasurements"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryUseUnicodeProperties,
(QLatin1String("searchOptions/historyUseUnicodeProperties")))
("searchOptions/historyUseUnicodeProperties"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryWholeWord,
(QLatin1String("searchOptions/historyWholeWord")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryWholeWord, ("searchOptions/historyWholeWord"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryRegexp,
(QLatin1String("searchOptions/historyRegexp")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryRegexp, ("searchOptions/historyRegexp"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryMatchCase,
(QLatin1String("searchOptions/historyMatchCase")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsHistoryMatchCase, ("searchOptions/historyMatchCase"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsUseUnicodeProperties,
(QLatin1String("searchOptions/incrementsUseUnicodeProperties")))
("searchOptions/incrementsUseUnicodeProperties"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsWholeWord,
(QLatin1String("searchOptions/incrementsWholeWord")))
("searchOptions/incrementsWholeWord"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsRegexp,
(QLatin1String("searchOptions/incrementsRegexp")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsRegexp, ("searchOptions/incrementsRegexp"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsIncrementsMatchCase,
(QLatin1String("searchOptions/incrementsMatchCase")))
("searchOptions/incrementsMatchCase"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsUseUnicodeProperties,
(QLatin1String("searchOptions/previewCalculationsUseUnicodeProperties")))
("searchOptions/previewCalculationsUseUnicodeProperties"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsWholeWord,
(QLatin1String("searchOptions/previewCalculationsWholeWord")))
("searchOptions/previewCalculationsWholeWord"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsRegexp,
(QLatin1String("searchOptions/previewCalculationsRegexp")))
("searchOptions/previewCalculationsRegexp"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsPreviewCalculationsMatchCase,
(QLatin1String("searchOptions/previewCalculationsMatchCase")))
("searchOptions/previewCalculationsMatchCase"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsUseUnicodeProperties,
(QLatin1String("searchOptions/finalMeasurementsUseUnicodeProperties")))
("searchOptions/finalMeasurementsUseUnicodeProperties"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsWholeWord,
(QLatin1String("searchOptions/finalMeasurementsWholeWord")))
("searchOptions/finalMeasurementsWholeWord"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsRegexp,
(QLatin1String("searchOptions/finalMeasurementsRegexp")))
("searchOptions/finalMeasurementsRegexp"_L1))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingSearchOptionsFinalMeasurementsMatchCase,
(QLatin1String("searchOptions/finalMeasurementsMatchCase")))
("searchOptions/finalMeasurementsMatchCase"_L1))
QT_WARNING_POP
} // namespace

View File

@ -54,6 +54,12 @@
#include <ciso646> // and, not, or
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
class QPaintDevice;
class QPixmap;
class QPoint;
@ -170,7 +176,7 @@ void VObjEngine::drawPath(const QPainterPath &path)
qint64 sq = Square(polygon);
++planeCount;
*stream << "o Plane." << QString("%1").arg(planeCount, 3, 10, QLatin1Char('0')) << Qt::endl;
*stream << "o Plane." << u"%1"_s.arg(planeCount, 3, 10, '0'_L1) << Qt::endl;
quint32 num_points = 0;
@ -239,7 +245,7 @@ void VObjEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
for (int i = 0; i < pointCount; ++i)
{
*stream << QString(" %1").arg(static_cast<int>(globalPointsCount) - pointCount + i + 1);
*stream << u" %1"_s.arg(static_cast<int>(globalPointsCount) - pointCount + i + 1);
}
*stream << Qt::endl;
}

View File

@ -32,6 +32,12 @@
#include <QComboBox>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
// pattern making systems codes
const QString p0_S = QStringLiteral("p0");
const QString p1_S = QStringLiteral("p1");
@ -94,62 +100,11 @@ const QString p998_S = QStringLiteral("p998");
auto ListPMSystems() -> QStringList
{
QStringList list;
list << p0_S
<< p1_S
<< p2_S
<< p3_S
<< p4_S
<< p5_S
<< p6_S
<< p7_S
<< p8_S
<< p9_S
<< p10_S
<< p11_S
<< p12_S
<< p13_S
<< p14_S
<< p15_S
<< p16_S
<< p17_S
<< p18_S
<< p19_S
<< p20_S
<< p21_S
<< p22_S
<< p23_S
<< p24_S
<< p25_S
<< p26_S
<< p27_S
<< p28_S
<< p29_S
<< p30_S
<< p31_S
<< p32_S
<< p33_S
<< p34_S
<< p35_S
<< p36_S
<< p37_S
<< p38_S
<< p39_S
<< p40_S
<< p41_S
<< p42_S
<< p43_S
<< p44_S
<< p45_S
<< p46_S
<< p47_S
<< p48_S
<< p49_S
<< p50_S
<< p51_S
<< p52_S
<< p53_S
<< p54_S
<< p998_S;
list << p0_S << p1_S << p2_S << p3_S << p4_S << p5_S << p6_S << p7_S << p8_S << p9_S << p10_S << p11_S << p12_S
<< p13_S << p14_S << p15_S << p16_S << p17_S << p18_S << p19_S << p20_S << p21_S << p22_S << p23_S << p24_S
<< p25_S << p26_S << p27_S << p28_S << p29_S << p30_S << p31_S << p32_S << p33_S << p34_S << p35_S << p36_S
<< p37_S << p38_S << p39_S << p40_S << p41_S << p42_S << p43_S << p44_S << p45_S << p46_S << p47_S << p48_S
<< p49_S << p50_S << p51_S << p52_S << p53_S << p54_S << p998_S;
return list;
}
@ -161,16 +116,15 @@ void InitPMSystems(QComboBox *systemCombo)
QMap<QString, QString> systems;
for (const auto &sys : listSystems)
{
systems.insert(VAbstractApplication::VApp()->TrVars()->PMSystemName(sys) + QLatin1String(" (") + sys +
QLatin1String(")"), sys);
systems.insert(VAbstractApplication::VApp()->TrVars()->PMSystemName(sys) + " ("_L1 + sys + ')'_L1, sys);
}
// * The default option (blank field or 'None') should appear at the top of the list.
// * The list should be sorted alphabetically so users can find their system easily.
// * The default option (blank field or 'None') should appear at the top of the list.
// * The list should be sorted alphabetically so users can find their system easily.
SCASSERT(systemCombo != nullptr)
systemCombo->addItem(VAbstractApplication::VApp()->TrVars()->PMSystemName(listSystems.at(listSystems.size()-1)),
listSystems.at(listSystems.size()-1));
systemCombo->addItem(VAbstractApplication::VApp()->TrVars()->PMSystemName(listSystems.at(listSystems.size() - 1)),
listSystems.at(listSystems.size() - 1));
QMap<QString, QString>::const_iterator i = systems.constBegin();
while (i != systems.constEnd())

View File

@ -31,30 +31,36 @@
#include <QLatin1String>
#include <QMessageLogger>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/vspline.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vspline.h"
#include "../vmisc/def.h"
#include "vcurvevariable.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VCurveAngle::VCurveAngle()
:VCurveVariable()
: VCurveVariable()
{
SetType(VarType::CurveAngle);
}
//---------------------------------------------------------------------------------------------------------------------
VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId)
:VCurveVariable(id, parentId)
: VCurveVariable(id, parentId)
{
SetType(VarType::CurveAngle);
}
//---------------------------------------------------------------------------------------------------------------------
VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, CurveAngle angle)
:VCurveVariable(id, parentId)
: VCurveVariable(id, parentId)
{
SetType(VarType::CurveAngle);
SCASSERT(curve != nullptr)
@ -83,7 +89,7 @@ VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbst
//---------------------------------------------------------------------------------------------------------------------
VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbstractCurve *baseCurve,
const VSpline &spl, CurveAngle angle, qint32 segment)
:VCurveVariable(id, parentId)
: VCurveVariable(id, parentId)
{
// cppcheck-suppress unknownMacro
SCASSERT(baseCurve != nullptr)
@ -92,35 +98,35 @@ VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbst
if (angle == CurveAngle::StartAngle)
{
SetValue(spl.GetStartAngle());
SetName(angle1_V + baseCurve->name() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetName(angle1_V + baseCurve->name() + '_'_L1 + seg_ + QString().setNum(segment));
if (not baseCurve->GetAlias().isEmpty())
{
SetAlias(angle1_V + baseCurve->GetAlias() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetAlias(angle1_V + baseCurve->GetAlias() + '_'_L1 + seg_ + QString().setNum(segment));
}
}
else
{
SetValue(spl.GetEndAngle());
SetName(angle2_V + baseCurve->name() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetName(angle2_V + baseCurve->name() + '_'_L1 + seg_ + QString().setNum(segment));
if (not baseCurve->GetAlias().isEmpty())
{
SetAlias(angle2_V + baseCurve->GetAlias() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetAlias(angle2_V + baseCurve->GetAlias() + '_'_L1 + seg_ + QString().setNum(segment));
}
}
}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcRotation::VEllipticalArcRotation()
: VCurveAngle()
: VCurveAngle()
{
SetType(VarType::CurveAngle);
}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcRotation::VEllipticalArcRotation(const quint32 &id, const quint32 &parentId, const VEllipticalArc *elArc)
: VCurveAngle(id, parentId)
: VCurveAngle(id, parentId)
{
SetType(VarType::CurveAngle);
SCASSERT(elArc != nullptr)

View File

@ -31,15 +31,20 @@
#include <QLatin1String>
#include <QMessageLogger>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/vspline.h"
#include "../vmisc/def.h"
#include "vcurvevariable.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VCurveCLength::VCurveCLength()
: VCurveVariable()
: VCurveVariable()
{
SetType(VarType::CurveCLength);
}
@ -47,7 +52,7 @@ VCurveCLength::VCurveCLength()
//---------------------------------------------------------------------------------------------------------------------
VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const VAbstractBezier *curve,
CurveCLength cType, Unit patternUnit)
: VCurveVariable(id, parentId)
: VCurveVariable(id, parentId)
{
SetType(VarType::CurveCLength);
SCASSERT(curve != nullptr)
@ -76,7 +81,7 @@ VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const V
//---------------------------------------------------------------------------------------------------------------------
VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const VAbstractBezier *baseCurve,
const VSpline &spl, CurveCLength cType, Unit patternUnit, qint32 segment)
: VCurveVariable(id, parentId)
: VCurveVariable(id, parentId)
{
// cppcheck-suppress unknownMacro
SCASSERT(baseCurve != nullptr)
@ -85,35 +90,35 @@ VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const V
if (cType == CurveCLength::C1)
{
SetValue(FromPixel(spl.GetC1Length(), patternUnit));
SetName(c1Length_V + baseCurve->name() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetName(c1Length_V + baseCurve->name() + '_'_L1 + seg_ + QString().setNum(segment));
if (not baseCurve->GetAlias().isEmpty())
{
SetAlias(c1Length_V + baseCurve->GetAlias() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetAlias(c1Length_V + baseCurve->GetAlias() + '_'_L1 + seg_ + QString().setNum(segment));
}
}
else
{
SetValue(FromPixel(spl.GetC2Length(), patternUnit));
SetName(c2Length_V + baseCurve->name() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetName(c2Length_V + baseCurve->name() + '_'_L1 + seg_ + QString().setNum(segment));
if (not baseCurve->GetAlias().isEmpty())
{
SetAlias(c2Length_V + baseCurve->GetAlias() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetAlias(c2Length_V + baseCurve->GetAlias() + '_'_L1 + seg_ + QString().setNum(segment));
}
}
}
//---------------------------------------------------------------------------------------------------------------------
VCurveCLength::VCurveCLength(const VCurveCLength &var)
: VCurveVariable(var)
: VCurveVariable(var)
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VCurveCLength::operator=(const VCurveCLength &var) -> VCurveCLength &
{
if ( &var == this )
if (&var == this)
{
return *this;
}
@ -125,4 +130,3 @@ auto VCurveCLength::operator=(const VCurveCLength &var) -> VCurveCLength &
VCurveCLength::~VCurveCLength()
{
}

View File

@ -36,16 +36,22 @@
#include "../vgeometry/vspline.h"
#include "vcurvevariable.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VCurveLength::VCurveLength()
:VCurveVariable()
: VCurveVariable()
{
SetType(VarType::CurveLength);
}
//---------------------------------------------------------------------------------------------------------------------
VCurveLength::VCurveLength(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve, Unit patternUnit)
:VCurveVariable(id, parentId)
: VCurveVariable(id, parentId)
{
SetType(VarType::CurveLength);
// cppcheck-suppress unknownMacro
@ -63,16 +69,16 @@ VCurveLength::VCurveLength(const quint32 &id, const quint32 &parentId, const VAb
//---------------------------------------------------------------------------------------------------------------------
VCurveLength::VCurveLength(const quint32 &id, const quint32 &parentId, const VAbstractCurve *baseCurve,
const VSpline &spl, Unit patternUnit, qint32 segment)
:VCurveVariable(id, parentId)
: VCurveVariable(id, parentId)
{
SCASSERT(baseCurve != nullptr)
SetType(VarType::CurveLength);
SetName(baseCurve->name() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetName(baseCurve->name() + '_'_L1 + seg_ + QString().setNum(segment));
if (not baseCurve->GetAlias().isEmpty())
{
SetAlias(baseCurve->GetAlias() + QLatin1String("_") + seg_ + QString().setNum(segment));
SetAlias(baseCurve->GetAlias() + '_'_L1 + seg_ + QString().setNum(segment));
}
SetValue(FromPixel(spl.GetLength(), patternUnit));
@ -80,13 +86,14 @@ VCurveLength::VCurveLength(const quint32 &id, const quint32 &parentId, const VAb
//---------------------------------------------------------------------------------------------------------------------
VCurveLength::VCurveLength(const VCurveLength &var)
:VCurveVariable(var)
{}
: VCurveVariable(var)
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VCurveLength::operator=(const VCurveLength &var) -> VCurveLength &
{
if ( &var == this )
if (&var == this)
{
return *this;
}
@ -96,4 +103,5 @@ auto VCurveLength::operator=(const VCurveLength &var) -> VCurveLength &
//---------------------------------------------------------------------------------------------------------------------
VCurveLength::~VCurveLength()
{}
{
}

View File

@ -33,6 +33,12 @@
#include <QRegularExpression>
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VPieceArea::VPieceArea()
: d(new VPieceAreaData)
@ -123,7 +129,7 @@ auto VPieceArea::PieceShortName(const VPiece &piece) -> QString
QString shortName = piece.GetShortName();
if (shortName.isEmpty())
{
shortName = piece.GetName().replace(QChar(QChar::Space), '_').left(25);
shortName = piece.GetName().replace(QChar(QChar::Space), '_'_L1).left(25);
if (shortName.isEmpty() || not QRegularExpression(VPiece::ShortNameRegExp()).match(shortName).hasMatch())
{
shortName = QObject::tr("Unknown", "piece area");

View File

@ -42,6 +42,12 @@
#include "vcontainer.h"
#include "vtranslatevars.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h"
#endif
using namespace Qt::Literals::StringLiterals;
// VFormula
//---------------------------------------------------------------------------------------------------------------------
VFormula::VFormula()
@ -259,7 +265,7 @@ void VFormula::Eval()
}
else
{
d->strValue = VAbstractApplication::VApp()->LocaleToString(result) + QLatin1Char(' ') + d->postfix;
d->strValue = VAbstractApplication::VApp()->LocaleToString(result) + ' '_L1 + d->postfix;
d->error = false;
}
}

View File

@ -51,6 +51,8 @@
#include <QSharedPointer>
#include <QTemporaryFile>
using namespace Qt::Literals::StringLiterals;
namespace
{
auto PieceMissingNodes(const QVector<quint32> &d1Nodes, const QVector<quint32> &d2Nodes) -> QVector<quint32>
@ -417,7 +419,7 @@ void VPiece::SetFormulaSAWidth(const QString &formula, qreal value)
{
SetSAWidth(value);
const qreal width = GetSAWidth();
width >= 0 ? d->m_formulaWidth = formula : d->m_formulaWidth = QLatin1Char('0');
width >= 0 ? d->m_formulaWidth = formula : d->m_formulaWidth = '0'_L1;
}
//---------------------------------------------------------------------------------------------------------------------
@ -1254,7 +1256,7 @@ auto VPiece::MainPathToJson() const -> QJsonObject
nodesArray.append(nodeObject);
}
pieceObject[QLatin1String("nodes")] = nodesArray;
pieceObject["nodes"_L1] = nodesArray;
return pieceObject;
}
@ -1500,8 +1502,8 @@ auto VPiece::ShortNameRegExp() -> QString
}
}
negativeSigns.replace('-', QLatin1String("\\-"));
groupSeparators.remove('\'');
negativeSigns.replace('-'_L1, "\\-"_L1);
groupSeparators.remove('\''_L1);
// Same regexp in pattern.xsd shema file. Don't forget to synchronize.
// \p{Zs} - \p{Space_Separator}

View File

@ -28,7 +28,6 @@
#include "vpiecenode.h"
#include "../vmisc/vabstractvalapplication.h"
#include "calculator.h"
#include "vcontainer.h"
#include "vformula.h"
#include "vpiecenode_p.h"

View File

@ -48,6 +48,8 @@
#include "pmsystems.h"
#include "vtranslatemeasurements.h"
using namespace Qt::Literals::StringLiterals;
//---------------------------------------------------------------------------------------------------------------------
VTranslateVars::VTranslateVars()
{
@ -789,7 +791,7 @@ void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<vsizetype, QS
continue;
}
if (tValues.at(i) == QChar('-'))
if (tValues.at(i) == '-'_L1)
{ // unary minus
newFormula.replace(tKeys.at(i), 1, LocaleNegativeSign(QLocale()));
}

Some files were not shown because too many files have changed in this diff Show More