Refactoring. Fixing static analyzers warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-01-17 10:36:37 +02:00
parent 69364be0ee
commit 3950ff9a5d
8 changed files with 203 additions and 178 deletions

View File

@ -655,10 +655,10 @@ void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &p
void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &propertyName, qreal aScale) void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &propertyName, qreal aScale)
{ {
QMap<QString, QVariant> settings; QMap<QString, QVariant> settings;
settings.insert(QString("Min"), 0); settings.insert(QStringLiteral("Min"), 0);
settings.insert(QString("Max"), maxCurveApproximationScale); settings.insert(QStringLiteral("Max"), maxCurveApproximationScale);
settings.insert(QString("Step"), 0.1); settings.insert(QStringLiteral("Step"), 0.1);
settings.insert(QString("Precision"), 1); settings.insert(QStringLiteral("Precision"), 1);
VPE::VDoubleProperty *aScaleProperty = new VPE::VDoubleProperty(propertyName, settings); VPE::VDoubleProperty *aScaleProperty = new VPE::VDoubleProperty(propertyName, settings);
aScaleProperty->setValue(aScale); aScaleProperty->setValue(aScale);
@ -1355,14 +1355,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VPE::VPr
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
{
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
SetPointName<VToolPointOfIntersectionArcs>(value.toString()); SetPointName<VToolPointOfIntersectionArcs>(value.toString());
break; break;
}
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
@ -1383,7 +1385,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VPE::
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolPointOfIntersectionCircles *i = qgraphicsitem_cast<VToolPointOfIntersectionCircles *>(currentItem); VToolPointOfIntersectionCircles *i = qgraphicsitem_cast<VToolPointOfIntersectionCircles *>(currentItem);
@ -1391,8 +1392,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VPE::
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
{
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
SetPointName<VToolPointOfIntersectionCircles>(value.toString()); SetPointName<VToolPointOfIntersectionCircles>(value.toString());
break; break;
}
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
@ -1400,10 +1404,10 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VPE::
break; break;
} }
case 29: // AttrC1Radius case 29: // AttrC1Radius
i->SetFirstCircleRadius(value.value<VFormula>()); i->SetFirstCircleRadius(property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).value<VFormula>());
break; break;
case 30: // AttrC2Radius case 30: // AttrC2Radius
i->SetSecondCircleRadius(value.value<VFormula>()); i->SetSecondCircleRadius(property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).value<VFormula>());
break; break;
case 49: // AttrC1Center (read only) case 49: // AttrC1Center (read only)
case 50: // AttrC2Center (read only) case 50: // AttrC2Center (read only)
@ -1419,14 +1423,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VPE::V
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
{
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
SetPointName<VToolPointOfIntersectionCurves>(value.toString()); SetPointName<VToolPointOfIntersectionCurves>(value.toString());
break; break;
}
case 34: // AttrVCrossPoint case 34: // AttrVCrossPoint
{ {
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
@ -1453,7 +1459,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VPE::V
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem); VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem);
@ -1461,10 +1466,13 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VPE::V
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
{
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
SetPointName<VToolPointFromCircleAndTangent>(value.toString()); SetPointName<VToolPointFromCircleAndTangent>(value.toString());
break; break;
}
case 31: // AttrCRadius case 31: // AttrCRadius
i->SetCircleRadius(value.value<VFormula>()); i->SetCircleRadius(property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).value<VFormula>());
break; break;
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
@ -1486,14 +1494,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromArcAndTangent(VPE::VPro
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
{
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
SetPointName<VToolPointFromArcAndTangent>(value.toString()); SetPointName<VToolPointFromArcAndTangent>(value.toString());
break; break;
}
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);

View File

