diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 248cc379c..21072e8d2 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -655,10 +655,10 @@ void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &p void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &propertyName, qreal aScale) { QMap settings; - settings.insert(QString("Min"), 0); - settings.insert(QString("Max"), maxCurveApproximationScale); - settings.insert(QString("Step"), 0.1); - settings.insert(QString("Precision"), 1); + settings.insert(QStringLiteral("Min"), 0); + settings.insert(QStringLiteral("Max"), maxCurveApproximationScale); + settings.insert(QStringLiteral("Step"), 0.1); + settings.insert(QStringLiteral("Precision"), 1); VPE::VDoubleProperty *aScaleProperty = new VPE::VDoubleProperty(propertyName, settings); aScaleProperty->setValue(aScale); @@ -1355,14 +1355,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VPE::VPr { SCASSERT(property != nullptr) - const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); const QString id = propertyToId[property]; switch (PropertiesList().indexOf(id)) { case 0: // AttrName + { + const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); SetPointName(value.toString()); break; + } case 28: // AttrCrossPoint { const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); @@ -1383,7 +1385,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VPE:: { SCASSERT(property != nullptr) - const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); const QString id = propertyToId[property]; VToolPointOfIntersectionCircles *i = qgraphicsitem_cast(currentItem); @@ -1391,8 +1392,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VPE:: switch (PropertiesList().indexOf(id)) { case 0: // AttrName + { + const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); SetPointName(value.toString()); break; + } case 28: // AttrCrossPoint { const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); @@ -1400,10 +1404,10 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VPE:: break; } case 29: // AttrC1Radius - i->SetFirstCircleRadius(value.value()); + i->SetFirstCircleRadius(property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).value()); break; case 30: // AttrC2Radius - i->SetSecondCircleRadius(value.value()); + i->SetSecondCircleRadius(property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).value()); break; case 49: // AttrC1Center (read only) case 50: // AttrC2Center (read only) @@ -1419,14 +1423,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VPE::V { SCASSERT(property != nullptr) - const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); const QString id = propertyToId[property]; switch (PropertiesList().indexOf(id)) { case 0: // AttrName + { + const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); SetPointName(value.toString()); break; + } case 34: // AttrVCrossPoint { const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); @@ -1453,7 +1459,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VPE::V { SCASSERT(property != nullptr) - const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); const QString id = propertyToId[property]; VToolPointFromCircleAndTangent *i = qgraphicsitem_cast(currentItem); @@ -1461,10 +1466,13 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VPE::V switch (PropertiesList().indexOf(id)) { case 0: // AttrName + { + const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); SetPointName(value.toString()); break; + } case 31: // AttrCRadius - i->SetCircleRadius(value.value()); + i->SetCircleRadius(property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).value()); break; case 28: // AttrCrossPoint { @@ -1486,14 +1494,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromArcAndTangent(VPE::VPro { SCASSERT(property != nullptr) - const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); const QString id = propertyToId[property]; switch (PropertiesList().indexOf(id)) { case 0: // AttrName + { + const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole); SetPointName(value.toString()); break; + } case 28: // AttrCrossPoint { const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 8eb1c8ce1..21ceb98ed 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -210,7 +210,7 @@ void DialogIncrements::FillTable(const QMap &varTable, QTableWidget QTableWidgetItem *item = new QTableWidgetItem(i.key()); item->setTextAlignment(Qt::AlignLeft); - item->setFont(QFont("Times", 12, QFont::Bold)); + item->setFont(QFont(QStringLiteral("Times"), 12, QFont::Bold)); table->setItem(currentRow, 0, item); item = new QTableWidgetItem(qApp->LocaleToString(length)); @@ -288,7 +288,7 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QS SCASSERT(table != nullptr) const QString header = table->horizontalHeaderItem(column)->text(); - const QString unitHeader = QString("%1 (%2)").arg(header, unit); + const QString unitHeader = QStringLiteral("%1 (%2)").arg(header, unit); table->horizontalHeaderItem(column)->setText(unitHeader); } @@ -615,7 +615,7 @@ bool DialogIncrements::IncrementUsed(const QString &name) const { const QVector expressions = doc->ListExpressions(); - for(auto field : expressions) + for(auto &field : expressions) { if (field.expression.indexOf(name) != -1) { @@ -1159,7 +1159,7 @@ void DialogIncrements::SaveIncrName(const QString &text) QString name = newName; do { - name = name + QLatin1String("_") + QString().number(num); + name = name + '_' + QString().number(num); num++; } while (not data->IsUnique(name)); newName = name; @@ -1348,15 +1348,15 @@ void DialogIncrements::DeployFormula() { plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT); //Set icon from theme (internal for Windows system) - pushButtonGrow->setIcon(QIcon::fromTheme("go-next", - QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png"))); + pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next"), + QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png"))); } else { plainTextEditFormula->setFixedHeight(baseHeight); //Set icon from theme (internal for Windows system) - pushButtonGrow->setIcon(QIcon::fromTheme("go-down", - QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png"))); + pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down"), + QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png"))); } // I found that after change size of formula field, it was filed for angle formula, field for formula became black. @@ -1418,8 +1418,7 @@ void DialogIncrements::Fx() { // Fix the bug #492. https://bitbucket.org/dismine/valentina/issues/492/valentina-crashes-when-add-an-increment // Because of the bug need to take QTableWidgetItem twice time. Previous update "killed" the pointer. - const QTableWidgetItem *nameField = table->item(row, 0); - doc->SetIncrementFormula(nameField->text(), dialog->GetFormula()); + doc->SetIncrementFormula(table->item(row, 0)->text(), dialog->GetFormula()); hasChanges = true; LocalUpdateTree(); @@ -1482,12 +1481,9 @@ bool DialogIncrements::eventFilter(QObject *object, QEvent *event) } } } - else - { - // pass the event on to the parent class - return DialogTool::eventFilter(object, event); - } - return false;// pass the event to the widget + + // pass the event on to the parent class + return DialogTool::eventFilter(object, event); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index 91185b11c..50ce8e642 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -77,7 +77,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName ui->lineEditFileName->setValidator( new QRegularExpressionValidator(QRegularExpression(*baseFilenameRegExp), this)); - const QString mask = fileName+QLatin1String("_"); + const QString mask = fileName + '_'; if (VApplication::IsGUIMode()) { ui->lineEditFileName->setText(mask); @@ -301,11 +301,11 @@ bool DialogSaveLayout::IsBinaryDXFFormat() const //--------------------------------------------------------------------------------------------------------------------- QString DialogSaveLayout::MakeHelpFormatList() { - QString out("\n"); + QString out(QStringLiteral("\n")); const auto formats = InitFormats(); for(int i = 0; i < formats.size(); ++i) { - out += QLatin1String("\t* ") + formats.at(i).first + QLatin1String(" = ") + out += QStringLiteral("\t* ") + formats.at(i).first + QStringLiteral(" = ") + QString::number(static_cast(formats.at(i).second)); if (i < formats.size() - 1) @@ -363,73 +363,73 @@ QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format) switch(format) { case LayoutExportFormats::SVG: - return QString("Svg %1 (*.svg)").arg(filesStr); + return QStringLiteral("Svg %1 (*.svg)").arg(filesStr); case LayoutExportFormats::PDF: - return QString("PDF %1 (*.pdf)").arg(filesStr); + return QStringLiteral("PDF %1 (*.pdf)").arg(filesStr); case LayoutExportFormats::PNG: - return tr("Image files") + QLatin1String(" (*.png)"); + return tr("Image files") + QStringLiteral(" (*.png)"); case LayoutExportFormats::OBJ: - return "Wavefront OBJ (*.obj)"; + return QStringLiteral("Wavefront OBJ (*.obj)"); case LayoutExportFormats::PS: - return QString("PS %1 (*.ps)").arg(filesStr); + return QStringLiteral("PS %1 (*.ps)").arg(filesStr); case LayoutExportFormats::EPS: - return QString("EPS %1 (*.eps)").arg(filesStr); + return QStringLiteral("EPS %1 (*.eps)").arg(filesStr); case LayoutExportFormats::DXF_AC1006_Flat: - return QString("AutoCAD DXF R10 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R10 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1009_Flat: - return QString("AutoCAD DXF R11/12 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R11/12 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1012_Flat: - return QString("AutoCAD DXF R13 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R13 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1014_Flat: - return QString("AutoCAD DXF R14 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R14 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1015_Flat: - return QString("AutoCAD DXF 2000 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2000 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1018_Flat: - return QString("AutoCAD DXF 2004 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2004 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1021_Flat: - return QString("AutoCAD DXF 2007 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2007 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1024_Flat: - return QString("AutoCAD DXF 2010 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2010 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1027_Flat: - return QString("AutoCAD DXF 2013 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2013 %1 %2").arg(dxfFlatFilesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1006_AAMA: - return QString("AutoCAD DXF R10 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R10 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1009_AAMA: - return QString("AutoCAD DXF R11/12 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R11/12 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1012_AAMA: - return QString("AutoCAD DXF R13 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R13 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1014_AAMA: - return QString("AutoCAD DXF R14 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R14 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1015_AAMA: - return QString("AutoCAD DXF 2000 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2000 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1018_AAMA: - return QString("AutoCAD DXF 2004 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2004 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1021_AAMA: - return QString("AutoCAD DXF 2007 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2007 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1024_AAMA: - return QString("AutoCAD DXF 2010 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2010 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1027_AAMA: - return QString("AutoCAD DXF 2013 AAMA %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2013 AAMA %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1006_ASTM: - return QString("AutoCAD DXF R10 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R10 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1009_ASTM: - return QString("AutoCAD DXF R11/12 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R11/12 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1012_ASTM: - return QString("AutoCAD DXF R13 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R13 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1014_ASTM: - return QString("AutoCAD DXF R14 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF R14 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1015_ASTM: - return QString("AutoCAD DXF 2000 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2000 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1018_ASTM: - return QString("AutoCAD DXF 2004 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2004 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1021_ASTM: - return QString("AutoCAD DXF 2007 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2007 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1024_ASTM: - return QString("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::DXF_AC1027_ASTM: - return QString("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix); + return QStringLiteral("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix); case LayoutExportFormats::PDFTiled: - return QString("PDF tiled %1 (*.pdf)").arg(filesStr); + return QStringLiteral("PDF tiled %1 (*.pdf)").arg(filesStr); default: return QString(); } @@ -441,18 +441,18 @@ QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format) switch(format) { case LayoutExportFormats::SVG: - return ".svg"; + return QStringLiteral(".svg"); case LayoutExportFormats::PDF: case LayoutExportFormats::PDFTiled: - return ".pdf"; + return QStringLiteral(".pdf"); case LayoutExportFormats::PNG: - return ".png"; + return QStringLiteral(".png"); case LayoutExportFormats::OBJ: - return ".obj"; + return QStringLiteral(".obj"); case LayoutExportFormats::PS: - return ".ps"; + return QStringLiteral(".ps"); case LayoutExportFormats::EPS: - return ".eps"; + return QStringLiteral(".eps"); case LayoutExportFormats::DXF_AC1006_Flat: case LayoutExportFormats::DXF_AC1009_Flat: case LayoutExportFormats::DXF_AC1012_Flat: @@ -480,7 +480,7 @@ QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format) case LayoutExportFormats::DXF_AC1021_ASTM: case LayoutExportFormats::DXF_AC1024_ASTM: case LayoutExportFormats::DXF_AC1027_ASTM: - return ".dxf"; + return QStringLiteral(".dxf"); default: return QString(); } @@ -515,7 +515,7 @@ void DialogSaveLayout::Save() { for (int i=0; i < count; ++i) { - const QString name = Path()+QLatin1Literal("/")+FileName()+QString::number(i+1)+ExportFromatSuffix(Format()); + const QString name = Path()+'/'+FileName()+QString::number(i+1)+ExportFromatSuffix(Format()); if (QFile::exists(name)) { QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"), diff --git a/src/app/valentina/dialogs/dialogsavelayout.h b/src/app/valentina/dialogs/dialogsavelayout.h index 8999d88c4..2dba003d4 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.h +++ b/src/app/valentina/dialogs/dialogsavelayout.h @@ -32,10 +32,12 @@ #include "../vgeometry/vgeometrydef.h" #include "vabstractlayoutdialog.h" +#ifndef PDFTOPS #ifdef Q_OS_WIN -# define PDFTOPS "pdftops.exe" +# define PDFTOPS QStringLiteral("pdftops.exe") #else -# define PDFTOPS "pdftops" +# define PDFTOPS QStringLiteral("pdftops") +#endif #endif namespace Ui diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index cf36eaf9a..2a3a7e818 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -541,7 +541,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons if (qApp->devicePixelRatio() >= 2) { // Try to load HiDPI versions of the cursors if availible - auto cursorHidpiResource = QString(cursor).replace(".png", "@2x.png"); + auto cursorHidpiResource = QString(cursor).replace(QLatin1String(".png"), QLatin1String("@2x.png")); if (QFileInfo::exists(cursorResource)) { cursorResource = cursorHidpiResource; @@ -738,7 +738,8 @@ void MainWindow::ApplyDetailsDialog() void MainWindow::ToolEndLine(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::EndLine, ":/cursor/endline_cursor.png", tr("Select point"), + SetToolButtonWithApply(checked, Tool::EndLine, QStringLiteral(":/cursor/endline_cursor.png"), + tr("Select point"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); } @@ -751,7 +752,8 @@ void MainWindow::ToolEndLine(bool checked) void MainWindow::ToolLine(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::Line, ":/cursor/line_cursor.png", tr("Select first point"), + SetToolButtonWithApply(checked, Tool::Line, QStringLiteral(":/cursor/line_cursor.png"), + tr("Select first point"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); } @@ -764,7 +766,7 @@ void MainWindow::ToolLine(bool checked) void MainWindow::ToolAlongLine(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::AlongLine, ":/cursor/alongline_cursor.png", + SetToolButtonWithApply(checked, Tool::AlongLine, QStringLiteral(":/cursor/alongline_cursor.png"), tr("Select point"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); } @@ -774,7 +776,7 @@ void MainWindow::ToolMidpoint(bool checked) { ToolSelectPointByRelease(); // Reuse DialogAlongLine and VToolAlongLine but with different cursor - SetToolButtonWithApply(checked, Tool::Midpoint, ":/cursor/midpoint_cursor.png", + SetToolButtonWithApply(checked, Tool::Midpoint, QStringLiteral(":/cursor/midpoint_cursor.png"), tr("Select point"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); } @@ -787,7 +789,8 @@ void MainWindow::ToolMidpoint(bool checked) void MainWindow::ToolShoulderPoint(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::ShoulderPoint, ":/cursor/shoulder_cursor.png", + SetToolButtonWithApply(checked, Tool::ShoulderPoint, + QStringLiteral(":/cursor/shoulder_cursor.png"), tr("Select point"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -801,7 +804,7 @@ void MainWindow::ToolShoulderPoint(bool checked) void MainWindow::ToolNormal(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::Normal, ":/cursor/normal_cursor.png", + SetToolButtonWithApply(checked, Tool::Normal, QStringLiteral(":/cursor/normal_cursor.png"), tr("Select first point of line"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -815,7 +818,7 @@ void MainWindow::ToolNormal(bool checked) void MainWindow::ToolBisector(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::Bisector, ":/cursor/bisector_cursor.png", + SetToolButtonWithApply(checked, Tool::Bisector, QStringLiteral(":/cursor/bisector_cursor.png"), tr("Select first point of angle"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -829,7 +832,8 @@ void MainWindow::ToolBisector(bool checked) void MainWindow::ToolLineIntersect(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::LineIntersect, ":/cursor/intersect_cursor.png", + SetToolButtonWithApply(checked, Tool::LineIntersect, + QStringLiteral(":/cursor/intersect_cursor.png"), tr("Select first point of first line"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -843,7 +847,7 @@ void MainWindow::ToolLineIntersect(bool checked) void MainWindow::ToolSpline(bool checked) { ToolSelectPointByPress(); - SetToolButtonWithApply(checked, Tool::Spline, ":/cursor/spline_cursor.png", + SetToolButtonWithApply(checked, Tool::Spline, QStringLiteral(":/cursor/spline_cursor.png"), tr("Select first point curve"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -853,7 +857,8 @@ void MainWindow::ToolSpline(bool checked) void MainWindow::ToolCubicBezier(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::CubicBezier, ":/cursor/cubic_bezier_cursor.png", + SetToolButtonWithApply(checked, Tool::CubicBezier, + QStringLiteral(":/cursor/cubic_bezier_cursor.png"), tr("Select first curve point"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -867,7 +872,8 @@ void MainWindow::ToolCubicBezier(bool checked) void MainWindow::ToolCutSpline(bool checked) { ToolSelectSpline(); - SetToolButtonWithApply(checked, Tool::CutSpline, ":/cursor/spline_cut_point_cursor.png", + SetToolButtonWithApply(checked, Tool::CutSpline, + QStringLiteral(":/cursor/spline_cut_point_cursor.png"), tr("Select simple curve"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -881,7 +887,7 @@ void MainWindow::ToolCutSpline(bool checked) void MainWindow::ToolArc(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::Arc, ":/cursor/arc_cursor.png", + SetToolButtonWithApply(checked, Tool::Arc, QStringLiteral(":/cursor/arc_cursor.png"), tr("Select point of center of arc"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -895,7 +901,8 @@ void MainWindow::ToolArc(bool checked) void MainWindow::ToolEllipticalArc(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::EllipticalArc, ":/cursor/el_arc_cursor.png", + SetToolButtonWithApply(checked, Tool::EllipticalArc, + QStringLiteral(":/cursor/el_arc_cursor.png"), tr("Select point of center of elliptical arc"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -909,7 +916,8 @@ void MainWindow::ToolEllipticalArc(bool checked) void MainWindow::ToolSplinePath(bool checked) { ToolSelectPointByPress(); - SetToolButtonWithApply(checked, Tool::SplinePath, ":/cursor/splinepath_cursor.png", + SetToolButtonWithApply(checked, Tool::SplinePath, + QStringLiteral(":/cursor/splinepath_cursor.png"), tr("Select point of curve path"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -920,7 +928,7 @@ void MainWindow::ToolCubicBezierPath(bool checked) { ToolSelectPointByRelease(); SetToolButtonWithApply(checked, Tool::CubicBezierPath, - ":/cursor/cubic_bezier_path_cursor.png", + QStringLiteral(":/cursor/cubic_bezier_path_cursor.png"), tr("Select point of cubic bezier path"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -935,7 +943,8 @@ void MainWindow::ToolCutSplinePath(bool checked) { ToolSelectSplinePath(); SetToolButtonWithApply(checked, Tool::CutSplinePath, - ":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"), + QStringLiteral(":/cursor/splinepath_cut_point_cursor.png"), + tr("Select curve path"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); } @@ -948,7 +957,8 @@ void MainWindow::ToolCutSplinePath(bool checked) void MainWindow::ToolPointOfContact(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", + SetToolButtonWithApply(checked, Tool::PointOfContact, + QStringLiteral(":/cursor/pointcontact_cursor.png"), tr("Select first point of line"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -962,7 +972,8 @@ void MainWindow::ToolPointOfContact(bool checked) void MainWindow::ToolDetail(bool checked) { ToolSelectAllDrawObjects(); - SetToolButtonWithApply(checked, Tool::Piece, "://cursor/new_detail_cursor.png", + SetToolButtonWithApply(checked, Tool::Piece, + QStringLiteral("://cursor/new_detail_cursor.png"), tr("Select main path objects clockwise."), &MainWindow::ClosedDetailsDialogWithApply, &MainWindow::ApplyDetailsDialog); @@ -972,7 +983,7 @@ void MainWindow::ToolDetail(bool checked) void MainWindow::ToolPiecePath(bool checked) { ToolSelectAllDrawObjects(); - SetToolButton(checked, Tool::PiecePath, "://cursor/path_cursor.png", + SetToolButton(checked, Tool::PiecePath, QStringLiteral("://cursor/path_cursor.png"), tr("Select path objects, Shift - reverse direction curve"), &MainWindow::ClosedDialogPiecePath); } @@ -981,7 +992,7 @@ void MainWindow::ToolPiecePath(bool checked) void MainWindow::ToolPin(bool checked) { ToolSelectPointByRelease(); - SetToolButton(checked, Tool::Pin, "://cursor/pin_cursor.png", tr("Select pin point"), + SetToolButton(checked, Tool::Pin, QStringLiteral("://cursor/pin_cursor.png"), tr("Select pin point"), &MainWindow::ClosedDialogPin); } @@ -989,7 +1000,7 @@ void MainWindow::ToolPin(bool checked) void MainWindow::ToolPlaceLabel(bool checked) { ToolSelectPointByRelease(); - SetToolButton(checked, Tool::PlaceLabel, "://cursor/place_label_cursor.png", + SetToolButton(checked, Tool::PlaceLabel, QStringLiteral("://cursor/place_label_cursor.png"), tr("Select placelabel center point"), &MainWindow::ClosedDialogPlaceLabel); } @@ -1001,7 +1012,8 @@ void MainWindow::ToolPlaceLabel(bool checked) void MainWindow::ToolHeight(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"), + SetToolButtonWithApply(checked, Tool::Height, QStringLiteral(":/cursor/height_cursor.png"), + tr("Select base point"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); } @@ -1014,7 +1026,7 @@ void MainWindow::ToolHeight(bool checked) void MainWindow::ToolTriangle(bool checked) { ToolSelectPointByRelease(); - SetToolButtonWithApply(checked, Tool::Triangle, ":/cursor/triangle_cursor.png", + SetToolButtonWithApply(checked, Tool::Triangle, QStringLiteral(":/cursor/triangle_cursor.png"), tr("Select first point of axis"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -1029,7 +1041,7 @@ void MainWindow::ToolPointOfIntersection(bool checked) { ToolSelectPointByRelease(); SetToolButtonWithApply(checked, Tool::PointOfIntersection, - ":/cursor/pointofintersect_cursor.png", + QStringLiteral(":/cursor/pointofintersect_cursor.png"), tr("Select point for X value (vertical)"), &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); @@ -1043,7 +1055,7 @@ void MainWindow::ToolPointOfIntersection(bool checked) void MainWindow::ToolUnionDetails(bool checked) { ToolSelectDetail(); - SetToolButton(checked, Tool::UnionDetails, ":/cursor/union_cursor.png", + SetToolButton(checked, Tool::UnionDetails, QStringLiteral(":/cursor/union_cursor.png"), tr("Select detail"), &MainWindow::ClosedDialogUnionDetails); } @@ -1061,8 +1073,9 @@ void MainWindow::ClosedDialogUnionDetails(int result) void MainWindow::ToolDuplicateDetail(bool checked) { ToolSelectDetail(); - SetToolButton(checked, Tool::DuplicateDetail, ":/cursor/duplicate_detail_cursor.png", - tr("Select detail"), &MainWindow::ClosedDialogDuplicateDetail); + SetToolButton(checked, Tool::DuplicateDetail, + QStringLiteral(":/cursor/duplicate_detail_cursor.png"), + tr("Select detail"), &MainWindow::ClosedDialogDuplicateDetail); } //--------------------------------------------------------------------------------------------------------------------- @@ -1088,7 +1101,7 @@ void MainWindow::ToolGroup(bool checked) const QString tooltip = tr("Select one or more objects, hold %1 - for multiple selection, " "Enter - finish creation") .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); - SetToolButton(checked, Tool::Group, ":/cursor/group_plus_cursor.png", tooltip, + SetToolButton(checked, Tool::Group, QStringLiteral(":/cursor/group_plus_cursor.png"), tooltip, &MainWindow::ClosedDialogGroup); } @@ -1099,8 +1112,8 @@ void MainWindow::ToolRotation(bool checked) const QString tooltip = tr("Select one or more objects, hold %1 - for multiple selection, " "Enter - confirm selection") .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); - SetToolButtonWithApply(checked, Tool::Rotation, ":/cursor/rotation_cursor.png", tooltip, - &MainWindow::ClosedDrawDialogWithApply, + SetToolButtonWithApply(checked, Tool::Rotation, QStringLiteral(":/cursor/rotation_cursor.png"), + tooltip, &MainWindow::ClosedDrawDialogWithApply, &MainWindow::ApplyDrawDialog); } diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 711e434ca..4823b7155 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -74,10 +74,12 @@ Q_LOGGING_CATEGORY(vMainNoGUIWindow, "v.mainnoguiwindow") QT_WARNING_POP +#ifndef PDFTOPS #ifdef Q_OS_WIN -# define PDFTOPS "pdftops.exe" +# define PDFTOPS QStringLiteral("pdftops.exe") #else -# define PDFTOPS "pdftops" +# define PDFTOPS QStringLiteral("pdftops") +#endif #endif namespace @@ -314,9 +316,8 @@ void MainWindowsNoGUI::ExportData(const QVector &listDetails) { for (int i = 0; i < detailsOnLayout.size(); ++i) { - const QString name = m_dialogSaveLayout->Path() + QLatin1String("/") + m_dialogSaveLayout->FileName() + - QString::number(i+1) - + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format()); + const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() + + QString::number(i+1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format()); QGraphicsRectItem *paper = qgraphicsitem_cast(papers.at(i)); SCASSERT(paper != nullptr) @@ -361,7 +362,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList &scenes, if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout) { - const QString name = path + QLatin1String("/") + m_dialogSaveLayout->FileName() + QString::number(1) + const QString name = path + '/' + m_dialogSaveLayout->FileName() + QString::number(1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format()); PdfTiledFile(name); } @@ -582,7 +583,7 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector listDe listDetails[i].SetMatrix(moveMatrix); } - const QString name = m_dialogSaveLayout->Path() + QLatin1String("/") + m_dialogSaveLayout->FileName() + + const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() + QString::number(1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format()); ExportApparelLayout(listDetails, name, rect.size()); @@ -606,7 +607,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer) return; } - painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); + painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); @@ -838,7 +839,7 @@ QIcon MainWindowsNoGUI::ScenePreview(int i) const { image.fill(Qt::white); QPainter painter(&image); - painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); + painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); @@ -1001,7 +1002,7 @@ void MainWindowsNoGUI::PdfFile(const QString &name, QGraphicsRectItem *paper, QG qCritical("%s", qUtf8Printable(tr("Can't open printer %1").arg(name))); return; } - painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); + painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); @@ -1047,7 +1048,7 @@ void MainWindowsNoGUI::EpsFile(const QString &name, QGraphicsRectItem *paper, QG if (tmp.open()) { PdfFile(tmp.fileName(), paper, scene, ignorePrinterFields, margins); - QStringList params = QStringList() << "-eps" << tmp.fileName() << name; + QStringList params = QStringList() << QStringLiteral("-eps") << tmp.fileName() << name; PdfToPs(params); } } @@ -1415,7 +1416,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr #ifdef Q_OS_WIN printer->setOutputFileName(outputFileName); #else - printer->setOutputFileName(outputFileName + QLatin1String(".pdf")); + printer->setOutputFileName(outputFileName + QStringLiteral(".pdf")); #endif #ifdef Q_OS_MAC @@ -1566,7 +1567,7 @@ void MainWindowsNoGUI::ExportScene(const QList &scenes, QGraphicsRectItem *paper = qgraphicsitem_cast(papers.at(i)); if (paper) { - const QString name = m_dialogSaveLayout->Path() + QLatin1String("/") + m_dialogSaveLayout->FileName() + + const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() + QString::number(i+1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format()); QBrush *brush = new QBrush(); brush->setColor( QColor( Qt::white ) ); @@ -1853,7 +1854,7 @@ void MainWindowsNoGUI::CheckRequiredMeasurements(const VMeasurements *m) const } VException e(tr("Measurement file doesn't include all required measurements.")); - e.AddMoreInformation(tr("Please, additionally provide: %1").arg(QStringList(list).join(", "))); + e.AddMoreInformation(tr("Please, additionally provide: %1").arg(QStringList(list).join(QStringLiteral(", ")))); throw e; } } diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 2b6ecad33..daf9a22e7 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -141,7 +141,9 @@ void VPattern::CreateEmptyFile() patternElement.appendChild(createElement(TagPreviewCalculations)); this->appendChild(patternElement); - insertBefore(createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""), this->firstChild()); + insertBefore(createProcessingInstruction(QStringLiteral("xml"), + QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), + this->firstChild()); } //--------------------------------------------------------------------------------------------------------------------- @@ -656,12 +658,12 @@ void VPattern::customEvent(QEvent *event) VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const { const quint32 id = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR); - const qreal mx = GetParametrDouble(domElement, AttrMx, "0.0"); - const qreal my = GetParametrDouble(domElement, AttrMy, "0.0"); + const qreal mx = GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0")); + const qreal my = GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0")); const bool reverse = GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, QChar('0')); const NodeDetail nodeType = NodeDetail::Contour; - const QString t = GetParametrString(domElement, AttrType, "NodePoint"); + const QString t = GetParametrString(domElement, AttrType, QStringLiteral("NodePoint")); Tool tool; QStringList types = QStringList() << VAbstractPattern::NodePoint @@ -827,8 +829,8 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse VToolSeamAllowanceInitData initData; initData.id = GetParametrId(domElement); initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail"))); - initData.detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0"))); - initData.detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0"))); + initData.detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0")))); + initData.detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0")))); initData.detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr)); initData.detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath, QString().setNum(qApp->ValentinaSettings()->IsHideMainPath()))); @@ -842,7 +844,7 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse initData.detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr)); initData.detail.SetUnited(GetParametrBool(domElement, VToolSeamAllowance::AttrUnited, falseStr)); - initData.width = GetParametrString(domElement, AttrWidth, "0.0"); + initData.width = GetParametrString(domElement, AttrWidth, QStringLiteral("0.0")); const QString w = initData.width;//need for saving fixed formula; ParseDetailInternals(domElement, initData.detail); @@ -913,7 +915,7 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 4, 0), "Time to refactor the code."); const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1')); - const qreal width = GetParametrDouble(domElement, AttrWidth, "0.0"); + const qreal width = GetParametrDouble(domElement, AttrWidth, QStringLiteral("0.0")); futurePathV1 = QtConcurrent::run(this, &VPattern::ParseDetailNodes, element, width, closed); } else @@ -1062,7 +1064,7 @@ VGrainlineData VPattern::ParsePieceGrainline(const QDomElement &domElement, VGra gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')), GetParametrDouble(domElement, AttrMy, QChar('0')))); gGeometry.SetLength(GetParametrString(domElement, AttrLength, QChar('1'))); - gGeometry.SetRotation(GetParametrString(domElement, AttrRotation, "90")); + gGeometry.SetRotation(GetParametrString(domElement, AttrRotation, QStringLiteral("90"))); gGeometry.SetArrowType(static_cast(GetParametrUInt(domElement, AttrArrows, QChar('0')))); gGeometry.SetCenterPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR)); gGeometry.SetTopPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR)); @@ -1114,7 +1116,7 @@ void VPattern::PointsWithLineCommonAttributes(const QDomElement &domElement, VTo void VPattern::PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData) { PointsCommonAttributes(domElement, initData.id, initData.mx, initData.my); - initData.name = GetParametrString(domElement, AttrName, "A"); + initData.name = GetParametrString(domElement, AttrName, QChar('A')); initData.showLabel = GetParametrBool(domElement, AttrShowLabel, trueStr); } @@ -1122,8 +1124,8 @@ void VPattern::PointsCommonAttributes(const QDomElement &domElement, VToolSingle void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my) { ToolsCommonAttributes(domElement, id); - mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, "10.0")); - my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, "15.0")); + mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("10.0"))); + my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("15.0"))); } //--------------------------------------------------------------------------------------------------------------------- @@ -1385,8 +1387,8 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement & initData.typeCreation = Source::FromFile; PointsCommonAttributes(domElement, initData); - initData.x = qApp->toPixel(GetParametrDouble(domElement, AttrX, "10.0")); - initData.y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0")); + initData.x = qApp->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0"))); + initData.y = qApp->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0"))); spoint = VToolBasePoint::Create(initData); } @@ -1417,12 +1419,12 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme PointsWithLineCommonAttributes(domElement, initData); - initData.formulaLength = GetParametrString(domElement, AttrLength, "100.0"); + initData.formulaLength = GetParametrString(domElement, AttrLength, QStringLiteral("100.0")); const QString f = initData.formulaLength;//need for saving fixed formula; initData.basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); - initData.formulaAngle = GetParametrString(domElement, AttrAngle, "0.0"); + initData.formulaAngle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0")); const QString angleFix = initData.formulaAngle; VToolEndLine::Create(initData); @@ -1465,7 +1467,7 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle initData.typeCreation = Source::FromFile; PointsWithLineCommonAttributes(domElement, initData); - initData.formula = GetParametrString(domElement, AttrLength, "100.0"); + initData.formula = GetParametrString(domElement, AttrLength, QStringLiteral("100.0")); const QString f = initData.formula;//need for saving fixed formula; initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); initData.secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); @@ -1509,7 +1511,7 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do initData.typeCreation = Source::FromFile; PointsWithLineCommonAttributes(domElement, initData); - initData.formula = GetParametrString(domElement, AttrLength, "100.0"); + initData.formula = GetParametrString(domElement, AttrLength, QStringLiteral("100.0")); const QString f = initData.formula;//need for saving fixed formula; initData.p1Line = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); initData.p2Line = GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR); @@ -1554,11 +1556,11 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen initData.typeCreation = Source::FromFile; PointsWithLineCommonAttributes(domElement, initData); - initData.formula = GetParametrString(domElement, AttrLength, "100.0"); + initData.formula = GetParametrString(domElement, AttrLength, QStringLiteral("100.0")); const QString f = initData.formula;//need for saving fixed formula; initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); initData.secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); - initData.angle = GetParametrDouble(domElement, AttrAngle, "0.0"); + initData.angle = GetParametrDouble(domElement, AttrAngle, QStringLiteral("0.0")); VToolNormal::Create(initData); //Rewrite attribute formula. Need for situation when we have wrong formula. @@ -1599,7 +1601,7 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem initData.typeCreation = Source::FromFile; PointsWithLineCommonAttributes(domElement, initData); - initData.formula = GetParametrString(domElement, AttrLength, "100.0"); + initData.formula = GetParametrString(domElement, AttrLength, QStringLiteral("100.0")); const QString f = initData.formula;//need for saving fixed formula; initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); initData.secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); @@ -1796,16 +1798,17 @@ void VPattern::ParsePlaceLabel(QDomElement &domElement, const Document &parse) initData.centerPoint = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR); initData.idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR); - initData.width = GetParametrString(domElement, AttrWidth, "1.0"); + initData.width = GetParametrString(domElement, AttrWidth, QStringLiteral("1.0")); const QString w = initData.width;//need for saving fixed formula; - initData.height = GetParametrString(domElement, AttrHeight, "1.0"); + initData.height = GetParametrString(domElement, AttrHeight, QStringLiteral("1.0")); const QString h = initData.height;//need for saving fixed formula; - initData.angle = GetParametrString(domElement, AttrAngle, "0.0"); + initData.angle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0")); const QString angle = initData.angle;//need for saving fixed formula; - initData.visibilityTrigger = GetParametrString(domElement, VAbstractPattern::AttrVisible, "1.0"); + initData.visibilityTrigger = GetParametrString(domElement, VAbstractPattern::AttrVisible, + QStringLiteral("1.0")); const QString visibility = initData.visibilityTrigger;//need for saving fixed formula; initData.type = static_cast(GetParametrUInt(domElement, AttrPlaceLabelType, QChar('0'))); @@ -2080,7 +2083,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement initData.firstPointId = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); initData.secondPointId = GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR); - initData.formulaAngle = GetParametrString(domElement, AttrAngle, "0.0"); + initData.formulaAngle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0")); const QString angleFix = initData.formulaAngle; VToolLineIntersectAxis::Create(initData); @@ -2128,7 +2131,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen initData.basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); initData.curveId = GetParametrUInt(domElement, AttrCurve, NULL_ID_STR); - initData.formulaAngle = GetParametrString(domElement, AttrAngle, "0.0"); + initData.formulaAngle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0")); const QString angleFix = initData.formulaAngle; VToolCurveIntersectAxis::Create(initData); @@ -2359,14 +2362,14 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement & initData.dartP2Id = GetParametrUInt(domElement, AttrDartP2, NULL_ID_STR); initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR); - initData.name1 = GetParametrString(domElement, AttrName1, "A"); - initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, "10.0")); - initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, "15.0")); + initData.name1 = GetParametrString(domElement, AttrName1, QChar('A')); + initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, QStringLiteral("10.0"))); + initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, QStringLiteral("15.0"))); initData.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr); - initData.name2 = GetParametrString(domElement, AttrName2, "A"); - initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, "10.0")); - initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, "15.0")); + initData.name2 = GetParametrString(domElement, AttrName2, QChar('A')); + initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, QStringLiteral("10.0"))); + initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, QStringLiteral("15.0"))); initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr); VToolTrueDarts::Create(initData); @@ -2398,11 +2401,11 @@ void VPattern::ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement & ToolsCommonAttributes(domElement, initData.id); const quint32 point1 = GetParametrUInt(domElement, AttrPoint1, NULL_ID_STR); const quint32 point4 = GetParametrUInt(domElement, AttrPoint4, NULL_ID_STR); - const qreal angle1 = GetParametrDouble(domElement, AttrAngle1, "270.0"); - const qreal angle2 = GetParametrDouble(domElement, AttrAngle2, "90.0"); - const qreal kAsm1 = GetParametrDouble(domElement, AttrKAsm1, "1.0"); - const qreal kAsm2 = GetParametrDouble(domElement, AttrKAsm2, "1.0"); - const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0"); + const qreal angle1 = GetParametrDouble(domElement, AttrAngle1, QStringLiteral("270.0")); + const qreal angle2 = GetParametrDouble(domElement, AttrAngle2, QStringLiteral("90.0")); + const qreal kAsm1 = GetParametrDouble(domElement, AttrKAsm1, QStringLiteral("1.0")); + const qreal kAsm2 = GetParametrDouble(domElement, AttrKAsm2, QStringLiteral("1.0")); + const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, QStringLiteral("1.0")); const QString color = GetParametrString(domElement, AttrColor, ColorBlack); const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0')); @@ -2564,7 +2567,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomEleme initData.typeCreation = Source::FromFile; ToolsCommonAttributes(domElement, initData.id); - const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0"); + const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, QStringLiteral("1.0")); const QString color = GetParametrString(domElement, AttrColor, ColorBlack); const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0')); const qreal approximationScale = GetParametrDouble(domElement, AttrAScale, QChar('0')); @@ -2580,9 +2583,9 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomEleme { if (element.tagName() == AttrPathPoint) { - const qreal kAsm1 = GetParametrDouble(element, AttrKAsm1, "1.0"); + const qreal kAsm1 = GetParametrDouble(element, AttrKAsm1, QStringLiteral("1.0")); const qreal angle = GetParametrDouble(element, AttrAngle, QChar('0')); - const qreal kAsm2 = GetParametrDouble(element, AttrKAsm2, "1.0"); + const qreal kAsm2 = GetParametrDouble(element, AttrKAsm2, QStringLiteral("1.0")); const quint32 pSpline = GetParametrUInt(element, AttrPSpline, NULL_ID_STR); const VPointF p = *data->GeometricObject(pSpline); @@ -2884,11 +2887,11 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, ToolsCommonAttributes(domElement, initData.id); initData.center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); - initData.radius = GetParametrString(domElement, AttrRadius, "10"); + initData.radius = GetParametrString(domElement, AttrRadius, QStringLiteral("10")); const QString r = initData.radius;//need for saving fixed formula; - initData.f1 = GetParametrString(domElement, AttrAngle1, "180"); + initData.f1 = GetParametrString(domElement, AttrAngle1, QStringLiteral("180")); const QString f1Fix = initData.f1;//need for saving fixed formula; - initData.f2 = GetParametrString(domElement, AttrAngle2, "270"); + initData.f2 = GetParametrString(domElement, AttrAngle2, QStringLiteral("270")); const QString f2Fix = initData.f2;//need for saving fixed formula; initData.color = GetParametrString(domElement, AttrColor, ColorBlack); initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine); @@ -2936,13 +2939,13 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do ToolsCommonAttributes(domElement, initData.id); initData.center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); - initData.radius1 = GetParametrString(domElement, AttrRadius1, "10"); - initData.radius2 = GetParametrString(domElement, AttrRadius2, "10"); + initData.radius1 = GetParametrString(domElement, AttrRadius1, QStringLiteral("10")); + initData.radius2 = GetParametrString(domElement, AttrRadius2, QStringLiteral("10")); const QString r1 = initData.radius1;//need for saving fixed formula; const QString r2 = initData.radius2;//need for saving fixed formula; - initData.f1 = GetParametrString(domElement, AttrAngle1, "180"); + initData.f1 = GetParametrString(domElement, AttrAngle1, QStringLiteral("180")); const QString f1Fix = initData.f1;//need for saving fixed formula; - initData.f2 = GetParametrString(domElement, AttrAngle2, "270"); + initData.f2 = GetParametrString(domElement, AttrAngle2, QStringLiteral("270")); const QString f2Fix = initData.f2;//need for saving fixed formula; initData.rotationAngle = GetParametrString(domElement, AttrRotationAngle, QChar('0')); const QString frotationFix = initData.rotationAngle;//need for saving fixed formula; @@ -3073,11 +3076,11 @@ void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &do ToolsCommonAttributes(domElement, initData.id); initData.center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); - initData.radius = GetParametrString(domElement, AttrRadius, "10"); + initData.radius = GetParametrString(domElement, AttrRadius, QStringLiteral("10")); const QString r = initData.radius;//need for saving fixed formula; - initData.f1 = GetParametrString(domElement, AttrAngle1, "180"); + initData.f1 = GetParametrString(domElement, AttrAngle1, QStringLiteral("180")); const QString f1Fix = initData.f1;//need for saving fixed formula; - initData.length = GetParametrString(domElement, AttrLength, "10"); + initData.length = GetParametrString(domElement, AttrLength, QStringLiteral("10")); const QString lengthFix = initData.length;//need for saving fixed length; initData.color = GetParametrString(domElement, AttrColor, ColorBlack); initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine); @@ -3124,7 +3127,7 @@ void VPattern::ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElem ToolsCommonAttributes(domElement, initData.id); initData.origin = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); - initData.angle = GetParametrString(domElement, AttrAngle, "10"); + initData.angle = GetParametrString(domElement, AttrAngle, QStringLiteral("10")); const QString a = initData.angle;//need for saving fixed formula; initData.suffix = GetParametrString(domElement, AttrSuffix, QString()); @@ -3654,8 +3657,8 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d try { VToolUnionDetailsInitData initData; - initData.indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1"); - initData.indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1"); + initData.indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, QStringLiteral("-1")); + initData.indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, QStringLiteral("-1")); initData.version = GetParametrUInt(domElement, AttrVersion, QChar('1')); initData.scene = scene; initData.doc = this; @@ -3979,7 +3982,7 @@ QString VPattern::GenerateLabel(const LabelType &type, const QString &reservedNa QString name; do { - name = QString("%1%2").arg(labelBase).arg(num); + name = QStringLiteral("%1%2").arg(labelBase).arg(num); num++; if (num == INT_MAX) { @@ -4002,7 +4005,7 @@ QString VPattern::GenerateSuffix() const QString suffix; for (;;) { - suffix = QString("%1%2").arg(suffixBase).arg(num); + suffix = QStringLiteral("%1%2").arg(suffixBase).arg(num); for (int i=0; i < uniqueNames.size(); ++i) { @@ -4407,7 +4410,7 @@ QT_WARNING_POP //--------------------------------------------------------------------------------------------------------------------- template -QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const +QRectF VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const { QRectF recTool = rec; if (tools.contains(id)) diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index 4c35a5707..26ff32e82 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -177,7 +177,7 @@ private: void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool); template - QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const; + QRectF ToolBoundingRect(const QRectF &rec, quint32 id) const; void ParseCurrentPP(); QString GetLabelBase(quint32 index)const;