@ -210,7 +210,7 @@ void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget
QTableWidgetItem *item = new QTableWidgetItem(i.key()); QTableWidgetItem *item = new QTableWidgetItem(i.key());
item->setTextAlignment(Qt::AlignLeft); item->setTextAlignment(Qt::AlignLeft);
item->setFont(QFont("Times", 12, QFont::Bold)); item->setFont(QFont(QStringLiteral("Times"), 12, QFont::Bold));
table->setItem(currentRow, 0, item); table->setItem(currentRow, 0, item);
item = new QTableWidgetItem(qApp->LocaleToString(length)); item = new QTableWidgetItem(qApp->LocaleToString(length));
@ -288,7 +288,7 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QS
SCASSERT(table != nullptr) SCASSERT(table != nullptr)
const QString header = table->horizontalHeaderItem(column)->text(); 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); table->horizontalHeaderItem(column)->setText(unitHeader);
} }
@ -615,7 +615,7 @@ bool DialogIncrements::IncrementUsed(const QString &name) const
{ {
const QVector<VFormulaField> expressions = doc->ListExpressions(); const QVector<VFormulaField> expressions = doc->ListExpressions();
for(auto field : expressions) for(auto &field : expressions)
{ {
if (field.expression.indexOf(name) != -1) if (field.expression.indexOf(name) != -1)
{ {
@ -1159,7 +1159,7 @@ void DialogIncrements::SaveIncrName(const QString &text)
QString name = newName; QString name = newName;
do do
{ {
name = name + QLatin1String("_") + QString().number(num); name = name + '_' + QString().number(num);
num++; num++;
} while (not data->IsUnique(name)); } while (not data->IsUnique(name));
newName = name; newName = name;
@ -1348,14 +1348,14 @@ void DialogIncrements::DeployFormula()
{ {
plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT); plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT);
//Set icon from theme (internal for Windows system) //Set icon from theme (internal for Windows system)
pushButtonGrow->setIcon(QIcon::fromTheme("go-next", pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-next"),
QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png"))); QIcon(":/icons/win.icon.theme/16x16/actions/go-next.png")));
} }
else else
{ {
plainTextEditFormula->setFixedHeight(baseHeight); plainTextEditFormula->setFixedHeight(baseHeight);
//Set icon from theme (internal for Windows system) //Set icon from theme (internal for Windows system)
pushButtonGrow->setIcon(QIcon::fromTheme("go-down", pushButtonGrow->setIcon(QIcon::fromTheme(QStringLiteral("go-down"),
QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png"))); QIcon(":/icons/win.icon.theme/16x16/actions/go-down.png")));
} }
@ -1418,8 +1418,7 @@ void DialogIncrements::Fx()
{ {
// Fix the bug #492. https://bitbucket.org/dismine/valentina/issues/492/valentina-crashes-when-add-an-increment // 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. // Because of the bug need to take QTableWidgetItem twice time. Previous update "killed" the pointer.
const QTableWidgetItem *nameField = table->item(row, 0); doc->SetIncrementFormula(table->item(row, 0)->text(), dialog->GetFormula());
doc->SetIncrementFormula(nameField->text(), dialog->GetFormula());
hasChanges = true; hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
@ -1482,13 +1481,10 @@ bool DialogIncrements::eventFilter(QObject *object, QEvent *event)
} }
} }
} }
else
{
// pass the event on to the parent class // pass the event on to the parent class
return DialogTool::eventFilter(object, event); return DialogTool::eventFilter(object, event);
} }
return false;// pass the event to the widget
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::showEvent(QShowEvent *event) void DialogIncrements::showEvent(QShowEvent *event)

View File

@ -77,7 +77,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
ui->lineEditFileName->setValidator( new QRegularExpressionValidator(QRegularExpression(*baseFilenameRegExp), this)); ui->lineEditFileName->setValidator( new QRegularExpressionValidator(QRegularExpression(*baseFilenameRegExp), this));
const QString mask = fileName+QLatin1String("_"); const QString mask = fileName + '_';
if (VApplication::IsGUIMode()) if (VApplication::IsGUIMode())
{ {
ui->lineEditFileName->setText(mask); ui->lineEditFileName->setText(mask);
@ -301,11 +301,11 @@ bool DialogSaveLayout::IsBinaryDXFFormat() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString DialogSaveLayout::MakeHelpFormatList() QString DialogSaveLayout::MakeHelpFormatList()
{ {
QString out("\n"); QString out(QStringLiteral("\n"));
const auto formats = InitFormats(); const auto formats = InitFormats();
for(int i = 0; i < formats.size(); ++i) 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<int>(formats.at(i).second)); + QString::number(static_cast<int>(formats.at(i).second));
if (i < formats.size() - 1) if (i < formats.size() - 1)
@ -363,73 +363,73 @@ QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format)
switch(format) switch(format)
{ {
case LayoutExportFormats::SVG: case LayoutExportFormats::SVG:
return QString("Svg %1 (*.svg)").arg(filesStr); return QStringLiteral("Svg %1 (*.svg)").arg(filesStr);
case LayoutExportFormats::PDF: case LayoutExportFormats::PDF:
return QString("PDF %1 (*.pdf)").arg(filesStr); return QStringLiteral("PDF %1 (*.pdf)").arg(filesStr);
case LayoutExportFormats::PNG: case LayoutExportFormats::PNG:
return tr("Image files") + QLatin1String(" (*.png)"); return tr("Image files") + QStringLiteral(" (*.png)");
case LayoutExportFormats::OBJ: case LayoutExportFormats::OBJ:
return "Wavefront OBJ (*.obj)"; return QStringLiteral("Wavefront OBJ (*.obj)");
case LayoutExportFormats::PS: case LayoutExportFormats::PS:
return QString("PS %1 (*.ps)").arg(filesStr); return QStringLiteral("PS %1 (*.ps)").arg(filesStr);
case LayoutExportFormats::EPS: case LayoutExportFormats::EPS:
return QString("EPS %1 (*.eps)").arg(filesStr); return QStringLiteral("EPS %1 (*.eps)").arg(filesStr);
case LayoutExportFormats::DXF_AC1006_Flat: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: case LayoutExportFormats::PDFTiled:
return QString("PDF tiled %1 (*.pdf)").arg(filesStr); return QStringLiteral("PDF tiled %1 (*.pdf)").arg(filesStr);
default: default:
return QString(); return QString();
} }
@ -441,18 +441,18 @@ QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format)
switch(format) switch(format)
{ {
case LayoutExportFormats::SVG: case LayoutExportFormats::SVG:
return ".svg"; return QStringLiteral(".svg");
case LayoutExportFormats::PDF: case LayoutExportFormats::PDF:
case LayoutExportFormats::PDFTiled: case LayoutExportFormats::PDFTiled:
return ".pdf"; return QStringLiteral(".pdf");
case LayoutExportFormats::PNG: case LayoutExportFormats::PNG:
return ".png"; return QStringLiteral(".png");
case LayoutExportFormats::OBJ: case LayoutExportFormats::OBJ:
return ".obj"; return QStringLiteral(".obj");
case LayoutExportFormats::PS: case LayoutExportFormats::PS:
return ".ps"; return QStringLiteral(".ps");
case LayoutExportFormats::EPS: case LayoutExportFormats::EPS:
return ".eps"; return QStringLiteral(".eps");
case LayoutExportFormats::DXF_AC1006_Flat: case LayoutExportFormats::DXF_AC1006_Flat:
case LayoutExportFormats::DXF_AC1009_Flat: case LayoutExportFormats::DXF_AC1009_Flat:
case LayoutExportFormats::DXF_AC1012_Flat: case LayoutExportFormats::DXF_AC1012_Flat:
@ -480,7 +480,7 @@ QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format)
case LayoutExportFormats::DXF_AC1021_ASTM: case LayoutExportFormats::DXF_AC1021_ASTM:
case LayoutExportFormats::DXF_AC1024_ASTM: case LayoutExportFormats::DXF_AC1024_ASTM:
case LayoutExportFormats::DXF_AC1027_ASTM: case LayoutExportFormats::DXF_AC1027_ASTM:
return ".dxf"; return QStringLiteral(".dxf");
default: default:
return QString(); return QString();
} }
@ -515,7 +515,7 @@ void DialogSaveLayout::Save()
{ {
for (int i=0; i < count; ++i) 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)) if (QFile::exists(name))
{ {
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"), QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),

View File

@ -32,10 +32,12 @@
#include "../vgeometry/vgeometrydef.h" #include "../vgeometry/vgeometrydef.h"
#include "vabstractlayoutdialog.h" #include "vabstractlayoutdialog.h"
#ifndef PDFTOPS
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# define PDFTOPS "pdftops.exe" # define PDFTOPS QStringLiteral("pdftops.exe")
#else #else
# define PDFTOPS "pdftops" # define PDFTOPS QStringLiteral("pdftops")
#endif
#endif #endif
namespace Ui namespace Ui

View File

@ -541,7 +541,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
if (qApp->devicePixelRatio() >= 2) if (qApp->devicePixelRatio() >= 2)
{ {
// Try to load HiDPI versions of the cursors if availible // 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)) if (QFileInfo::exists(cursorResource))
{ {
cursorResource = cursorHidpiResource; cursorResource = cursorHidpiResource;
@ -738,7 +738,8 @@ void MainWindow::ApplyDetailsDialog()
void MainWindow::ToolEndLine(bool checked) void MainWindow::ToolEndLine(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLine, ":/cursor/endline_cursor.png", tr("Select point"), SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLine, QStringLiteral(":/cursor/endline_cursor.png"),
tr("Select point"),
&MainWindow::ClosedDrawDialogWithApply<VToolEndLine>, &MainWindow::ClosedDrawDialogWithApply<VToolEndLine>,
&MainWindow::ApplyDrawDialog<VToolEndLine>); &MainWindow::ApplyDrawDialog<VToolEndLine>);
} }
@ -751,7 +752,8 @@ void MainWindow::ToolEndLine(bool checked)
void MainWindow::ToolLine(bool checked) void MainWindow::ToolLine(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogLine>(checked, Tool::Line, ":/cursor/line_cursor.png", tr("Select first point"), SetToolButtonWithApply<DialogLine>(checked, Tool::Line, QStringLiteral(":/cursor/line_cursor.png"),
tr("Select first point"),
&MainWindow::ClosedDrawDialogWithApply<VToolLine>, &MainWindow::ClosedDrawDialogWithApply<VToolLine>,
&MainWindow::ApplyDrawDialog<VToolLine>); &MainWindow::ApplyDrawDialog<VToolLine>);
} }
@ -764,7 +766,7 @@ void MainWindow::ToolLine(bool checked)
void MainWindow::ToolAlongLine(bool checked) void MainWindow::ToolAlongLine(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLine, ":/cursor/alongline_cursor.png", SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLine, QStringLiteral(":/cursor/alongline_cursor.png"),
tr("Select point"), &MainWindow::ClosedDrawDialogWithApply<VToolAlongLine>, tr("Select point"), &MainWindow::ClosedDrawDialogWithApply<VToolAlongLine>,
&MainWindow::ApplyDrawDialog<VToolAlongLine>); &MainWindow::ApplyDrawDialog<VToolAlongLine>);
} }
@ -774,7 +776,7 @@ void MainWindow::ToolMidpoint(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
// Reuse DialogAlongLine and VToolAlongLine but with different cursor // Reuse DialogAlongLine and VToolAlongLine but with different cursor
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::Midpoint, ":/cursor/midpoint_cursor.png", SetToolButtonWithApply<DialogAlongLine>(checked, Tool::Midpoint, QStringLiteral(":/cursor/midpoint_cursor.png"),
tr("Select point"), &MainWindow::ClosedDrawDialogWithApply<VToolAlongLine>, tr("Select point"), &MainWindow::ClosedDrawDialogWithApply<VToolAlongLine>,
&MainWindow::ApplyDrawDialog<VToolAlongLine>); &MainWindow::ApplyDrawDialog<VToolAlongLine>);
} }
@ -787,7 +789,8 @@ void MainWindow::ToolMidpoint(bool checked)
void MainWindow::ToolShoulderPoint(bool checked) void MainWindow::ToolShoulderPoint(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPoint, ":/cursor/shoulder_cursor.png", SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPoint,
QStringLiteral(":/cursor/shoulder_cursor.png"),
tr("Select point"), tr("Select point"),
&MainWindow::ClosedDrawDialogWithApply<VToolShoulderPoint>, &MainWindow::ClosedDrawDialogWithApply<VToolShoulderPoint>,
&MainWindow::ApplyDrawDialog<VToolShoulderPoint>); &MainWindow::ApplyDrawDialog<VToolShoulderPoint>);
@ -801,7 +804,7 @@ void MainWindow::ToolShoulderPoint(bool checked)
void MainWindow::ToolNormal(bool checked) void MainWindow::ToolNormal(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogNormal>(checked, Tool::Normal, ":/cursor/normal_cursor.png", SetToolButtonWithApply<DialogNormal>(checked, Tool::Normal, QStringLiteral(":/cursor/normal_cursor.png"),
tr("Select first point of line"), tr("Select first point of line"),
&MainWindow::ClosedDrawDialogWithApply<VToolNormal>, &MainWindow::ClosedDrawDialogWithApply<VToolNormal>,
&MainWindow::ApplyDrawDialog<VToolNormal>); &MainWindow::ApplyDrawDialog<VToolNormal>);
@ -815,7 +818,7 @@ void MainWindow::ToolNormal(bool checked)
void MainWindow::ToolBisector(bool checked) void MainWindow::ToolBisector(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogBisector>(checked, Tool::Bisector, ":/cursor/bisector_cursor.png", SetToolButtonWithApply<DialogBisector>(checked, Tool::Bisector, QStringLiteral(":/cursor/bisector_cursor.png"),
tr("Select first point of angle"), tr("Select first point of angle"),
&MainWindow::ClosedDrawDialogWithApply<VToolBisector>, &MainWindow::ClosedDrawDialogWithApply<VToolBisector>,
&MainWindow::ApplyDrawDialog<VToolBisector>); &MainWindow::ApplyDrawDialog<VToolBisector>);
@ -829,7 +832,8 @@ void MainWindow::ToolBisector(bool checked)
void MainWindow::ToolLineIntersect(bool checked) void MainWindow::ToolLineIntersect(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogLineIntersect>(checked, Tool::LineIntersect, ":/cursor/intersect_cursor.png", SetToolButtonWithApply<DialogLineIntersect>(checked, Tool::LineIntersect,
QStringLiteral(":/cursor/intersect_cursor.png"),
tr("Select first point of first line"), tr("Select first point of first line"),
&MainWindow::ClosedDrawDialogWithApply<VToolLineIntersect>, &MainWindow::ClosedDrawDialogWithApply<VToolLineIntersect>,
&MainWindow::ApplyDrawDialog<VToolLineIntersect>); &MainWindow::ApplyDrawDialog<VToolLineIntersect>);
@ -843,7 +847,7 @@ void MainWindow::ToolLineIntersect(bool checked)
void MainWindow::ToolSpline(bool checked) void MainWindow::ToolSpline(bool checked)
{ {
ToolSelectPointByPress(); ToolSelectPointByPress();
SetToolButtonWithApply<DialogSpline>(checked, Tool::Spline, ":/cursor/spline_cursor.png", SetToolButtonWithApply<DialogSpline>(checked, Tool::Spline, QStringLiteral(":/cursor/spline_cursor.png"),
tr("Select first point curve"), tr("Select first point curve"),
&MainWindow::ClosedDrawDialogWithApply<VToolSpline>, &MainWindow::ClosedDrawDialogWithApply<VToolSpline>,
&MainWindow::ApplyDrawDialog<VToolSpline>); &MainWindow::ApplyDrawDialog<VToolSpline>);
@ -853,7 +857,8 @@ void MainWindow::ToolSpline(bool checked)
void MainWindow::ToolCubicBezier(bool checked) void MainWindow::ToolCubicBezier(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogCubicBezier>(checked, Tool::CubicBezier, ":/cursor/cubic_bezier_cursor.png", SetToolButtonWithApply<DialogCubicBezier>(checked, Tool::CubicBezier,
QStringLiteral(":/cursor/cubic_bezier_cursor.png"),
tr("Select first curve point"), tr("Select first curve point"),
&MainWindow::ClosedDrawDialogWithApply<VToolCubicBezier>, &MainWindow::ClosedDrawDialogWithApply<VToolCubicBezier>,
&MainWindow::ApplyDrawDialog<VToolCubicBezier>); &MainWindow::ApplyDrawDialog<VToolCubicBezier>);
@ -867,7 +872,8 @@ void MainWindow::ToolCubicBezier(bool checked)
void MainWindow::ToolCutSpline(bool checked) void MainWindow::ToolCutSpline(bool checked)
{ {
ToolSelectSpline(); ToolSelectSpline();
SetToolButtonWithApply<DialogCutSpline>(checked, Tool::CutSpline, ":/cursor/spline_cut_point_cursor.png", SetToolButtonWithApply<DialogCutSpline>(checked, Tool::CutSpline,
QStringLiteral(":/cursor/spline_cut_point_cursor.png"),
tr("Select simple curve"), tr("Select simple curve"),
&MainWindow::ClosedDrawDialogWithApply<VToolCutSpline>, &MainWindow::ClosedDrawDialogWithApply<VToolCutSpline>,
&MainWindow::ApplyDrawDialog<VToolCutSpline>); &MainWindow::ApplyDrawDialog<VToolCutSpline>);
@ -881,7 +887,7 @@ void MainWindow::ToolCutSpline(bool checked)
void MainWindow::ToolArc(bool checked) void MainWindow::ToolArc(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogArc>(checked, Tool::Arc, ":/cursor/arc_cursor.png", SetToolButtonWithApply<DialogArc>(checked, Tool::Arc, QStringLiteral(":/cursor/arc_cursor.png"),
tr("Select point of center of arc"), tr("Select point of center of arc"),
&MainWindow::ClosedDrawDialogWithApply<VToolArc>, &MainWindow::ClosedDrawDialogWithApply<VToolArc>,
&MainWindow::ApplyDrawDialog<VToolArc>); &MainWindow::ApplyDrawDialog<VToolArc>);
@ -895,7 +901,8 @@ void MainWindow::ToolArc(bool checked)
void MainWindow::ToolEllipticalArc(bool checked) void MainWindow::ToolEllipticalArc(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogEllipticalArc>(checked, Tool::EllipticalArc, ":/cursor/el_arc_cursor.png", SetToolButtonWithApply<DialogEllipticalArc>(checked, Tool::EllipticalArc,
QStringLiteral(":/cursor/el_arc_cursor.png"),
tr("Select point of center of elliptical arc"), tr("Select point of center of elliptical arc"),
&MainWindow::ClosedDrawDialogWithApply<VToolEllipticalArc>, &MainWindow::ClosedDrawDialogWithApply<VToolEllipticalArc>,
&MainWindow::ApplyDrawDialog<VToolEllipticalArc>); &MainWindow::ApplyDrawDialog<VToolEllipticalArc>);
@ -909,7 +916,8 @@ void MainWindow::ToolEllipticalArc(bool checked)
void MainWindow::ToolSplinePath(bool checked) void MainWindow::ToolSplinePath(bool checked)
{ {
ToolSelectPointByPress(); ToolSelectPointByPress();
SetToolButtonWithApply<DialogSplinePath>(checked, Tool::SplinePath, ":/cursor/splinepath_cursor.png", SetToolButtonWithApply<DialogSplinePath>(checked, Tool::SplinePath,
QStringLiteral(":/cursor/splinepath_cursor.png"),
tr("Select point of curve path"), tr("Select point of curve path"),
&MainWindow::ClosedDrawDialogWithApply<VToolSplinePath>, &MainWindow::ClosedDrawDialogWithApply<VToolSplinePath>,
&MainWindow::ApplyDrawDialog<VToolSplinePath>); &MainWindow::ApplyDrawDialog<VToolSplinePath>);
@ -920,7 +928,7 @@ void MainWindow::ToolCubicBezierPath(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogCubicBezierPath>(checked, Tool::CubicBezierPath, SetToolButtonWithApply<DialogCubicBezierPath>(checked, Tool::CubicBezierPath,
":/cursor/cubic_bezier_path_cursor.png", QStringLiteral(":/cursor/cubic_bezier_path_cursor.png"),
tr("Select point of cubic bezier path"), tr("Select point of cubic bezier path"),
&MainWindow::ClosedDrawDialogWithApply<VToolCubicBezierPath>, &MainWindow::ClosedDrawDialogWithApply<VToolCubicBezierPath>,
&MainWindow::ApplyDrawDialog<VToolCubicBezierPath>); &MainWindow::ApplyDrawDialog<VToolCubicBezierPath>);
@ -935,7 +943,8 @@ void MainWindow::ToolCutSplinePath(bool checked)
{ {
ToolSelectSplinePath(); ToolSelectSplinePath();
SetToolButtonWithApply<DialogCutSplinePath>(checked, Tool::CutSplinePath, SetToolButtonWithApply<DialogCutSplinePath>(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<VToolCutSplinePath>, &MainWindow::ClosedDrawDialogWithApply<VToolCutSplinePath>,
&MainWindow::ApplyDrawDialog<VToolCutSplinePath>); &MainWindow::ApplyDrawDialog<VToolCutSplinePath>);
} }
@ -948,7 +957,8 @@ void MainWindow::ToolCutSplinePath(bool checked)
void MainWindow::ToolPointOfContact(bool checked) void MainWindow::ToolPointOfContact(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogPointOfContact>(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", SetToolButtonWithApply<DialogPointOfContact>(checked, Tool::PointOfContact,
QStringLiteral(":/cursor/pointcontact_cursor.png"),
tr("Select first point of line"), tr("Select first point of line"),
&MainWindow::ClosedDrawDialogWithApply<VToolPointOfContact>, &MainWindow::ClosedDrawDialogWithApply<VToolPointOfContact>,
&MainWindow::ApplyDrawDialog<VToolPointOfContact>); &MainWindow::ApplyDrawDialog<VToolPointOfContact>);
@ -962,7 +972,8 @@ void MainWindow::ToolPointOfContact(bool checked)
void MainWindow::ToolDetail(bool checked) void MainWindow::ToolDetail(bool checked)
{ {
ToolSelectAllDrawObjects(); ToolSelectAllDrawObjects();
SetToolButtonWithApply<DialogSeamAllowance>(checked, Tool::Piece, "://cursor/new_detail_cursor.png", SetToolButtonWithApply<DialogSeamAllowance>(checked, Tool::Piece,
QStringLiteral("://cursor/new_detail_cursor.png"),
tr("Select main path objects clockwise."), tr("Select main path objects clockwise."),
&MainWindow::ClosedDetailsDialogWithApply<VToolSeamAllowance>, &MainWindow::ClosedDetailsDialogWithApply<VToolSeamAllowance>,
&MainWindow::ApplyDetailsDialog<VToolSeamAllowance>); &MainWindow::ApplyDetailsDialog<VToolSeamAllowance>);
@ -972,7 +983,7 @@ void MainWindow::ToolDetail(bool checked)
void MainWindow::ToolPiecePath(bool checked) void MainWindow::ToolPiecePath(bool checked)
{ {
ToolSelectAllDrawObjects(); ToolSelectAllDrawObjects();
SetToolButton<DialogPiecePath>(checked, Tool::PiecePath, "://cursor/path_cursor.png", SetToolButton<DialogPiecePath>(checked, Tool::PiecePath, QStringLiteral("://cursor/path_cursor.png"),
tr("Select path objects, <b>Shift</b> - reverse direction curve"), tr("Select path objects, <b>Shift</b> - reverse direction curve"),
&MainWindow::ClosedDialogPiecePath); &MainWindow::ClosedDialogPiecePath);
} }
@ -981,7 +992,7 @@ void MainWindow::ToolPiecePath(bool checked)
void MainWindow::ToolPin(bool checked) void MainWindow::ToolPin(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButton<DialogPin>(checked, Tool::Pin, "://cursor/pin_cursor.png", tr("Select pin point"), SetToolButton<DialogPin>(checked, Tool::Pin, QStringLiteral("://cursor/pin_cursor.png"), tr("Select pin point"),
&MainWindow::ClosedDialogPin); &MainWindow::ClosedDialogPin);
} }
@ -989,7 +1000,7 @@ void MainWindow::ToolPin(bool checked)
void MainWindow::ToolPlaceLabel(bool checked) void MainWindow::ToolPlaceLabel(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButton<DialogPlaceLabel>(checked, Tool::PlaceLabel, "://cursor/place_label_cursor.png", SetToolButton<DialogPlaceLabel>(checked, Tool::PlaceLabel, QStringLiteral("://cursor/place_label_cursor.png"),
tr("Select placelabel center point"), &MainWindow::ClosedDialogPlaceLabel); tr("Select placelabel center point"), &MainWindow::ClosedDialogPlaceLabel);
} }
@ -1001,7 +1012,8 @@ void MainWindow::ToolPlaceLabel(bool checked)
void MainWindow::ToolHeight(bool checked) void MainWindow::ToolHeight(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogHeight>(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"), SetToolButtonWithApply<DialogHeight>(checked, Tool::Height, QStringLiteral(":/cursor/height_cursor.png"),
tr("Select base point"),
&MainWindow::ClosedDrawDialogWithApply<VToolHeight>, &MainWindow::ClosedDrawDialogWithApply<VToolHeight>,
&MainWindow::ApplyDrawDialog<VToolHeight>); &MainWindow::ApplyDrawDialog<VToolHeight>);
} }
@ -1014,7 +1026,7 @@ void MainWindow::ToolHeight(bool checked)
void MainWindow::ToolTriangle(bool checked) void MainWindow::ToolTriangle(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogTriangle>(checked, Tool::Triangle, ":/cursor/triangle_cursor.png", SetToolButtonWithApply<DialogTriangle>(checked, Tool::Triangle, QStringLiteral(":/cursor/triangle_cursor.png"),
tr("Select first point of axis"), tr("Select first point of axis"),
&MainWindow::ClosedDrawDialogWithApply<VToolTriangle>, &MainWindow::ClosedDrawDialogWithApply<VToolTriangle>,
&MainWindow::ApplyDrawDialog<VToolTriangle>); &MainWindow::ApplyDrawDialog<VToolTriangle>);
@ -1029,7 +1041,7 @@ void MainWindow::ToolPointOfIntersection(bool checked)
{ {
ToolSelectPointByRelease(); ToolSelectPointByRelease();
SetToolButtonWithApply<DialogPointOfIntersection>(checked, Tool::PointOfIntersection, SetToolButtonWithApply<DialogPointOfIntersection>(checked, Tool::PointOfIntersection,
":/cursor/pointofintersect_cursor.png", QStringLiteral(":/cursor/pointofintersect_cursor.png"),
tr("Select point for X value (vertical)"), tr("Select point for X value (vertical)"),
&MainWindow::ClosedDrawDialogWithApply<VToolPointOfIntersection>, &MainWindow::ClosedDrawDialogWithApply<VToolPointOfIntersection>,
&MainWindow::ApplyDrawDialog<VToolPointOfIntersection>); &MainWindow::ApplyDrawDialog<VToolPointOfIntersection>);
@ -1043,7 +1055,7 @@ void MainWindow::ToolPointOfIntersection(bool checked)
void MainWindow::ToolUnionDetails(bool checked) void MainWindow::ToolUnionDetails(bool checked)
{ {
ToolSelectDetail(); ToolSelectDetail();
SetToolButton<DialogUnionDetails>(checked, Tool::UnionDetails, ":/cursor/union_cursor.png", SetToolButton<DialogUnionDetails>(checked, Tool::UnionDetails, QStringLiteral(":/cursor/union_cursor.png"),
tr("Select detail"), &MainWindow::ClosedDialogUnionDetails); tr("Select detail"), &MainWindow::ClosedDialogUnionDetails);
} }
@ -1061,7 +1073,8 @@ void MainWindow::ClosedDialogUnionDetails(int result)
void MainWindow::ToolDuplicateDetail(bool checked) void MainWindow::ToolDuplicateDetail(bool checked)
{ {
ToolSelectDetail(); ToolSelectDetail();
SetToolButton<DialogDuplicateDetail>(checked, Tool::DuplicateDetail, ":/cursor/duplicate_detail_cursor.png", SetToolButton<DialogDuplicateDetail>(checked, Tool::DuplicateDetail,
QStringLiteral(":/cursor/duplicate_detail_cursor.png"),
tr("Select detail"), &MainWindow::ClosedDialogDuplicateDetail); tr("Select detail"), &MainWindow::ClosedDialogDuplicateDetail);
} }
@ -1088,7 +1101,7 @@ void MainWindow::ToolGroup(bool checked)
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, " const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>Enter</b> - finish creation") "<b>Enter</b> - finish creation")
.arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData()));
SetToolButton<DialogGroup>(checked, Tool::Group, ":/cursor/group_plus_cursor.png", tooltip, SetToolButton<DialogGroup>(checked, Tool::Group, QStringLiteral(":/cursor/group_plus_cursor.png"), tooltip,
&MainWindow::ClosedDialogGroup); &MainWindow::ClosedDialogGroup);
} }
@ -1099,8 +1112,8 @@ void MainWindow::ToolRotation(bool checked)
const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, " const QString tooltip = tr("Select one or more objects, hold <b>%1</b> - for multiple selection, "
"<b>Enter</b> - confirm selection") "<b>Enter</b> - confirm selection")
.arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData())); .arg(QCoreApplication::translate(strQShortcut->toUtf8().constData(), strCtrl->toUtf8().constData()));
SetToolButtonWithApply<DialogRotation>(checked, Tool::Rotation, ":/cursor/rotation_cursor.png", tooltip, SetToolButtonWithApply<DialogRotation>(checked, Tool::Rotation, QStringLiteral(":/cursor/rotation_cursor.png"),
&MainWindow::ClosedDrawDialogWithApply<VToolRotation>, tooltip, &MainWindow::ClosedDrawDialogWithApply<VToolRotation>,
&MainWindow::ApplyDrawDialog<VToolRotation>); &MainWindow::ApplyDrawDialog<VToolRotation>);
} }

View File

@ -74,10 +74,12 @@ Q_LOGGING_CATEGORY(vMainNoGUIWindow, "v.mainnoguiwindow")
QT_WARNING_POP QT_WARNING_POP
#ifndef PDFTOPS
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# define PDFTOPS "pdftops.exe" # define PDFTOPS QStringLiteral("pdftops.exe")
#else #else
# define PDFTOPS "pdftops" # define PDFTOPS QStringLiteral("pdftops")
#endif
#endif #endif
namespace namespace
@ -314,9 +316,8 @@ void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails)
{ {
for (int i = 0; i < detailsOnLayout.size(); ++i) for (int i = 0; i < detailsOnLayout.size(); ++i)
{ {
const QString name = m_dialogSaveLayout->Path() + QLatin1String("/") + m_dialogSaveLayout->FileName() + const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() +
QString::number(i+1) QString::number(i+1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
+ DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i)); QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
SCASSERT(paper != nullptr) SCASSERT(paper != nullptr)
@ -361,7 +362,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList<QGraphicsScene *> &scenes,
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout) 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()); + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
PdfTiledFile(name); PdfTiledFile(name);
} }
@ -582,7 +583,7 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDe
listDetails[i].SetMatrix(moveMatrix); 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()); QString::number(1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
ExportApparelLayout(listDetails, name, rect.size()); ExportApparelLayout(listDetails, name, rect.size());
@ -606,7 +607,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
return; return;
} }
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) ); painter.setBrush ( QBrush ( Qt::NoBrush ) );
@ -838,7 +839,7 @@ QIcon MainWindowsNoGUI::ScenePreview(int i) const
{ {
image.fill(Qt::white); image.fill(Qt::white);
QPainter painter(&image); QPainter painter(&image);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin)); 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))); qCritical("%s", qUtf8Printable(tr("Can't open printer %1").arg(name)));
return; return;
} }
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) ); painter.setBrush ( QBrush ( Qt::NoBrush ) );
@ -1047,7 +1048,7 @@ void MainWindowsNoGUI::EpsFile(const QString &name, QGraphicsRectItem *paper, QG
if (tmp.open()) if (tmp.open())
{ {
PdfFile(tmp.fileName(), paper, scene, ignorePrinterFields, margins); PdfFile(tmp.fileName(), paper, scene, ignorePrinterFields, margins);
QStringList params = QStringList() << "-eps" << tmp.fileName() << name; QStringList params = QStringList() << QStringLiteral("-eps") << tmp.fileName() << name;
PdfToPs(params); PdfToPs(params);
} }
} }
@ -1415,7 +1416,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
printer->setOutputFileName(outputFileName); printer->setOutputFileName(outputFileName);
#else #else
printer->setOutputFileName(outputFileName + QLatin1String(".pdf")); printer->setOutputFileName(outputFileName + QStringLiteral(".pdf"));
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@ -1566,7 +1567,7 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i)); QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
if (paper) 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()); QString::number(i+1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
QBrush *brush = new QBrush(); QBrush *brush = new QBrush();
brush->setColor( QColor( Qt::white ) ); 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.")); 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; throw e;
} }
} }

View File

@ -141,7 +141,9 @@ void VPattern::CreateEmptyFile()
patternElement.appendChild(createElement(TagPreviewCalculations)); patternElement.appendChild(createElement(TagPreviewCalculations));
this->appendChild(patternElement); 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 VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
{ {
const quint32 id = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR); const quint32 id = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
const qreal mx = GetParametrDouble(domElement, AttrMx, "0.0"); const qreal mx = GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"));
const qreal my = GetParametrDouble(domElement, AttrMy, "0.0"); const qreal my = GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"));
const bool reverse = GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, QChar('0')); const bool reverse = GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, QChar('0'));
const NodeDetail nodeType = NodeDetail::Contour; const NodeDetail nodeType = NodeDetail::Contour;
const QString t = GetParametrString(domElement, AttrType, "NodePoint"); const QString t = GetParametrString(domElement, AttrType, QStringLiteral("NodePoint"));
Tool tool; Tool tool;
QStringList types = QStringList() << VAbstractPattern::NodePoint QStringList types = QStringList() << VAbstractPattern::NodePoint
@ -827,8 +829,8 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
VToolSeamAllowanceInitData initData; VToolSeamAllowanceInitData initData;
initData.id = GetParametrId(domElement); initData.id = GetParametrId(domElement);
initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail"))); initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
initData.detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0"))); initData.detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
initData.detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0"))); initData.detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"))));
initData.detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr)); initData.detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
initData.detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath, initData.detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath,
QString().setNum(qApp->ValentinaSettings()->IsHideMainPath()))); 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.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
initData.detail.SetUnited(GetParametrBool(domElement, VToolSeamAllowance::AttrUnited, falseStr)); 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; const QString w = initData.width;//need for saving fixed formula;
ParseDetailInternals(domElement, initData.detail); 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), Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 4, 0),
"Time to refactor the code."); "Time to refactor the code.");
const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1')); 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); futurePathV1 = QtConcurrent::run(this, &VPattern::ParseDetailNodes, element, width, closed);
} }
else else
@ -1062,7 +1064,7 @@ VGrainlineData VPattern::ParsePieceGrainline(const QDomElement &domElement, VGra
gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')), gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
GetParametrDouble(domElement, AttrMy, QChar('0')))); GetParametrDouble(domElement, AttrMy, QChar('0'))));
gGeometry.SetLength(GetParametrString(domElement, AttrLength, QChar('1'))); gGeometry.SetLength(GetParametrString(domElement, AttrLength, QChar('1')));
gGeometry.SetRotation(GetParametrString(domElement, AttrRotation, "90")); gGeometry.SetRotation(GetParametrString(domElement, AttrRotation, QStringLiteral("90")));
gGeometry.SetArrowType(static_cast<ArrowType>(GetParametrUInt(domElement, AttrArrows, QChar('0')))); gGeometry.SetArrowType(static_cast<ArrowType>(GetParametrUInt(domElement, AttrArrows, QChar('0'))));
gGeometry.SetCenterPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR)); gGeometry.SetCenterPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR));
gGeometry.SetTopPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, 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) void VPattern::PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData)
{ {
PointsCommonAttributes(domElement, initData.id, initData.mx, initData.my); 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); 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) void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my)
{ {
ToolsCommonAttributes(domElement, id); ToolsCommonAttributes(domElement, id);
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, "10.0")); mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("10.0")));
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, "15.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; initData.typeCreation = Source::FromFile;
PointsCommonAttributes(domElement, initData); PointsCommonAttributes(domElement, initData);
initData.x = qApp->toPixel(GetParametrDouble(domElement, AttrX, "10.0")); initData.x = qApp->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0")));
initData.y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0")); initData.y = qApp->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0")));
spoint = VToolBasePoint::Create(initData); spoint = VToolBasePoint::Create(initData);
} }
@ -1417,12 +1419,12 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
PointsWithLineCommonAttributes(domElement, initData); 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; const QString f = initData.formulaLength;//need for saving fixed formula;
initData.basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); 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; const QString angleFix = initData.formulaAngle;
VToolEndLine::Create(initData); VToolEndLine::Create(initData);
@ -1465,7 +1467,7 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
initData.typeCreation = Source::FromFile; initData.typeCreation = Source::FromFile;
PointsWithLineCommonAttributes(domElement, initData); 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; const QString f = initData.formula;//need for saving fixed formula;
initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
initData.secondPointId = GetParametrUInt(domElement, AttrSecondPoint, 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; initData.typeCreation = Source::FromFile;
PointsWithLineCommonAttributes(domElement, initData); 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; const QString f = initData.formula;//need for saving fixed formula;
initData.p1Line = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); initData.p1Line = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
initData.p2Line = GetParametrUInt(domElement, AttrP2Line, 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; initData.typeCreation = Source::FromFile;
PointsWithLineCommonAttributes(domElement, initData); 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; const QString f = initData.formula;//need for saving fixed formula;
initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
initData.secondPointId = GetParametrUInt(domElement, AttrSecondPoint, 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); VToolNormal::Create(initData);
//Rewrite attribute formula. Need for situation when we have wrong formula. //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; initData.typeCreation = Source::FromFile;
PointsWithLineCommonAttributes(domElement, initData); 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; const QString f = initData.formula;//need for saving fixed formula;
initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); initData.firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
initData.secondPointId = GetParametrUInt(domElement, AttrSecondPoint, 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.centerPoint = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
initData.idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, 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; 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; 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; 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; const QString visibility = initData.visibilityTrigger;//need for saving fixed formula;
initData.type = static_cast<PlaceLabelType>(GetParametrUInt(domElement, AttrPlaceLabelType, QChar('0'))); initData.type = static_cast<PlaceLabelType>(GetParametrUInt(domElement, AttrPlaceLabelType, QChar('0')));
@ -2080,7 +2083,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
initData.firstPointId = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); initData.firstPointId = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
initData.secondPointId = GetParametrUInt(domElement, AttrP2Line, 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; const QString angleFix = initData.formulaAngle;
VToolLineIntersectAxis::Create(initData); VToolLineIntersectAxis::Create(initData);
@ -2128,7 +2131,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
initData.basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); initData.basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
initData.curveId = GetParametrUInt(domElement, AttrCurve, 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; const QString angleFix = initData.formulaAngle;
VToolCurveIntersectAxis::Create(initData); VToolCurveIntersectAxis::Create(initData);
@ -2359,14 +2362,14 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
initData.dartP2Id = GetParametrUInt(domElement, AttrDartP2, NULL_ID_STR); initData.dartP2Id = GetParametrUInt(domElement, AttrDartP2, NULL_ID_STR);
initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR); initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR);
initData.name1 = GetParametrString(domElement, AttrName1, "A"); initData.name1 = GetParametrString(domElement, AttrName1, QChar('A'));
initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, "10.0")); initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, QStringLiteral("10.0")));
initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, "15.0")); initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, QStringLiteral("15.0")));
initData.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr); initData.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr);
initData.name2 = GetParametrString(domElement, AttrName2, "A"); initData.name2 = GetParametrString(domElement, AttrName2, QChar('A'));
initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, "10.0")); initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, QStringLiteral("10.0")));
initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, "15.0")); initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, QStringLiteral("15.0")));
initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr); initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr);
VToolTrueDarts::Create(initData); VToolTrueDarts::Create(initData);
@ -2398,11 +2401,11 @@ void VPattern::ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &
ToolsCommonAttributes(domElement, initData.id); ToolsCommonAttributes(domElement, initData.id);
const quint32 point1 = GetParametrUInt(domElement, AttrPoint1, NULL_ID_STR); const quint32 point1 = GetParametrUInt(domElement, AttrPoint1, NULL_ID_STR);
const quint32 point4 = GetParametrUInt(domElement, AttrPoint4, NULL_ID_STR); const quint32 point4 = GetParametrUInt(domElement, AttrPoint4, NULL_ID_STR);
const qreal angle1 = GetParametrDouble(domElement, AttrAngle1, "270.0"); const qreal angle1 = GetParametrDouble(domElement, AttrAngle1, QStringLiteral("270.0"));
const qreal angle2 = GetParametrDouble(domElement, AttrAngle2, "90.0"); const qreal angle2 = GetParametrDouble(domElement, AttrAngle2, QStringLiteral("90.0"));
const qreal kAsm1 = GetParametrDouble(domElement, AttrKAsm1, "1.0"); const qreal kAsm1 = GetParametrDouble(domElement, AttrKAsm1, QStringLiteral("1.0"));
const qreal kAsm2 = GetParametrDouble(domElement, AttrKAsm2, "1.0"); const qreal kAsm2 = GetParametrDouble(domElement, AttrKAsm2, QStringLiteral("1.0"));
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 QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0')); const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0'));
@ -2564,7 +2567,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomEleme
initData.typeCreation = Source::FromFile; initData.typeCreation = Source::FromFile;
ToolsCommonAttributes(domElement, initData.id); 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 QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0')); const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0'));
const qreal approximationScale = GetParametrDouble(domElement, AttrAScale, 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) 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 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 quint32 pSpline = GetParametrUInt(element, AttrPSpline, NULL_ID_STR);
const VPointF p = *data->GeometricObject<VPointF>(pSpline); const VPointF p = *data->GeometricObject<VPointF>(pSpline);
@ -2884,11 +2887,11 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
ToolsCommonAttributes(domElement, initData.id); ToolsCommonAttributes(domElement, initData.id);
initData.center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); 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; 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; 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; const QString f2Fix = initData.f2;//need for saving fixed formula;
initData.color = GetParametrString(domElement, AttrColor, ColorBlack); initData.color = GetParametrString(domElement, AttrColor, ColorBlack);
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine); initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
@ -2936,13 +2939,13 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do
ToolsCommonAttributes(domElement, initData.id); ToolsCommonAttributes(domElement, initData.id);
initData.center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); initData.center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
initData.radius1 = GetParametrString(domElement, AttrRadius1, "10"); initData.radius1 = GetParametrString(domElement, AttrRadius1, QStringLiteral("10"));
initData.radius2 = GetParametrString(domElement, AttrRadius2, "10"); initData.radius2 = GetParametrString(domElement, AttrRadius2, QStringLiteral("10"));
const QString r1 = initData.radius1;//need for saving fixed formula; const QString r1 = initData.radius1;//need for saving fixed formula;
const QString r2 = initData.radius2;//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; 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; const QString f2Fix = initData.f2;//need for saving fixed formula;
initData.rotationAngle = GetParametrString(domElement, AttrRotationAngle, QChar('0')); initData.rotationAngle = GetParametrString(domElement, AttrRotationAngle, QChar('0'));
const QString frotationFix = initData.rotationAngle;//need for saving fixed formula; 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); ToolsCommonAttributes(domElement, initData.id);
initData.center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); 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; 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; 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; const QString lengthFix = initData.length;//need for saving fixed length;
initData.color = GetParametrString(domElement, AttrColor, ColorBlack); initData.color = GetParametrString(domElement, AttrColor, ColorBlack);
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine); initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
@ -3124,7 +3127,7 @@ void VPattern::ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElem
ToolsCommonAttributes(domElement, initData.id); ToolsCommonAttributes(domElement, initData.id);
initData.origin = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); 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; const QString a = initData.angle;//need for saving fixed formula;
initData.suffix = GetParametrString(domElement, AttrSuffix, QString()); initData.suffix = GetParametrString(domElement, AttrSuffix, QString());
@ -3654,8 +3657,8 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
try try
{ {
VToolUnionDetailsInitData initData; VToolUnionDetailsInitData initData;
initData.indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1"); initData.indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, QStringLiteral("-1"));
initData.indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1"); initData.indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, QStringLiteral("-1"));
initData.version = GetParametrUInt(domElement, AttrVersion, QChar('1')); initData.version = GetParametrUInt(domElement, AttrVersion, QChar('1'));
initData.scene = scene; initData.scene = scene;
initData.doc = this; initData.doc = this;
@ -3979,7 +3982,7 @@ QString VPattern::GenerateLabel(const LabelType &type, const QString &reservedNa
QString name; QString name;
do do
{ {
name = QString("%1%2").arg(labelBase).arg(num); name = QStringLiteral("%1%2").arg(labelBase).arg(num);
num++; num++;
if (num == INT_MAX) if (num == INT_MAX)
{ {
@ -4002,7 +4005,7 @@ QString VPattern::GenerateSuffix() const
QString suffix; QString suffix;
for (;;) 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) for (int i=0; i < uniqueNames.size(); ++i)
{ {
@ -4407,7 +4410,7 @@ QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const QRectF VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const
{ {
QRectF recTool = rec; QRectF recTool = rec;
if (tools.contains(id)) if (tools.contains(id))

View File

@ -177,7 +177,7 @@ private:
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
quint32 &idTool); quint32 &idTool);
template <typename T> template <typename T>
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const; QRectF ToolBoundingRect(const QRectF &rec, quint32 id) const;
void ParseCurrentPP(); void ParseCurrentPP();
QString GetLabelBase(quint32 index)const; QString GetLabelBase(quint32 index)const;